diff clojure/com/aurellem/exp/item_bridge.clj @ 238:e23ab90fcc86

found appropriate map-function on Route 3
author Robert McIntyre <rlm@mit.edu>
date Sun, 25 Mar 2012 00:08:23 -0500
parents 5becef6312b9
children 19fd38fe376e
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/exp/item_bridge.clj	Sat Mar 24 23:38:21 2012 -0500
     1.2 +++ b/clojure/com/aurellem/exp/item_bridge.clj	Sun Mar 25 00:08:23 2012 -0500
     1.3 @@ -178,39 +178,41 @@
     1.4      0x1D
     1.5      0xD3 ;; set first item to lemonade
     1.6      
     1.7 -    0xC3 ;; return control to the game via absolute junp.
     1.8 +    0xC3 ;; return control to the game via absolute jump.
     1.9      (read-map-function-address state)
    1.10      ]))
    1.11  
    1.12  (defn test-trampoline
    1.13    "Demonstrates item-program execution via the map-function that
    1.14     returns control to the main pokemon game after one loop."
    1.15 -  []
    1.16 +  [assembly-fn state]
    1.17    (let [insertion-address 0xD33D
    1.18          insertion-address-bits [0x3D 0xD3]]
    1.19    (->
    1.20 -   (menu-open-state)
    1.21 +   state
    1.22     (set-memory-range
    1.23      insertion-address
    1.24 -    (trampoline-assembly (menu-open-state)))
    1.25 +    (assembly-fn state))
    1.26     (set-memory-range 
    1.27      memory-function-address-start
    1.28      insertion-address-bits))))
    1.29  
    1.30 +(def lemonade-trampoline (partial test-trampoline
    1.31 +                                  trampoline-assembly
    1.32 +                                  (menu-open-state)))
    1.33  
    1.34 +(defn trampoline-assembly-burn-heal [^SaveState state]
    1.35 +  (flatten
    1.36 +   [0x3E ;; 
    1.37 +    0x3E ;; load lemonade into A
    1.38 +    
    1.39 +    0xEA
    1.40 +    0x1D
    1.41 +    0xD3 ;; set first item to lemonade
    1.42 +    
    1.43 +    0xC3 ;; return control to the game via absolute jump.
    1.44 +    0x0C ;; return control to Route 3's map-function
    1.45 +    0x55
    1.46 +    ]))
    1.47  
    1.48 -;;map-functions
    1.49  
    1.50 -;; Room, Upstairs        0xBO 0x40
    1.51 -;; Room, Downstairs      0x02 0x41
    1.52 -;; Pallet Town           0xFA 0x4D
    1.53 -;; Rival's House         0x3B 0x5C
    1.54 -;; Oak's Lab             0x92 0x43
    1.55 -;; Route 1               0x58 0x43
    1.56 -;; Viridian City         0x2A 0x50
    1.57 -;; Viridian PkmnCenter   0x5D 0x42
    1.58 -;; Viridian Mart         0x7A 0x4C
    1.59 -;; Viridian House #1     0x79 0x4D
    1.60 -;; Viridian House #2     0xD3 0x4D
    1.61 -;; Route 22              0xB3 0x4E
    1.62 -;; League Front Gate     0x8D 0x5F
    1.63 \ No newline at end of file