... | ... |
@@ -1,9 +1,16 @@ |
1 | 1 |
( Dev/Time ) |
2 | 2 |
|
3 |
+%+ { ADD } %- { SUB } %/ { DIV } |
|
4 |
+%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
|
5 |
+%++ { ADD2 } %-- { SUB2 } %// { DIV2 } |
|
6 |
+%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } |
|
7 |
+ |
|
8 |
+%8* { #30 SFT } |
|
3 | 9 |
%2// { #01 SFT2 } |
4 | 10 |
%4// { #02 SFT2 } |
5 | 11 |
%2** { #10 SFT2 } |
6 | 12 |
|
13 |
+%TOS { #00 SWP } |
|
7 | 14 |
%RTN { JMP2r } |
8 | 15 |
%MOD { DUP2 DIV MUL SUB } |
9 | 16 |
%ABS2 { DUP2 #0f SFT2 EQU #05 JCN #0000 SWP2 SUB2 } |
... | ... |
@@ -12,11 +19,13 @@ |
12 | 19 |
%12HOURS { DUP #0c GTH #0c MUL SUB } |
13 | 20 |
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 } |
14 | 21 |
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 } |
22 |
+%GET-CHAR-SPRITE { 8* TOS ;font-hex ++ } |
|
15 | 23 |
|
16 | 24 |
( devices ) |
17 | 25 |
|
18 | 26 |
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |
19 |
-|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |
|
27 |
+|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ] |
|
28 |
+|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |
|
20 | 29 |
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ] |
21 | 30 |
|
22 | 31 |
( variables ) |
... | ... |
@@ -33,9 +42,12 @@ |
33 | 42 |
|0100 ( -> ) |
34 | 43 |
|
35 | 44 |
( theme ) |
36 |
- #0ff8 .System/r DEO2 |
|
37 |
- #0f08 .System/g DEO2 |
|
38 |
- #0f08 .System/b DEO2 |
|
45 |
+ #e0f8 .System/r DEO2 |
|
46 |
+ #e008 .System/g DEO2 |
|
47 |
+ #e008 .System/b DEO2 |
|
48 |
+ |
|
49 |
+ #00f0 .Screen/width DEO2 |
|
50 |
+ #00f0 .Screen/height DEO2 |
|
39 | 51 |
|
40 | 52 |
( vectors ) |
41 | 53 |
;on-frame .Screen/vector DEO2 |
... | ... |
@@ -45,25 +57,32 @@ BRK |
45 | 57 |
@on-frame ( -> ) |
46 | 58 |
|
47 | 59 |
( only draw once per second ) |
48 |
- ( skip ) .DateTime/second DEI .current LDZ NEQ #01 JCN [ BRK ] |
|
60 |
+ .DateTime/second DEI .current LDZ = ,&skip JCN |
|
61 |
+ ;draw-clock JSR2 |
|
62 |
+ ;draw-display JSR2 |
|
63 |
+ &skip |
|
49 | 64 |
|
50 | 65 |
.DateTime/second DEI .current STZ |
51 | 66 |
|
67 |
+BRK |
|
68 |
+ |
|
69 |
+@draw-clock ( -- ) |
|
70 |
+ |
|
52 | 71 |
( clear ) |
53 | 72 |
#0080 SCALEX #0080 SCALEY .needles/sx LDZ2 .needles/sy LDZ2 #00 ;draw-line JSR2 |
54 | 73 |
#0080 SCALEX #0080 SCALEY .needles/mx LDZ2 .needles/my LDZ2 #00 ;draw-line JSR2 |
55 | 74 |
#0080 SCALEX #0080 SCALEY .needles/hx LDZ2 .needles/hy LDZ2 #00 ;draw-line JSR2 |
56 | 75 |
|
57 | 76 |
( place ) |
58 |
- #00 .DateTime/second DEI 2** ;table ADD2 LDA2 |
|
59 |
- #00 SWP SCALEY .needles/sy STZ2 |
|
60 |
- #00 SWP SCALEX .needles/sx STZ2 |
|
61 |
- #00 .DateTime/minute DEI 2** ;table ADD2 LDA2 |
|
62 |
- #00 SWP 4// DUP2k ADD2 ADD2 #0020 ADD2 SCALEY .needles/my STZ2 |
|
63 |
- #00 SWP 4// DUP2k ADD2 ADD2 #0020 ADD2 SCALEX .needles/mx STZ2 |
|
64 |
- #00 .DateTime/hour DEI 12HOURS #20 SFTk NIP ADD 2** ;table ADD2 LDA2 |
|
65 |
- #00 SWP 2// #0040 ADD2 SCALEY .needles/hy STZ2 |
|
66 |
- #00 SWP 2// #0040 ADD2 SCALEX .needles/hx STZ2 |
|
77 |
+ #00 .DateTime/second DEI 2** ;table ++ LDA2 |
|
78 |
+ TOS SCALEY .needles/sy STZ2 |
|
79 |
+ TOS SCALEX .needles/sx STZ2 |
|
80 |
+ #00 .DateTime/minute DEI 2** ;table ++ LDA2 |
|
81 |
+ TOS 4// DUP2k ++ ++ #0020 ++ SCALEY .needles/my STZ2 |
|
82 |
+ TOS 4// DUP2k ++ ++ #0020 ++ SCALEX .needles/mx STZ2 |
|
83 |
+ #00 .DateTime/hour DEI 12HOURS #20 SFTk NIP ADD 2** ;table ++ LDA2 |
|
84 |
+ TOS 2// #0040 ++ SCALEY .needles/hy STZ2 |
|
85 |
+ TOS 2// #0040 ++ SCALEX .needles/hx STZ2 |
|
67 | 86 |
|
68 | 87 |
( needles ) |
69 | 88 |
#0080 SCALEX #0080 SCALEY .needles/sx LDZ2 .needles/sy LDZ2 #02 ;draw-line JSR2 |
... | ... |
@@ -73,40 +92,58 @@ BRK |
73 | 92 |
( circle ) |
74 | 93 |
#3c #00 |
75 | 94 |
&loop |
76 |
- ( load ) DUP #00 SWP 2** ;table ADD2 LDA2 |
|
95 |
+ ( load ) DUP #00 SWP 2** ;table ++ LDA2 |
|
77 | 96 |
#00 SWP SCALEY .Screen/y DEO2 |
78 | 97 |
#00 SWP SCALEX .Screen/x DEO2 |
79 | 98 |
DUP #0f MOD #00 EQU INC .Screen/pixel DEO |
80 | 99 |
INC GTHk ,&loop JCN |
81 | 100 |
POP2 |
82 | 101 |
|
83 |
- ;draw-display JSR2 |
|
84 |
- |
|
85 |
-BRK |
|
102 |
+RTN |
|
86 | 103 |
|
87 | 104 |
@draw-display ( -- ) |
88 | 105 |
|
89 |
- .Screen/height DEI2 2// #0048 ADD2 .Screen/y DEO2 |
|
90 |
- .Screen/width DEI2 2// |
|
91 |
- DUP2 #0020 SUB2 .Screen/x DEO2 |
|
92 |
- ;font-hex #00 .DateTime/hour DEI #0a DIV #30 SFT ADD2 .Screen/addr DEO2 |
|
93 |
- #02 .Screen/sprite DEO |
|
94 |
- DUP2 #0018 SUB2 .Screen/x DEO2 |
|
95 |
- ;font-hex #00 .DateTime/hour DEI #0a MOD #30 SFT ADD2 .Screen/addr DEO2 |
|
96 |
- #02 .Screen/sprite DEO |
|
97 |
- DUP2 #0008 SUB2 .Screen/x DEO2 |
|
98 |
- ;font-hex #00 .DateTime/minute DEI #0a DIV #30 SFT ADD2 .Screen/addr DEO2 |
|
99 |
- #02 .Screen/sprite DEO |
|
100 |
- DUP2 .Screen/x DEO2 |
|
101 |
- ;font-hex #00 .DateTime/minute DEI #0a MOD #30 SFT ADD2 .Screen/addr DEO2 |
|
102 |
- #02 .Screen/sprite DEO |
|
103 |
- DUP2 #0010 ADD2 .Screen/x DEO2 |
|
104 |
- ;font-hex #00 .DateTime/second DEI #0a DIV #30 SFT ADD2 .Screen/addr DEO2 |
|
105 |
- #02 .Screen/sprite DEO |
|
106 |
- DUP2 #0018 ADD2 .Screen/x DEO2 |
|
107 |
- ;font-hex #00 .DateTime/second DEI #0a MOD #30 SFT ADD2 .Screen/addr DEO2 |
|
108 |
- #02 .Screen/sprite DEO |
|
109 |
- POP2 |
|
106 |
+ ( auto x ) #01 .Screen/auto DEO |
|
107 |
+ |
|
108 |
+ ( date ) |
|
109 |
+ .Screen/height DEI2 2// #0058 -- .Screen/y DEO2 |
|
110 |
+ .Screen/width DEI2 2// #0014 -- .Screen/x DEO2 |
|
111 |
+ .DateTime/month DEI INC |
|
112 |
+ DUP #0a DIV GET-CHAR-SPRITE .Screen/addr DEO2 |
|
113 |
+ #03 .Screen/sprite DEO |
|
114 |
+ #0a MOD GET-CHAR-SPRITE .Screen/addr DEO2 |
|
115 |
+ #03 .Screen/sprite DEO |
|
116 |
+ .Screen/x DEI2 #0008 ++ .Screen/x DEO2 |
|
117 |
+ .DateTime/day DEI |
|
118 |
+ DUP #0a DIV GET-CHAR-SPRITE .Screen/addr DEO2 |
|
119 |
+ #03 .Screen/sprite DEO |
|
120 |
+ #0a MOD GET-CHAR-SPRITE .Screen/addr DEO2 |
|
121 |
+ #03 .Screen/sprite DEO |
|
122 |
+ |
|
123 |
+ ( time ) |
|
124 |
+ .Screen/height DEI2 2// #0050 ++ .Screen/y DEO2 |
|
125 |
+ .Screen/width DEI2 2// #0020 -- .Screen/x DEO2 |
|
126 |
+ .DateTime/hour DEI |
|
127 |
+ DUP #0a DIV GET-CHAR-SPRITE .Screen/addr DEO2 |
|
128 |
+ #01 .Screen/sprite DEO |
|
129 |
+ #0a MOD GET-CHAR-SPRITE .Screen/addr DEO2 |
|
130 |
+ #01 .Screen/sprite DEO |
|
131 |
+ ;spacer-icn .Screen/addr DEO2 |
|
132 |
+ .DateTime/second DEI #01 AND .Screen/sprite DEO |
|
133 |
+ .DateTime/minute DEI |
|
134 |
+ DUP #0a DIV GET-CHAR-SPRITE .Screen/addr DEO2 |
|
135 |
+ #01 .Screen/sprite DEO |
|
136 |
+ #0a MOD GET-CHAR-SPRITE .Screen/addr DEO2 |
|
137 |
+ #01 .Screen/sprite DEO |
|
138 |
+ ;spacer-icn .Screen/addr DEO2 |
|
139 |
+ .DateTime/second DEI #01 AND .Screen/sprite DEO |
|
140 |
+ .DateTime/second DEI |
|
141 |
+ DUP #0a DIV GET-CHAR-SPRITE .Screen/addr DEO2 |
|
142 |
+ #01 .Screen/sprite DEO |
|
143 |
+ #0a MOD GET-CHAR-SPRITE .Screen/addr DEO2 |
|
144 |
+ #01 .Screen/sprite DEO |
|
145 |
+ |
|
146 |
+ ( auto none ) #00 .Screen/auto DEO |
|
110 | 147 |
|
111 | 148 |
RTN |
112 | 149 |
|
... | ... |
@@ -115,9 +152,9 @@ RTN |
115 | 152 |
( load ) .color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2 |
116 | 153 |
.line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2 |
117 | 154 |
.line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2 |
118 |
- #ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ADD2 .line/sx STZ2 |
|
119 |
- #ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 2** ADD2 .line/sy STZ2 |
|
120 |
- .line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2 |
|
155 |
+ #ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ++ .line/sx STZ2 |
|
156 |
+ #ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 2** ++ .line/sy STZ2 |
|
157 |
+ .line/dx LDZ2 .line/dy LDZ2 ++ .line/e1 STZ2 |
|
121 | 158 |
&loop |
122 | 159 |
.line/x LDZ2 .Screen/x DEO2 |
123 | 160 |
.line/y LDZ2 .Screen/y DEO2 |
... | ... |
@@ -126,12 +163,12 @@ RTN |
126 | 163 |
[ .line/y LDZ2 .line/y0 LDZ2 EQU2 ] #0101 EQU2 ,&end JCN |
127 | 164 |
.line/e1 LDZ2 2** .line/e2 STZ2 |
128 | 165 |
.line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN |
129 |
- .line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2 |
|
130 |
- .line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2 |
|
166 |
+ .line/e1 LDZ2 .line/dy LDZ2 ++ .line/e1 STZ2 |
|
167 |
+ .line/x LDZ2 .line/sx LDZ2 ++ .line/x STZ2 |
|
131 | 168 |
&skipy |
132 | 169 |
.line/e2 LDZ2 .line/dx LDZ2 GTS2 ,&skipx JCN |
133 |
- .line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2 |
|
134 |
- .line/y LDZ2 .line/sy LDZ2 ADD2 .line/y STZ2 |
|
170 |
+ .line/e1 LDZ2 .line/dx LDZ2 ++ .line/e1 STZ2 |
|
171 |
+ .line/y LDZ2 .line/sy LDZ2 ++ .line/y STZ2 |
|
135 | 172 |
&skipx |
136 | 173 |
;&loop JMP2 |
137 | 174 |
&end |
... | ... |
@@ -148,6 +185,9 @@ RTN |
148 | 185 |
0658 0b4b 113f 1834 202a 2a20 3418 3f11 |
149 | 186 |
4b0b 5806 6502 7200 |
150 | 187 |
|
188 |
+@spacer-icn |
|
189 |
+ 0000 0010 0010 0000 |
|
190 |
+ |
|
151 | 191 |
@font-hex ( 0-F ) |
152 | 192 |
007c 8282 8282 827c 0030 1010 1010 1010 |
153 | 193 |
007c 8202 7c80 80fe 007c 8202 1c02 827c |