2022-03-14 12:55:31 -04:00
|
|
|
( Bifurcan )
|
2021-04-23 14:17:17 -04:00
|
|
|
|
2024-01-14 19:06:24 -05:00
|
|
|
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|
2024-01-14 19:16:54 -05:00
|
|
|
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|
2024-01-14 19:06:24 -05:00
|
|
|
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1
|
|
|
|
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
|
|
|
|
|80 @Controller &vector $2 &button $1 &key $1
|
2024-06-15 22:27:58 -04:00
|
|
|
|000
|
2021-04-23 14:17:17 -04:00
|
|
|
|
2024-01-14 19:06:24 -05:00
|
|
|
@last $1
|
|
|
|
@style $1
|
|
|
|
@center &x $2 &y $2
|
2021-04-23 14:17:17 -04:00
|
|
|
|
2024-06-15 22:27:58 -04:00
|
|
|
|100
|
2021-04-23 14:17:17 -04:00
|
|
|
|
2024-01-14 19:06:24 -05:00
|
|
|
@on-reset ( -> )
|
|
|
|
( | theme )
|
|
|
|
#0f3a .System/r DEO2
|
|
|
|
#0fda .System/g DEO2
|
2021-04-23 14:17:17 -04:00
|
|
|
#0faa .System/b DEO2
|
2024-01-14 19:06:24 -05:00
|
|
|
( | vectors )
|
2021-04-23 14:17:17 -04:00
|
|
|
;on-frame .Screen/vector DEO2
|
|
|
|
;on-mouse .Mouse/vector DEO2
|
2021-08-21 15:35:28 -04:00
|
|
|
;on-button .Controller/vector DEO2
|
2024-01-14 19:06:24 -05:00
|
|
|
( | find center )
|
2022-03-14 12:55:31 -04:00
|
|
|
.Screen/width DEI2 #01 SFT2 .center/x STZ2
|
|
|
|
.Screen/height DEI2 #01 SFT2 .center/y STZ2
|
2024-01-14 19:06:24 -05:00
|
|
|
( | background )
|
2024-01-14 19:16:54 -05:00
|
|
|
;tiles <cover-pattern>
|
|
|
|
<redraw>
|
|
|
|
BRK
|
2021-04-23 14:17:17 -04:00
|
|
|
|
|
|
|
@on-frame ( -> )
|
2024-01-14 19:16:54 -05:00
|
|
|
( | only draw once per second )
|
|
|
|
.DateTime/second DEI .last LDZ NEQk ?{ POP2 BRK }
|
|
|
|
.last STZ
|
|
|
|
POP <redraw>
|
|
|
|
BRK
|
2021-04-23 14:17:17 -04:00
|
|
|
|
|
|
|
@on-mouse ( -> )
|
2024-01-14 19:16:54 -05:00
|
|
|
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;cursor-icn <update-cursor>
|
|
|
|
.Mouse/state DEI ?{ BRK }
|
|
|
|
select [ LIT2 00 -Mouse/state ] DEO
|
|
|
|
BRK
|
2021-04-23 14:17:17 -04:00
|
|
|
|
2021-08-21 15:35:28 -04:00
|
|
|
@on-button ( -> )
|
2024-01-14 19:16:54 -05:00
|
|
|
.Controller/button DEI ?{ BRK }
|
|
|
|
select [ LIT2 00 -Controller/button ] DEO
|
|
|
|
BRK
|
2021-08-21 15:35:28 -04:00
|
|
|
|
2022-03-14 12:55:31 -04:00
|
|
|
@select ( -- )
|
2024-01-14 19:16:54 -05:00
|
|
|
.style LDZ INC #03 DIVk MUL SUB .style STZ
|
|
|
|
;tiles [ LIT2 00 -style ] LDZ #40 SFT ADD2 <cover-pattern>
|
|
|
|
( >> )
|
2022-03-14 12:55:31 -04:00
|
|
|
|
2024-06-15 22:27:58 -04:00
|
|
|
(
|
|
|
|
@|drawing )
|
|
|
|
|
2024-01-14 19:16:54 -05:00
|
|
|
@<redraw> ( -- )
|
2024-01-14 19:06:24 -05:00
|
|
|
( | hrs )
|
2024-01-14 19:16:54 -05:00
|
|
|
[ .center/x LDZ2 #0018 SUB2 ] [ .center/y LDZ2 #0048 SUB2 ] .DateTime/hour DEI #0a DIV <draw-number>
|
|
|
|
[ .center/x LDZ2 #0008 ADD2 ] [ .center/y LDZ2 #0048 SUB2 ] .DateTime/hour DEI #0a DIVk MUL SUB <draw-number>
|
2024-01-14 19:06:24 -05:00
|
|
|
( | min )
|
2024-01-14 19:16:54 -05:00
|
|
|
[ .center/x LDZ2 #0018 SUB2 ] [ .center/y LDZ2 #0018 SUB2 ] .DateTime/minute DEI #0a DIV <draw-number>
|
|
|
|
[ .center/x LDZ2 #0008 ADD2 ] [ .center/y LDZ2 #0018 SUB2 ] .DateTime/minute DEI #0a DIVk MUL SUB <draw-number>
|
2024-01-14 19:06:24 -05:00
|
|
|
( | sec )
|
2024-01-14 19:16:54 -05:00
|
|
|
[ .center/x LDZ2 #0018 SUB2 ] [ .center/y LDZ2 #0018 ADD2 ] .DateTime/second DEI #0a DIV <draw-number>
|
|
|
|
[ .center/x LDZ2 #0008 ADD2 ] [ .center/y LDZ2 #0018 ADD2 ] .DateTime/second DEI #0a DIVk MUL SUB
|
2021-04-23 14:17:17 -04:00
|
|
|
|
2024-01-14 19:16:54 -05:00
|
|
|
@<draw-number> ( x* y* n -- )
|
2024-01-14 19:06:24 -05:00
|
|
|
,&digit STR
|
|
|
|
,&y STR2
|
|
|
|
,&x STR2
|
|
|
|
#0f00
|
2024-06-15 22:27:58 -04:00
|
|
|
&>loop ( -- )
|
2024-01-14 19:16:54 -05:00
|
|
|
( save-x ) DUP #03 DIVk MUL SUB #00 SWP #30 SFT2 [ LIT2 &x $2 ] ADD2 .Screen/x DEO2
|
2022-03-14 12:55:31 -04:00
|
|
|
( save-y ) DUP #03 DIV #00 SWP #30 SFT2 [ LIT2 &y $2 ] ADD2 .Screen/y DEO2
|
2024-01-14 19:06:24 -05:00
|
|
|
( get digit* ) DUP [ LIT &digit $1 ] DUP ADD #00 SWP ;digits ADD2 LDA2
|
|
|
|
( get bit ) ROT #0e SWP SUB SFT2 #0001 AND2
|
|
|
|
( set tile ) #30 SFT2 ;tiles ADD2
|
|
|
|
( set style ) .style LDZ #40 SFT #00 SWP ADD2 .Screen/addr DEO2
|
2024-01-14 19:16:54 -05:00
|
|
|
( draw ) [ LIT2 01 -Screen/sprite ] DEO
|
2024-06-15 22:27:58 -04:00
|
|
|
INC GTHk ?&>loop
|
2024-01-14 19:16:54 -05:00
|
|
|
POP2 JMP2r
|
2021-04-23 14:17:17 -04:00
|
|
|
|
2024-01-14 19:16:54 -05:00
|
|
|
@<cover-pattern> ( addr* -- )
|
2022-03-14 12:55:31 -04:00
|
|
|
.Screen/addr DEO2
|
2024-06-15 22:27:58 -04:00
|
|
|
.Screen/height DEI2 #03 SFT2 ,&h STR
|
|
|
|
POP .Screen/width DEI2 #03 SFT2 ,&w STR
|
|
|
|
POP [ LIT &h $1 ] #00
|
|
|
|
&>ver ( -- )
|
2022-03-14 12:55:31 -04:00
|
|
|
#00 OVR #30 SFT2 .Screen/y DEO2
|
|
|
|
[ LIT &w $1 ] #00
|
2024-06-15 22:27:58 -04:00
|
|
|
&>hor ( -- )
|
|
|
|
#00 OVR #30 SFT2 .Screen/x DEO2
|
|
|
|
[ LIT2 01 -Screen/sprite ] DEO
|
|
|
|
INC GTHk ?&>hor
|
|
|
|
POP2 INC GTHk ?&>ver
|
2024-01-14 19:16:54 -05:00
|
|
|
POP2 JMP2r
|
|
|
|
|
|
|
|
@<update-cursor> ( color addr* -- )
|
|
|
|
[ LIT2 00 -Screen/auto ] DEO
|
|
|
|
;fill-icn .Screen/addr DEO2
|
|
|
|
#40 <draw-cursor>
|
|
|
|
.Mouse/x DEI2 ,<draw-cursor>/x STR2
|
|
|
|
.Mouse/y DEI2 ,<draw-cursor>/y STR2
|
|
|
|
.Screen/addr DEO2
|
2024-03-24 12:46:30 -04:00
|
|
|
( >> )
|
2024-01-14 19:16:54 -05:00
|
|
|
|
|
|
|
@<draw-cursor> ( color -- )
|
|
|
|
[ LIT2 &x $2 ] .Screen/x DEO2
|
|
|
|
[ LIT2 &y $2 ] .Screen/y DEO2
|
|
|
|
.Screen/sprite DEO
|
2024-01-14 19:06:24 -05:00
|
|
|
JMP2r
|
2021-04-23 14:17:17 -04:00
|
|
|
|
2024-06-15 22:27:58 -04:00
|
|
|
(
|
|
|
|
@|assets )
|
|
|
|
|
2024-01-14 19:16:54 -05:00
|
|
|
@cursor-icn [ 80c0 e0f0 f8e0 1000 ]
|
2022-03-14 12:55:31 -04:00
|
|
|
|
2024-01-14 19:16:54 -05:00
|
|
|
@fill-icn [ ffff ffff ffff ffff ]
|
2021-04-23 14:17:17 -04:00
|
|
|
|
2024-01-14 19:06:24 -05:00
|
|
|
@digits [
|
|
|
|
7b6f 2492 73e7 73cf 5bc9 79cf 49ef 7249
|
|
|
|
7bef 7bc9 ]
|
2021-04-29 00:00:39 -04:00
|
|
|
|
2024-01-14 19:06:24 -05:00
|
|
|
@tiles [
|
|
|
|
0102 0408 1020 4080 8040 2010 0804 0201
|
|
|
|
0718 2040 4080 8080 0101 0102 0204 18e0
|
|
|
|
0808 0810 e304 0808 0808 0804 e310 0808 ]
|
2021-04-29 00:00:39 -04:00
|
|
|
|