comparison clojure/com/aurellem/assembly.clj @ 114:a454730d92dd

added test for count-frames
author Robert McIntyre <rlm@mit.edu>
date Fri, 16 Mar 2012 13:51:17 -0500
parents 0831da75d2c5
children 39fb0cbab25e
comparison
equal deleted inserted replaced
113:0831da75d2c5 114:a454730d92dd
176 176
177 0xCA ;D32B ; if bit-0 is not 1 177 0xCA ;D32B ; if bit-0 is not 1
178 0x43 ;D32C ; GOTO not-v-blank 178 0x43 ;D32C ; GOTO not-v-blank
179 0xD3 ;D32D 179 0xD3 ;D32D
180 180
181 ;; in v-blank mode 181 ;;; in v-blank mode
182 182
183 ;; if v-blank-prev was 0, 183 ;; if v-blank-prev was 0,
184 ;; increment frame-count 184 ;; increment frame-count
185 185
186 0xFA ;D32E ; load v-blank-prev to A 186 0xFA ;D32E ; load v-blank-prev to A
202 202
203 0xEA ;D339 ; load A into frame-count 203 0xEA ;D339 ; load A into frame-count
204 0x1F ;D33A 204 0x1F ;D33A
205 0xD3 ;D33B 205 0xD3 ;D33B
206 206
207 ;; set v-blank? to 1 207 ;; set v-blank-prev to 1
208 0x3E ;D33C ; load 1 into A 208 0x3E ;D33C ; load 1 into A
209 0x01 ;D33D 209 0x01 ;D33D
210 210
211 0xEA ;D33E ; load A into v-blank-prev 211 0xEA ;D33E ; load A into v-blank-prev
212 0x20 ;D33F 212 0x20 ;D33F
213 0xD3 ;D340 213 0xD3 ;D340
214 214
215 0x18 ;D341 ; skip not-in-v-blank section 215 0x18 ;D341 ; skip not-in-v-blank section
216 0x05 ;D342 216 0x05 ;D342
217 217
218 ;; not in v-blank mode 218 ;;; not in v-blank mode
219 ;; set b-blank? to 0 219 ;; set v-blank-prev to 0
220 0x3E ;D343 ; load 0 into A 220 0x3E ;D343 ; load 0 into A
221 0x00 ;D344 221 0x00 ;D344
222 222
223 0xEA ;D345 ; load A into v-blank-prev 223 0xEA ;D345 ; load A into v-blank-prev
224 0x20 ;D346 224 0x20 ;D346
226 226
227 227
228 0xC3 ;D348 ; return to beginning 228 0xC3 ;D348 ; return to beginning
229 0x1D ;D349 229 0x1D ;D349
230 0xD3 ;D34A 230 0xD3 ;D34A
231
232
233
234 ]))) 231 ])))
235 232
236 233 (defn step-count-frames []
237
238
239 (defn run-a-bit []
240 (-> (read-down-button) 234 (-> (read-down-button)
241 (info) 235 (info)
242 (tick) ;; skip over data section 236 (tick) ;; skip over data section
243 (info) 237 (info)
244 (view-register "Register A" A) 238 (view-register "Register A" A)
260 (tick) 254 (tick)
261 (info) 255 (info)
262 (tick) 256 (tick)
263 (print-inventory))) 257 (print-inventory)))
264 258
265 (defn test-read-pad [] 259 (defn test-read-down []
266 (= (view-memory (step (step (read-buttons) [:d])) 0xD328) 260 (= (view-memory (step (step (read-buttons) [:d])) 0xD328)
267 (view-memory (step (step (read-buttons))) 0xD328))) 261 (view-memory (step (step (read-buttons))) 0xD328)))
268 262
269 (defn trace [state] 263 (defn trace [state]
270 (loop [program-counters [] 264 (loop [program-counters []
284 (defn good-trace [] 278 (defn good-trace []
285 (-> (mid-game) (tick) (IE! 0) 279 (-> (mid-game) (tick) (IE! 0)
286 (set-inv-mem [0x00 0x00 0X00 0x00]) 280 (set-inv-mem [0x00 0x00 0X00 0x00])
287 (PC! item-list-start)(print-interrupt) 281 (PC! item-list-start)(print-interrupt)
288 (info) (tick) (info) (tick) (info))) 282 (info) (tick) (info) (tick) (info)))
283
284
285
286
287
288
289
290
291