0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-30 01:33:01 +00:00
uxn/examples/pixels.usm
2021-02-16 12:19:48 -08:00

42 lines
713 B
Text

( pixels )
:dev/r fff8 ( std read port )
:dev/w fff9 ( std write port )
;x 2 ;y 2 ;color 1 ;alive 1
|0100 @RESET
#01 =dev/w ( set dev/write to screen )
#01 =color ( set color )
#0020 =x #0030 =y ( set origin )
#01 =alive ( set alive = true )
BRK
|c000 @FRAME
~alive #00 EQU BRK?
#01 ~color ~x ~y ,putpixel JSR
,move JSR
BRK
@move
~x #0001 ADD2 =x ( incr x )
~x #0040 LTH2 RTS? ( if x > 60 )
#0020 =x ( x = 0x0020 )
~y #0001 ADD2 =y ( incr y )
~y #0050 LTH2 RTS? ( y > 50 )
#00 ,alive STR ( alive = 0 )
RTS
@putpixel
IOW2 ( y short )
IOW2 ( x short )
IOW ( color byte )
IOW ( redraw byte )
RTS
|d000 @ERROR BRK
|FFFA .RESET .FRAME .ERROR