commit 5f4a5b9
zzo38
·
2023-09-22 06:29:24 +0000 UTC
parent ec92775
More work on UHS viewer program (still not completed yet)
2 files changed,
+181,
-25
+1,
-1
1@@ -7,7 +7,7 @@ implement none, some, or all of them in their own emulators, as well as
2 their own extensions.
3
4 Most programs should not need these extensions, although some might be
5-able to use then optionally. (More rarely, some programs might require
6+able to use them optionally. (More rarely, some programs might require
7 one or more of these extensions, but this is generally discouraged.)
8
9
+180,
-24
1@@ -8,11 +8,13 @@
2 @Mstate $1
3 @MouseX $2
4 @MouseY $2
5+ @Type $1
6 \\ Pointers into line index
7 @Active $2
8 @Scroll $2
9 @Cursor $2
10 @Break $2
11+ @ActiveEnd $2
12 |0022
13 @Width $1
14 |0024
15@@ -87,27 +89,78 @@
16 STHrk #80 LTH [? DUPr LITr df GTHr INCr LITr 60 MULr SUBr ]@ STHk STZr
17 INC DUP
18 ]?
19- POP ;line-1
20+ POP ;lines
21 \\ This must end not before 0x0200
22 \_1@8>/[1E]
23+\\ This fall through to gonode
24
25 @gonode ( address* -- ) ( no return )
26- ( clear screen ) DUP2k EOR2 #28 DEO2k INC INC DEO2 #802e DEO
27- DUP2 .Active STZ2 DUP2 .Scroll STZ2 .Cursor STZ2
28- showtitle
29+ DUP2k .Active STZ2 #0010 ADD2 DUP2 .Scroll STZ2 .Cursor STZ2
30+ #05 ADD LDAk .Type STZ INC2 LDA2 .ActiveEnd STZ2
31 @shownode
32-
33+ cls showtitle
34+ rvoff
35+ LITr -Scroll LDZ2r #01
36+ [@
37+ #00 OVR locate
38+ ( draw cursor ) #20 STH2rk .Cursor LDZ2 EQU2 OVR SFT SUB drawch
39+ STH2rk .ActiveEnd LDZ2 NEQ2 [?
40+ printi "--End-- 00
41+ !&end
42+ ]@
43+ STH2rk .Break LDZ2 NEQ2 [?
44+ printi "--More-- 00
45+ !&end
46+ ]@
47+ STH2rk #05 ADD LDA ( type )
48+ DUP .typ/inner NEQ [?
49+ LIT2r 0008 ADD2r \\ the actual item is the next line
50+ ][
51+ LIT2 -typ/subject -Type LDZ EQU [?
52+ \\ Not a subject or nesthint block; it contains text (possibly encrypted)
53+ DUP .typ/break EQU [?
54+ STH2rk seek
55+ plaintext \\ TODO
56+ ][
57+ printi "-- 00
58+ ]@
59+ POP !&next
60+ ]@
61+ ]@
62+ \\ It is an item in a subject or nesthint block
63+ typech STH2rk seek skipline plaintext
64+ &next \\ Next item
65+ LITr 06 ADDr LDA2r
66+ INC DUP .Height LDZ LTH
67+ ]?
68+ &end
69+ \\ Scroll indicator
70+ POP2r #0000 locate
71+ .Height LDZ NEQ DUP ADD
72+ .Active LDZ2 #0010 ADD2 .Scroll LDZ2 EQU2
73+ ADD #1d ADD drawch
74 BRK
75
76+@cls ( -- )
77+ #0000 #28 DEO2k INC INC DEO2 #802e DEO JMP2r
78+
79 @seek ( node* -- )
80 STH2k LDA2 #a000 STH2rk STA2 STH2rk #02 DEO2 STH2r STA2 JMP2r
81
82 @locate ( x y -- )
83 #0005 SFT2 #2a DEO2 #0005 SFT2 #28 DEO2 JMP2r
84
85+ 85 80 81 81 82 83 84 2d 2d 84
86+@typech ( type -- )
87+ #0e SUB LDR
88+ \\ fall through
89+
90 @drawch ( char -- )
91 #0005 SFT2 ;Font ADD2 #2c DEO2 LIT2 &ink 012f DEO JMP2r
92
93+@printi ( -- )
94+ [@ LDArk STHr INC2r DUP [? POP JMP2r ]@ drawch ]!
95+
96 @rvon ( -- )
97 LIT2 04 \,drawch/ink STR JMP2r
98
99@@ -116,14 +169,18 @@
100
101 @showtitle ( -- )
102 rvon #0100 locate
103- #ff drawch \\ TODO: change it to draw the icon for the block type
104- .Active LDZ2 seek
105+ .Type LDZ typech
106+ .Active LDZ2 seek skipline
107+@plaintext ( -- )
108 [@ #ac DEI DUP #0d NEQ [? POP JMP2r ]@ drawch ]!
109
110 @error
111 [@ STH2rk INC2r LDA DUP #19 DEO #0a EOR ]?
112 #010f DEO BRK
113
114+@skipline ( -- )
115+ [@ #0aac DEI NEQ ]? JMP2r
116+
117 @isword ( char -- )
118 DUP LDArk STHr INC2r EQU [?
119 [@ LDArk STHr INC2r #0d NEQ ]? JMP2r
120@@ -143,23 +200,62 @@
121 ]@ JMP2r
122
123 @vkey
124- #92 DEI2 #28 DEO2 #94 DEI2 #2a DEO2 #402f DEO
125+ hidemouse
126+ \\ Keyboard
127
128- #82 DEI .Jstate STH2k LDZ STZr EQU ?&brk
129+ #82 DEI .Jstate STH2k LDZ STZr EQU ?brk
130+ \\ Joypad
131+ #0182 DEI EQU ?kEnter
132+ #0282 DEI EQU ?kExit
133+ #1082 DEI EQU ?kUp
134+ #2082 DEI EQU ?kDown
135
136- &brk BRK
137+ @brk BRK
138
139 @vmouse
140- .MouseX LDZ2 #28 DEO2
141- .MouseY LDZ2 #2a DEO2
142- #402f DEO
143+ hidemouse
144 #92 DEI2 DUP2 .MouseX STZ2 #28 DEO2
145 #94 DEI2 DUP2 .MouseY STZ2 #2a DEO2
146 ;mouseshape #2c DEO2 #c12f DEO
147- #96 DEI .Mstate STH2k LDZ STZr EQU ?vkey/brk
148+ #96 DEI .Mstate STH2k LDZ STZr EQU ?brk
149+ \\ If mouse button is pushed
150
151 BRK
152
153+@hidemouse ( -- )
154+ .MouseX LDZ2 #28 DEO2
155+ .MouseY LDZ2 #2a DEO2
156+ ;BlankFont #2c DEO2
157+ #412f DEO JMP2r
158+
159+@kEnter
160+ .Cursor LDZ2 .ActiveEnd LDZ2 EQU2 ?brk
161+ LIT2 -typ/subject -Type LDZ EQU [?
162+ LIT2 -typ/nesthint -Type LDZ NEQ ?brk
163+ LIT2 -typ/inner -Cursor LDZ2 #05 ADD LDA NEQ ?brk
164+ #0008
165+ ][
166+ #0000
167+ ]@
168+ .Cursor LDZ2 ADD2
169+ DUP2 #05 ADD LDA DUP .typ/blank LTH MUL [? POP2 BRK ]@
170+ !gonode
171+
172+@kExit
173+ .Active LDZ2 LDA2 !gonode
174+
175+@kUp
176+
177+ BRK
178+
179+@kDown
180+ .Cursor LDZ2 INC2 .ActiveEnd LDZ2 GTH2 ?brk
181+ .Cursor LDZ2 .Break LDZ2 EQU2 ?brk
182+ .Cursor LDZ2k
183+ LIT2 -typ/inner -Cursor LDZ2 #05 ADD LDA NEQ [? #0008 ADD2 ]@
184+ #06 ADD LDA2 ROT STZ2
185+ !shownode
186+
187 \_@2+fe'&(@2+!) \\ alignment
188 @Tkey "yke
189
190@@ -176,6 +272,16 @@
191 \=......22;
192
193 ( 1c )
194+ \-........
195+ \-.11.....
196+ \-.1111...
197+ \-.111111.
198+ \-.1111...
199+ \-.11.....
200+ \-........
201+ \-........;
202+
203+( 1d )
204 \-...1....
205 \-..1.1...
206 \-.1...1..
207@@ -185,7 +291,7 @@
208 \-..1.1...
209 \-...1....;
210
211-( 1d )
212+( 1e )
213 \-........
214 \-........
215 \-........
216@@ -195,7 +301,7 @@
217 \-..1.1...
218 \-...1....;
219
220-( 1e )
221+( 1f )
222 \-...1....
223 \-..1.1...
224 \-.1...1..
225@@ -205,17 +311,67 @@
226 \-........
227 \-........;
228
229-( 1f )
230+\_@20'8*- \@Font @BlankFont \~ascii.font
231+
232+( 80 - subject )
233 \-........
234- \-.11.....
235- \-.1111...
236- \-.111111.
237- \-.1111...
238- \-.11.....
239+ \-........
240+ \-..1111..
241+ \-..1111..
242+ \-..1111..
243+ \-..1111..
244 \-........
245 \-........;
246
247-\_@20'8*- \@Font \~ascii.font
248+( 81 - hint,nesthint )
249+ \-........
250+ \-...1....
251+ \-..111...
252+ \-.11111..
253+ \-1111111.
254+ \-.11111..
255+ \-..111...
256+ \-...1....;
257+
258+( 82 - comment )
259+ \-........
260+ \-..1111..
261+ \-.1....1.
262+ \-.1....1.
263+ \-.1....1.
264+ \-.1....1.
265+ \-..1111..
266+ \-........;
267+
268+( 83 - credit )
269+ \-........
270+ \-..1111..
271+ \-.1.1..1.
272+ \-.1..1.1.
273+ \-.1.1..1.
274+ \-.1..1.1.
275+ \-..1111..
276+ \-........;
277+
278+( 84 - link )
279+ \-........
280+ \-.1.1....
281+ \-..1.1...
282+ \-...1.1..
283+ \-.1111.1.
284+ \-...1.1..
285+ \-..1.1...
286+ \-.1.1....;
287+
288+( 85 - unknown type )
289+ \-........
290+ \-1111111.
291+ \-11...11.
292+ \-1.111.1.
293+ \-1111.11.
294+ \-111.111.
295+ \-1111111.
296+ \-111.111.;
297
298 \\ Extra records (explained below)
299 @line-1 :line-1 00 00 00 -typ/subject &final ffff
300@@ -270,7 +426,7 @@
301 #d0f0 #08 DEO2
302 #d0f2 #0a DEO2
303 #c0f1 #0c DEO2
304- #0200 #22 DEO2
305+ #0278 #22 DEO2
306 #00c8 #24 DEO2
307 #0126 DEO
308 ;vkey #80 DEO2