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

46 lines
813 B
Text
Raw Normal View History

2021-02-11 00:41:16 +00:00
( my default test file )
:dev/r fff8 ( std read port )
:dev/w fff9 ( std write port )
2021-02-11 03:05:40 +00:00
;x 2 ;y 2 ;color 1 ;alive 1
2021-02-11 00:41:16 +00:00
|0100 @RESET
,01 ,dev/w STR ( set dev/write to screen )
,01 ,color STR ( set color )
,0020 ,x STR^ ( set x-pos )
,0030 ,y STR^ ( set y-pos )
2021-02-11 03:05:40 +00:00
,01 ,alive STR ( set alive = true )
2021-02-11 00:41:16 +00:00
BRK
|c000 @FRAME
2021-02-11 03:05:40 +00:00
,alive LDR ,00 EQU BRK?
2021-02-11 00:41:16 +00:00
,01 ,color LDR ,x LDR^ ,y LDR^ ,putpixel JSR
2021-02-11 03:05:40 +00:00
,move JSR
2021-02-11 00:41:16 +00:00
BRK
@move
,x LDR^ ,0001 ADD^ ,x STR^ ( incr x )
2021-02-11 03:05:40 +00:00
,x LDR^ ,0040 LTH^ RTS? ( if x > 60 )
2021-02-11 00:41:16 +00:00
,0020 ,x STR^ ( x = 0x0020 )
,y LDR^ ,0001 ADD^ ,y STR^ ( incr y )
2021-02-11 03:05:40 +00:00
,y LDR^ ,0050 LTH^ RTS? ( y > 50 )
,00 ,alive STR ( alive = 0 )
2021-02-11 00:41:16 +00:00
RTS
@putpixel
IOW^ ( y short )
IOW^ ( x short )
2021-02-11 03:05:40 +00:00
IOW ( color byte )
IOW ( redraw byte )
2021-02-11 00:41:16 +00:00
RTS
|d000 @ERROR BRK
|FFFA .RESET .FRAME .ERROR