75 lines
1.7 KiB
Plaintext
75 lines
1.7 KiB
Plaintext
( draw routines )
|
|
|
|
:dev/r fff8 ( std read port )
|
|
:dev/w fff9 ( std write port )
|
|
|
|
;color 1 ;x1 2 ;x2 2 ;y1 2 ;y2 2
|
|
|
|
|0100 @RESET
|
|
|
|
#01 =dev/w ( set dev/write to screen )
|
|
|
|
#01 =color
|
|
#0010 #0020 #0040 #0060 ,fill-rect JSR
|
|
#02 =color
|
|
#0020 #0030 #0050 #0070 ,fill-rect JSR
|
|
#03 =color
|
|
#0030 #0040 #0060 #0080 ,fill-rect JSR
|
|
|
|
#01 =color
|
|
#0070 #0020 #00a0 #0060 ,line-rect JSR
|
|
#02 =color
|
|
#0080 #0030 #00b0 #0070 ,line-rect JSR
|
|
#03 =color
|
|
#0090 #0040 #00c0 #0080 ,line-rect JSR
|
|
|
|
BRK
|
|
|
|
@line-ver ( x1 y1 y2 )
|
|
=y2 =y1 =x1
|
|
@line-ver-loop
|
|
( draw ) ~x1 ~y1 IOW2 IOW2 ~color IOW
|
|
( incr ) ~y1 #0001 ADD2 DUP2 =y1
|
|
~y2 NEQ2 ,line-ver-loop ROT JMP? POP2
|
|
RTS
|
|
|
|
@line-hor ( x1 y1 x2 )
|
|
=x2 =y1 =x1
|
|
@line-hor-loop
|
|
( draw ) ~x1 ~y1 IOW2 IOW2 ~color IOW
|
|
( incr ) ~x1 #0001 ADD2 DUP2 =x1
|
|
~x2 NEQ2 ,line-hor-loop ROT JMP? POP2
|
|
RTS
|
|
|
|
@line-rect ( x1 y1 x2 y2 )
|
|
=y2 =x2 ( stash x1 y1 ) DUP2 WSR2 =y1 DUP2 WSR2 =x1
|
|
@line-rect-hor
|
|
( draw ) ~x1 ~y1 IOW2 IOW2 ~color IOW
|
|
( draw ) ~x1 ~y2 IOW2 IOW2 ~color IOW
|
|
( incr ) ~x1 #0001 ADD2 DUP2 =x1
|
|
~x2 #0001 ADD2 LTH2 ,line-rect-hor ROT JMP? POP2
|
|
( restore x1 y1 ) RSW2 =x1 RSW2 =y1
|
|
@line-rect-ver
|
|
( incr ) ~y1 #0001 ADD2 DUP2 =y1
|
|
( draw ) ~x1 ~y1 IOW2 IOW2 ~color IOW
|
|
( draw ) ~x2 ~y1 IOW2 IOW2 ~color IOW
|
|
~y2 #0001 SUB2 LTH2 ,line-rect-ver ROT JMP? POP2
|
|
RTS
|
|
|
|
@fill-rect ( x1 y1 x2 y2 )
|
|
=y2 =x2 ( stash x1 y1 ) =y1 DUP2 WSR2 =x1
|
|
@fill-rect-ver
|
|
RSW2 DUP2 =x1 WSR2
|
|
@fill-rect-hor
|
|
( draw ) ~x1 ~y1 IOW2 IOW2 ~color IOW
|
|
( incr ) ~x1 #0001 ADD2 DUP2 =x1
|
|
~x2 LTH2 ,fill-rect-hor ROT JMP? POP2
|
|
~y1 #0001 ADD2 DUP2 =y1
|
|
~y2 LTH2 ,fill-rect-ver ROT JMP? POP2
|
|
RSW2 POP2
|
|
RTS
|
|
|
|
|c000 @FRAME BRK
|
|
|d000 @ERROR BRK
|
|
|FFF0 [ 0f0f 0fff 0ff0 ] ( palette )
|
|
|FFFA .RESET .FRAME .ERROR ( vectors ) |