2021-04-02 04:53:41 +00:00
|
|
|
( GUI Shapes )
|
2021-02-21 01:14:36 +00:00
|
|
|
|
2021-03-16 04:29:44 +00:00
|
|
|
%RTN { JMP2r }
|
2021-05-24 21:52:11 +00:00
|
|
|
%8++ { #0008 ADD2 }
|
|
|
|
%2** { #10 SFT2 }
|
|
|
|
%4** { #20 SFT2 }
|
2021-08-30 21:53:01 +00:00
|
|
|
%2// { #01 SFT2 }
|
|
|
|
%4// { #02 SFT2 }
|
2021-08-17 19:16:39 +00:00
|
|
|
%ABS2 { DUP2 #0f SFT2 EQU #05 JCN #0000 SWP2 SUB2 }
|
2021-05-01 16:59:57 +00:00
|
|
|
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
|
|
|
|
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
|
2021-03-16 04:29:44 +00:00
|
|
|
|
2021-04-14 19:11:01 +00:00
|
|
|
%SIZE-TO-RECT {
|
2021-04-23 14:34:03 +00:00
|
|
|
STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2
|
2021-04-14 19:11:01 +00:00
|
|
|
} ( x y w h -- x1 y1 x2 y2 )
|
|
|
|
|
2021-08-30 21:53:01 +00:00
|
|
|
%WIDTH { #0100 } %HEIGHT { #00a0 }
|
|
|
|
|
2021-04-23 14:34:03 +00:00
|
|
|
( devices )
|
|
|
|
|
|
|
|
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|
2021-07-31 20:58:33 +00:00
|
|
|
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|
2021-04-23 14:34:03 +00:00
|
|
|
|
|
|
|
( variables )
|
2021-04-14 19:11:01 +00:00
|
|
|
|
2021-04-23 14:34:03 +00:00
|
|
|
|0000
|
|
|
|
|
|
|
|
( draw requirements )
|
|
|
|
@color [ &byte $1 ]
|
2021-03-22 16:42:48 +00:00
|
|
|
|
2021-04-23 14:34:03 +00: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 21:16:19 +00:00
|
|
|
|
2021-04-05 20:00:55 +00:00
|
|
|
( program )
|
|
|
|
|
2021-04-23 14:34:03 +00:00
|
|
|
|0100
|
2021-03-28 18:20:36 +00:00
|
|
|
|
2021-08-18 18:40:51 +00:00
|
|
|
( theme )
|
2021-08-30 21:53:01 +00:00
|
|
|
#f0ff .System/r DEO2
|
2021-08-18 18:40:51 +00:00
|
|
|
#f03c .System/g DEO2
|
|
|
|
#f03f .System/b DEO2
|
2021-04-14 19:11:01 +00:00
|
|
|
|
2021-07-31 20:58:33 +00:00
|
|
|
( background ) ;checker_icn #03 ;cover-pattern JSR2
|
2021-04-14 19:11:01 +00:00
|
|
|
|
2021-08-30 21:53:01 +00:00
|
|
|
.Screen/width DEI2 2// WIDTH 2// SUB2 #0008 ADD2
|
|
|
|
.Screen/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2
|
|
|
|
WIDTH HEIGHT
|
|
|
|
SIZE-TO-RECT #02 ;fill-rect JSR2
|
|
|
|
|
|
|
|
.Screen/width DEI2 2// WIDTH 2// SUB2
|
|
|
|
.Screen/height DEI2 2// HEIGHT 2// SUB2
|
|
|
|
WIDTH HEIGHT
|
|
|
|
SIZE-TO-RECT #01 ;fill-rect JSR2
|
|
|
|
|
|
|
|
.Screen/width DEI2 2// WIDTH 2// SUB2 #0008 ADD2
|
|
|
|
.Screen/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2
|
|
|
|
WIDTH #0010 SUB2 HEIGHT #0010 SUB2
|
|
|
|
SIZE-TO-RECT #03 ;line-rect JSR2
|
|
|
|
|
|
|
|
.Screen/width DEI2 2// .Screen/height DEI2 2// WIDTH 4// #02 ;draw-circle JSR2
|
|
|
|
|
|
|
|
#0010 #0030 #0068 #02 ;line-hor JSR2
|
|
|
|
#0020 #0058 #0078 #02 ;line-ver JSR2
|
2021-02-21 21:23:36 +00:00
|
|
|
|
2021-02-21 01:14:36 +00:00
|
|
|
BRK
|
|
|
|
|
2021-04-14 19:11:01 +00:00
|
|
|
@line-slow ( x1 y1 x2 y2 color -- )
|
2021-03-21 16:18:52 +00:00
|
|
|
|
2021-08-30 21:53:01 +00:00
|
|
|
( load ) .color STZ #0001 SUB2 .line/y0 STZ2 #0001 SUB2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2
|
2021-05-11 18:14:52 +00:00
|
|
|
.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 21:52:11 +00: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 18:14:52 +00:00
|
|
|
.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
|
2021-04-23 14:34:03 +00:00
|
|
|
&loop
|
2021-07-31 20:58:33 +00:00
|
|
|
.line/x LDZ2 .Screen/x DEO2 .line/y LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
2021-05-11 18:14:52 +00:00
|
|
|
.line/x LDZ2 .line/x0 LDZ2 EQU2 .line/y LDZ2 .line/y0 LDZ2 EQU2 #0101 EQU2 ,&end JCN
|
2021-05-24 21:52:11 +00:00
|
|
|
.line/e1 LDZ2 2** .line/e2 STZ2
|
2021-05-11 18:14:52 +00: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 14:34:03 +00:00
|
|
|
&skipy
|
2021-05-11 18:14:52 +00: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 14:34:03 +00:00
|
|
|
&skipx
|
|
|
|
;&loop JMP2
|
|
|
|
|
|
|
|
&end
|
2021-03-21 16:18:52 +00:00
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-08-18 18:40:51 +00:00
|
|
|
@line-rect ( x1* y1* x2* y2* color -- )
|
2021-04-14 05:50:01 +00:00
|
|
|
|
2022-02-21 18:30:55 +00:00
|
|
|
STH
|
|
|
|
DUP2 ,&ver-y2 STR2 ,&hor-y2 STR2
|
|
|
|
DUP2 ,&ver-x2 STR2 ,&hor-x2 STR2
|
|
|
|
DUP2 ,&ver-y1 STR2 ,&hor-y1 STR2
|
|
|
|
DUP2 ,&ver-x1 STR2 ,&hor-x1 STR2
|
|
|
|
( horizontal )
|
|
|
|
[ LIT2 &hor-x2 $2 ] INC2 [ LIT2 &hor-x1 $2 ]
|
|
|
|
&hor
|
|
|
|
DUP2 .Screen/x DEO2
|
|
|
|
[ LIT2 &hor-y1 $2 ] .Screen/y DEO2 STHkr .Screen/pixel DEOk
|
|
|
|
[ LIT2 &hor-y2 $2 ] .Screen/y DEO2 DEO
|
|
|
|
INC2 GTH2k ,&hor JCN
|
|
|
|
POP2 POP2
|
|
|
|
( vertical )
|
|
|
|
[ LIT2 &ver-y2 $2 ] [ LIT2 &ver-y1 $2 ]
|
2021-04-23 14:34:03 +00:00
|
|
|
&ver
|
2022-02-21 18:30:55 +00:00
|
|
|
DUP2 .Screen/y DEO2
|
|
|
|
[ LIT2 &ver-x1 $2 ] .Screen/x DEO2 STHkr .Screen/pixel DEOk
|
|
|
|
[ LIT2 &ver-x2 $2 ] .Screen/x DEO2 DEO
|
|
|
|
INC2 GTH2k ,&ver JCN
|
2021-04-14 05:50:01 +00:00
|
|
|
POP2 POP2
|
2022-02-21 18:30:55 +00:00
|
|
|
POPr
|
2021-02-27 19:39:12 +00:00
|
|
|
|
2021-03-14 21:26:17 +00:00
|
|
|
RTN
|
2021-02-21 21:23:36 +00:00
|
|
|
|
2021-08-18 18:40:51 +00:00
|
|
|
@fill-rect ( x1* y1* x2* y2* color -- )
|
2021-04-14 05:50:01 +00:00
|
|
|
|
2021-08-18 18:40:51 +00:00
|
|
|
,&color STR
|
|
|
|
( x1 x2 y1 y2 ) ROT2
|
2021-04-23 14:34:03 +00:00
|
|
|
&ver
|
2021-08-18 18:40:51 +00:00
|
|
|
( save ) DUP2 .Screen/y DEO2
|
|
|
|
STH2 STH2 OVR2 OVR2 SWP2
|
2021-04-23 14:34:03 +00:00
|
|
|
&hor
|
2021-08-18 18:40:51 +00:00
|
|
|
( save ) DUP2 .Screen/x DEO2
|
|
|
|
( draw ) ,&color LDR .Screen/pixel DEO
|
|
|
|
( incr ) INC2
|
|
|
|
OVR2 OVR2 GTS2 ,&hor JCN
|
2021-04-14 05:50:01 +00:00
|
|
|
POP2 POP2 STH2r STH2r
|
2021-08-18 18:40:51 +00:00
|
|
|
( incr ) INC2
|
|
|
|
OVR2 OVR2 GTS2 ,&ver JCN
|
2021-04-14 05:50:01 +00:00
|
|
|
POP2 POP2 POP2 POP2
|
|
|
|
|
|
|
|
RTN
|
2021-08-18 18:40:51 +00:00
|
|
|
&color $1
|
2021-04-14 05:50:01 +00:00
|
|
|
|
2021-04-14 19:11:01 +00:00
|
|
|
@draw-circle ( xc yc r color -- )
|
2021-03-22 16:42:48 +00:00
|
|
|
|
2021-05-11 18:14:52 +00: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 21:52:11 +00:00
|
|
|
.circle/r LDZ2 2** .circle/d STZ2
|
2021-04-23 14:34:03 +00:00
|
|
|
( draw ) ;&seg JSR2
|
|
|
|
&loop
|
2021-08-18 02:30:34 +00:00
|
|
|
( incr ) .circle/x LDZ2 INC2 .circle/x STZ2
|
2021-05-11 18:14:52 +00:00
|
|
|
.circle/d LDZ2 #0001 LTS2 ,&else JCN
|
2021-08-30 21:53:01 +00:00
|
|
|
( decr ) .circle/y LDZ2 #0001 SUB2 .circle/y STZ2
|
2021-05-24 21:52:11 +00:00
|
|
|
.circle/x LDZ2 .circle/y LDZ2 SUB2 4** .circle/d LDZ2 ADD2 .circle/d STZ2
|
2021-04-23 14:34:03 +00:00
|
|
|
;&end JMP2
|
|
|
|
&else
|
2021-05-24 21:52:11 +00:00
|
|
|
.circle/x LDZ2 4** .circle/d LDZ2 ADD2 .circle/d STZ2
|
2021-04-23 14:34:03 +00:00
|
|
|
&end
|
|
|
|
( draw ) ;&seg JSR2
|
2021-08-30 21:53:01 +00:00
|
|
|
.circle/y LDZ2 .circle/x LDZ2 #0001 SUB2 GTS2 ,&loop JCN
|
2021-03-22 16:42:48 +00:00
|
|
|
RTN
|
2021-04-23 14:34:03 +00:00
|
|
|
&seg
|
2021-07-31 20:58:33 +00:00
|
|
|
.circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
|
|
|
.circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
|
|
|
.circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
|
|
|
.circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
|
|
|
.circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
|
|
|
.circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
|
|
|
.circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
|
|
|
.circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
2021-03-22 16:42:48 +00:00
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-08-18 18:40:51 +00:00
|
|
|
@cover-pattern ( addr* color -- )
|
2021-04-14 19:11:01 +00:00
|
|
|
|
2021-08-18 18:40:51 +00:00
|
|
|
( load ) STH .Screen/addr DEO2
|
|
|
|
.Screen/height DEI2 #0000
|
2021-04-23 14:34:03 +00:00
|
|
|
&ver
|
2021-08-18 18:40:51 +00:00
|
|
|
( save ) DUP2 .Screen/y DEO2
|
|
|
|
.Screen/width DEI2 #0000
|
2021-04-23 14:34:03 +00:00
|
|
|
&hor
|
2021-08-18 18:40:51 +00:00
|
|
|
( save ) DUP2 .Screen/x DEO2
|
|
|
|
( draw ) STHkr .Screen/sprite DEO
|
|
|
|
#0008 ADD2 GTH2k ,&hor JCN
|
2021-04-14 19:11:01 +00:00
|
|
|
POP2 POP2
|
2021-08-18 18:40:51 +00:00
|
|
|
#0008 ADD2 GTH2k ,&ver JCN
|
2021-04-14 19:11:01 +00:00
|
|
|
POP2 POP2
|
2021-08-18 18:40:51 +00:00
|
|
|
POPr
|
2021-04-14 19:11:01 +00:00
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-05-15 20:09:11 +00:00
|
|
|
@line-hor ( x0* x1* y* color -- )
|
|
|
|
|
|
|
|
STH .Screen/y DEO2
|
2021-08-18 18:40:51 +00:00
|
|
|
SWP2
|
2021-05-15 20:09:11 +00:00
|
|
|
&loop
|
2021-08-18 18:40:51 +00:00
|
|
|
( save ) DUP2 .Screen/x DEO2
|
2021-07-31 20:58:33 +00:00
|
|
|
( draw ) STHkr .Screen/pixel DEO
|
2021-08-18 18:40:51 +00:00
|
|
|
INC2 GTH2k ,&loop JCN
|
2021-05-15 20:09:11 +00:00
|
|
|
POP2 POP2 POPr
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
|
|
|
@line-ver ( x* y0* y1* color -- )
|
|
|
|
|
|
|
|
STH ROT2 .Screen/x DEO2
|
2021-08-18 18:40:51 +00:00
|
|
|
SWP2
|
2021-05-15 20:09:11 +00:00
|
|
|
&loop
|
2021-08-18 18:40:51 +00:00
|
|
|
( save ) DUP2 .Screen/y DEO2
|
2021-07-31 20:58:33 +00:00
|
|
|
( draw ) STHkr .Screen/pixel DEO
|
2021-08-18 18:40:51 +00:00
|
|
|
INC2 GTH2k ,&loop JCN
|
2021-05-15 20:09:11 +00:00
|
|
|
POP2 POP2 POPr
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-04-14 19:11:01 +00:00
|
|
|
@checker_icn [ f0f0 f0f0 0f0f 0f0f ]
|