0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-08 15:25:05 +00:00
uxn/projects/tests/loop.usm

68 lines
971 B
Text
Raw Normal View History

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