comparison clojure/com/aurellem/gb_driver.clj @ 94:612393a0d3a0

fixed memory retrieval function to use the simulated gameboy's mapped memory
author Robert McIntyre <rlm@mit.edu>
date Sun, 11 Mar 2012 20:55:21 -0500
parents 4c60ebca1a9d
children b74a578d0c88
comparison
equal deleted inserted replaced
93:4c60ebca1a9d 94:612393a0d3a0
130 130
131 ;;;;;;;;;;;;;;; CPU data 131 ;;;;;;;;;;;;;;; CPU data
132 132
133 (defn cpu-data [size arr-fn] 133 (defn cpu-data [size arr-fn]
134 (let [store (int-array size)] 134 (let [store (int-array size)]
135 (fn [state] (set-state! state) (arr-fn store) store))) 135 (fn get-data
136 ([] (get-data @current-state))
137 ([state]
138 (set-state! state) (arr-fn store) store))))
136 139
137 (def memory 140 (def memory
138 (cpu-date Gb/GB_MEMORY #(Gb/getMemory %))) 141 (cpu-data Gb/GB_MEMORY #(Gb/getMemory %)))
139 142
140 (def ram 143 (def ram
141 (cpu-data Gb/RAM_SIZE #(Gb/getRAM %))) 144 (cpu-data Gb/RAM_SIZE #(Gb/getRAM %)))
142 145
143 (def rom 146 (def rom