0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-05 05:45:05 +00:00
uxn/examples/mouse.usm
2021-02-10 11:06:36 -08:00

40 lines
532 B
Text

( mouse )
:dev/r fff8 ( std read port )
:dev/w fff9 ( std write port )
|0100 @RESET
,02 ,dev/r STR ( set dev/read mouse#02 )
,01 ,dev/w STR ( set dev/write screen#01 )
BRK
|c000 @FRAME
( get mouse button, or break )
,04 IOR
,01 NEQ
BRK?
( paint a white pixel )
,01 ,01
,getmouse JSR
,putpixel JSR
BRK
@getmouse
,00 IOR^ ( get mouse x )
,02 IOR^ ( get mouse y )
RTS
@putpixel
IOW^ ( y short )
IOW^ ( x short )
IOW ( color byte )
IOW ( redraw byte )
RTS
|d000 @ERROR BRK
|FFFA .RESET .FRAME .ERROR