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

59 lines
1 KiB
Text
Raw Normal View History

2021-02-19 02:16:39 +00:00
( sprite )
:dev/r fff8 ( std read port )
:dev/w fff9 ( std write port )
;mousex 2 ;mousey 2 ;lastx 2 ;lasty 2 ;color 1
|0100 @RESET
#05 =dev/r ( set dev/read mouse )
#02 =dev/w ( set dev/write to sprite )
#00 ,rounds_chr #0004 #0004 ,drawsprite JSR
BRK
|c000 @FRAME
#02 =dev/w ( set dev/write to sprite )
( clear last cursor )
#10 ,clear_icn ~lastx ~lasty ,drawsprite JSR
( record mouse values )
#00 IOR2 =mousex #02 IOR2 =mousey
#04 IOR #11 ADD =color
~color ,cursor_icn ~mousex ~mousey ,drawsprite JSR
( check paint )
#04 IOR #00 EQU ,skip ROT JMP? POP2
#05 ,brush_large ~mousex #0004 SUB2 ~mousey #0004 SUB2 ,drawsprite JSR
@skip
~mousex =lastx ~mousey =lasty
BRK
@drawsprite
IOW2 ( y byte )
IOW2 ( x byte )
IOW2 ( sprite address )
IOW ( layer-color )
RTS
|0200 @SPRITESHEET
@rounds_chr [ 3844 92aa 9244 3800 0038 7c7c 7c38 0000 ]
@cursor_icn [ 80c0 e0f0 f8e0 1000 ]
@clear_icn [ 0000 0000 0000 0000 ]
@brush_large [ 387c fefe fe7c 3800 ]
@brush_small [ 0038 7c7c 7c38 0000 ]
BRK
|d000 @ERROR BRK
|FFFA .RESET .FRAME .ERROR