[stella] Variable cycle delays

Subject: [stella] Variable cycle delays
From: Jim Nitchals <jimn8@xxxxxxxxxx>
Date: Wed, 18 Mar 1998 12:22:13 -0800 (PST)
Hi,

Here's a way to implement single cycle resolution without the use of the
carry flag (which adds overhead in the setup and at the end):

; A is assumed to hold the delay value plus the offset address of JumpTable.
; Or, you can align JumpTable to a page boundary.

  sta indjmp
  jmp (indjmp)  ; point indjmp+1 to JumpTable somewhere in your init code

JumpTable:
  dc.b $C9
  dc.b $C9
; repeat as many $C9's as you need for the maximum number of cycles you
; you need to delay by.
  dc.b $C9      ; opcode: CMP immediate (4 cycles: uses the $C5, executes
                ; the NOP below.)
  dc.b $C5      ; opcode: CMP zero page (3 cycles, uses up the NOP as a
                ; destination address of $EA)
  nop           ; opcode: NOP (2 cycles by itself)

You may find the reduced overhead of this technique useful.


--
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/stella.html
Don't post pirate BINs to Stellalist.  Be a programmer, not a pirate.
Write the best game, win framed autographs of famous Atari alumni!!

Current Thread