# HG changeset patch # User Robert McIntyre # Date 1346585831 18000 # Node ID 0b4ff504157da4f918c91887227c982f3b5f1e93 # Parent 747d47d96d2f936eda29f67a5408831ee123e1b3# Parent 2fda49e1d0c5ded5c244d781d25336f924383670 merge. diff -r 2fda49e1d0c5 -r 0b4ff504157d clojure/com/aurellem/gb/rlm_assembly.clj --- a/clojure/com/aurellem/gb/rlm_assembly.clj Sat Sep 01 18:37:19 2012 -0400 +++ b/clojure/com/aurellem/gb/rlm_assembly.clj Sun Sep 02 06:37:11 2012 -0500 @@ -6,10 +6,11 @@ (defn pc-item-writer-program [] - (let [limit 201 ;; should be more like 92 + (let [;;limit 75 + limit 201 ;; (item-hack 201 is the smallest I could make this.) [target-high target-low] (disect-bytes-2 pokemon-list-start)] (flatten - [[0x00 ;; (item-hack) set increment stack pointer no-op + [[0x00 ;; (item-hack) no-op (can't buy repel (1E) at celadon) 0x1E ;; load limit into E limit 0x3F ;; (item-hack) set carry flag no-op @@ -494,7 +495,7 @@ moves (map (comp buttons (partial - 15)) nybbles) header (map buttons (concat (repeat - 50 + 23 ;; found by manual binary search (- 15 (first nybbles))) [(first nybbles)]))] (assert (no-consecutive-repeats? nybbles)) diff -r 2fda49e1d0c5 -r 0b4ff504157d clojure/com/aurellem/run/adv_choreo.clj --- a/clojure/com/aurellem/run/adv_choreo.clj Sat Sep 01 18:37:19 2012 -0400 +++ b/clojure/com/aurellem/run/adv_choreo.clj Sun Sep 02 06:37:11 2012 -0500 @@ -303,7 +303,7 @@ (+ (count init) start-address)))])] (concat init header glyph-display state-machine return-to-header))) -(defn-memo begin-glyph-bootstrap +(defn begin-glyph-bootstrap ([] (begin-glyph-bootstrap (launch-main-bootstrap-program))) ([script] (let [glyph-init (glyph-init-program relocated-bootstrap-start) diff -r 2fda49e1d0c5 -r 0b4ff504157d clojure/com/aurellem/run/bootstrap_1.clj --- a/clojure/com/aurellem/run/bootstrap_1.clj Sat Sep 01 18:37:19 2012 -0400 +++ b/clojure/com/aurellem/run/bootstrap_1.clj Sun Sep 02 06:37:11 2012 -0500 @@ -800,18 +800,33 @@ 0xD162 (+ 0xD162 (count pattern))) pattern)))) -(defn-memo launch-main-bootstrap-program + +(defn item-writer-test-script [] + [[] + (-> (second (control-checkpoint)) + (set-memory-range + (inc pc-item-list-start) + (pc-item-writer-program)))]) + + +(defn launch-main-bootstrap-program ([] (launch-main-bootstrap-program ;;(control-checkpoint) - (launch-bootstrap-program) + ;;(launch-bootstrap-program) + (item-writer-test-script) )) ([script] - (->> script - (play-moves - (bootstrap-pattern (main-bootstrap-program))) - (play-moves - (take 253 (interleave (repeat 1000 [:b]) - (repeat 1000 []))))))) + (->> script + (play-moves + (bootstrap-pattern (main-bootstrap-program))) + ;; I'd like to just press b here, but I can't + ;; because the smallest item with item id >= 75 is + ;; TM01, which has value 201. + ;; (* 2 (- 201 75)) == 252, which plus 1 is 253 here :( + ;;(play-moves [[:b]]) + (take 253 (interleave (repeat 1000 [:b]) + (repeat 1000 [])))))) + (def bootstrap-start pokemon-list-start) (defn test-main-bootstrap-integrety