Mercurial > vba-clojure
changeset 341:bf9b9777c3ce
brought item-writer down to 20 items.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 08 Apr 2012 05:48:13 -0500 |
parents | dea7e476eba7 |
children | 4e0b64ea7b66 |
files | clojure/com/aurellem/run/bootstrap_0.clj |
diffstat | 1 files changed, 37 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj Sun Apr 08 04:10:49 2012 -0500 1.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj Sun Apr 08 05:48:13 2012 -0500 1.3 @@ -919,18 +919,15 @@ 1.4 ;;0xD5 1.5 ;;0xE5 1.6 ;;0xF5 1.7 - 0x37 ;; (item-hack) set cary flag no-op 1.8 + 0x33 ;; (item-hack) set increment stack pointer no-op 1.9 0x1E ;; load limit into E 1.10 limit 1.11 0x3F ;; (item-hack) set carry flag no-op 1.12 1.13 - ;; load 1 into C. 1.14 - 0x0E ;; C == 0 means input-first nybble 1.15 - 0x01 ;; C == 0xFF means input-second nybble 1.16 + ;; load 2 into C. 1.17 + 0x0E ;; C == 1 means input-first nybble 1.18 + 0x04 ;; C == 0 means input-second nybble 1.19 1.20 - 0x0D ;; (item-hack) (dec C) 1.21 - 0x2B ;; (item-hack) (dec HL) no-op 1.22 - 1.23 0x21 ;; load target into HL 1.24 target-low 1.25 target-high 1.26 @@ -960,7 +957,7 @@ 1.27 0x00 ;; (item-hack) no-op 1.28 0xB8 ;; see if input is different (CP A B) 1.29 1.30 - 0x33 ;; (item-hack) (INC SP) 1.31 + 0x00 ;; (item-hack) (INC SP) 1.32 0x28 ;; repeat above steps if input is not different 1.33 ;; (jump relative backwards if B != A) 1.34 0xED ;; (literal -19) (item-hack) -19 == egg bomb (TM37) 1.35 @@ -971,7 +968,7 @@ 1.36 0x37 ;; (item-hack) set-carry flag 1.37 ;; branch based on C: 1.38 0x20 ;; JR NZ 1.39 - 0x08 ;; skip "input first nybble" below 1.40 + 23 ;; skip "input second nybble" and "jump to target" below 1.41 1.42 ;; input second nybble 1.43 1.44 @@ -993,8 +990,22 @@ 1.45 0x00 ;; (item-hack) 1.46 0x20 ;; jump back to input section if not done 1.47 0xDA ;; literal -36 == TM 18 (counter) 1.48 - 0x01 ;; (item-hack) will never reach this instruction 1.49 + 0x01 ;; (item-hack) set BC to literal (no-op) 1.50 1.51 + ;; jump to target 1.52 + 0x00 ;; (item-hack) these two bytes can be anything. 1.53 + 0x01 1.54 + 1.55 + 0x00 ;; (item-hack) no-op 1.56 + 0xBF ;; (CP A A) ensures Z 1.57 + 1.58 + 0xCA ;; (item-hack) jump if Z 1.59 + return-low 1.60 + return-high 1.61 + 0x01 ;; (item-hack) will never be reached. 1.62 + 1.63 + 1.64 + 1.65 ;; input first nybble 1.66 0x00 1.67 0xCB 1.68 @@ -1002,24 +1013,21 @@ 1.69 1.70 0x57 ;; A -> D 1.71 1.72 - 0x37 1.73 - 0x18 1.74 - 0xD5 ;; literal -20 == TM13; go back to input section 1.75 - 0x01 1.76 + 0x37 ;; (item-hack) set carry flag no-op 1.77 + 0x18 ;; relative jump backwards 1.78 + 0xCD ;; literal -51 == TM05; go back to input section 1.79 + 0x01 ;; (item-hack) will never reach this instruction 1.80 1.81 - 0x3A ;; (item-hack) these two bytes can be anything. 1.82 - 0x01 1.83 - ;; cleanup 1.84 - ;;0xF1 1.85 - ;;0xE1 1.86 - ;;0xD1 1.87 - ;;0xC1 1.88 - 0x00 ;; (item-hack) no-op 1.89 - 0xBF ;; (CP A A) ensures Z 1.90 - ;;0xFB ;; re-enable interrupts;; unnecessary 1.91 - 0xCA ;; (item-hack) jump if Z 1.92 - return-low 1.93 - return-high 1.94 + ]))) 1.95 1.96 - 0x01 ;; (item-hack) will never be reached. 1.97 - ]))) 1.98 + 1.99 + 1.100 +(defn test-item-writer [] 1.101 + (-> (read-state "bootstrap-init") 1.102 + (set-memory pc-item-list-start 50) 1.103 + (set-memory-range 1.104 + map-function-address-start 1.105 + (reverse (disect-bytes-2 (inc pc-item-list-start)))) 1.106 + (set-memory-range 1.107 + (inc pc-item-list-start) 1.108 + (item-writer 0xD162 201 0xD162))))