comparison clojure/com/aurellem/run/adv_choreo.clj @ 584:bbed03870072

cosmetic improvements revealed glitch in clear-screen.
author Robert McIntyre <rlm@mit.edu>
date Sat, 01 Sep 2012 10:02:25 -0500
parents 21e4ab461506
children 9159187bbf26
comparison
equal deleted inserted replaced
583:21e4ab461506 584:bbed03870072
132 (let [data-start (+ 2 start-address) 132 (let [data-start (+ 2 start-address)
133 load-data 133 load-data
134 (flatten 134 (flatten
135 [;; data region 135 [;; data region
136 0x18 136 0x18
137 4 137 2
138 0 0 0 0;; current row and column 138 0 0;; current row and column
139 ;; save all registers 139 ;; save all registers
140 0xC5 0xD5 0xE5 0xF5 140 0xC5 0xD5 0xE5 0xF5
141 141
142 ;; load data from data region into registers 142 ;; load data from data region into registers
143 143
177 177
178 178
179 0x16 3 ;; 3 -> D 179 0x16 3 ;; 3 -> D
180 0x1E 190 ;; 188 -> E 180 0x1E 190 ;; 188 -> E
181 181
182 0x3E 0 ;; 0-> A 182 ;; Empty space Character ID
183 0x3E 16 ;; 0-> A
183 184
184 ;; begin of do-while loop 185 ;; begin of do-while loop
185 0x22 ;; load 0 to 0x9800 186 0x22 ;; load A to 0x9800
186 0x1D ;; dec E 187 0x1D ;; dec E
187 0x20 188 0x20
188 (->signed-8-bit -4) 189 (->signed-8-bit -4)
189 0x15 ;; dec D 190 0x15 ;; dec D
190 0x1E 190 ;; 188 -> E 191 0x1E 190 ;; 188 -> E
193 ;; end of do-while-loop 194 ;; end of do-while-loop
194 195
195 ;; restore all registers 196 ;; restore all registers
196 0xF1 0xE1 0xD1 0xC1]) 197 0xF1 0xE1 0xD1 0xC1])
197 198
198 ;; RLM: for TESTING ONLY!!! 199
199 clear-screen (repeat 10 0)
200 increment-row-column 200 increment-row-column
201 [;; D contains row and E contains column 201 [;; D contains row and E contains column
202 202
203 ;; every time column (E) reaches 20, set 203 ;; every time column (E) reaches 20, set
204 ;; column to 0 and increment row 204 ;; column to 0 and increment row
239 0xD5 ;; push DE 239 0xD5 ;; push DE
240 240
241 ;; RLM: this should be 0x9800, investigate 241 ;; RLM: this should be 0x9800, investigate
242 0x21 0x00 0x98 ;; load HL with something 242 0x21 0x00 0x98 ;; load HL with something
243 243
244 ;;0x06 0 244 0x06 0
245 ;;0x4B ;; columns (E) -> BC 245 0x4B ;; columns (E) -> BC
246 ;;0x09 ;; HL += columns 246 0x09 ;; HL += columns
247 247
248 248
249 0xAF ;; 0 -> A 249 0xAF ;; 0 -> A
250 250
251 0x06 0 251 0x06 0
276 276
277 render-glyph 277 render-glyph
278 (flatten 278 (flatten
279 [;; Render each nybble of A as a character 279 [;; Render each nybble of A as a character
280 ;; there are two characters to a glyph. 280 ;; there are two characters to a glyph.
281
281 0x21 282 0x21
282 (reverse (disect-bytes-2 data-start)) 283 (reverse (disect-bytes-2 data-start))
283 ;; load row and column into DE 284 ;; load row and column into DE
284 0x2A 0x57 ;; row -> D 285 0x2A 0x57 ;; row -> D
285 0x2A 0x5F ;; column -> E 286 0x2A 0x5F ;; column -> E
286 287
287 288
288 set-HL-from-row-and-column 289 set-HL-from-row-and-column
289 290
290 0xF1 ;; pop A, now A is equal to key input 291 0xF1 ;; pop A, now A is equal to key input
291 0x3E 0xFF ;; RLM: TESTING set A = 0xFF
292 0xF5 ;; save A 292 0xF5 ;; save A
293 293
294 0xE6 0xF0 ;; clear second nybble 294 0xE6 0xF0 ;; clear second nybble
295 0xCB 0x37 ;; swap nybbles 295 0xCB 0x37 ;; swap nybbles
296 0x77 ;; store A in video RAM as a character (pun) 296 0x77 ;; store A in video RAM as a character (pun)
314 314
315 cleanup 315 cleanup
316 ;; restore all registers 316 ;; restore all registers
317 (flatten 317 (flatten
318 [;; Reset HL to initial data-start value 318 [;; Reset HL to initial data-start value
319 0x44 0x4D ;;HL -> BC
320
321 0x21 319 0x21
322 (reverse (disect-bytes-2 data-start)) 320 (reverse (disect-bytes-2 data-start))
323 ;;0x23 321 ;;0x23
324 ;; write variables 322 ;; write variables
325 0x7A 0x22 ;; D -> rows -> to RAM 323 0x7A 0x22 ;; D -> rows -> to RAM
326 0x7B 0x22 ;; E -> columns 324 0x7B 0x22 ;; E -> columns
327
328 0x78 0x22 ;; RLM: testing store HL
329 0x79 0x22
330
331
332 ]) 325 ])
333 326
334 stack-cleanup 327 stack-cleanup
335 [0xF1 0xE1 0xD1 0xC1] 328 [0xF1 0xE1 0xD1 0xC1]
336 ] 329 ]