... | ... |
@@ -19,7 +19,7 @@ |
19 | 19 |
%ABS2 { DUP2 #0f SFT2 EQU #05 JCN #0000 SWP2 -- } |
20 | 20 |
%SCALEX { 2// .center/x LDZ2 ++ RADIUS -- } |
21 | 21 |
%SCALEY { 2// .center/y LDZ2 ++ RADIUS -- } |
22 |
-%12HOURS { DUP #0c GTH #0c MUL SUB } |
|
22 |
+%12HOURS { #0c MOD } |
|
23 | 23 |
%LTS2 { #8000 ++ SWP2 #8000 ++ GTH2 } |
24 | 24 |
%GTS2 { #8000 ++ SWP2 #8000 ++ LTH2 } |
25 | 25 |
%GET-CHAR-SPRITE { 8* TOS ;font-hex ++ } |
... | ... |
@@ -35,14 +35,13 @@ |
35 | 35 |
|
36 | 36 |
|0000 |
37 | 37 |
|
38 |
-@color $1 |
|
39 | 38 |
@current $1 |
40 | 39 |
@center |
41 | 40 |
&x $2 &y $2 |
42 | 41 |
@needles |
43 | 42 |
&hx $2 &hy $2 &mx $2 &my $2 &sx $2 &sy $2 |
44 | 43 |
@line |
45 |
- &x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2 &dx $2 &dy $2 &e1 $2 &e2 $2 |
|
44 |
+ &x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2 &dx $2 &dy $2 &e1 $2 &e2 $2 &color $1 |
|
46 | 45 |
|
47 | 46 |
( program ) |
48 | 47 |
|
... | ... |
@@ -53,6 +52,7 @@ |
53 | 52 |
#0f08 .System/g DEO2 |
54 | 53 |
#0f08 .System/b DEO2 |
55 | 54 |
|
55 |
+ ( resize ) |
|
56 | 56 |
#00f0 .Screen/width DEO2 |
57 | 57 |
#0120 .Screen/height DEO2 |
58 | 58 |
|
... | ... |
@@ -63,13 +63,25 @@ |
63 | 63 |
.Screen/width DEI2 2// .center/x STZ2 |
64 | 64 |
.Screen/height DEI2 2// .center/y STZ2 |
65 | 65 |
|
66 |
+ ( circle ) |
|
67 |
+ #3c00 |
|
68 |
+ &loop |
|
69 |
+ ( load ) DUP TOS 2** ;table ++ LDA2 |
|
70 |
+ TOS #0010 ** #001c // .center/x LDZ2 ++ #0049 -- .Screen/x DEO2 |
|
71 |
+ TOS #0010 ** #001c // .center/y LDZ2 ++ #0049 -- .Screen/y DEO2 |
|
72 |
+ DUP #0f MOD #00 EQU INC .Screen/pixel DEO |
|
73 |
+ INC GTHk ,&loop JCN |
|
74 |
+ POP2 |
|
75 |
+ |
|
66 | 76 |
BRK |
67 | 77 |
|
68 | 78 |
@on-frame ( -> ) |
69 | 79 |
|
70 | 80 |
( only draw once per second ) |
71 | 81 |
.DateTime/second DEI .current LDZ = ,&skip JCN |
72 |
- ;draw-clock JSR2 |
|
82 |
+ ( clear ) #00 ,draw-needles JSR |
|
83 |
+ ( update ) ,update-needles JSR |
|
84 |
+ ( draw ) #01 ,draw-needles JSR |
|
73 | 85 |
;draw-display JSR2 |
74 | 86 |
&skip |
75 | 87 |
|
... | ... |
@@ -77,40 +89,26 @@ BRK |
77 | 89 |
|
78 | 90 |
BRK |
79 | 91 |
|
80 |
-@draw-clock ( -- ) |
|
92 |
+@draw-needles ( mul -- ) |
|
93 |
+ |
|
94 |
+ STH |
|
95 |
+ .center/x LDZ2 .center/y LDZ2 .needles/sx LDZ2 .needles/sy LDZ2 #02 STHkr * ;draw-line JSR2 |
|
96 |
+ .center/x LDZ2 .center/y LDZ2 .needles/mx LDZ2 .needles/my LDZ2 #01 STHkr * ;draw-line JSR2 |
|
97 |
+ .center/x LDZ2 .center/y LDZ2 .needles/hx LDZ2 .needles/hy LDZ2 #01 STHr * ;draw-line JSR2 |
|
98 |
+ |
|
99 |
+RTN |
|
81 | 100 |
|
82 |
- ( clear ) #00 ;draw-needles JSR2 |
|
101 |
+@update-needles ( -- ) |
|
83 | 102 |
|
84 | 103 |
#00 .DateTime/second DEI 2** ;table ++ LDA2 |
85 | 104 |
TOS SCALEY .needles/sy STZ2 |
86 | 105 |
TOS SCALEX .needles/sx STZ2 |
87 | 106 |
#00 .DateTime/minute DEI 2** ;table ++ LDA2 |
88 |
- TOS 4// DUP2k ++ ++ #0020 ++ SCALEY .needles/my STZ2 |
|
89 |
- TOS 4// DUP2k ++ ++ #0020 ++ SCALEX .needles/mx STZ2 |
|
107 |
+ TOS #0020 ** RADIUS ++ #0024 // SCALEY #0007 ++ .needles/my STZ2 |
|
108 |
+ TOS #0020 ** RADIUS ++ #0024 // SCALEX #0007 ++ .needles/mx STZ2 |
|
90 | 109 |
#00 .DateTime/hour DEI 12HOURS #20 SFTk NIP ADD 2** ;table ++ LDA2 |
91 |
- TOS 2// RADIUS ++ SCALEY .needles/hy STZ2 |
|
92 |
- TOS 2// RADIUS ++ SCALEX .needles/hx STZ2 |
|
93 |
- |
|
94 |
- ( draw ) #01 ;draw-needles JSR2 |
|
95 |
- |
|
96 |
- ( circle ) |
|
97 |
- #3c #00 |
|
98 |
- &loop |
|
99 |
- ( load ) DUP TOS 2** ;table ++ LDA2 |
|
100 |
- TOS SCALEY .Screen/y DEO2 |
|
101 |
- TOS SCALEX .Screen/x DEO2 |
|
102 |
- DUP #0f MOD #00 EQU INC .Screen/pixel DEO |
|
103 |
- INC GTHk ,&loop JCN |
|
104 |
- POP2 |
|
105 |
- |
|
106 |
-RTN |
|
107 |
- |
|
108 |
-@draw-needles ( mul -- ) |
|
109 |
- |
|
110 |
- STH |
|
111 |
- .center/x LDZ2 .center/y LDZ2 .needles/sx LDZ2 .needles/sy LDZ2 #02 STHkr * ;draw-line JSR2 |
|
112 |
- .center/x LDZ2 .center/y LDZ2 .needles/mx LDZ2 .needles/my LDZ2 #01 STHkr * ;draw-line JSR2 |
|
113 |
- .center/x LDZ2 .center/y LDZ2 .needles/hx LDZ2 .needles/hy LDZ2 #01 STHr * ;draw-line JSR2 |
|
110 |
+ TOS 4// DUP2k ++ ++ #0020 ++ SCALEY .needles/hy STZ2 |
|
111 |
+ TOS 4// DUP2k ++ ++ #0020 ++ SCALEX .needles/hx STZ2 |
|
114 | 112 |
|
115 | 113 |
RTN |
116 | 114 |
|
... | ... |
@@ -119,7 +117,7 @@ RTN |
119 | 117 |
( auto x ) #01 .Screen/auto DEO |
120 | 118 |
|
121 | 119 |
( date ) |
122 |
- .center/y LDZ2 #0058 -- .Screen/y DEO2 |
|
120 |
+ .center/y LDZ2 #0068 -- .Screen/y DEO2 |
|
123 | 121 |
.center/x LDZ2 #0014 -- .Screen/x DEO2 |
124 | 122 |
.DateTime/month DEI INC |
125 | 123 |
DUP #0a DIV GET-CHAR-SPRITE .Screen/addr DEO2 |
... | ... |
@@ -134,7 +132,7 @@ RTN |
134 | 132 |
#03 .Screen/sprite DEO |
135 | 133 |
|
136 | 134 |
( time ) |
137 |
- .center/y LDZ2 #0050 ++ .Screen/y DEO2 |
|
135 |
+ .center/y LDZ2 #0060 ++ .Screen/y DEO2 |
|
138 | 136 |
.center/x LDZ2 #0020 -- .Screen/x DEO2 |
139 | 137 |
.DateTime/hour DEI |
140 | 138 |
DUP #0a DIV GET-CHAR-SPRITE .Screen/addr DEO2 |
... | ... |
@@ -162,7 +160,7 @@ RTN |
162 | 160 |
|
163 | 161 |
@draw-line ( x1 y1 x2 y2 color -- ) |
164 | 162 |
|
165 |
- ( load ) .color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2 |
|
163 |
+ ( load ) .line/color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2 |
|
166 | 164 |
.line/x0 LDZ2 .line/x LDZ2 -- ABS2 .line/dx STZ2 |
167 | 165 |
.line/y0 LDZ2 .line/y LDZ2 -- ABS2 #0000 SWP2 -- .line/dy STZ2 |
168 | 166 |
#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ++ .line/sx STZ2 |
... | ... |
@@ -171,7 +169,7 @@ RTN |
171 | 169 |
&loop |
172 | 170 |
.line/x LDZ2 .Screen/x DEO2 |
173 | 171 |
.line/y LDZ2 .Screen/y DEO2 |
174 |
- .color LDZ .Screen/pixel DEO |
|
172 |
+ .line/color LDZ .Screen/pixel DEO |
|
175 | 173 |
[ .line/x LDZ2 .line/x0 LDZ2 == ] |
176 | 174 |
[ .line/y LDZ2 .line/y0 LDZ2 == ] AND ,&end JCN |
177 | 175 |
.line/e1 LDZ2 2** .line/e2 STZ2 |