This commit is contained in:
Devine Lu Linvega 2024-07-24 15:33:24 -07:00
parent 600048613f
commit 5a514844ff
1 changed files with 30 additions and 83 deletions

View File

@ -5,14 +5,11 @@
|80 @Controller &vector $2 &button $1 &key $1 |80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $1 &ylb $1 &state $1 &chord $1 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1 |90 @Mouse &vector $2 &x $2 &y $1 &ylb $1 &state $1 &chord $1 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 |c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
|000
( | 15 minutes = 900 seconds, or 0x384 )
( | 0x384 / 2 = 0x1c2 )
( | each minute is 4 bars, of 15 seconds each )
( | 15 minutes )
@remaining-seconds $2
@height $2 |000
@timeleft $2
@height $2
|100 |100
@ -27,7 +24,7 @@
;on-frame .Screen/vector DEO2 ;on-frame .Screen/vector DEO2
;on-mouse .Mouse/vector DEO2 ;on-mouse .Mouse/vector DEO2
( | screen size ) ( | screen size )
#0148 .Screen/width DEO2 #0078 .Screen/width DEO2
#0110 .Screen/height DEO2 #0110 .Screen/height DEO2
<redraw> <redraw>
BRK BRK
@ -38,7 +35,7 @@
BRK BRK
@on-frame ( -> ) @on-frame ( -> )
.remaining-seconds LDZ2 ORAk ?{ POP2 BRK } .timeleft LDZ2 ORAk ?{ POP2 BRK }
[ LIT2 40 &f $1 ] INCk ,&f STR [ LIT2 40 &f $1 ] INCk ,&f STR
NEQ ?{ NEQ ?{
[ LIT2 00 _&f ] STR [ LIT2 00 _&f ] STR
@ -69,11 +66,10 @@
JMP2r JMP2r
@<set-height> ( distance* -- ) @<set-height> ( distance* -- )
#00f0 SWP2 SUB2 #02 SFT2 #000f MUL2 DUP2 <pdec> #00f0 SWP2 SUB2 #02 SFT2 #000f MUL2
#0a18 DEO
@<set-seconds> ( seconds* -- ) @<set-seconds> ( seconds* -- )
DUP2 .remaining-seconds LDZ2 EQU2 ?{ .remaining-seconds STZ2 DUP2 .timeleft LDZ2 EQU2 ?{ .timeleft STZ2
<draw-remains> !<redraw-bar> } <draw-remains> !<redraw-bar> }
POP2 JMP2r POP2 JMP2r
@ -82,41 +78,11 @@
@<redraw> ( -- ) @<redraw> ( -- )
<redraw-bar> <redraw-bar>
<draw-markers>
<draw-labels> <draw-labels>
JMP2r ( >> )
( | markers )
;tick-icn .Screen/addr DEO2
[ LIT2 f1 -Screen/auto ] DEO
#0030 .Screen/x DEO2
#0010 .Screen/y DEO2
[ LIT2r 0f -Screen/sprite ] DEOkr
[ LIT2 d1 -Screen/auto ] DEO
#0030 .Screen/x DEO2
#0090 .Screen/y DEO2
DEOr
( | labels )
#003a .Screen/x DEO2
#000c .Screen/y DEO2
[ LIT2 02 -Screen/auto ] DEO
[ LIT2r =label-tilemap ] #1f00
&>l ( -- )
LDAkr #00 STHr INC2r ;digits ADD2 .Screen/addr DEO2
[ LIT2 05 -Screen/sprite ] DEO
INC GTHk ?&>l
POP2
( | labels, cont )
#0042 .Screen/x DEO2
#000c .Screen/y DEO2
#1f00
&>ll ( -- )
LDAkr #00 STHr INC2r ;digits ADD2 .Screen/addr DEO2
[ LIT2 05 -Screen/sprite ] DEO
INC GTHk ?&>ll
POP2 POP2r JMP2r
@<draw-markers> ( -- ) @<draw-markers> ( -- )
#00 .Screen/auto DEO [ LIT2 00 -Screen/auto ] DEO
#00f1 #0000 #00f1 #0000
&>l ( -- ) &>l ( -- )
( | every 5th ) ( | every 5th )
@ -124,25 +90,10 @@
DUP2 #0009 ADD2 .Screen/y DEO2 DUP2 #0009 ADD2 .Screen/y DEO2
#0030 .Screen/x DEO2 #0030 .Screen/x DEO2
DUP #02 SFT #03 AND #00 EQU #00 SWP #30 SFT2 ;mark-icn ADD2 .Screen/addr DEO2 DUP #02 SFT #03 AND #00 EQU #00 SWP #30 SFT2 ;mark-icn ADD2 .Screen/addr DEO2
#05 .Screen/sprite DEO } [ LIT2 05 -Screen/sprite ] DEO }
INC2 GTH2k ?&>l INC2 GTH2k ?&>l
POP2 POP2 JMP2r POP2 POP2 JMP2r
@<draw-remains> ( -- )
#003c .Screen/x DEO2
#00f5 .Screen/y DEO2
[ LIT2 15 -Screen/auto ] DEO
.remaining-seconds LDZ2 ORAk ?{ POP2 ;dict/min0 !<draw-uf2> }
( | minutes )
( x0 ) DUP2 #0258 DIV2 NIP DUP #00 EQU ?{
DUP [ LIT "0 ] ADD <draw-char> }
POP
( 0x ) DUP2 #003c DIV2 NIP <draw-uf2-dec>
( : ) [ LIT ": ] <draw-char>
( | seconds )
( x0 ) DUP2 #003c DIV2k MUL2 SUB2 #000a DIV2 NIP <draw-uf2-dec>
( 0x ) #000a DIV2k MUL2 SUB2 NIP !<draw-uf2-dec>
@<draw-labels> ( -- ) @<draw-labels> ( -- )
#003c .Screen/x DEO2 #003c .Screen/x DEO2
#00a9 .Screen/y DEO2 #00a9 .Screen/y DEO2
@ -152,8 +103,8 @@
;dict/min10 <draw-uf2> ;dict/min10 <draw-uf2>
#003c .Screen/x DEO2 #003c .Screen/x DEO2
#000d .Screen/y DEO2 #000d .Screen/y DEO2
;dict/min15 <draw-uf2> ;dict/min15
JMP2r ( >> )
@<draw-uf2> ( addr* -- ) @<draw-uf2> ( addr* -- )
[ LIT2 15 -Screen/auto ] DEO [ LIT2 15 -Screen/auto ] DEO
@ -162,6 +113,22 @@
INC2 LDAk ?&>while INC2 LDAk ?&>while
POP2 JMP2r POP2 JMP2r
@<draw-remains> ( -- )
#003c .Screen/x DEO2
#00f5 .Screen/y DEO2
[ LIT2 15 -Screen/auto ] DEO
.timeleft LDZ2 ORAk ?{ POP2 ;dict/min0 !<draw-uf2> }
( | minutes )
( x0 ) DUP2 #0258 DIV2 NIP DUP #00 EQU ?{
DUP [ LIT "0 ] ADD <draw-char> }
POP
( 0x ) DUP2 #003c DIV2 NIP <draw-uf2-dec>
( : ) [ LIT ": ] <draw-char>
( | seconds )
( x0 ) DUP2 #003c DIV2k MUL2 SUB2 #000a DIV2 NIP <draw-uf2-dec>
( 0x ) #000a DIV2k MUL2 SUB2 NIP
( >> )
@<draw-uf2-dec> ( -- ) @<draw-uf2-dec> ( -- )
#0a DIVk MUL SUB [ LIT "0 ] ADD #0a DIVk MUL SUB [ LIT "0 ] ADD
( >> ) ( >> )
@ -190,7 +157,7 @@
@<draw-bar> ( -- ) @<draw-bar> ( -- )
( y2 ) .Screen/height DEI2 #0010 SUB2 ( y2 ) .Screen/height DEI2 #0010 SUB2
( y1 ) #0100 .remaining-seconds LDZ2 #000f DIV2 #20 SFT2 SUB2 ( y1 ) #0100 .timeleft LDZ2 #000f DIV2 #20 SFT2 SUB2
( | paint ) ( | paint )
[ LIT2 32 -Screen/auto ] DEO [ LIT2 32 -Screen/auto ] DEO
;line-icn .Screen/addr DEO2 ;line-icn .Screen/addr DEO2
@ -218,26 +185,6 @@
.Screen/sprite DEO .Screen/sprite DEO
JMP2r JMP2r
(
@|stdlib )
@<phex> ( short* -: )
SWP /b
&b ( byte -: )
DUP #04 SFT /c
&c ( byte -: )
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO
JMP2r
@<pdec> ( short* -- )
#2710 [ LIT2r 00fb ]
&w ( -- )
DIV2k #000a DIV2k MUL2 SUB2 SWPr EQUk OVR STHkr EQU AND ?{
DUP [ LIT "0 ] ADD #19 DEO
INCr }
POP2 #000a DIV2 SWPr INCr STHkr ?&w
POP2r POP2 POP2 JMP2r
( (
@|assets ) @|assets )