Mercurial > vba-clojure
comparison clojure/com/aurellem/gb/gb_driver.clj @ 522:5596cd4a3fc6
added RAM display.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 23 Jun 2012 19:12:26 -0500 |
parents | a6d060a64246 |
children | d00096b6bf17 |
comparison
equal
deleted
inserted
replaced
521:bad7b7430245 | 522:5596cd4a3fc6 |
---|---|
152 (defn play-moves | 152 (defn play-moves |
153 ([moves [prev state]] | 153 ([moves [prev state]] |
154 (set-state! state) | 154 (set-state! state) |
155 (dorun (map (fn [move] (step @current-state move)) moves)) | 155 (dorun (map (fn [move] (step @current-state move)) moves)) |
156 [(concat prev moves) @current-state])) | 156 [(concat prev moves) @current-state])) |
157 | |
158 (defn accurate-memory | |
159 ([^SaveState state address] | |
160 (set-state! state) | |
161 (Gb/readMemory address)) | |
162 ([address] | |
163 (accurate-memory @current-state address))) | |
157 | 164 |
158 ;;;;;;;;;;; | 165 ;;;;;;;;;;; |
159 | 166 |
160 ;; Get Screen Pixels, Save Screenshot | 167 ;; Get Screen Pixels, Save Screenshot |
161 | 168 |
163 ([^SaveState state ^File target] | 170 ([^SaveState state ^File target] |
164 (set-state! state) | 171 (set-state! state) |
165 (Gb/nwritePNG (.getCanonicalPath target))) | 172 (Gb/nwritePNG (.getCanonicalPath target))) |
166 ([^File target] | 173 ([^File target] |
167 (write-png! @current-state target))) | 174 (write-png! @current-state target))) |
168 | |
169 | |
170 | |
171 | 175 |
172 ;;;;;;;;;;;;;;; CPU data | 176 ;;;;;;;;;;;;;;; CPU data |
173 | 177 |
174 (defn cpu-data [size arr-fn] | 178 (defn cpu-data [size arr-fn] |
175 (let [store (int-array size)] | 179 (let [store (int-array size)] |
293 ;; Glen Cook, Jeff Frohwein, and Rob Jones. | 297 ;; Glen Cook, Jeff Frohwein, and Rob Jones. |
294 (defn rgb->gb-rb [[r g b :as color]] | 298 (defn rgb->gb-rb [[r g b :as color]] |
295 (let [store (int-array 3)] | 299 (let [store (int-array 3)] |
296 (Gb/translateRGB (int-array color) store) | 300 (Gb/translateRGB (int-array color) store) |
297 (vec store))) | 301 (vec store))) |
298 | |
299 |