diff clojure/com/aurellem/run/bootstrap_0.clj @ 303:5bcda2d6d135

item manipulation program works!
author Robert McIntyre <rlm@mit.edu>
date Sat, 31 Mar 2012 00:33:35 -0500
parents 0b3e89103dc2
children fefe5ce49b21
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/bootstrap_0.clj	Sat Mar 31 00:05:39 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/bootstrap_0.clj	Sat Mar 31 00:33:35 2012 -0500
     1.3 @@ -784,6 +784,8 @@
     1.4            (do-nothing 1))))
     1.5      
     1.6  
     1.7 +("d572" "d573" "d574" "d575" "d576" "d577" "d58b" "d58e" "d58f" "ff80" "ff82" "ff84" "ff86" "ff87" "ff89")
     1.8 +
     1.9  
    1.10  (defn test-pc-item-program []
    1.11    (-> (read-state "bootstrap-init")
    1.12 @@ -794,47 +796,49 @@
    1.13         (flatten
    1.14          [
    1.15           (repeat
    1.16 -          25
    1.17 +          28
    1.18            [0xFF 0x01])
    1.19 -         [0x00   ;;  second part of item manipulation program
    1.20 -          0x2A   
    1.21 -          
    1.22 -          0x00
    1.23 -          0x47   
    1.24 -          
    1.25 -          0x00
    1.26 -          0x3A
    1.27 +         [;;  second part of item manipulation program
    1.28 +          0x00   ;; this starts at address 0xD56C
    1.29 +          0x2A   ;; save (HL)=(target) to A, increment HL
    1.30  
    1.31            0x00
    1.32 -          0x22
    1.33 +          0x47   ;; save A to B					
    1.34  
    1.35            0x00
    1.36 -          0X70
    1.37 +          0x3A   ;; save (target+1) to A, decrement HL		
    1.38  
    1.39            0x00
    1.40 -          0xC3
    1.41 +          0x22   ;; A -> target, increment HL [(target+1) -> target]
    1.42  
    1.43 -          0x0C
    1.44 +          0x00
    1.45 +          0x70   ;; load B into target+1 [(target) -> target+1]	
    1.46 +
    1.47 +          0x00
    1.48 +          0xC3   ;; first part of absolute jump
    1.49 +
    1.50 +          0x0C   ;; return control to pokemon kernel
    1.51            0x5F]
    1.52           (repeat
    1.53 -          8
    1.54 +          5
    1.55            [0xFF 0x01])
    1.56  
    1.57 -         [0x00
    1.58 -          0x21
    1.59 +         [;; first part of item manipulation program
    1.60 +          0x00
    1.61 +          0x21   ;; load target into HL
    1.62  
    1.63 -          0x93
    1.64 +          0x94   ;; this is the target address
    1.65            0xD5
    1.66  
    1.67 -          0x00
    1.68 -          0x18
    1.69 +          0x00   ;; relative jump back to first part
    1.70 +          0x18   
    1.71  
    1.72 -          0xE1
    1.73 +          0xE1   ;; of program
    1.74            0x01
    1.75  
    1.76 -          0xFF
    1.77 +          0xFF   ;; spacer
    1.78            0x01
    1.79            
    1.80 -          0x04  ;; target ID
    1.81 -          0x3E  ;; target Quantity
    1.82 +          0x04  ;; target ID        (pokeball)
    1.83 +          0x3E  ;; target Quantity  (lemonade)
    1.84            ]]))))