changeset 596:747d47d96d2f

determined that I cannot shorten the long B sequeuce during bootstrap.
author Robert McIntyre <rlm@mit.edu>
date Sun, 02 Sep 2012 06:36:57 -0500
parents 96ee9d72aeb9
children 0b4ff504157d
files clojure/com/aurellem/gb/rlm_assembly.clj clojure/com/aurellem/run/adv_choreo.clj clojure/com/aurellem/run/bootstrap_1.clj
diffstat 3 files changed, 28 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/rlm_assembly.clj	Sat Sep 01 13:32:19 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/rlm_assembly.clj	Sun Sep 02 06:36:57 2012 -0500
     1.3 @@ -6,10 +6,11 @@
     1.4  
     1.5  (defn pc-item-writer-program
     1.6    []
     1.7 -  (let [limit 201 ;; should be more like 92
     1.8 +  (let [;;limit 75
     1.9 +        limit 201 ;; (item-hack 201 is the smallest I could make this.) 
    1.10          [target-high target-low] (disect-bytes-2 pokemon-list-start)]
    1.11      (flatten
    1.12 -     [[0x00  ;; (item-hack) set increment stack pointer no-op
    1.13 +     [[0x00  ;; (item-hack) no-op (can't buy repel (1E) at celadon)
    1.14         0x1E  ;; load limit into E
    1.15         limit
    1.16         0x3F  ;; (item-hack) set carry flag no-op
    1.17 @@ -494,7 +495,7 @@
    1.18          moves (map (comp buttons (partial - 15)) nybbles)
    1.19          header (map buttons
    1.20                      (concat (repeat
    1.21 -                             50
    1.22 +                             23 ;; found by manual binary search
    1.23                               (- 15 (first nybbles)))
    1.24                              [(first nybbles)]))]
    1.25      (assert (no-consecutive-repeats? nybbles))
     2.1 --- a/clojure/com/aurellem/run/adv_choreo.clj	Sat Sep 01 13:32:19 2012 -0500
     2.2 +++ b/clojure/com/aurellem/run/adv_choreo.clj	Sun Sep 02 06:36:57 2012 -0500
     2.3 @@ -303,7 +303,7 @@
     2.4                       (+ (count init) start-address)))])]
     2.5      (concat init header glyph-display state-machine return-to-header)))
     2.6  
     2.7 -(defn-memo begin-glyph-bootstrap
     2.8 +(defn begin-glyph-bootstrap
     2.9    ([] (begin-glyph-bootstrap (launch-main-bootstrap-program)))
    2.10    ([script]
    2.11       (let [glyph-init (glyph-init-program relocated-bootstrap-start)
     3.1 --- a/clojure/com/aurellem/run/bootstrap_1.clj	Sat Sep 01 13:32:19 2012 -0500
     3.2 +++ b/clojure/com/aurellem/run/bootstrap_1.clj	Sun Sep 02 06:36:57 2012 -0500
     3.3 @@ -800,18 +800,33 @@
     3.4                         0xD162 (+ 0xD162 (count pattern)))
     3.5            pattern))))
     3.6  
     3.7 -(defn-memo launch-main-bootstrap-program
     3.8 +
     3.9 +(defn item-writer-test-script []
    3.10 +  [[]
    3.11 +   (-> (second (control-checkpoint))
    3.12 +       (set-memory-range
    3.13 +        (inc pc-item-list-start)
    3.14 +        (pc-item-writer-program)))])
    3.15 +
    3.16 +
    3.17 +(defn launch-main-bootstrap-program
    3.18    ([] (launch-main-bootstrap-program
    3.19         ;;(control-checkpoint)
    3.20 -       (launch-bootstrap-program)
    3.21 +       ;;(launch-bootstrap-program)
    3.22 +       (item-writer-test-script)
    3.23         ))
    3.24    ([script]
    3.25 -       (->> script
    3.26 -            (play-moves
    3.27 -             (bootstrap-pattern (main-bootstrap-program)))
    3.28 -            (play-moves
    3.29 -             (take 253 (interleave (repeat 1000 [:b])
    3.30 -                                   (repeat 1000 [])))))))
    3.31 +     (->> script
    3.32 +          (play-moves
    3.33 +           (bootstrap-pattern (main-bootstrap-program)))
    3.34 +          ;; I'd like to just press b here, but I can't
    3.35 +          ;; because the smallest item with item id >= 75 is
    3.36 +          ;; TM01, which has value 201.
    3.37 +          ;; (* 2 (- 201 75)) == 252, which plus 1 is 253 here :(
    3.38 +          ;;(play-moves [[:b]])
    3.39 +          (take 253 (interleave (repeat 1000 [:b])
    3.40 +                                (repeat 1000 []))))))
    3.41 +             
    3.42  (def bootstrap-start pokemon-list-start)
    3.43  
    3.44  (defn test-main-bootstrap-integrety