changeset 415:f2f1e0b8c1c7

saving progress before debugging.
author Robert McIntyre <rlm@mit.edu>
date Sat, 14 Apr 2012 04:09:51 -0500
parents 0162dd315814
children 21b8b3350b20
files clojure/com/aurellem/gb/rlm_assembly.clj clojure/com/aurellem/run/bootstrap_1.clj
diffstat 2 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/rlm_assembly.clj	Sat Apr 14 03:22:10 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/rlm_assembly.clj	Sat Apr 14 04:09:51 2012 -0500
     1.3 @@ -483,14 +483,9 @@
     1.4                      (concat (repeat
     1.5                               50
     1.6                               (- 15 (first nybbles)))
     1.7 -                            [(first nybbles)]))
     1.8 -        tail (map buttons
     1.9 -                  (take
    1.10 -                   (- 201 (count moves))
    1.11 -                   (interleave (repeat 100 (last nybbles))
    1.12 -                               (repeat 1000 (- 15 (last nybbles))))))]
    1.13 +                            [(first nybbles)]))]
    1.14      (assert (no-consecutive-repeats? nybbles))
    1.15 -    (concat header moves tail)))
    1.16 +    (concat header moves)))
    1.17      
    1.18  ;;;;;; TESTS ;;;;;;
    1.19  
     2.1 --- a/clojure/com/aurellem/run/bootstrap_1.clj	Sat Apr 14 03:22:10 2012 -0500
     2.2 +++ b/clojure/com/aurellem/run/bootstrap_1.clj	Sat Apr 14 04:09:51 2012 -0500
     2.3 @@ -6,6 +6,7 @@
     2.4    (:use (com.aurellem.exp item-bridge))
     2.5    (:import [com.aurellem.gb.gb_driver SaveState]))
     2.6  
     2.7 +(def hex #(printf "0x%02X\n" %))
     2.8  
     2.9  (defn print-desired-item-layout []
    2.10    (clojure.pprint/pprint
    2.11 @@ -778,7 +779,7 @@
    2.12                         0xD162 (+ 0xD162 (count pattern)))
    2.13            pattern))))
    2.14  
    2.15 -(defn-memo launch-main-bootstrap-program
    2.16 +(defn launch-main-bootstrap-program
    2.17    ([] (launch-main-bootstrap-program
    2.18         (control-checkpoint)
    2.19         ;;(launch-bootstrap-program)
    2.20 @@ -786,8 +787,19 @@
    2.21    ([script]
    2.22       (->> script
    2.23            (play-moves
    2.24 -           (bootstrap-pattern (main-bootstrap-program))))))
    2.25 +           (bootstrap-pattern (main-bootstrap-program)))
    2.26 +          (play-moves
    2.27 +           (take 263 (interleave (repeat 1000 [:b])
    2.28 +                                 (repeat 1000 [])))))))
    2.29  
    2.30 +(defn test-main-bootstrap-integrety
    2.31 +  []
    2.32 +  (assert
    2.33 +   (= (main-bootstrap-program)
    2.34 +      (subvec (vec (memory (second (launch-main-bootstrap-program))))
    2.35 +              pokemon-list-start
    2.36 +              (+ pokemon-list-start (count (main-bootstrap-program)))))))
    2.37 +   
    2.38  (defn set-target-address
    2.39    "Assumes that the game is under control of the main-bootstrap
    2.40     program in MODE-SELECT mode, and sets the target address to which
    2.41 @@ -818,18 +830,17 @@
    2.42         (set-target-address target-address)
    2.43         (play-moves [(buttons jump-mode)])))
    2.44  
    2.45 -(defn-memo relocate-main-bootstrap
    2.46 +(defn relocate-main-bootstrap
    2.47    ([] (relocate-main-bootstrap (launch-main-bootstrap-program)))
    2.48    ([script]
    2.49       (let [target (+ 90 pokemon-box-1-address)]
    2.50         (->> script
    2.51 -            (write-RAM target (main-bootstrap-program target))
    2.52 -            (transfer-control target)))))
    2.53 +            (do-nothing 500)))))
    2.54  
    2.55  (def mid-game-data
    2.56    (subvec (vec (memory (mid-game)))
    2.57            pokemon-list-start
    2.58 -          (+ pokemon-list-start 700)))
    2.59 +          (+ pokemon-list-start 100)))
    2.60  
    2.61  (def mid-game-map-address 0x46BC)
    2.62  
    2.63 @@ -837,8 +848,9 @@
    2.64    ([] (set-mid-game-data (relocate-main-bootstrap)))
    2.65    ([script]
    2.66       (->> script
    2.67 -          (write-RAM pokemon-list-start mid-game-data)
    2.68 -          (transfer-control mid-game-map-address))))
    2.69 +          (do-nothing 10)
    2.70 +          (write-RAM pokemon-list-start mid-game-data))))
    2.71 +
    2.72  
    2.73  
    2.74