# HG changeset patch # User Robert McIntyre # Date 1334312897 18000 # Node ID 0591dcddf83171bae99de745325ba2da477bf592 # Parent 9b0d79cad6249eb450d0f410b3f49c175a284205 fixed bug where variables would be overwritten. diff -r 9b0d79cad624 -r 0591dcddf831 clojure/com/aurellem/gb/rlm_assembly.clj --- a/clojure/com/aurellem/gb/rlm_assembly.clj Fri Apr 13 04:56:01 2012 -0500 +++ b/clojure/com/aurellem/gb/rlm_assembly.clj Fri Apr 13 05:28:17 2012 -0500 @@ -208,7 +208,7 @@ (count (read-user-input))) init - [0xAF 0x5F 0x57 0x47] ;; 0->A; 0->E; 0->D; 0->B + [0xAF 0x4F 0x57 0x47] ;; 0->A; 0->C; 0->D; 0->B input [0xC1 ;; pop BC so it's not volatile @@ -217,15 +217,24 @@ 0xAF ;; test for output-mode (bytes-to-write > 0) 0x00 ;; (cp A B) 0x7B ;; E->A - 0x20 ;; skip input section if :to-output ;; we're not in input mode - + :to-be-executed ;; write mode to instruction-to-be-executed (pun) 0xEA :to-be-executed-address + + 0x0C ;; inc C + 0xCB + 0x41 ;; test bit 0 of C + 0x20 ;; if (0 == (C % 2)) + 0x04 + 0xAF ;; put a no op (0x00) in to-be-executed + 0xEA + :to-be-executed-address + 0x18 ;; return :to-beginning-1] @@ -243,9 +252,7 @@ ;; 0x05 ;; DEC bytes-to-write (B) ;; 0x20 ;; if there are no more bytes to write, ;; 0x04 - ;; 0xAF ;; put a no op (0x00) in to-be-executed - ;; 0xEA - ;; :to-be-executed-address + ;; ;; 0x18 ;; :to-beginning-2] @@ -328,6 +335,7 @@ (let [after (-> (bootstrap-base) (step []) + (step []) (step (buttons 0x67)) (step (buttons n)) )]