Mercurial > vba-clojure
changeset 396:c7a43f4ffd9d
fixed bug where A was always 0 when the self-modigying code was executed.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 13 Apr 2012 04:50:58 -0500 |
parents | 6ab872c5a7e7 |
children | 9b0d79cad624 |
files | clojure/com/aurellem/gb/rlm_assembly.clj |
diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/gb/rlm_assembly.clj Fri Apr 13 04:37:12 2012 -0500 1.2 +++ b/clojure/com/aurellem/gb/rlm_assembly.clj Fri Apr 13 04:50:58 2012 -0500 1.3 @@ -213,18 +213,18 @@ 1.4 input 1.5 [0xC1 ;; pop BC so it's not volatile 1.6 1.7 - 0x00 ;; A->C 1.8 + 0x4F ;; A->C 1.9 + 0xAF ;; test for output-mode (bytes-to-write > 0) 1.10 + 0x00 ;; (cp A B) 1.11 + 0x79 ;; C->A 1.12 1.13 - 0x00 ;; test for output-mode (bytes-to-write > 0) 1.14 - 0x00 ;; (cp A B) 1.15 - 1.16 - 0x00 ;; skip input section if 1.17 - 0x00 ;;:to-output ;; we're not in input mode 1.18 + 0x20 ;; skip input section if 1.19 + :to-output ;; we're not in input mode 1.20 1.21 :to-be-executed 1.22 1.23 ;; write mode to instruction-to-be-executed (pun) 1.24 - 0x00 ;; C->A 1.25 + 1.26 0xEA 1.27 :to-be-executed-address 1.28 0x18 ;; return 1.29 @@ -282,7 +282,7 @@ 1.30 (+ start-address jump-distance 1.31 (count init) 1.32 (symbol-index :to-be-executed input)))) 1.33 - :to-be-executed 0x3F} ;; clear carry flag no-op 1.34 + :to-be-executed 0x00} ;; clear carry flag no-op 1.35 1.36 program** (flatten 1.37 (replace 1.38 @@ -304,11 +304,11 @@ 1.39 {:to-beginning-1 1.40 (->signed-8-bit 1.41 (+ (count init) 1.42 - -2 (- (inc (symbol-index :to-beginning-1 program*))))) 1.43 + -2 (- (dec (symbol-index :to-beginning-1 program*))))) 1.44 :to-beginning-2 1.45 (->signed-8-bit 1.46 (+ (count init) 1.47 - -2 (- (inc (symbol-index :to-beginning-2 program*)))))} 1.48 + -2 (- (dec (symbol-index :to-beginning-2 program*)))))} 1.49 1.50 program 1.51 (replace resolve-external-jumps program*)]