comparison clojure/com/aurellem/gb/util.clj @ 222:c9a855de1d07

enabled pokedex printing.
author Robert McIntyre <rlm@mit.edu>
date Sat, 24 Mar 2012 03:10:56 -0500
parents 8523faa122b0
children fe26776e1a58
comparison
equal deleted inserted replaced
221:2fac825a4de9 222:c9a855de1d07
1 (ns com.aurellem.gb.util 1 (ns com.aurellem.gb.util
2 (:use (com.aurellem.gb gb-driver vbm)) 2 (:use (com.aurellem.gb gb-driver vbm constants))
3 (:import java.io.File)
3 (:import [com.aurellem.gb.gb_driver SaveState])) 4 (:import [com.aurellem.gb.gb_driver SaveState]))
4
5 5
6 (defn A [state] 6 (defn A [state]
7 (bit-shift-right (bit-and 0x0000FF00 (AF state)) 8)) 7 (bit-shift-right (bit-and 0x0000FF00 (AF state)) 8))
8 8
9 (defn B [state] 9 (defn B [state]
143 143
144 ([h m l] 144 ([h m l]
145 (+ (glue-bytes m l) 145 (+ (glue-bytes m l)
146 (bit-shift-left h 16)))) 146 (bit-shift-left h 16))))
147 147
148 (def cartography
149 (File. user-home
150 "proj/vba-clojure/clojure/com/aurellem/exp/cartography"))
148 151
152
153
154 (defn print-D-memory
155 ([^SaveState state]
156
157 (let [descriptions
158 (clojure.string/split-lines
159 (slurp cartography))]
160 (dorun
161 (map
162 (fn [line data desc]
163 (printf "%04X %02X%s\n"
164 line data (apply str
165 (drop 20 desc))))
166 (range pokemon-record-begin
167 (inc D-memory-end))
168
169 (subvec (vec (memory state))
170 pokemon-record-begin
171 (inc D-memory-end))
172 descriptions))))
173 ([] (print-D-memory @current-state)))
174