annotate clojure/com/aurellem/world/practice.clj @ 498:554883a95de0

discovered gameboy->vga color map.
author Robert McIntyre <rlm@mit.edu>
date Mon, 11 Jun 2012 10:07:01 -0500
parents de172acc5a03
children
rev   line source
ocsenave@185 1 (ns com.aurellem.world.practice
ocsenave@308 2 (:use (com.aurellem.gb saves util mem-util constants gb-driver vbm items assembly characters))
ocsenave@227 3 (:use (com.aurellem.exp pokemon))
ocsenave@227 4 (:use (com.aurellem.exp item-bridge))
ocsenave@227 5 (:import [com.aurellem.gb.gb_driver SaveState]))
ocsenave@227 6
ocsenave@227 7
ocsenave@227 8 ;;(def original-rom (rom(root)))
ocsenave@227 9
ocsenave@185 10 (defn state-surprise
ocsenave@185 11 "This is one tick before the trainer goes [!]"
ocsenave@185 12 []
ocsenave@185 13 (->
ocsenave@185 14 (pre-trainer-battle)
ocsenave@185 15 (step [:r])
ocsenave@185 16 (step)
ocsenave@185 17 (ntick 88147)
ocsenave@185 18 ;(step [:r])
ocsenave@185 19
ocsenave@185 20 ;(step [:r])
ocsenave@185 21 ;(step [:r])
ocsenave@185 22 ;(step [:r])
ocsenave@185 23 ;(step [:r])
ocsenave@185 24 ))
ocsenave@289 25
ocsenave@194 26 (defn state-inject
ocsenave@194 27 "I have replaced the letter e with e-acute @ 0xC4E8."
ocsenave@194 28 []
ocsenave@194 29 (read-state "inject-surprise"))
ocsenave@185 30
ocsenave@185 31
ocsenave@185 32
ocsenave@185 33
ocsenave@194 34
ocsenave@194 35
ocsenave@194 36
ocsenave@194 37 (defn state-speak
ocsenave@194 38 "This is when the trainer speaks."
ocsenave@194 39 []
ocsenave@194 40 (->
ocsenave@194 41 (pre-trainer-battle)
ocsenave@194 42 (set-memory 0xD354 0x0)
ocsenave@194 43 (step [:r])
ocsenave@194 44 (step)
ocsenave@194 45 (ntick 88147)
ocsenave@194 46 (tick)
ocsenave@194 47 (nstep 102)
ocsenave@194 48
ocsenave@194 49 ;(step [:r])
ocsenave@194 50
ocsenave@194 51 ;(step [:r])
ocsenave@194 52 ;(step [:r])
ocsenave@194 53 ;(step [:r])
ocsenave@194 54 ;(step [:r])
ocsenave@194 55 ))
ocsenave@194 56
ocsenave@194 57
ocsenave@194 58
ocsenave@194 59
ocsenave@194 60
ocsenave@227 61
ocsenave@227 62
ocsenave@227 63 (comment
ocsenave@194 64 (println)
ocsenave@194 65 (print (character-codes->str (take 6000 (drop 0xA75F4
ocsenave@227 66 (vec(com.aurellem.gb.gb-driver/rom)))))))
ocsenave@194 67
ocsenave@194 68 ;(dorun (map println (view-memory* (state-surprise) 0x1AEF 1600)))
ocsenave@194 69
ocsenave@194 70
ocsenave@194 71
ocsenave@194 72 (def surprise-words
ocsenave@194 73 [0x80 0xAB 0xAB 0x7F 0xB1 0xA8 0xA6 0xA7 0xB3 0xE7 0x7F 0x8B 0xA4 0xB3 0xE0 0xB2 0x7F 0xB1 0xAE 0xAB 0xAB 0x7F 0xB3 0xA7 0xA4 0x7F 0xA3 0xA8 0xA2 0xA4 0xE7])
ocsenave@194 74
ocsenave@227 75
ocsenave@194 76
ocsenave@194 77
ocsenave@194 78
ocsenave@194 79 (defn change-speech
ocsenave@194 80 ([state str k]
ocsenave@194 81 (loop [ops str
ocsenave@194 82 s state
ocsenave@194 83 n k]
ocsenave@194 84 (if (empty? ops) s
ocsenave@194 85 (recur
ocsenave@194 86 (rest ops)
ocsenave@194 87 (set-memory (first-change s (+ 0xC4B9 n)) (+ 0xC4B9 n)
ocsenave@194 88 (first ops))
ocsenave@194 89 (if (not= n 19) (inc n)
ocsenave@194 90 (+ n 21))))))
ocsenave@194 91 ([str k]
ocsenave@194 92 (change-speech (state-speak) str k))
ocsenave@194 93 ([str]
ocsenave@227 94 (change-speech str 0)))
ocsenave@227 95
ocsenave@227 96
ocsenave@227 97
ocsenave@227 98
ocsenave@227 99
ocsenave@308 100
ocsenave@227 101
ocsenave@227 102
ocsenave@227 103
ocsenave@227 104 (def oak-intro
ocsenave@227 105
ocsenave@227 106 (list "Hello there!"
ocsenave@227 107 0x4F
ocsenave@227 108 "Welcome to the"
ocsenave@227 109 0x55
ocsenave@227 110 "world of "
ocsenave@227 111 0x54
ocsenave@227 112 "MON!"
ocsenave@227 113 0x51
ocsenave@227 114 "My name is OAK!"
ocsenave@227 115 0x4F
ocsenave@227 116 "People call me"
ocsenave@227 117 0x55
ocsenave@227 118 "the "
ocsenave@227 119 0x54
ocsenave@227 120 "MON PROF!"
ocsenave@227 121 0x58
ocsenave@227 122 "This world is"
ocsenave@227 123 0x4F
ocsenave@227 124 "inhabited by"
ocsenave@227 125 0x55
ocsenave@227 126 "creatures called"
ocsenave@227 127 0x55
ocsenave@227 128 0x54
ocsenave@227 129 "MON!"
ocsenave@227 130 0x50
ocsenave@227 131 0x50
ocsenave@227 132 0x51
ocsenave@227 133 "For some people, "
ocsenave@227 134 0x4F
ocsenave@227 135 0x54
ocsenave@227 136 "MON are"
ocsenave@227 137 0x55
ocsenave@227 138 "pets. Others use"
ocsenave@227 139 0x55
ocsenave@227 140 "them for fights."
ocsenave@227 141 0x51
ocsenave@227 142 "Myself..."
ocsenave@227 143 0x51
ocsenave@227 144 "I study "
ocsenave@227 145 0x54
ocsenave@227 146 "MON"
ocsenave@227 147 0x4F
ocsenave@227 148 "as a profession."
ocsenave@227 149 0x58
ocsenave@227 150 "First, what is"
ocsenave@227 151 0x4F
ocsenave@227 152 "your name?"
ocsenave@227 153 0x58
ocsenave@227 154 "This is my grand-"
ocsenave@227 155 0x4F
ocsenave@227 156 "son. He's been"
ocsenave@227 157 0x55
ocsenave@227 158 "your rival since"
ocsenave@227 159 0x55
ocsenave@227 160 "you were a baby."
ocsenave@227 161 0x51
ocsenave@227 162 "...Erm, what is"
ocsenave@227 163 0x4F
ocsenave@227 164 "his name again?"
ocsenave@227 165 0x58
ocsenave@227 166 0x52
ocsenave@227 167 "!"
ocsenave@227 168 0x51
ocsenave@227 169 "Your very own"
ocsenave@227 170 0x4F
ocsenave@227 171 0x54
ocsenave@227 172 "MON legend is"
ocsenave@227 173 0x55
ocsenave@227 174 "about to unfold!"
ocsenave@227 175 0x51
ocsenave@227 176 "A world of dreams"
ocsenave@227 177 0x4F
ocsenave@227 178 "and adventures"
ocsenave@227 179 0x55
ocsenave@227 180 "with "
ocsenave@227 181 0x54
ocsenave@227 182 "MON"
ocsenave@227 183 0x55
ocsenave@227 184 "awaits! Let's go!"
ocsenave@227 185 0x57) )
ocsenave@227 186
ocsenave@227 187 (defn state-intro
ocsenave@227 188 "Professor Oak speaks!"
ocsenave@227 189 []
ocsenave@227 190 (do
ocsenave@227 191 (->
ocsenave@227 192 (rewrite-rom 0xA07BB
ocsenave@227 193 (list 0x87 0xA4 0xAB 0xAB 0xAE 0x7F 0xB3 0xA7 0xA4 0xB1 0xA4 0xE7 0x4F 0x96 0xA4 0xAB 0xA2 0xAE 0xAC 0xA4 0x7F 0xB3 0xAE 0x7F 0xB3 0xA7 0xA4 0x55 0xB6 0xAE 0xB1 0xAB 0xA3 0x7F 0xAE 0xA5 0x7F 0x54 0x8C 0x8E 0x8D 0xE7 0x51 0x8C 0xB8 0x7F 0xAD 0xA0 0xAC 0xA4 0x7F 0xA8 0xB2 0x7F 0x8E 0x80 0x8A 0xE7 0x4F 0x8F 0xA4 0xAE 0xAF 0xAB 0xA4 0x7F 0xA2 0xA0 0xAB 0xAB 0x7F 0xAC 0xA4 0x55 0xB3 0xA7 0xA4 0x7F 0x8F 0x8C 0x8E 0x8D 0x7F 0x8F 0x91 0x8E 0x85 0xE7 0x58 0x93 0xA7 0xA8 0xB2 0x7F 0xB6 0xAE 0xB1 0xAB 0xA3 0x7F 0xA8 0xB2 0x4F 0xA8 0xAD 0xA7 0xA0 0xA1 0xA8 0xB3 0xA4 0xA3 0x7F 0xA1 0xB8 0x55 0xA2 0xB1 0xA4 0xA0 0xB3 0xB4 0xB1 0xA4 0xB2 0x7F 0xA2 0xA0 0xAB 0xAB 0xA4 0xA3 0x55 0x54 0x8C 0x8E 0x8D 0xE7 0x50 0x50 0x51 0x85 0xAE 0x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A4 0xB1 0x4F 0xFC 0x71 0xFE 0x73 0x7F 0xB3 0xA0 0xAB 0xAB 0xE7 0x58 0x1 0x6D 0xCD 0x0)
ocsenave@227 194 ;; (list
ocsenave@227 195 ;; "Sleeping on the"
ocsenave@227 196 ;; 0x4F
ocsenave@227 197 ;; "job again are we?"
ocsenave@227 198 ;; 0x51
ocsenave@227 199 ;; 0x00
ocsenave@227 200 ;; "test"
ocsenave@227 201 ;; 0x59
ocsenave@227 202 ;; "EOM")
ocsenave@227 203
ocsenave@227 204
ocsenave@227 205 )
ocsenave@227 206 (int-array)
ocsenave@227 207 (write-rom!))
ocsenave@227 208 (root)
ocsenave@227 209
ocsenave@227 210 )
ocsenave@227 211
ocsenave@194 212 )
ocsenave@194 213
ocsenave@227 214 (comment
ocsenave@227 215 "Hello there![0x4F]Welcome to the[0x55]world of [POKE]MON![0x51]My
ocsenave@227 216 name is OAK![0x4F]People call me[0x55]the [POKE]MON PROF![0x58]This
ocsenave@227 217 world is[0x4F]inhabited by[0x55]creatures
ocsenave@227 218 called[0x55][POKE]MON![0x50][0x50][0x51]For some people,
ocsenave@227 219 [0x4F][POKE]MON are[0x55]pets. Others use[0x55]them for
ocsenave@227 220 fights.[0x51]Myself...[0x51]I study [POKE]MON[0x4F]as a
ocsenave@227 221 profession.[0x58]First, what is[0x4F]your name?[0x58]This is my
ocsenave@227 222 grand-[0x4F]son. He's been[0x55]your rival since[0x55]you were a
ocsenave@227 223 baby.[0x51]...Erm, what is[0x4F]his name again?[0x58][RED]![0x51]Your
ocsenave@227 224 very own[0x4F][POKE]MON legend is[0x55]about to unfold![0x51]A world
ocsenave@227 225 of dreams[0x4F]and adventures[0x55]with [POKE]MON[0x55]awaits! Let's
ocsenave@227 226 go![0x57]")
ocsenave@227 227
ocsenave@227 228
ocsenave@227 229
ocsenave@227 230
ocsenave@227 231
ocsenave@227 232
ocsenave@227 233
ocsenave@227 234
ocsenave@227 235
ocsenave@227 236
ocsenave@227 237
ocsenave@227 238
ocsenave@227 239