uxn/examples/line.usm

53 lines
787 B
Plaintext
Raw Normal View History

2021-02-12 13:26:58 -05:00
( draw routines )
:dev/r fff8 ( std read port )
:dev/w fff9 ( std write port )
;x_ 2 ;y_ 2 ;x0 2 ;y0 2 ;x1 2 ;y1 2 ;color 1
2021-02-12 19:18:52 -05:00
;dx 2 ;dy 2 ;err 2 ;err2 2
2021-02-12 13:26:58 -05:00
|0100 @RESET
( set dev/write to screen )
,01 ,dev/w STR
,01 ,color STR
( init positions )
,0020 ,x0 STR^ ,0018 ,y0 STR^
2021-02-12 19:18:52 -05:00
,0060 ,x1 STR^ ,0048 ,y1 STR^
2021-02-12 13:26:58 -05:00
,x0 LDR^ ,x_ STR^ ,y0 LDR^ ,y_ STR^
2021-02-12 19:18:52 -05:00
2021-02-12 13:26:58 -05:00
( draw control points )
,02 ,color STR
,x0 LDR^ ,y0 LDR^ ,putpixel JSR
,x1 LDR^ ,y1 LDR^ ,putpixel JSR
,redraw JSR
BRK
@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
2021-02-12 19:18:52 -05:00
@diff16
OVR^ OVR^ GTH^ ,diff16sub ROT JMP? POP^
SWP^ @diff16sub SUB^
RTS
2021-02-12 13:26:58 -05:00
|c000 @FRAME BRK
|d000 @ERROR BRK
|FFFA .RESET .FRAME .ERROR