diff clojure/com/aurellem/run/bootstrap_1.clj @ 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
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/bootstrap_1.clj	Sat Apr 14 03:22:10 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/bootstrap_1.clj	Sat Apr 14 04:09:51 2012 -0500
     1.3 @@ -6,6 +6,7 @@
     1.4    (:use (com.aurellem.exp item-bridge))
     1.5    (:import [com.aurellem.gb.gb_driver SaveState]))
     1.6  
     1.7 +(def hex #(printf "0x%02X\n" %))
     1.8  
     1.9  (defn print-desired-item-layout []
    1.10    (clojure.pprint/pprint
    1.11 @@ -778,7 +779,7 @@
    1.12                         0xD162 (+ 0xD162 (count pattern)))
    1.13            pattern))))
    1.14  
    1.15 -(defn-memo launch-main-bootstrap-program
    1.16 +(defn launch-main-bootstrap-program
    1.17    ([] (launch-main-bootstrap-program
    1.18         (control-checkpoint)
    1.19         ;;(launch-bootstrap-program)
    1.20 @@ -786,8 +787,19 @@
    1.21    ([script]
    1.22       (->> script
    1.23            (play-moves
    1.24 -           (bootstrap-pattern (main-bootstrap-program))))))
    1.25 +           (bootstrap-pattern (main-bootstrap-program)))
    1.26 +          (play-moves
    1.27 +           (take 263 (interleave (repeat 1000 [:b])
    1.28 +                                 (repeat 1000 [])))))))
    1.29  
    1.30 +(defn test-main-bootstrap-integrety
    1.31 +  []
    1.32 +  (assert
    1.33 +   (= (main-bootstrap-program)
    1.34 +      (subvec (vec (memory (second (launch-main-bootstrap-program))))
    1.35 +              pokemon-list-start
    1.36 +              (+ pokemon-list-start (count (main-bootstrap-program)))))))
    1.37 +   
    1.38  (defn set-target-address
    1.39    "Assumes that the game is under control of the main-bootstrap
    1.40     program in MODE-SELECT mode, and sets the target address to which
    1.41 @@ -818,18 +830,17 @@
    1.42         (set-target-address target-address)
    1.43         (play-moves [(buttons jump-mode)])))
    1.44  
    1.45 -(defn-memo relocate-main-bootstrap
    1.46 +(defn relocate-main-bootstrap
    1.47    ([] (relocate-main-bootstrap (launch-main-bootstrap-program)))
    1.48    ([script]
    1.49       (let [target (+ 90 pokemon-box-1-address)]
    1.50         (->> script
    1.51 -            (write-RAM target (main-bootstrap-program target))
    1.52 -            (transfer-control target)))))
    1.53 +            (do-nothing 500)))))
    1.54  
    1.55  (def mid-game-data
    1.56    (subvec (vec (memory (mid-game)))
    1.57            pokemon-list-start
    1.58 -          (+ pokemon-list-start 700)))
    1.59 +          (+ pokemon-list-start 100)))
    1.60  
    1.61  (def mid-game-map-address 0x46BC)
    1.62  
    1.63 @@ -837,8 +848,9 @@
    1.64    ([] (set-mid-game-data (relocate-main-bootstrap)))
    1.65    ([script]
    1.66       (->> script
    1.67 -          (write-RAM pokemon-list-start mid-game-data)
    1.68 -          (transfer-control mid-game-map-address))))
    1.69 +          (do-nothing 10)
    1.70 +          (write-RAM pokemon-list-start mid-game-data))))
    1.71 +
    1.72  
    1.73  
    1.74