Mercurial > vba-clojure
changeset 126:86f92deacd2a
completed mode 3
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 17 Mar 2012 02:25:48 -0500 |
parents | d2e00c923bad |
children | 901ee6b648da |
files | clojure/com/aurellem/assembly.clj |
diffstat | 1 files changed, 70 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/assembly.clj Sat Mar 17 02:00:02 2012 -0500 1.2 +++ b/clojure/com/aurellem/assembly.clj Sat Mar 17 02:25:48 2012 -0500 1.3 @@ -623,9 +623,9 @@ 1.4 0x05 ;D381 ; 5 variables: 1.5 0x00 ;D382 ; current-mode 1.6 0x00 ;D383 ; bytes-to-write 1.7 - 0x00 ;D384 ; start-point 1.8 - 0x00 ;D385 ; bytes-written 1.9 - 0x00 ;D386 ; unused 1.10 + 0x00 ;D384 ; bytes-written 1.11 + 0x00 ;D385 ; start-point-high 1.12 + 0x00 ;D386 ; start-point-low 1.13 1.14 1.15 ;; banch on current mode 1.16 @@ -651,7 +651,7 @@ 1.17 0xB1 ;D393 1.18 0xD3 ;D394 ; goto Mode 1 if A == 1 1.19 1.20 - ;; GOTO Mode 2 (set-start-point) if current mode is 2 1.21 + ;; GOTO Mode 2 (set-start-point-high) if current mode is 2 1.22 0xFE ;D395 1.23 0x02 ;D396 ; compare A with 0x02 1.24 1.25 @@ -659,14 +659,15 @@ 1.26 0xBF ;D398 1.27 0xD3 ;D399 ; goto Mode 2 if A == 2 1.28 1.29 - ;; GOTO Mode 3 (write-memory) if current mode is 3 1.30 + ;; GOTO Mode 3 (set-start-point-low) if current mode is 3 1.31 0xFE ;D39A 1.32 0x03 ;D39B 1.33 1.34 - 0x00 ;D39C 1.35 - 0xCA ;D39D 1.36 - 0xXX ;D39E 1.37 - 0xXX ;D39F 1.38 + 0xCA ;D39C 1.39 + 0xCD ;D39D 1.40 + 0xD3 ;D39E ; goto Mode 3 if A == 3 1.41 + 1.42 + 0x00 ;D39F 1.43 0x00 ;D3A0 1.44 0x00 ;D3A1 1.45 0x00 ;D3A2 1.46 @@ -727,20 +728,20 @@ 1.47 ;; End Mode 1 1.48 1.49 1.50 - ;; Mode 2 -- set start-point mode 1.51 - ;; Final part of the header for writing things to memory. 1.52 + ;; Mode 2 -- set start-point-high mode 1.53 + ;; Middle part of the header for writing things to memory. 1.54 ;; User specifies the start location in RAM to which 1.55 ;; data will be written. 1.56 ;; Mode is auto advanced to Mode 3 after this mode completes. 1.57 1.58 - ;; Set start-point to input-number; 1.59 + ;; Set start-point-high to input-number; 1.60 ;; set current mode to 0x03. 1.61 0xFA ;D3BF ; load input-number (0xD352) 1.62 0x52 ;D3C0 ; into A 1.63 0xD3 ;D3C1 1.64 1.65 - 0xEA ;D3C2 ; load A into start-point 1.66 - 0x84 ;D3C3 ; (0xD384) 1.67 + 0xEA ;D3C2 ; load A into start-point-high 1.68 + 0x85 ;D3C3 ; (0xD385) 1.69 0xD3 ;D3C4 1.70 1.71 0x3E ;D3C5 ; load 0x03 into A. 1.72 @@ -756,7 +757,32 @@ 1.73 ;;End Mode 2 1.74 1.75 1.76 - ;; Mode 3 -- write bytes mode 1.77 + ;; Mode 3 -- set-start-point-low mode 1.78 + ;; Final part of header for writing things to memory. 1.79 + ;; User specifies the low bytes of 16 bit start-point. 1.80 + 1.81 + ;; Set start-point-low to input-number; 1.82 + ;; set current mode to 0x04 1.83 + 0xFA ;D3CD ; load input-number into A 1.84 + 0x52 ;D3CE 1.85 + 0xD3 ;D3CF 1.86 + 1.87 + 0xEA ;D3D0 ; load A into start-point-low 1.88 + 0x86 ;D3D1 1.89 + 0xD3 ;D3D2 1.90 + 1.91 + 0x3E ;D3D3 ; load 0x04 into A. 1.92 + 0x04 ;D3D4 1.93 + 1.94 + 0xEA ;D3D5 ; load A to current-mode, 1.95 + 0x82 ;D3D6 ; advancing from Mode 3 to 1.96 + 0xD3 ;D3D7 ; Mode 4. 1.97 + 1.98 + 0xC3 ;D3D8 ; go back to beginning 1.99 + 0x1D ;D3D9 1.100 + 0xD3 ;D3DA 1.101 + 1.102 + ;; Mode 4 -- write bytes mode 1.103 1.104 ;; This is where RAM manipulation happens. User supplies 1.105 ;; bytes every frame, which are written sequentially to 1.106 @@ -766,19 +792,15 @@ 1.107 ;; compare bytes-written with bytes-to-write. 1.108 ;; if they are the same, then reset mode to 0 1.109 1.110 - 0xFA ;D3CD ; load bytes-to-write into A 1.111 - 0x83 ;D3CE 1.112 - 0xD3 ;D3CF 1.113 - 1.114 - 0x47 ;D3D0 ; load A into B 1.115 - 1.116 - 0xFA ;D3D1 ; load bytes-written into A 1.117 - 0x82 ;D3D2 1.118 - 0xD3 ;D3D3 1.119 - 1.120 - 0xB8 ;D3D4 ; compare A with B 1.121 - 1.122 - 0xCA ;D3D5 ; if they are equal, go to cleanup 1.123 + 0xFA ;D3DB ; load bytes-to-write into A 1.124 + 0x83 ;D3DC 1.125 + 0xD3 ;D3DD 1.126 + 0x47 ;D3DE ; load A into B 1.127 + 0xFA ;D3DF ; load bytes-written into A 1.128 + 0x84 ;D3E0 1.129 + 0xD3 ;D3E1 1.130 + 0xB8 ;D3E2 ; compare A with B 1.131 + 0xCA ;D3E3 ; if they are equal, go to cleanup 1.132 1.133 ;; Write Memory Section 1.134 ;; Write the input-number, interpreted as an 8-bit number, 1.135 @@ -847,7 +869,9 @@ 1.136 (def input 0xD352) 1.137 (def current-mode 0xD382) 1.138 (def bytes-to-write 0xD383) 1.139 -(def start-point 0xD384) 1.140 +(def start-point-high 0xD385) 1.141 +(def start-point-low 0xD386) 1.142 + 1.143 (def bytes-written 0xD385) 1.144 1.145 (defn write-memory [] 1.146 @@ -895,18 +919,27 @@ 1.147 (#(do (println "step with [:a]") %)) 1.148 (view-memory current-mode) 1.149 (view-memory bytes-to-write) 1.150 - (view-memory start-point) 1.151 + (view-memory start-point-high) 1.152 + (view-memory start-point-low) 1.153 + (#(do (println "step with [:a :b :start]")%)) 1.154 + (step [:a :b :start]) 1.155 + (view-memory current-mode) 1.156 + (view-memory bytes-to-write) 1.157 + (view-memory start-point-high) 1.158 + (view-memory start-point-low) 1.159 + (#(do (println "step with [:u :d]")%)) 1.160 + (step [:u :d]) 1.161 + (view-memory current-mode) 1.162 + (view-memory bytes-to-write) 1.163 + (view-memory start-point-high) 1.164 + (view-memory start-point-low) 1.165 (#(do (println "step with [:u :d :l :r]")%)) 1.166 (step [:u :d :l :r]) 1.167 (view-memory current-mode) 1.168 (view-memory bytes-to-write) 1.169 - (view-memory start-point) 1.170 - (#(do (println "step with [:u :d]")%)) 1.171 - (step [:u :d]) 1.172 - (view-memory current-mode) 1.173 - (view-memory bytes-to-write) 1.174 - (view-memory start-point) 1.175 - 1.176 + (view-memory start-point-high) 1.177 + (view-memory start-point-low) 1.178 + 1.179 )) 1.180 1.181