uxn/projects/tests/loop.usm

68 lines
970 B
Plaintext

( Loop )
;a { byte 1 } ;b { byte 1 } ;c { byte 1 }
|0100 @RESET
,slow-muljmp JSR2
,slow-jmppop JSR2
,slow-jmppop-rel JSR2
,fast-byte JSR2
,fast-short JSR2
BRK
|0200 @slow-muljmp ( type: padded muljmp )
$loop NOP
~a #01 ADD =a
~a #d0 LTH ^$loop MUL JMP
~a =Console.byte
RTN
|0300 @slow-jmppop ( type: jmppop )
$loop
~b #01 ADD =b
,$loop ~b #d0 LTH JNZ2
~b =Console.byte
RTN
|0400 @slow-jmppop-rel ( type: padded jmppop )
$loop NOP
~c #01 ADD =c
~c #d0 LTH ^$loop SWP JMP?
~c =Console.byte
RTN
|0500 @fast-byte ( fast byte )
#00 #d0
$loop NOP
( incr ) SWP #01 ADD SWP
DUP2 LTH ^$loop SWP JMP?
POP =Console.byte
RTN
|0600 @fast-short ( fast short )
#0000 #0d00
$loop NOP
( incr ) SWP2 #0001 ADD2 SWP2
OVR2 OVR2 LTH2 ^$loop SWP JMP?
POP2 =Console.short
RTN
|c000 @FRAME
|d000 @ERROR
|FF00 ;Console { pad 8 char 1 byte 1 short 2 }
|FFF0 .RESET .FRAME .ERROR ( vectors )
|FFF8 [ 13fd 1ef3 1bf2 ] ( palette )