Re: [stella] Variable cycle delays

Subject: Re: [stella] Variable cycle delays
From: Chris Wilkson <cwilkson@xxxxxxxxxxxxx>
Date: Wed, 18 Mar 1998 13:36:32 -0800 (PST)
> 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.

This rocks!  I was looking for a way to do this very thing.  But software
is such an abstract thing to me.  Heh...guess that's sorta the point.  :)

(chants "I'm not worthy!  I'm not worthy!")

It might be more illustrative if you extend the comments a few lines back.
Also might help to show the actual commands that are executed.  Took me a
while to wrap my mind around what was happening...

   dc.b $C9      ; opcode: CMP immediate 7 cycles; CMP #$C9
                                                 ; CMP #$C9
                                                 ; CMP $EA
                                                 ;
   dc.b $C9      ; opcode: CMP immediate 6 cycles; CMP #$C9
                                                 ; CMP #$C5
                                                 ; NOP
                                                 ;
   dc.b $C9      ; opcode: CMP immediate 5 cycles; CMP #$C9
                                                 ; CMP $EA
                                                 ;
   dc.b $C9      ; opcode: CMP immediate 4 cycles; CMP #$C5
                                                 ; NOP
                                                 ;
   dc.b $C5      ; opcode: CMP zero page 3 cycles; CMP $EA
                                                 ;
   nop           ; opcode: NOP 2 cycles          ; NOP

This is the kind of thing that makes me consider subcontracting code warriors
even for simple tasks...ack!!

-Chris


--
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