uxn/projects/tests/loop.usm

68 lines
992 B
Plaintext
Raw Normal View History

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