( teatimer ) |00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $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 |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 |100 @on-reset ( -> ) ( | meta ) ;meta #06 DEO2 ( | theme ) #f0f7 .System/r DEO2 #f0fc .System/g DEO2 #f0f8 .System/b DEO2 ( | vector ) ;on-frame .Screen/vector DEO2 ;on-mouse .Mouse/vector DEO2 ( | screen size ) #0148 .Screen/width DEO2 #0110 .Screen/height DEO2 BRK @on-frame-freeze ( -> ) [ LIT &lock $1 ] INCk ,&lock STR ?{ ;on-frame .Screen/vector DEO2 } BRK @on-frame ( -> ) .remaining-seconds LDZ2 ORAk ?{ POP2 BRK } [ LIT2 40 &f $1 ] INCk ,&f STR NEQ ?{ [ LIT2 00 _&f ] STR DUP2 #0001 SUB2 } POP2 BRK @on-mouse ( -> ) #4100 [ LIT2 00 -Mouse/state ] DEI NEQ #30 SFT2 ;hand-icn ADD2 .Mouse/state DEI ?{ BRK } ( | down ) .Mouse/y DEI2 #0010 SUB2 DUP2 #00f0 GTH2 ?{ DUP2 #22 SFT2 } POP2 BRK @meta 00 ( name ) "Teatime 0a ( details ) "A 20 "Countdown 20 "Timer 0a ( author ) "By 20 "Dave 20 "Van 20 "Ee 0a ( date ) "24 20 "Jul 20 "2024 $1 ( elements ) 00 ( @|core ) @ ( -- ) ;on-frame-freeze .Screen/vector DEO2 #c0 ;on-frame-freeze/lock STA JMP2r @ ( distance* -- ) #00f0 SWP2 SUB2 #02 SFT2 #001f MUL2 @ ( seconds* -- ) DUP2 .remaining-seconds LDZ2 EQU2 ?{ .remaining-seconds STZ2 ! } POP2 JMP2r ( @|drawing ) @ ( -- ) 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 @ ( -- ) #00 .Screen/auto DEO #00f1 #0000 &>l ( -- ) ( | every 5th ) DUP #03 AND ?{ DUP2 #0009 ADD2 .Screen/y DEO2 #0030 .Screen/x DEO2 DUP #02 SFT #03 AND #00 EQU #00 SWP #30 SFT2 ;mark-icn ADD2 .Screen/addr DEO2 #05 .Screen/sprite DEO } INC2 GTH2k ?&>l POP2 POP2 JMP2r @ ( -- ) ;halftone-icn .Screen/addr DEO2 ( | top ) #0010 .Screen/x DEO2 #0010 .Screen/y DEO2 [ LIT2 f1 -Screen/auto ] DEO [ LIT2 01 -Screen/sprite ] DEOk DEOk DEOk DEO ( | bottom ) #0010 .Screen/x DEO2 #0090 .Screen/y DEO2 [ LIT2 d1 -Screen/auto ] DEO [ LIT2 01 -Screen/sprite ] DEOk DEOk DEOk DEO ( >> ) @ ( -- ) ( y2 ) .Screen/height DEI2 #0010 SUB2 ( y1 ) #0100 .remaining-seconds LDZ2 #001f DIV2 #20 SFT2 SUB2 ( | paint ) [ LIT2 32 -Screen/auto ] DEO ;line-icn .Screen/addr DEO2 #0010 .Screen/x DEO2 ( | fill ) [ LIT2r 05 -Screen/sprite ] &>l ( -- ) DUP2 .Screen/y DEO2 DEOkr INC2 GTH2k ?&>l POP2 POP2 POP2r JMP2r @ ( color addr* -- ) [ LIT2 00 -Screen/auto ] DEO ;fill-icn .Screen/addr DEO2 #40 .Screen/addr DEO2 .Mouse/x DEI2 ,/x STR2 .Mouse/y DEI2 ,/y STR2 ( >> ) @ ( color -- ) [ LIT2 &x $2 ] .Screen/x DEO2 [ LIT2 &y $2 ] .Screen/y DEO2 .Screen/sprite DEO JMP2r ( @|stdlib ) @ ( 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 ( @|assets ) ~assets.tal