Mercurial > vba-clojure
changeset 340:dea7e476eba7
preliminary item-writer complete
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 08 Apr 2012 04:10:49 -0500 |
parents | 93e74ed34305 |
children | bf9b9777c3ce |
files | clojure/com/aurellem/run/bootstrap_0.clj |
diffstat | 1 files changed, 39 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj Sun Apr 08 03:00:51 2012 -0500 1.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj Sun Apr 08 04:10:49 2012 -0500 1.3 @@ -760,11 +760,7 @@ 1.4 [return-high return-low] (disect-bytes-2 return-address)] 1.5 (flatten 1.6 [0xF3 ;; disable interrupts 1.7 - ;;0xC5 ;; push junk onto stack 1.8 - ;;0xD5 1.9 - ;;0xE5 1.10 - ;;0xF5 1.11 - 1.12 + 1.13 0x1E ;; load limit into E 1.14 limit 1.15 1.16 @@ -776,7 +772,6 @@ 1.17 0x0E ;; C == 1 means input-first nybble 1.18 0x01 ;; C == 0 means input-second nybble 1.19 1.20 - 1.21 ;; Input Section 1.22 1.23 0x3E ;; load 0x20 into A, to measure dpad 1.24 @@ -831,12 +826,6 @@ 1.25 0x20 ;; jump back to input section if not done 1.26 0xE4 ;; literal -28 1.27 1.28 - ;; cleanup 1.29 - ;;0xF1 1.30 - ;;0xE1 1.31 - ;;0xD1 1.32 - ;;0xC1 1.33 - 1.34 0xFB ;; re-enable interrupts 1.35 1.36 0xC3 1.37 @@ -936,9 +925,12 @@ 1.38 0x3F ;; (item-hack) set carry flag no-op 1.39 1.40 ;; load 1 into C. 1.41 - 0x0E ;; C == 1 means input-first nybble 1.42 - 0x01 ;; C == 0 means input-second nybble 1.43 - 1.44 + 0x0E ;; C == 0 means input-first nybble 1.45 + 0x01 ;; C == 0xFF means input-second nybble 1.46 + 1.47 + 0x0D ;; (item-hack) (dec C) 1.48 + 0x2B ;; (item-hack) (dec HL) no-op 1.49 + 1.50 0x21 ;; load target into HL 1.51 target-low 1.52 target-high 1.53 @@ -976,45 +968,58 @@ 1.54 0x47 ;; load A into B 1.55 1.56 0x0D ;; dec C 1.57 + 0x37 ;; (item-hack) set-carry flag 1.58 ;; branch based on C: 1.59 0x20 ;; JR NZ 1.60 - 0x07 ;; skip "input first nybble" below 1.61 - 1.62 + 0x08 ;; skip "input first nybble" below 1.63 1.64 - ;; input first nybble 1.65 - 1.66 - 0xCB 1.67 - 0x37 ;; swap nybbles on A 1.68 - 1.69 - 0x57 ;; A -> D 1.70 - 1.71 - 0x18 1.72 - 0xEC ;; literal -20 -- go back to input section 1.73 - 1.74 ;; input second nybble 1.75 1.76 0x0C ;; inc C 1.77 - 1.78 + 0x37 ;; (item-hack) set-carry flag no-op 1.79 + 1.80 + 0x00 ;; (item-hack) no-op 1.81 0xE6 ;; select bottom bits 1.82 0x0F 1.83 + 0x37 ;; (item-hack) set-carry flag no-op 1.84 1.85 + 0x00 ;; (item-hack) no-op 1.86 0xB2 ;; (OR A D) -> A 1.87 1.88 0x22 ;; (do (A -> (HL)) (INC HL)) 1.89 1.90 0x1D ;; (DEC E) 1.91 1.92 + 0x00 ;; (item-hack) 1.93 0x20 ;; jump back to input section if not done 1.94 - 0xE4 ;; literal -28 1.95 + 0xDA ;; literal -36 == TM 18 (counter) 1.96 + 0x01 ;; (item-hack) will never reach this instruction 1.97 1.98 + ;; input first nybble 1.99 + 0x00 1.100 + 0xCB 1.101 + 0x37 ;; swap nybbles on A 1.102 + 1.103 + 0x57 ;; A -> D 1.104 + 1.105 + 0x37 1.106 + 0x18 1.107 + 0xD5 ;; literal -20 == TM13; go back to input section 1.108 + 0x01 1.109 + 1.110 + 0x3A ;; (item-hack) these two bytes can be anything. 1.111 + 0x01 1.112 ;; cleanup 1.113 ;;0xF1 1.114 ;;0xE1 1.115 ;;0xD1 1.116 ;;0xC1 1.117 - 1.118 - 0xFB ;; re-enable interrupts 1.119 - 1.120 - 0xC3 1.121 + 0x00 ;; (item-hack) no-op 1.122 + 0xBF ;; (CP A A) ensures Z 1.123 + ;;0xFB ;; re-enable interrupts;; unnecessary 1.124 + 0xCA ;; (item-hack) jump if Z 1.125 return-low 1.126 - return-high ]))) 1.127 + return-high 1.128 + 1.129 + 0x01 ;; (item-hack) will never be reached. 1.130 + ])))