# HG changeset patch # User Robert McIntyre # Date 1333168798 18000 # Node ID 1de6aada1cb78a0c8707bfcc5df9b649c7816f66 # Parent bc1f62b269b51d0b7438006ef223cef42b83546f inserted backwards jump into bootstrap program to fit it into item-pc space diff -r bc1f62b269b5 -r 1de6aada1cb7 clojure/com/aurellem/exp/notes.txt --- a/clojure/com/aurellem/exp/notes.txt Fri Mar 30 23:05:38 2012 -0500 +++ b/clojure/com/aurellem/exp/notes.txt Fri Mar 30 23:39:58 2012 -0500 @@ -2,7 +2,7 @@ start game -name rival "LT" +name rival "LT" (0x8B 0xE1 0x93 0xE1 in character codes) get pikachu, fight rival, deliver oak's parcel, go back to @@ -29,30 +29,15 @@ pattern in the item computer. You can do this with what is in your item list because of the previous setup. -[repeat following 35 times] +[repeat the following 24 times] 0xFF 0x01 [end repeat] -;;; program to swap item ID and quantity at fixed address. -;; here target is equal to rival's thrid and fourth character +;; Second part of program to swap item ID and quantity at +;; fixed address. -0x00 -0x21 ;; load target into HL - -third rival's name character -xD5 -- target item address - -0x00 -0x18 ;; jump relative - -pokeball ;; pokeball = 0x04, so -x any ;; jump over the next four bytes - -target-item type -target-item quantity - -0x00 +0x00 ;; this starts at address 0xD56C 0x2A ;; save (HL)=(target) to A, increment HL 0x00 @@ -63,7 +48,7 @@ 0x00 0x22 ;; save A to target, increment HL [(target+1) -> target] - + 0x00 0x70 ;; load B into target+1 [(target) -> target+1] @@ -73,8 +58,29 @@ burn-heal x 95 -- address of Route 3 memory-function +[repeat the following 8 times] +0xFF +0x01 +[end repeat] -Drop enough from rival's first character/ second character +0x00 ;; this starts at address 0xD58B +0x21 ;; load target into HL + +third rival's name character +x D5 -- target item address + +0x00 +0x18 ;; jump relative + +fifth rival's name character (PK) (TM25) (0xE1 == -31) +x any + +target-item type +target-item quantity + + + +Drop enough from rival's first character/ third character as an item so that it is [_ 0xD5] instead of [_ 0xE1]. shift rival's name's first two characters into @@ -136,3 +142,13 @@ 0x9B ")" ; [x] 0x9C ":" ; [x] --- last valid character for target + + + +;;; character canadates for jump-relative backwards + + 0xE1 "PK" ; [TM25] + 0xE2 "MN" ; [TM26] + 0xE6 "?" ; [TM30] + 0xE7 "!" ; [TM31] + 0xE8 "." ; [TM32] diff -r bc1f62b269b5 -r 1de6aada1cb7 clojure/com/aurellem/gb/util.clj --- a/clojure/com/aurellem/gb/util.clj Fri Mar 30 23:05:38 2012 -0500 +++ b/clojure/com/aurellem/gb/util.clj Fri Mar 30 23:39:58 2012 -0500 @@ -218,3 +218,13 @@ descriptions)))) ([] (print-D-memory @current-state))) + +(defn signed-8-bits + "the lower 8 bits of an integer interpreted as a signed 8 + bit number" + [n] + (let [lower-seven (bit-and n 127)] + (if (bit-test n 7) + (- 128 lower-seven) + lower-seven))) + \ No newline at end of file