uxn/examples/draw.usm

64 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-02-11 16:28:13 -05:00
( draw routines )
:dev/r fff8 ( std read port )
:dev/w fff9 ( std write port )
2021-02-11 16:56:27 -05:00
;x_ 2 ;y_ 2 ;x 2 ;y 2 ;w 2 ;h 2 ;color 1
2021-02-11 16:28:13 -05:00
|0100 @RESET
( set dev/write to screen )
,01 ,dev/w STR
,01 ,color STR
( fill rect x y w h )
,0020 ,0020 ,0060 ,0040 ,fillrect JSR
,02 ,color STR
( fill rect x y w h )
,0030 ,0030 ,0040 ,0060 ,fillrect JSR
,03 ,color STR
( fill rect x y w h )
,0040 ,0040 ,0060 ,0040 ,fillrect JSR
2021-02-11 16:56:27 -05:00
,01 ,color STR
( fill rect x y w h )
,00a0 ,0010 ,0020 ,0020 ,fillrect JSR
2021-02-11 16:28:13 -05:00
,redraw JSR
BRK
2021-02-11 16:56:27 -05:00
@fillrect
,h STR^ ,w STR^ ,y STR^ ,x STR^
,x LDR^ ,x_ STR^ ,y LDR^ ,y_ STR^
@fillrectrow
,x LDR^ ,x_ STR^
@fillrectcol
,x_ LDR^ ,y_ LDR^ ,putpixel JSR
,x_ LDR^ ,0001 ADD^ ,x_ STR^
,x_ LDR^ ,w LDR^ ,x LDR^ ADD^ LTH^ ,fillrectcol ROT JMP? POP^
,y_ LDR^ ,0001 ADD^ ,y_ STR^
,y_ LDR^ ,h LDR^ ,y LDR^ ADD^ LTH^ ,fillrectrow ROT JMP? POP^
RTS
2021-02-11 16:28:13 -05:00
@redraw
,0000 IOW^
,0000 IOW^
,00 IOW
,01 IOW
RTS
@putpixel
IOW^ ( y short )
IOW^ ( x short )
,color LDR IOW ( color byte )
,00 IOW ( redraw byte )
RTS
|c000 @FRAME BRK
|d000 @ERROR BRK
|FFFA .RESET .FRAME .ERROR