Re: [stella] An Efficient Waste Of Time

Subject: Re: [stella] An Efficient Waste Of Time
From: Christopher Tumber <christophertumber@xxxxxxxxxx>
Date: Fri, 18 Oct 2002 01:21:30 -0400
>12 cycles (3Bytes):
>
>JSR AnyRTS
>
>14 cycles and more 
>
>- jsr to any subroutine point wasting the desired # of 
>cycles without destroying other data.
>
>Or do something like:
>
>...
>Waste16
>        NOP
>Waste14
>        NOP
>Waste12
>     RTS

Yup, good point though I've kinda been focussed on the <10 cycles to maximise a bytes/cycles ratio (least bytes, most cycles..) since usually it's for timing in the display kernal (spacing RESP0's or altering other TIA registers at appropriate times). A good variant where the length of the pause is variable is::

  jmp ($ZeroPage)
  nop
  nop
  nop
  (Whole bunch of NOPs)

Where the value in $ZeroPage is an address down the list of NOPs depending upon the length of the pause. Much more usefull on a CPU with 16-bit registers so you can determine (add) the address quickly but could still be usefull... There's a little bit of overhead to setting it up (The jump and whatever adc type instructions you need) but you have a much higher degree of cycle count accuracy for "long" pauses than a loop like:

     ldy $ZeroPage
NextPause:
     dey
     bne NextPause

gives you. (The "resolution" of the loop pause is 4 cycles, the jmp () pause is 2 cycles...)


Chris...


----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread