changeset 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
files clojure/com/aurellem/gb/rlm_assembly.clj
diffstat 1 files changed, 39 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/rlm_assembly.clj	Thu Apr 12 01:25:28 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/rlm_assembly.clj	Fri Apr 13 04:13:12 2012 -0500
     1.3 @@ -218,38 +218,63 @@
     1.4           0xAF  ;; test for output-mode (bytes-to-write > 0)
     1.5           0xB8  ;; (cp A B)
     1.6  
     1.7 -         0x20       ;; skip input section if
     1.8 -         :to-output ;; we're not in input mode 
     1.9 +         0x00       ;; skip input section if
    1.10 +         0x00;;:to-output ;; we're not in input mode 
    1.11                    
    1.12           :to-be-executed
    1.13  
    1.14           ;; write mode to instruction-to-be-executed (pun)
    1.15 +         0x79  ;; C->A
    1.16           0xEA
    1.17           :to-be-executed-address
    1.18           0x18           ;; return
    1.19           :to-beginning-1]
    1.20          
    1.21 +        ;; output
    1.22 +        ;; [:output-start ;; just a label
    1.23 +        ;;  0x54 ;;
    1.24 +        ;;  0x5D ;; HL->DE  \
    1.25 +        ;;       ;;          |
    1.26 +        ;;  0x79 ;; C->A     | this mess is all to do 
    1.27 +        ;;  0x12 ;; A->(DE)  | 0x22 (LDI (HL), A) without
    1.28 +        ;;       ;;          | any repeating nybbles
    1.29 +        ;;  0x23 ;; inc HL  /
    1.30 +
    1.31 +
    1.32 +        ;;  0x05 ;; DEC bytes-to-write (B)
    1.33 +        ;;  0x20 ;; if there are no more bytes to write,
    1.34 +        ;;  0x04
    1.35 +        ;;  0xAF ;; put a no op (0x00) in to-be-executed
    1.36 +        ;;  0xEA
    1.37 +        ;;  :to-be-executed-address
    1.38 +                  
    1.39 +        ;;  0x18
    1.40 +        ;;  :to-beginning-2]
    1.41 +
    1.42          output
    1.43          [:output-start ;; just a label
    1.44 -         0x54 ;;
    1.45 -         0x5D ;; HL->DE  \
    1.46 +         0x00 ;;
    1.47 +         0x00 ;; HL->DE  \
    1.48                ;;          |
    1.49 -         0x79 ;; C->A     | this mess is all to do 
    1.50 -         0x12 ;; A->(DE)  | 0x22 (LDI (HL), A) without
    1.51 +         0x00 ;; C->A     | this mess is all to do 
    1.52 +         0x00 ;; A->(DE)  | 0x22 (LDI (HL), A) without
    1.53                ;;          | any repeating nybbles
    1.54 -         0x23 ;; inc HL  /
    1.55 +         0x00 ;; inc HL  /
    1.56  
    1.57  
    1.58 -         0x05 ;; DEC bytes-to-write (B)
    1.59 -         0x20 ;; if there are no more bytes to write,
    1.60 -         0x04
    1.61 -         0xAF ;; put a no op (0x00) in to-be-executed
    1.62 -         0xEA
    1.63 -         :to-be-executed-address
    1.64 +         0x00 ;; DEC bytes-to-write (B)
    1.65 +         0x00 ;; if there are no more bytes to write,
    1.66 +         0x00
    1.67 +         0x00 ;; put a no op (0x00) in to-be-executed
    1.68 +         0x00
    1.69 +         0x00
    1.70 +         0x00
    1.71                    
    1.72           0x18
    1.73           :to-beginning-2]
    1.74          
    1.75 +
    1.76 +        
    1.77          symbols
    1.78          {:to-be-executed-address
    1.79           (reverse
    1.80 @@ -304,13 +329,9 @@
    1.81    (let [after
    1.82          (-> (bootstrap-base)
    1.83              (step [])
    1.84 -            (step [])
    1.85 -            (step [])
    1.86              (step (buttons 0x67))
    1.87              (step (buttons n))
    1.88 -            (step [])
    1.89 -            (step [])
    1.90 -            (step []))]
    1.91 +            )]
    1.92      (hex (H after))))
    1.93  
    1.94  (defn test-write-bytes-mode []