comparison clojure/com/aurellem/gb/rlm_assembly.clj @ 394:5c0e12f0a833

set H, but found flaw in program flow.
author Robert McIntyre <rlm@mit.edu>
date Fri, 13 Apr 2012 04:13:12 -0500
parents b21d28e6c966
children 6ab872c5a7e7
comparison
equal deleted inserted replaced
393:b21d28e6c966 394:5c0e12f0a833
216 0x4F ;; A->C 216 0x4F ;; A->C
217 217
218 0xAF ;; test for output-mode (bytes-to-write > 0) 218 0xAF ;; test for output-mode (bytes-to-write > 0)
219 0xB8 ;; (cp A B) 219 0xB8 ;; (cp A B)
220 220
221 0x20 ;; skip input section if 221 0x00 ;; skip input section if
222 :to-output ;; we're not in input mode 222 0x00;;:to-output ;; we're not in input mode
223 223
224 :to-be-executed 224 :to-be-executed
225 225
226 ;; write mode to instruction-to-be-executed (pun) 226 ;; write mode to instruction-to-be-executed (pun)
227 0x79 ;; C->A
227 0xEA 228 0xEA
228 :to-be-executed-address 229 :to-be-executed-address
229 0x18 ;; return 230 0x18 ;; return
230 :to-beginning-1] 231 :to-beginning-1]
231 232
233 ;; output
234 ;; [:output-start ;; just a label
235 ;; 0x54 ;;
236 ;; 0x5D ;; HL->DE \
237 ;; ;; |
238 ;; 0x79 ;; C->A | this mess is all to do
239 ;; 0x12 ;; A->(DE) | 0x22 (LDI (HL), A) without
240 ;; ;; | any repeating nybbles
241 ;; 0x23 ;; inc HL /
242
243
244 ;; 0x05 ;; DEC bytes-to-write (B)
245 ;; 0x20 ;; if there are no more bytes to write,
246 ;; 0x04
247 ;; 0xAF ;; put a no op (0x00) in to-be-executed
248 ;; 0xEA
249 ;; :to-be-executed-address
250
251 ;; 0x18
252 ;; :to-beginning-2]
253
232 output 254 output
233 [:output-start ;; just a label 255 [:output-start ;; just a label
234 0x54 ;; 256 0x00 ;;
235 0x5D ;; HL->DE \ 257 0x00 ;; HL->DE \
236 ;; | 258 ;; |
237 0x79 ;; C->A | this mess is all to do 259 0x00 ;; C->A | this mess is all to do
238 0x12 ;; A->(DE) | 0x22 (LDI (HL), A) without 260 0x00 ;; A->(DE) | 0x22 (LDI (HL), A) without
239 ;; | any repeating nybbles 261 ;; | any repeating nybbles
240 0x23 ;; inc HL / 262 0x00 ;; inc HL /
241 263
242 264
243 0x05 ;; DEC bytes-to-write (B) 265 0x00 ;; DEC bytes-to-write (B)
244 0x20 ;; if there are no more bytes to write, 266 0x00 ;; if there are no more bytes to write,
245 0x04 267 0x00
246 0xAF ;; put a no op (0x00) in to-be-executed 268 0x00 ;; put a no op (0x00) in to-be-executed
247 0xEA 269 0x00
248 :to-be-executed-address 270 0x00
271 0x00
249 272
250 0x18 273 0x18
251 :to-beginning-2] 274 :to-beginning-2]
275
276
252 277
253 symbols 278 symbols
254 {:to-be-executed-address 279 {:to-be-executed-address
255 (reverse 280 (reverse
256 (disect-bytes-2 281 (disect-bytes-2
302 327
303 (defn test-set-H [n] 328 (defn test-set-H [n]
304 (let [after 329 (let [after
305 (-> (bootstrap-base) 330 (-> (bootstrap-base)
306 (step []) 331 (step [])
307 (step [])
308 (step [])
309 (step (buttons 0x67)) 332 (step (buttons 0x67))
310 (step (buttons n)) 333 (step (buttons n))
311 (step []) 334 )]
312 (step [])
313 (step []))]
314 (hex (H after)))) 335 (hex (H after))))
315 336
316 (defn test-write-bytes-mode [] 337 (defn test-write-bytes-mode []
317 (let [target-address 0xC00F 338 (let [target-address 0xC00F
318 [target-high target-low] (disect-bytes-2 target-address) 339 [target-high target-low] (disect-bytes-2 target-address)