2021-04-02 00:53:41 -04:00
|
|
|
( GUI Shapes )
|
2021-02-20 20:14:36 -05:00
|
|
|
|
2021-03-16 00:29:44 -04:00
|
|
|
%RTN { JMP2r }
|
2021-03-16 14:25:26 -04:00
|
|
|
%++ { #0001 ADD2 }
|
2021-03-22 12:42:48 -04:00
|
|
|
%-- { #0001 SUB2 }
|
2021-05-24 17:52:11 -04:00
|
|
|
%8++ { #0008 ADD2 }
|
|
|
|
%2** { #10 SFT2 }
|
|
|
|
%4** { #20 SFT2 }
|
2021-05-23 11:27:15 -04:00
|
|
|
%ABS2 { DUP2 #0f SFT2 EQU #04 JCN #ffff MUL2 }
|
2021-05-01 12:59:57 -04:00
|
|
|
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
|
|
|
|
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
|
2021-03-16 00:29:44 -04:00
|
|
|
|
2021-04-14 15:11:01 -04:00
|
|
|
%SIZE-TO-RECT {
|
2021-04-23 10:34:03 -04:00
|
|
|
STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2
|
2021-04-14 15:11:01 -04:00
|
|
|
} ( x y w h -- x1 y1 x2 y2 )
|
|
|
|
|
2021-04-23 10:34:03 -04:00
|
|
|
( devices )
|
|
|
|
|
|
|
|
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|
|
|
|
|10 @Console [ &vector $2 &pad $6 &char $1 &byte $1 &short $2 &string $2 ]
|
|
|
|
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
|
|
|
|
|
|
|
|
( variables )
|
2021-04-14 15:11:01 -04:00
|
|
|
|
2021-04-23 10:34:03 -04:00
|
|
|
|0000
|
|
|
|
|
|
|
|
( draw requirements )
|
|
|
|
@color [ &byte $1 ]
|
2021-03-22 12:42:48 -04:00
|
|
|
|
2021-04-23 10:34:03 -04:00
|
|
|
@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
|
|
|
|
@line [ &x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2 &dx $2 &dy $2 &e1 $2 &e2 $2 ]
|
|
|
|
@circle [ &xc $2 &yc $2 &x $2 &y $2 &r $2 &d $2 ]
|
2021-03-21 17:16:19 -04:00
|
|
|
|
2021-04-05 16:00:55 -04:00
|
|
|
( program )
|
|
|
|
|
2021-04-23 10:34:03 -04:00
|
|
|
|0100
|
2021-03-28 14:20:36 -04:00
|
|
|
|
2021-04-23 10:34:03 -04:00
|
|
|
( theme ) #f03f .System/r DEO2 #f03f .System/g DEO2 #003f .System/b DEO2
|
2021-04-14 15:11:01 -04:00
|
|
|
|
2021-04-23 10:34:03 -04:00
|
|
|
( background ) ;checker_icn #23 ;cover-pattern JSR2
|
2021-04-14 15:11:01 -04:00
|
|
|
|
2021-04-23 10:34:03 -04:00
|
|
|
#0010 #0030 #0020 #0020 SIZE-TO-RECT #01 ;line-slow JSR2
|
|
|
|
#0070 #0040 #0010 #01 ;draw-circle JSR2
|
|
|
|
#0038 #0030 #0020 #0020 SIZE-TO-RECT #01 ;line-rect JSR2
|
|
|
|
#0038 #0058 #0020 #0020 SIZE-TO-RECT #01 ;fill-rect JSR2
|
2021-02-21 16:23:36 -05:00
|
|
|
|
2021-02-20 20:14:36 -05:00
|
|
|
BRK
|
|
|
|
|
2021-04-14 15:11:01 -04:00
|
|
|
@line-slow ( x1 y1 x2 y2 color -- )
|
2021-03-21 12:18:52 -04:00
|
|
|
|
2021-05-11 14:14:52 -04:00
|
|
|
( load ) .color STZ -- .line/y0 STZ2 -- .line/x0 STZ2 .line/y STZ2 .line/x STZ2
|
|
|
|
.line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2
|
|
|
|
.line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2
|
2021-05-24 17:52:11 -04:00
|
|
|
#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ADD2 .line/sx STZ2
|
|
|
|
#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 2** ADD2 .line/sy STZ2
|
2021-05-11 14:14:52 -04:00
|
|
|
.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
|
2021-04-23 10:34:03 -04:00
|
|
|
&loop
|
2021-05-11 14:14:52 -04:00
|
|
|
.line/x LDZ2 .Screen/x DEO2 .line/y LDZ2 .Screen/y DEO2 .color LDZ .Screen/color DEO
|
|
|
|
.line/x LDZ2 .line/x0 LDZ2 EQU2 .line/y LDZ2 .line/y0 LDZ2 EQU2 #0101 EQU2 ,&end JCN
|
2021-05-24 17:52:11 -04:00
|
|
|
.line/e1 LDZ2 2** .line/e2 STZ2
|
2021-05-11 14:14:52 -04:00
|
|
|
.line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
|
|
|
|
.line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
|
|
|
|
.line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2
|
2021-04-23 10:34:03 -04:00
|
|
|
&skipy
|
2021-05-11 14:14:52 -04:00
|
|
|
.line/e2 LDZ2 .line/dx LDZ2 GTS2 ,&skipx JCN
|
|
|
|
.line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2
|
|
|
|
.line/y LDZ2 .line/sy LDZ2 ADD2 .line/y STZ2
|
2021-04-23 10:34:03 -04:00
|
|
|
&skipx
|
|
|
|
;&loop JMP2
|
|
|
|
|
|
|
|
&end
|
2021-03-21 12:18:52 -04:00
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-04-14 15:11:01 -04:00
|
|
|
@line-rect ( x1 y1 x2 y2 color -- )
|
2021-04-14 01:50:01 -04:00
|
|
|
|
2021-05-11 14:14:52 -04:00
|
|
|
( load ) .color STZ DUP2 STH2 -- .rect/y2 STZ2 -- .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2
|
2021-04-14 01:50:01 -04:00
|
|
|
STH2r STH2r
|
2021-04-23 10:34:03 -04:00
|
|
|
&ver
|
|
|
|
( save ) OVR2 .Screen/y DEO2
|
2021-05-11 14:14:52 -04:00
|
|
|
( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/color DEO
|
|
|
|
( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/color DEO
|
2021-04-14 01:50:01 -04:00
|
|
|
( incr ) SWP2 ++ SWP2
|
2021-05-11 14:12:07 -04:00
|
|
|
OVR2 OVR2 LTS2 ,&ver JCN
|
2021-04-14 01:50:01 -04:00
|
|
|
POP2 POP2
|
2021-05-11 14:14:52 -04:00
|
|
|
.rect/x1 LDZ2 .rect/x2 LDZ2
|
2021-04-23 10:34:03 -04:00
|
|
|
&hor
|
|
|
|
( save ) OVR2 .Screen/x DEO2
|
2021-05-11 14:14:52 -04:00
|
|
|
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/color DEO
|
|
|
|
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/color DEO
|
2021-04-14 01:50:01 -04:00
|
|
|
( incr ) SWP2 ++ SWP2
|
2021-05-11 14:12:07 -04:00
|
|
|
OVR2 OVR2 ++ LTS2 ,&hor JCN
|
2021-04-14 01:50:01 -04:00
|
|
|
POP2 POP2
|
2021-02-27 14:39:12 -05:00
|
|
|
|
2021-03-14 17:26:17 -04:00
|
|
|
RTN
|
2021-02-21 16:23:36 -05:00
|
|
|
|
2021-04-14 15:11:01 -04:00
|
|
|
@fill-rect ( x1 y1 x2 y2 color -- )
|
2021-04-14 01:50:01 -04:00
|
|
|
|
2021-05-11 14:14:52 -04:00
|
|
|
.color STZ
|
2021-04-14 01:50:01 -04:00
|
|
|
( x1 x2 y1 y2 ) ROT2 SWP2
|
2021-04-23 10:34:03 -04:00
|
|
|
&ver
|
|
|
|
( save ) OVR2 .Screen/y DEO2
|
|
|
|
STH2 STH2 OVR2 OVR2
|
|
|
|
&hor
|
|
|
|
( save ) OVR2 .Screen/x DEO2
|
2021-05-11 14:14:52 -04:00
|
|
|
( draw ) .color LDZ .Screen/color DEO
|
2021-04-14 01:50:01 -04:00
|
|
|
( incr ) SWP2 ++ SWP2
|
2021-05-11 14:12:07 -04:00
|
|
|
OVR2 OVR2 LTS2 ,&hor JCN
|
2021-04-14 01:50:01 -04:00
|
|
|
POP2 POP2 STH2r STH2r
|
|
|
|
( incr ) SWP2 ++ SWP2
|
2021-05-11 14:12:07 -04:00
|
|
|
OVR2 OVR2 LTS2 ,&ver JCN
|
2021-04-14 01:50:01 -04:00
|
|
|
POP2 POP2 POP2 POP2
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-04-14 15:11:01 -04:00
|
|
|
@draw-circle ( xc yc r color -- )
|
2021-03-22 12:42:48 -04:00
|
|
|
|
2021-05-11 14:14:52 -04:00
|
|
|
( load ) .color STZ .circle/r STZ2 .circle/yc STZ2 .circle/xc STZ2
|
|
|
|
#0000 .circle/x STZ2 .circle/r LDZ2 .circle/y STZ2
|
2021-05-24 17:52:11 -04:00
|
|
|
.circle/r LDZ2 2** .circle/d STZ2
|
2021-04-23 10:34:03 -04:00
|
|
|
( draw ) ;&seg JSR2
|
|
|
|
&loop
|
2021-05-11 14:14:52 -04:00
|
|
|
( incr ) .circle/x LDZ2 ++ .circle/x STZ2
|
|
|
|
.circle/d LDZ2 #0001 LTS2 ,&else JCN
|
|
|
|
( decr ) .circle/y LDZ2 -- .circle/y STZ2
|
2021-05-24 17:52:11 -04:00
|
|
|
.circle/x LDZ2 .circle/y LDZ2 SUB2 4** .circle/d LDZ2 ADD2 .circle/d STZ2
|
2021-04-23 10:34:03 -04:00
|
|
|
;&end JMP2
|
|
|
|
&else
|
2021-05-24 17:52:11 -04:00
|
|
|
.circle/x LDZ2 4** .circle/d LDZ2 ADD2 .circle/d STZ2
|
2021-04-23 10:34:03 -04:00
|
|
|
&end
|
|
|
|
( draw ) ;&seg JSR2
|
2021-05-11 14:14:52 -04:00
|
|
|
.circle/y LDZ2 .circle/x LDZ2 -- GTS2 ,&loop JCN
|
2021-03-22 12:42:48 -04:00
|
|
|
RTN
|
2021-04-23 10:34:03 -04:00
|
|
|
&seg
|
2021-05-11 14:14:52 -04:00
|
|
|
.circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/color DEO
|
|
|
|
.circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/color DEO
|
|
|
|
.circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/color DEO
|
|
|
|
.circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/color DEO
|
|
|
|
.circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/color DEO
|
|
|
|
.circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/color DEO
|
|
|
|
.circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/color DEO
|
|
|
|
.circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/color DEO
|
2021-03-22 12:42:48 -04:00
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-04-14 15:11:01 -04:00
|
|
|
@cover-pattern ( addr color -- )
|
|
|
|
|
2021-05-11 14:14:52 -04:00
|
|
|
( load ) .color STZ .Screen/addr DEO2
|
2021-04-23 10:34:03 -04:00
|
|
|
#0000 .Screen/height DEI2
|
|
|
|
&ver
|
|
|
|
( save ) OVR2 .Screen/y DEO2
|
|
|
|
#0000 .Screen/width DEI2
|
|
|
|
&hor
|
|
|
|
( save ) OVR2 .Screen/x DEO2
|
2021-05-11 14:14:52 -04:00
|
|
|
( draw ) .color LDZ .Screen/color DEO
|
2021-05-24 17:52:11 -04:00
|
|
|
( incr ) SWP2 8++ SWP2
|
2021-05-11 14:12:07 -04:00
|
|
|
OVR2 OVR2 LTH2 ,&hor JCN
|
2021-04-14 15:11:01 -04:00
|
|
|
POP2 POP2
|
2021-05-24 17:52:11 -04:00
|
|
|
( incr ) SWP2 8++ SWP2
|
2021-05-11 14:12:07 -04:00
|
|
|
OVR2 OVR2 LTH2 ,&ver JCN
|
2021-04-14 15:11:01 -04:00
|
|
|
POP2 POP2
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-05-15 16:09:11 -04:00
|
|
|
@line-hor ( x0* x1* y* color -- )
|
|
|
|
|
|
|
|
STH .Screen/y DEO2
|
|
|
|
&loop
|
|
|
|
( save ) OVR2 .Screen/x DEO2
|
|
|
|
( draw ) STHkr .Screen/color DEO
|
|
|
|
( incr ) SWP2 #0002 ++ SWP2
|
|
|
|
LTH2k ,&loop JCN
|
|
|
|
POP2 POP2 POPr
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
|
|
|
@line-ver ( x* y0* y1* color -- )
|
|
|
|
|
|
|
|
STH ROT2 .Screen/x DEO2
|
|
|
|
&loop
|
|
|
|
( save ) OVR2 .Screen/y DEO2
|
|
|
|
( draw ) STHkr .Screen/color DEO
|
|
|
|
( incr ) SWP2 #0002 ++ SWP2
|
|
|
|
LTH2k ,&loop JCN
|
|
|
|
POP2 POP2 POPr
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-04-14 15:11:01 -04:00
|
|
|
@checker_icn [ f0f0 f0f0 0f0f 0f0f ]
|