296 lines
8.3 KiB
Tal
296 lines
8.3 KiB
Tal
( Dev/Time )
|
|
|
|
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
|
|
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
|
|
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
|
|
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
|
|
|
|
%4* { #20 SFT }
|
|
%10* { #40 SFT }
|
|
%2** { #10 SFT2 } %2// { #01 SFT2 }
|
|
%4// { #02 SFT2 }
|
|
%10** { #40 SFT2 }
|
|
%20** { #50 SFT2 }
|
|
|
|
%TOS { #00 SWP }
|
|
%RTN { JMP2r }
|
|
%MOD { DUP2 DIV MUL SUB }
|
|
%ABS2 { DUP2 #0f SFT2 EQU #05 JCN #0000 SWP2 -- }
|
|
%LTS2 { #8000 ++ SWP2 #8000 ++ GTH2 }
|
|
%GTS2 { #8000 ++ SWP2 #8000 ++ LTH2 }
|
|
|
|
%RADIUS { #0040 }
|
|
%SCALEX { 2// .center/x LDZ2 ++ RADIUS -- }
|
|
%SCALEY { 2// .center/y LDZ2 ++ RADIUS -- }
|
|
%12HOURS { #0c MOD }
|
|
|
|
( devices )
|
|
|
|
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|
|
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|
|
|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|
|
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
|
|
|
|
( variables )
|
|
|
|
|0000
|
|
|
|
@current $1
|
|
@center
|
|
&x $2 &y $2
|
|
@needles
|
|
&hx $2 &hy $2 &mx $2 &my $2 &sx $2 &sy $2
|
|
@line
|
|
&x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2 &dx $2 &dy $2 &e1 $2 &e2 $2 &color $1
|
|
|
|
( program )
|
|
|
|
|0100 ( -> )
|
|
|
|
( theme )
|
|
#0ff8 .System/r DEO2
|
|
#0f08 .System/g DEO2
|
|
#0f08 .System/b DEO2
|
|
|
|
( resize )
|
|
#00f0 .Screen/width DEO2
|
|
#0120 .Screen/height DEO2
|
|
|
|
( vectors )
|
|
;on-frame .Screen/vector DEO2
|
|
|
|
( center )
|
|
.Screen/width DEI2 2// .center/x STZ2
|
|
.Screen/height DEI2 2// .center/y STZ2
|
|
|
|
( circle )
|
|
#3c00
|
|
&loop
|
|
( load ) DUP TOS 2** ;table ++ LDA2
|
|
TOS #0010 ** #001c // .center/x LDZ2 ++ #0049 -- .Screen/x DEO2
|
|
TOS #0010 ** #001c // .center/y LDZ2 ++ #0049 -- .Screen/y DEO2
|
|
DUP #0f MOD #00 EQU INC .Screen/pixel DEO
|
|
INC GTHk ,&loop JCN
|
|
POP2
|
|
|
|
( continue )
|
|
|
|
@on-frame ( -> )
|
|
|
|
( only draw once per second )
|
|
.DateTime/second DEI .current LDZ = ,&skip JCN
|
|
( clear ) #00 ,draw-needles JSR
|
|
( update ) ,update-needles JSR
|
|
( draw ) #01 ,draw-needles JSR
|
|
;draw-display JSR2
|
|
&skip
|
|
|
|
.DateTime/second DEI .current STZ
|
|
|
|
BRK
|
|
|
|
@draw-needles ( mul -- )
|
|
|
|
STH
|
|
.center/x LDZ2 .center/y LDZ2
|
|
OVR2 OVR2
|
|
OVR2 OVR2
|
|
.needles/sx LDZ2 .needles/sy LDZ2 #02 STHkr * ;draw-line JSR2
|
|
.needles/mx LDZ2 .needles/my LDZ2 #01 STHkr * ;draw-line JSR2
|
|
.needles/hx LDZ2 .needles/hy LDZ2 #01 STHr * ;draw-line JSR2
|
|
|
|
RTN
|
|
|
|
@update-needles ( -- )
|
|
|
|
#00 .DateTime/second DEI 2** ;table ++ LDA2
|
|
TOS SCALEY .needles/sy STZ2
|
|
TOS SCALEX .needles/sx STZ2
|
|
#00 .DateTime/minute DEI 2** ;table ++ LDA2
|
|
TOS 20** RADIUS ++ #0024 // SCALEY #0007 ++ .needles/my STZ2
|
|
TOS 20** RADIUS ++ #0024 // SCALEX #0007 ++ .needles/mx STZ2
|
|
#00 .DateTime/hour DEI 12HOURS #20 SFTk NIP ADD 2** ;table ++ LDA2
|
|
TOS 4// DUP2k ++ ++ #0020 ++ SCALEY .needles/hy STZ2
|
|
TOS 4// DUP2k ++ ++ #0020 ++ SCALEX .needles/hx STZ2
|
|
|
|
RTN
|
|
|
|
@draw-display ( -- )
|
|
|
|
( auto addr ) #04 .Screen/auto DEO
|
|
|
|
( dotw )
|
|
.center/y LDZ2 #0068 -- .Screen/y DEO2
|
|
.center/x LDZ2 #0048 -- .Screen/x DEO2
|
|
.DateTime/dotw DEI 4* TOS ;dotw ++ ;draw-dotw JSR2
|
|
( date )
|
|
.center/x LDZ2 #0014 -- .Screen/x DEO2
|
|
.DateTime/month DEI2
|
|
SWP INC ,&number JSR
|
|
;font/slash ,&char JSR
|
|
,&number JSR
|
|
( time )
|
|
.center/y LDZ2 #0060 ++ .Screen/y DEO2
|
|
.center/x LDZ2 #0020 -- .Screen/x DEO2
|
|
.DateTime/hour DEI2
|
|
SWP ,&number JSR
|
|
;font/spacer ,&char JSR
|
|
,&number JSR
|
|
;font/spacer ,&char JSR
|
|
.DateTime/second DEI
|
|
,&number JSR
|
|
|
|
( auto none ) #00 .Screen/auto DEO
|
|
|
|
RTN
|
|
&pady ( -- )
|
|
.Screen/y DEI2 #0008 ++ .Screen/y DEO2 RTN
|
|
&char ( char* -- )
|
|
.Screen/addr DEO2
|
|
#03 .Screen/sprite DEO
|
|
,&pady JSR
|
|
#03 .Screen/sprite DEO
|
|
,&reset JSR
|
|
RTN
|
|
&number ( number -- )
|
|
DUP #0a DIV [ 10* TOS ;font ++ ] .Screen/addr DEO2
|
|
#03 .Screen/sprite DEO
|
|
,&pady JSR
|
|
#03 .Screen/sprite DEO
|
|
,&reset JSR
|
|
#0a MOD [ 10* TOS ;font ++ ] .Screen/addr DEO2
|
|
#03 .Screen/sprite DEO
|
|
,&pady JSR
|
|
#03 .Screen/sprite DEO
|
|
&reset
|
|
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
|
|
.Screen/y DEI2 #0008 -- .Screen/y DEO2
|
|
RTN
|
|
|
|
@draw-dotw ( str* -- )
|
|
|
|
DUP2 #0003 ++ SWP2
|
|
&loop
|
|
LDAk #41 - TOS 10** ;font/letters ++ ;draw-display/char JSR2
|
|
INC2 GTH2k ,&loop JCN
|
|
POP2 POP2
|
|
|
|
RTN
|
|
|
|
@draw-line ( x1 y1 x2 y2 color -- )
|
|
|
|
( load ) .line/color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2
|
|
.line/x0 LDZ2 .line/x LDZ2 -- ABS2 .line/dx STZ2
|
|
.line/y0 LDZ2 .line/y LDZ2 -- ABS2 #0000 SWP2 -- .line/dy STZ2
|
|
#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ++ .line/sx STZ2
|
|
#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 2** ++ .line/sy STZ2
|
|
.line/dx LDZ2 .line/dy LDZ2 ++ .line/e1 STZ2
|
|
&loop
|
|
.line/x LDZ2 .Screen/x DEO2
|
|
.line/y LDZ2 .Screen/y DEO2
|
|
.line/color LDZ .Screen/pixel DEO
|
|
[ .line/x LDZ2 .line/x0 LDZ2 == ]
|
|
[ .line/y LDZ2 .line/y0 LDZ2 == ] AND ,&end JCN
|
|
.line/e1 LDZ2 2** .line/e2 STZ2
|
|
.line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
|
|
.line/e1 LDZ2 .line/dy LDZ2 ++ .line/e1 STZ2
|
|
.line/x LDZ2 .line/sx LDZ2 ++ .line/x STZ2
|
|
&skipy
|
|
.line/e2 LDZ2 .line/dx LDZ2 GTS2 ,&skipx JCN
|
|
.line/e1 LDZ2 .line/dx LDZ2 ++ .line/e1 STZ2
|
|
.line/y LDZ2 .line/sy LDZ2 ++ .line/y STZ2
|
|
&skipx
|
|
;&loop JMP2
|
|
&end
|
|
|
|
RTN
|
|
|
|
@dotw
|
|
"Sun $1 "Mon $1 "Tue $1 "Wed $1 "Thu $1 "Fri $1 "Sat $1
|
|
|
|
@table ( 60 positions on a circle )
|
|
8000 8d00 9a02 a706 b40b c011 cb18 d520
|
|
df2a e734 ee40 f44b f958 fd65 ff72 ff80
|
|
ff8d fd9a f9a7 f4b4 eec0 e7cb dfd5 d5df
|
|
cbe7 c0ee b4f4 a7f9 9afd 8dff 80ff 72ff
|
|
65fd 58f9 4bf4 40ee 34e7 2adf 20d5 18cb
|
|
11c0 0bb4 06a7 029a 008d 0080 0072 0265
|
|
0658 0b4b 113f 1834 202a 2a20 3418 3f11
|
|
4b0b 5806 6502 7200
|
|
|
|
@font
|
|
0018 2442 4242 4242 4242 4242 4224 1800
|
|
0008 1828 0808 0808 0808 0808 0808 1c00
|
|
0018 2442 4202 0202 0408 1020 4040 7e00
|
|
0018 2442 0202 0438 0402 0202 0204 7800
|
|
000c 0c14 1414 2424 2444 447e 0404 0e00
|
|
007e 4040 4040 5864 4202 0202 0204 7800
|
|
000c 1020 4040 5864 4242 4242 4224 1800
|
|
007e 4202 0204 0404 0808 0810 1010 1000
|
|
0018 2442 4242 2418 2442 4242 4224 1800
|
|
0018 2442 4242 4242 261a 0202 0408 3000
|
|
&spacer
|
|
0000 0000 0010 1000 0000 0000 1010 0000
|
|
&slash
|
|
0202 0404 0808 1010 2020 4040 8080 0000
|
|
&letters
|
|
0010 1028 2844 4444 8282 fe82 8282 0000
|
|
00f8 4442 4242 4478 4442 4242 44f8 0000
|
|
003c 4282 8280 8080 8080 8282 423c 0000
|
|
00f8 4442 4242 4242 4242 4242 44f8 0000
|
|
00fc 4240 4040 4878 4840 4040 42fc 0000
|
|
80fe 4240 4040 447c 4440 4040 40e0 0000
|
|
003a 4682 8080 8e82 8282 8282 463a 0000
|
|
00ee 4444 4444 447c 4444 4444 44ee 0000
|
|
0038 1010 1010 1010 1010 1010 1038 0000
|
|
000e 0404 0404 0404 0404 4444 2810 0000
|
|
00ee 4448 4850 5060 5050 4848 44ee 0000
|
|
00e0 4040 4040 4040 4040 4040 42fe 0000
|
|
0082 c6c6 c6aa aaaa 9292 9282 8282 0000
|
|
00e2 4262 6262 5252 4a4a 4646 42e2 0000
|
|
0038 4482 8282 8282 8282 8282 4438 0000
|
|
00f8 4442 4242 4244 7840 4040 40f0 0000
|
|
0038 4482 8282 8282 8282 829a 643a 0000
|
|
00f8 4442 4242 4478 4844 4442 42e2 0000
|
|
0010 2844 4440 2010 0804 4444 2810 0000
|
|
00fe 9210 1010 1010 1010 1010 1038 0000
|
|
00ee 4444 4444 4444 4444 4444 4438 0000
|
|
0082 8282 8282 8244 4444 2828 1010 0000
|
|
0082 8292 9292 9292 92ba aa44 4444 0000
|
|
0042 4242 2424 1818 1824 2442 4242 0000
|
|
0082 8282 4444 2828 1010 1010 1038 0000
|
|
007e 4204 0408 0810 1020 2040 427e 0000
|
|
0e08 0808 0808 0808 0808 0808 0808 080e
|
|
0082 8282 4444 fe28 10fe 1010 1010 1000
|
|
7010 1010 1010 1010 1010 1010 1010 1070
|
|
1028 4400 0000 0000 0000 0000 0000 0000
|
|
0000 0000 0000 0000 0000 0000 0000 00fe
|
|
1010 1008 0000 0000 0000 0000 0000 0000
|
|
0000 0000 0030 0808 3848 4848 4834 0000
|
|
0060 2020 202c 3222 2222 2222 322c 0000
|
|
0000 0000 001c 2240 4040 4040 221c 0000
|
|
000c 0404 0434 4c44 4444 4444 4c36 0000
|
|
0000 0000 0018 2424 3c20 2020 2418 0000
|
|
000c 1210 1038 1010 1010 1010 1038 0000
|
|
0000 0000 0034 4a48 4830 4038 4444 4438
|
|
00c0 4040 4058 6444 4444 4444 44ee 0000
|
|
0010 0000 0030 1010 1010 1010 1038 0000
|
|
0008 0000 0018 0808 0808 0808 0808 2810
|
|
0060 2020 2022 2224 2438 2424 2272 0000
|
|
0030 1010 1010 1010 1010 1010 1038 0000
|
|
0000 0000 00a4 da92 9292 9292 9292 0000
|
|
0000 0000 00d8 6444 4444 4444 44ee 0000
|
|
0000 0000 0038 4482 8282 8282 4438 0000
|
|
0000 0000 00d8 6442 4242 4242 6458 40e0
|
|
0000 0000 0034 4c84 8484 8484 4c34 040e
|
|
0000 0000 0068 3420 2020 2020 2070 0000
|
|
0000 0000 0018 2424 1008 0424 2418 0000
|
|
0010 1010 107c 1010 1010 1010 1408 0000
|
|
0000 0000 00cc 4444 4444 4444 4c36 0000
|
|
0000 0000 00ee 4444 4428 2828 1010 0000
|
|
0000 0000 0092 9292 9292 92aa 4444 0000
|
|
0000 0000 00ee 4428 1010 1028 44ee 0000
|
|
0000 0000 00ee 4444 4448 2828 1010 2040
|
|
0000 0000 007c 4408 0810 2020 447c 0000
|
|
|