Mercurial > vba-clojure
diff clojure/com/aurellem/gb/rlm_assembly.clj @ 382:3c24216e0080
decreased frame-metronome by one opcode
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 11 Apr 2012 13:17:08 -0500 |
parents | 1bfa43d35403 |
children | 9eae7e914bf0 |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/gb/rlm_assembly.clj Wed Apr 11 13:09:41 2012 -0500 1.2 +++ b/clojure/com/aurellem/gb/rlm_assembly.clj Wed Apr 11 13:17:08 2012 -0500 1.3 @@ -63,18 +63,21 @@ 1.4 (if (< n 0) 1.5 (+ 256 n) n)) 1.6 1.7 +0x01 1.8 +0x44 1.9 +0xFF 1.10 +inc C 1.11 +inc D 1.12 + 1.13 (defn frame-metronome [] 1.14 (let [timing-loop 1.15 - [0x16 1.16 - 0xFE ;; load FF into D without repeats 1.17 - 0x14 1.18 + [0x01 1.19 + 0x43 1.20 + 0xFE ;; load 0xFF44 into BC without repeats 1.21 + 0x0C 1.22 + 0x04 1.23 1.24 - 0x1E 1.25 - 0x43 ;; load 44 into E without repeats 1.26 - 0x1C 1.27 - 1.28 - 0x1A ;; (DE) -> A, now A = LY (vertical line coord) 1.29 - ] 1.30 + 0x0A] ;; (BC) -> A, now A = LY (vertical line coord) 1.31 continue-if-144 1.32 [0xFE 1.33 144 ;; compare LY (in A) with 144 1.34 @@ -82,8 +85,8 @@ 1.35 (->signed-8-bit 1.36 (+ -4 (- (count timing-loop))))] 1.37 spin-loop 1.38 - [0x15 ;; dec D, which is 0xFF 1.39 - 0x20 ;; spin until D==0 1.40 + [0x05 ;; dec B, which is 0xFF 1.41 + 0x20 ;; spin until B==0 1.42 0xFD]] 1.43 (concat timing-loop continue-if-144 spin-loop))) 1.44 1.45 @@ -92,21 +95,21 @@ 1.46 "Ensure that frame-metronome ticks exactly once every frame." 1.47 ([] (test-frame-metronome 151)) 1.48 ([steps] 1.49 - (let [inc-C [0x0C 0x18 1.50 + (let [inc-D [0x14 0x18 1.51 (->signed-8-bit 1.52 (+ -3 (- (count (frame-metronome)))))] 1.53 - program (concat (frame-metronome) inc-C) 1.54 + program (concat (frame-metronome) inc-D) 1.55 count-frames 1.56 (-> (tick (mid-game)) 1.57 (IE! 0) 1.58 - (BC! 0) 1.59 + (DE! 0) 1.60 (set-memory-range pokemon-list-start program) 1.61 (PC! pokemon-list-start)) 1.62 - C-after-moves (C (run-moves count-frames (repeat steps [])))] 1.63 - (println "C:" C-after-moves) 1.64 - ;;(assert (= steps C-after-moves)) 1.65 + D-after-moves (D (run-moves count-frames (repeat steps [])))] 1.66 + (println "D:" D-after-moves) 1.67 + (assert (= steps D-after-moves)) 1.68 1.69 - (println "C =" C-after-moves "after" steps "steps") 1.70 + (println "D =" D-after-moves "after" steps "steps") 1.71 count-frames))) 1.72 1.73 (defn main-bootstrap-program [start-address]