2021-04-23 19:00:34 +00:00
|
|
|
(
|
|
|
|
Bifurcan
|
|
|
|
Every second, the Labyrinth reorganize itself to display the time.
|
|
|
|
)
|
2021-04-23 18:17:17 +00:00
|
|
|
|
|
|
|
%RTN { JMP2r }
|
|
|
|
%MOD { DUP2 DIV MUL SUB }
|
|
|
|
%TOS { #00 SWP }
|
2021-05-24 21:36:15 +00:00
|
|
|
%2// { #01 SFT2 }
|
2021-05-24 21:52:11 +00:00
|
|
|
%8** { #30 SFT2 }
|
2021-04-23 18:17:17 +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-05-31 22:08:34 +00:00
|
|
|
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|
2021-04-26 17:52:46 +00:00
|
|
|
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
|
2021-04-23 18:17:17 +00:00
|
|
|
|
|
|
|
( variables )
|
|
|
|
|
|
|
|
|0000
|
|
|
|
|
2021-04-23 18:25:19 +00:00
|
|
|
@last $1
|
2021-04-23 18:17:17 +00:00
|
|
|
@style $1
|
2021-04-23 18:25:19 +00:00
|
|
|
@pointer [ &x $2 &y $2 ]
|
2021-04-23 18:17:17 +00:00
|
|
|
@center [ &x $2 &y $2 ]
|
|
|
|
@anchor [ &x $2 &y $2 ]
|
|
|
|
|
|
|
|
( program )
|
|
|
|
|
|
|
|
|0100 ( -> )
|
|
|
|
|
|
|
|
( theme )
|
|
|
|
#0f3a .System/r DEO2
|
|
|
|
#0fda .System/g DEO2
|
|
|
|
#0faa .System/b DEO2
|
|
|
|
|
|
|
|
( vectors )
|
|
|
|
;on-frame .Screen/vector DEO2
|
|
|
|
;on-mouse .Mouse/vector DEO2
|
|
|
|
|
|
|
|
( find center )
|
2021-05-24 21:36:15 +00:00
|
|
|
.Screen/width DEI2 2// .center/x STZ2
|
|
|
|
.Screen/height DEI2 2// .center/y STZ2
|
2021-04-23 18:17:17 +00:00
|
|
|
|
|
|
|
( background )
|
2021-04-23 18:25:19 +00:00
|
|
|
;tiles ;cover-pattern JSR2
|
2021-04-23 18:17:17 +00:00
|
|
|
;redraw JSR2
|
|
|
|
|
|
|
|
BRK
|
|
|
|
|
|
|
|
@on-frame ( -> )
|
|
|
|
|
|
|
|
( only draw once per second )
|
2021-05-11 18:14:52 +00:00
|
|
|
.DateTime/second DEI .last LDZ NEQ #01 JCN [ BRK ]
|
2021-04-29 04:00:39 +00:00
|
|
|
|
2021-05-11 18:14:52 +00:00
|
|
|
.DateTime/second DEI .last STZ
|
2021-04-23 18:17:17 +00:00
|
|
|
;redraw JSR2
|
|
|
|
|
|
|
|
BRK
|
|
|
|
|
|
|
|
@on-mouse ( -> )
|
|
|
|
|
|
|
|
;draw-cursor JSR2
|
|
|
|
|
2021-05-11 18:12:07 +00:00
|
|
|
.Mouse/state DEI #00 EQU ,&no-touch JCN
|
2021-05-12 19:13:28 +00:00
|
|
|
( incr ) .style LDZ #01 ADD #03 MOD .style STZ
|
2021-08-17 19:16:39 +00:00
|
|
|
( bg ) ;tiles .style LDZ #40 SFT TOS ADD2 ;cover-pattern JSR2
|
2021-04-23 18:25:19 +00:00
|
|
|
( fg ) ;redraw JSR2
|
2021-04-23 18:17:17 +00:00
|
|
|
( release ) #00 .Mouse/state DEO
|
|
|
|
&no-touch
|
|
|
|
|
|
|
|
BRK
|
|
|
|
|
|
|
|
@redraw ( -- )
|
|
|
|
|
|
|
|
( hrs )
|
2021-05-11 18:14:52 +00:00
|
|
|
[ .center/x LDZ2 #0018 SUB2 ]
|
|
|
|
[ .center/y LDZ2 #0048 SUB2 ]
|
2021-04-23 18:17:17 +00:00
|
|
|
.DateTime/hour DEI #0a DIV ;draw-number JSR2
|
2021-05-11 18:14:52 +00:00
|
|
|
[ .center/x LDZ2 #0008 ADD2 ]
|
|
|
|
[ .center/y LDZ2 #0048 SUB2 ]
|
2021-04-23 18:17:17 +00:00
|
|
|
.DateTime/hour DEI #0a MOD ;draw-number JSR2
|
|
|
|
( min )
|
2021-05-11 18:14:52 +00:00
|
|
|
[ .center/x LDZ2 #0018 SUB2 ]
|
|
|
|
[ .center/y LDZ2 #0018 SUB2 ]
|
2021-04-23 18:17:17 +00:00
|
|
|
.DateTime/minute DEI #0a DIV ;draw-number JSR2
|
2021-05-11 18:14:52 +00:00
|
|
|
[ .center/x LDZ2 #0008 ADD2 ]
|
|
|
|
[ .center/y LDZ2 #0018 SUB2 ]
|
2021-04-23 18:17:17 +00:00
|
|
|
.DateTime/minute DEI #0a MOD ;draw-number JSR2
|
|
|
|
( sec )
|
2021-05-11 18:14:52 +00:00
|
|
|
[ .center/x LDZ2 #0018 SUB2 ]
|
|
|
|
[ .center/y LDZ2 #0018 ADD2 ]
|
2021-04-23 18:17:17 +00:00
|
|
|
.DateTime/second DEI #0a DIV
|
|
|
|
;draw-number JSR2
|
2021-05-11 18:14:52 +00:00
|
|
|
[ .center/x LDZ2 #0008 ADD2 ]
|
|
|
|
[ .center/y LDZ2 #0018 ADD2 ]
|
2021-04-23 18:17:17 +00:00
|
|
|
.DateTime/second DEI #0a MOD
|
|
|
|
;draw-number JSR2
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-05-12 18:44:18 +00:00
|
|
|
@draw-number ( x* y* n -- )
|
2021-04-23 18:17:17 +00:00
|
|
|
|
|
|
|
STH
|
2021-05-11 18:14:52 +00:00
|
|
|
( save pos ) .anchor/y STZ2 .anchor/x STZ2
|
2021-04-23 18:17:17 +00:00
|
|
|
#00 #0f
|
|
|
|
&loop
|
2021-05-24 21:52:11 +00:00
|
|
|
( save-x ) OVR #03 MOD TOS 8** .anchor/x LDZ2 ADD2 .Screen/x DEO2
|
|
|
|
( save-y ) OVR #03 DIV TOS 8** .anchor/y LDZ2 ADD2 .Screen/y DEO2
|
2021-08-17 19:16:39 +00:00
|
|
|
( get digit* ) OVR STHkr DUP ADD TOS ;digits ADD2 LDA2
|
2021-05-23 15:27:15 +00:00
|
|
|
( get bit ) ROT #0e SWP SUB SFT2 #0001 AND2
|
2021-05-24 21:52:11 +00:00
|
|
|
( set tile ) 8** ;tiles ADD2
|
2021-08-17 19:16:39 +00:00
|
|
|
( set style ) .style LDZ #40 SFT TOS ADD2
|
2021-04-23 18:17:17 +00:00
|
|
|
.Screen/addr DEO2
|
2021-07-31 20:58:33 +00:00
|
|
|
( draw ) #01 .Screen/sprite DEO
|
2021-05-12 18:44:18 +00:00
|
|
|
( incr ) SWP #01 ADD SWP
|
2021-05-12 19:13:28 +00:00
|
|
|
LTHk ,&loop JCN
|
2021-04-23 18:17:17 +00:00
|
|
|
POP2
|
|
|
|
POPr
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-05-12 18:44:18 +00:00
|
|
|
@cover-pattern ( addr* -- )
|
2021-04-23 18:17:17 +00:00
|
|
|
|
2021-04-23 18:25:19 +00:00
|
|
|
( load ) .Screen/addr DEO2
|
2021-04-23 18:17:17 +00:00
|
|
|
#0000 .Screen/height DEI2
|
|
|
|
&ver
|
|
|
|
( save ) OVR2 .Screen/y DEO2
|
|
|
|
#0000 .Screen/width DEI2
|
|
|
|
&hor
|
|
|
|
( save ) OVR2 .Screen/x DEO2
|
2021-07-31 20:58:33 +00:00
|
|
|
( draw ) #01 .Screen/sprite DEO
|
2021-05-12 18:44:18 +00:00
|
|
|
( incr ) SWP2 #0008 ADD2 SWP2
|
|
|
|
LTH2k ,&hor JCN
|
2021-04-23 18:17:17 +00:00
|
|
|
POP2 POP2
|
2021-05-12 18:44:18 +00:00
|
|
|
( incr ) SWP2 #0008 ADD2 SWP2
|
|
|
|
LTH2k ,&ver JCN
|
2021-04-23 18:17:17 +00:00
|
|
|
POP2 POP2
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
|
|
|
@draw-cursor ( -- )
|
|
|
|
|
|
|
|
( clear last cursor )
|
2021-05-06 17:38:38 +00:00
|
|
|
;cursor .Screen/addr DEO2
|
2021-05-11 18:14:52 +00:00
|
|
|
.pointer/x LDZ2 .Screen/x DEO2
|
|
|
|
.pointer/y LDZ2 .Screen/y DEO2
|
2021-07-31 20:58:33 +00:00
|
|
|
#40 .Screen/sprite DEO
|
2021-04-23 18:17:17 +00:00
|
|
|
( record pointer positions )
|
2021-07-09 18:38:45 +00:00
|
|
|
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
|
|
|
|
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
|
2021-04-23 18:17:17 +00:00
|
|
|
( colorize on state )
|
2021-07-31 20:58:33 +00:00
|
|
|
#41 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/sprite DEO
|
2021-04-23 18:17:17 +00:00
|
|
|
|
|
|
|
RTN
|
|
|
|
|
|
|
|
@cursor [
|
|
|
|
80c0 e0f0 f8e0 1000 ]
|
2021-04-29 04:00:39 +00:00
|
|
|
|
2021-04-23 18:17:17 +00:00
|
|
|
@digits [
|
2021-04-29 04:00:39 +00:00
|
|
|
7b6f 2492 73e7 73cf
|
|
|
|
5bc9 79cf 49ef 7249
|
|
|
|
7bef 7bc9 ]
|
|
|
|
|
2021-04-23 18:17:17 +00:00
|
|
|
@tiles [
|
|
|
|
0102 0408 1020 4080
|
|
|
|
8040 2010 0804 0201
|
|
|
|
0718 2040 4080 8080
|
|
|
|
0101 0102 0204 18e0
|
|
|
|
0808 0810 e304 0808
|
2021-05-12 19:13:28 +00:00
|
|
|
0808 0804 e310 0808 ]
|