comparison clojure/com/aurellem/run/adv_choreo.clj @ 559:91e99cc36bda

problem was improper value for starting position in memory for glyph-display-program.
author Robert McIntyre <rlm@mit.edu>
date Fri, 31 Aug 2012 04:58:15 -0500
parents 6f8b15c2fb48
children 3194a4f438ca
comparison
equal deleted inserted replaced
558:6f8b15c2fb48 559:91e99cc36bda
167 [start-address 167 [start-address
168 monitor-address 168 monitor-address
169 delay-count 169 delay-count
170 total-glyph-count] 170 total-glyph-count]
171 (let [data-start (+ 2 start-address) 171 (let [data-start (+ 2 start-address)
172 monitor-address-high (+ 0 data-start)
173 monitor-address-low (+ 1 data-start)
174
175 glyph-count-high (+ 2 data-start)
176 glyph-count-low (+ 3 data-start)
177
178 delay-address (+ 4 data-start)
179
180 load-data 172 load-data
181 (flatten 173 (flatten
182 [;; data region 174 [;; data region
183 175
184 0x18 176 0x18
206 display-glyph [0 0 0] 198 display-glyph [0 0 0]
207 cleanup 199 cleanup
208 ;; restore all registers 200 ;; restore all registers
209 201
210 (flatten 202 (flatten
211 [;; HL points to delay currently, 203 [0x03 ;; (inc monitor-address) -> monitor-address
212 ;; decrement HL and then restore everything
213
214 0x03 ;; (inc monitor-address) -> monitor-address
215 0x1B ;; (dec glyph-count) -> glyph-count 204 0x1B ;; (dec glyph-count) -> glyph-count
216 205
217 ;; Reset HL to initial value 206 ;; Reset HL to initial value
218 0x21 207 0x21
219 (reverse (disect-bytes-2 data-start)) 208 (reverse (disect-bytes-2 data-start))
220 209
221 0x78 0x22 ;; B -> monitor-address-high 210 0x78 0x22 ;; B -> monitor-address-high
222 0x79 0x22 ;; C -> monitor-address-low 211 0x79 0x22 ;; C -> monitor-address-low
223 212
224 ;;0x7A 0x22 ;; D -> glyph-count-high 213 0x7A 0x22 ;; D -> glyph-count-high
225 ;;0x7B 0x22 ;; E -> glyph-count-low 214 0x7B 0x22 ;; E -> glyph-count-low
226 ]) 215 ])
227 216
228 stack-cleanup 217 stack-cleanup
229 [0xF1 0xE1 0xD1 0xC1] 218 [0xF1 0xE1 0xD1 0xC1]
230 219
242 [start-address delay-count total-glyph-count] 231 [start-address delay-count total-glyph-count]
243 (let [init [0xAF 0x4F 0x47] ;; 0->A; 0->C; 0->B 232 (let [init [0xAF 0x4F 0x47] ;; 0->A; 0->C; 0->B
244 header (concat (frame-metronome) (read-user-input)) 233 header (concat (frame-metronome) (read-user-input))
245 234
246 glyph-display (glyph-display-program 235 glyph-display (glyph-display-program
247 (+ (count init) (count header) 236 (+ (count init)
237 ;;(count header)
248 start-address) 238 start-address)
249 main-program-base-address 100 239 main-program-base-address 100
250 200) 240 200)
251 ;;(- (count (program-data 0)) 100)) 241 ;;(- (count (program-data 0)) 100))
252 242