Browse code

Moved neralie to software

neauoire authored on 29/09/2021 03:54:03
Showing 1 changed files
1 1
similarity index 65%
2 2
rename from projects/examples/demos/neralie.tal
3 3
rename to projects/software/neralie.tal
... ...
@@ -5,15 +5,41 @@
5 5
 		- use splash screen when FPS calculation is unstable
6 6
 )
7 7
 
8
+%+  { ADD } %-   { SUB }              %/   { DIV }  
9
+%<  { LTH } %>   { GTH }  %=  { EQU } %!   { NEQ } 
10
+%++ { ADD2 } %-- { SUB2 }              %// { DIV2 } 
11
+%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }  
12
+
13
+%2*  { #10 SFT } %2/  { #01 SFT }
14
+%4*  { #20 SFT } %4/  { #02 SFT }
15
+%8*  { #30 SFT } %8/  { #03 SFT }
16
+%10* { #40 SFT } %10/ { #04 SFT }
17
+%20* { #50 SFT } %20/ { #05 SFT }
18
+
19
+%2**  { #10 SFT2 } %2//  { #01 SFT2 }
20
+%4**  { #20 SFT2 } %4//  { #02 SFT2 }
21
+%8**  { #30 SFT2 } %8//  { #03 SFT2 }
22
+%10** { #40 SFT2 } %10// { #04 SFT2 }
23
+%20** { #50 SFT2 } %20// { #05 SFT2 }
24
+
25
+%MOD  { DUP2 DIV MUL SUB }
26
+%MOD2 { DIV2k MUL2 SUB2 }
27
+%TOS { #00 SWP }
28
+
8 29
 %h { .DateTime/hour   DEI }
9 30
 %m { .DateTime/minute DEI }
10 31
 %s { .DateTime/second DEI }
11
-%8** { #30 SFT2 }
32
+
33
+%1-- { #0001 -- }
34
+
35
+%PAD { #0018 }
36
+%RTN { JMP2r }
12 37
 
13 38
 ( devices )
14 39
 
15 40
 |00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
16
-|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
41
+|10 @Console    [ &vector $2 &read     $1 &pad    $5 &write $1 &error  $1 ]
42
+|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
17 43
 |b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
18 44
 
19 45
 ( variables )
... ...
@@ -22,48 +48,62 @@
22 48
 
23 49
 @fps [ &current $1 &next $1 &second $1 ]
24 50
 @number [ &started $1 &count $1 ]
25
-@lines [ &x1 $2 &x2 $2 &y1 $2 &y2 $2 &addr $1 ]
51
+@lines [ &addr $1 ]
26 52
 @neralie [ &n0123 $2 &n4 $1 &n5 $1 &n6 $1 &n7 $1 &n8 $1 &n9 $1 &color $1 &x $2 &y $2 &w $2 &h $2 ]
27 53
 @mul [ &ahi $1 &alo $1 &bhi $1 &blo $1 ]
54
+@frame
55
+	&x1 $2 &x2 $2 &y1 $2 &y2 $2
28 56
 
29 57
 ( program )
30 58
 
31 59
 |0100
32 60
 
33
-	( theme )  #0f3d .System/r DEO2 #0fe3 .System/g DEO2 #0fb2 .System/b DEO2
34
-	( vectors )  ;on-screen .Screen/vector DEO2
61
+	( theme )  
62
+	#0f3d .System/r DEO2 
63
+	#0fe3 .System/g DEO2 
64
+	#0fb2 .System/b DEO2
65
+
66
+	( vectors )  
67
+	;on-screen .Screen/vector DEO2
68
+
69
+	( window )
70
+	#0160 .Screen/width DEO2
71
+	#0110 .Screen/height DEO2
72
+
35 73
 	#01 .fps/current STZ
36 74
 
37
-	#000c
38
-	DUP2 .lines/x1 STZ2
39
-	DUP2 .lines/y1 STZ2
40
-	DUP2 .Screen/width DEI2 SWP2 SUB2 #0001 SUB2 .lines/x2 STZ2
41
-	     .Screen/height DEI2 SWP2 SUB2 .lines/y2 STZ2
75
+	( set size )
76
+	PAD
77
+	DUP2 .frame/x1 STZ2
78
+	DUP2 .frame/y1 STZ2
79
+	DUP2 .Screen/width DEI2 SWP2 -- #0001 -- .frame/x2 STZ2
80
+	     .Screen/height DEI2 SWP2 -- .frame/y2 STZ2
42 81
 
43 82
 	#01 .neralie/color STZ
44
-	.lines/x1 LDZ2 .lines/x2 LDZ2
45
-	OVR2 OVR2 .lines/y1 LDZ2 ;h JSR2
46
-	          .lines/y2 LDZ2 ;h JSR2
47
-	.lines/y1 LDZ2 #0001 SUB2 .lines/y2 LDZ2 INC2
48
-	OVR2 OVR2 .lines/x1 LDZ2 ;v JSR2
49
-	          .lines/x2 LDZ2 ;v JSR2
50
-
51
-@on-screen
83
+
84
+	.frame/x1 LDZ2 .frame/x2 LDZ2
85
+	OVR2 OVR2 .frame/y1 LDZ2 ;h JSR2
86
+	          .frame/y2 LDZ2 ;h JSR2
87
+	.frame/y1 LDZ2 #0001 -- .frame/y2 LDZ2 INC2
88
+	OVR2 OVR2 .frame/x1 LDZ2 ;v JSR2
89
+	          .frame/x2 LDZ2 ;v JSR2
90
+
91
+@on-screen ( -> )
92
+
52 93
 	;update-fps JSR2
94
+
53 95
 	#00 .neralie/color STZ
54
-	;neralie-lines JSR2
96
+	;draw-clock JSR2
55 97
 	;neralie-calc JSR2
98
+
56 99
 	#01 .neralie/color STZ
57
-	;arvelie-text JSR2
58
-	;neralie-text JSR2
59
-	;neralie-lines JSR2
60
-	BRK
100
+	;draw-date JSR2
101
+	;draw-clock JSR2
61 102
 
62
-	#01 .Screen/sprite DEO
63
-	#0000 #00 .number/count LDZ DUP2 ;h JSR2
64
-	.number/count LDZ INC .number/count STZ
103
+BRK
65 104
 
66 105
 @neralie-calc ( -- )
106
+
67 107
 	( add up fractions of a pulse, store tenths in n6 )
68 108
 	#0120 #00 h MUL2
69 109
 	#00c0 #00 m MUL2 ADD2
... ...
@@ -82,23 +122,32 @@
82 122
 	#01a0 #00 h MUL2 ADD2
83 123
 	#0006 #00 m MUL2 ADD2 .neralie/n0123 STZ2
84 124
 
85
-	JMP2r
125
+RTN
126
+
127
+@draw-date ( -- )
128
+
129
+	( auto x ) #01 .Screen/auto DEO
86 130
 
87
-@arvelie-text ( -- )
88
-	.Screen/width DEI2 #01 SFT2 #0034 SUB2 .Screen/x DEO2
89
-	.Screen/height DEI2 #0008 SUB2 .Screen/y DEO2
90
-	.DateTime/year DEI2 #07d6 SUB2
91
-	#000a ;modf JSR2 ;digit JSR2
92
-	                 ;digit JSR2
131
+	.Screen/width DEI2 2// #0034 -- .Screen/x DEO2
132
+	.Screen/height DEI2 #0010 -- .Screen/y DEO2
133
+
134
+	( arvelie )
135
+	.DateTime/year DEI2 #07d6 -- NIP 
136
+		DUP #0a DIV TOS 8** ;font-numbers ++ .Screen/addr DEO2
137
+			#01 .Screen/sprite DEO
138
+		#0a MOD TOS 8** ;font-numbers ++ .Screen/addr DEO2
139
+			#01 .Screen/sprite DEO
93 140
 	.DateTime/doty DEI2
94
-	#000e ;modf JSR2 ,letter JSR
95
-	#000a ;modf JSR2 ,digit JSR
96
-	                 ,digit JSR
97
-	JMP2r
141
+		DUP2 #000e DIV2 8** ;font-letters ++ .Screen/addr DEO2
142
+			#01 .Screen/sprite DEO
143
+		#000e MOD2
144
+		DUP2 #000a DIV2 ,digit JSR
145
+		#000a MOD2 ,digit JSR
98 146
 
99
-@neralie-text ( -- )
100
-	.Screen/width DEI2 #01 SFT2 #0004 SUB2 .Screen/x DEO2
101
-	.neralie/n0123 LDZ2
147
+	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
148
+
149
+	( neralie )
150
+	.neralie/n0123 LDZ2 
102 151
 	#03e8 ;modf JSR2 ,digit JSR
103 152
 	#0064 ;modf JSR2 ,digit JSR
104 153
 	#000a ;modf JSR2 ,digit JSR
... ...
@@ -106,33 +155,38 @@
106 155
 	                 ,digit JSR
107 156
 	#00 .neralie/n4 LDZ  ,digit JSR
108 157
 	#00 .neralie/n5 LDZ  ,digit JSR
109
-	JMP2r
110 158
 
111
-@letter ( index* -- )
112
-	8** ;font-letters ADD2 .Screen/addr DEO2
113
-	,digit/middle JMP
159
+	( auto none ) #00 .Screen/auto DEO
160
+
161
+RTN
114 162
 
115 163
 @digit ( index* -- )
116
-	8** ;font-numbers ADD2 .Screen/addr DEO2
117
-	&middle
164
+
165
+	8** ;font-numbers ++ .Screen/addr DEO2
118 166
 	.neralie/color LDZ .Screen/sprite DEO
119
-	.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
120
-	JMP2r
167
+	
168
+RTN
121 169
 
122
-@neralie-lines ( -- )
123
-	.lines/x2 LDZ2 .lines/x1 LDZ2 DUP2 .neralie/x STZ2 SUB2 .neralie/w STZ2
124
-	.lines/y2 LDZ2 .lines/y1 LDZ2 DUP2 .neralie/y STZ2 SUB2 .neralie/h STZ2
170
+@draw-clock ( -- )
171
+
172
+	.frame/x2 LDZ2 .frame/x1 LDZ2 
173
+		DUP2 .neralie/x STZ2 SUB2 .neralie/w STZ2
174
+	.frame/y2 LDZ2 .frame/y1 LDZ2 
175
+		DUP2 .neralie/y STZ2 SUB2 .neralie/h STZ2
125 176
 
126 177
 	;neralie/n4 NIP .neralie/n0123 LDZ2
178
+
127 179
 	DUP2 ;&h JSR2
128
-	;&next JSR2 #0001 .Screen/x DEO2 .neralie/y LDZ2 #0003 SUB2 .Screen/y DEO2 ,digit JSR
180
+
181
+	;&next JSR2 #0008 .Screen/x DEO2 .neralie/y LDZ2 #0003 SUB2 .Screen/y DEO2 ,digit JSR
182
+
129 183
 	DUP2 ;&v JSR2
130 184
 	#04 ;v/spacing STA
131
-	.lines/y1 LDZ2 #0003 SUB2 .neralie/y LDZ2 .neralie/x LDZ2 ;v JSR2
185
+	.frame/y1 LDZ2 #0003 SUB2 .neralie/y LDZ2 .neralie/x LDZ2 ;v JSR2
132 186
 	#01 ;v/spacing STA
133
-	,&next JSR #0001 .Screen/y DEO2 .neralie/x LDZ2 #0003 SUB2 .Screen/x DEO2 ;digit JSR2
187
+	,&next JSR #0008 .Screen/y DEO2 .neralie/x LDZ2 #0003 SUB2 .Screen/x DEO2 ;digit JSR2
134 188
 	DUP2 ,&h JSR
135
-	,&next JSR .Screen/width DEI2 #0009 SUB2 .Screen/x DEO2 .neralie/y LDZ2 #0003 SUB2 .Screen/y DEO2 ;digit JSR2
189
+	,&next JSR .Screen/width DEI2 #0010 SUB2 .Screen/x DEO2 .neralie/y LDZ2 #0003 SUB2 .Screen/y DEO2 ;digit JSR2
136 190
 	DUP2 ,&v JSR
137 191
 	,&next JSR POP2
138 192
 	DUP2 ,&h JSR
... ...
@@ -246,15 +300,12 @@
246 300
 	JMP2r
247 301
 
248 302
 @font-numbers
249
-[
250 303
 	7cc6 ced6 e6c6 7c00 1838 1818 1818 7e00 3c66 063c 6066 7e00
251 304
 	3c66 061c 0666 3c00 1c3c 6ccc fe0c 1e00 7e62 607c 0666 3c00
252 305
 	3c66 607c 6666 3c00 7e66 060c 1818 1800 3c66 663c 6666 3c00
253 306
 	3c66 663e 0666 3c00 7cc6 ced6 e6c6 7c00 0018 1800 1818 0000
254
-]
255 307
 
256 308
 @font-letters
257
-[
258 309
 	183c 6666 7e66 6600 fc66 667c 6666 fc00 3c66 c0c0 c066 3c00
259 310
 	f86c 6666 666c f800 fe62 6878 6862 fe00 fe62 6878 6860 f000
260 311
 	3c66 c0c0 ce66 3e00 6666 667e 6666 6600 7e18 1818 1818 7e00
... ...
@@ -264,5 +315,3 @@
264 315
 	3c66 603c 0666 3c00 7e5a 1818 1818 3c00 6666 6666 6666 3c00
265 316
 	6666 6666 663c 1800 c6c6 c6d6 feee c600 c66c 3838 6cc6 c600
266 317
 	6666 663c 1818 3c00 fec6 8c18 3266 fe00 0018 187e 1818 0000
267
-]
268
-