comparison clojure/com/aurellem/run/adv_choreo.clj @ 582:393b49a83394

tracked down error to set=HL-from-row-and-column
author Robert McIntyre <rlm@mit.edu>
date Sat, 01 Sep 2012 09:43:19 -0500
parents 5f09601abe8c
children 21e4ab461506
comparison
equal deleted inserted replaced
581:5f09601abe8c 582:393b49a83394
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 2 137 4
138 0 0 ;; current row and column 138 0 0 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
226 ;; ;; every time row (D) reaches 18, set row to 0 226 ;; ;; every time row (D) reaches 18, set row to 0
227 ;; 0x3E 18 0xBA ;; compare D to 18 227 ;; 0x3E 18 0xBA ;; compare D to 18
228 ;; 0x20 ;; if D is 18 228 ;; 0x20 ;; if D is 18
229 ;; 2 229 ;; 2
230 ;; 0x16 0 230 ;; 0x16 0
231 ] ;; set D to zero 231 ;; set D to zero
232 ]
232 233
233 set-HL-from-row-and-column 234 set-HL-from-row-and-column
234 (flatten 235 (flatten
235 [;; formula for memory offset is: 236 [;; formula for memory offset is:
236 ;; (+ 0x9800 (* 32 row) column) == 237 ;; (+ 0x9800 (* 32 row) column) ==
312 (concat init clear-screen render-glyph)) 313 (concat init clear-screen render-glyph))
313 314
314 cleanup 315 cleanup
315 ;; restore all registers 316 ;; restore all registers
316 (flatten 317 (flatten
317 [;; Reset HL to initial value 318 [;; Reset HL to initial data-start value
319 0x44 0x4D ;;HL -> BC
320
318 0x21 321 0x21
319 (reverse (disect-bytes-2 data-start)) 322 (reverse (disect-bytes-2 data-start))
320 ;;0x23 323 ;;0x23
324 ;; write variables
321 0x7A 0x22 ;; D -> rows -> to RAM 325 0x7A 0x22 ;; D -> rows -> to RAM
322 0x7B 0x22 ;; E -> columns 326 0x7B 0x22 ;; E -> columns
327
328 0x78 0x22 ;; RLM: testing store HL
329 0x79 0x22
330
331
323 ]) 332 ])
324 333
325 stack-cleanup 334 stack-cleanup
326 [0xF1 0xE1 0xD1 0xC1] 335 [0xF1 0xE1 0xD1 0xC1]
327 ] 336 ]