diff clojure/com/aurellem/run/bootstrap_1.clj @ 541:cd557c922cec

working on basic choreo.
author Robert McIntyre <rlm@mit.edu>
date Mon, 25 Jun 2012 15:32:16 -0500
parents 0b6624c1291c
children daa3497bbe12
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/bootstrap_1.clj	Mon Jun 25 15:08:52 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/bootstrap_1.clj	Mon Jun 25 15:32:16 2012 -0500
     1.3 @@ -791,14 +791,16 @@
     1.4              (play-moves
     1.5               (take 253 (interleave (repeat 1000 [:b])
     1.6                                     (repeat 1000 [])))))))
     1.7 +(def bootstrap-start pokemon-list-start)
     1.8  
     1.9  (defn test-main-bootstrap-integrety
    1.10    []
    1.11    (assert
    1.12     (= (main-bootstrap-program)
    1.13 -      (subvec (vec (memory (second (launch-main-bootstrap-program))))
    1.14 -              pokemon-list-start
    1.15 -              (+ pokemon-list-start (count (main-bootstrap-program)))))))
    1.16 +      (subvec
    1.17 +       (vec (memory (second (launch-main-bootstrap-program))))
    1.18 +       pokemon-list-start
    1.19 +       (+ pokemon-list-start (count (main-bootstrap-program)))))))
    1.20     
    1.21  (defn set-target-address
    1.22    "Assumes that the game is under control of the main-bootstrap
    1.23 @@ -845,18 +847,22 @@
    1.24         (set-target-address target-address)
    1.25         (play-moves [(buttons jump-mode)])))
    1.26  
    1.27 -(def box-target (+ 90 pokemon-box-1-address))
    1.28 +
    1.29 +(def relocated-bootstrap-start
    1.30 +  (+ 90 pokemon-box-1-address))
    1.31  
    1.32  (defn-memo relocate-main-bootstrap
    1.33    ([] (relocate-main-bootstrap (launch-main-bootstrap-program)))
    1.34    ([script]
    1.35 -     (let [target (+ 90 pokemon-box-1-address)]
    1.36 -       (->> script
    1.37 -            (do-nothing 2)
    1.38 -            (write-RAM target (main-bootstrap-program target))
    1.39 -            (do-nothing 1)
    1.40 -            (transfer-control target)
    1.41 -            (do-nothing 1)))))
    1.42 +     (->> script
    1.43 +          (do-nothing 2)
    1.44 +          (write-RAM
    1.45 +           relocated-bootstrap-start
    1.46 +           (main-bootstrap-program
    1.47 +            relocated-bootstrap-start))
    1.48 +          (do-nothing 1)
    1.49 +          (transfer-control relocated-bootstrap-start)
    1.50 +          (do-nothing 1))))
    1.51  
    1.52  (defn gen-new-kernel-checkpoint! []
    1.53    (write-script! (do-nothing 10 (relocate-main-bootstrap))
    1.54 @@ -864,7 +870,6 @@
    1.55  
    1.56  (defn new-kernel [] (read-script "new-kernel"))
    1.57  
    1.58 -
    1.59  (def mid-game-data
    1.60    (subvec (vec (memory (mid-game)))
    1.61            pokemon-list-start