SLEEP macro (was: [stella] 6502 Less Than / Greater Than Help!)

Subject: SLEEP macro (was: [stella] 6502 Less Than / Greater Than Help!)
From: Thomas Jentzsch <tjentzsch@xxxxxx>
Date: Sat, 6 Jul 2002 09:39:19 +0200
Kirk wrote:
> And glad to hear the NOP/ trick works well...I'll
> probably be using the same technique a few iterations
> from now.

I have a macro that makes using NOP much easier:

  MAC SLEEP
    IF {1} = 1
      ECHO "ERROR: SLEEP 1 not allowed!"
      ERR
    ENDIF
    IF {1} & 1
      nop $00
      REPEAT ({1}-3)/2
        nop
      REPEND
    ELSE
      REPEAT ({1})/2
        nop
      REPEND
    ENDIF
  ENDM

For using nop $00, your DASM version must be compiled for accepting
illegal opcodes. Else you could use bit $00 (changes some flags) or
write .byte $04, $00 ($04 = opcode for nop zp) instead.

Just include it in your code and call e.g. SLEEP 5

Have fun!
Thomas                            
_______________________________________________________
Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |

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


Current Thread