view clojure/com/aurellem/gb_driver.clj @ 70:ff6f1acae59e

removed zero frame confusion
author Robert McIntyre <rlm@mit.edu>
date Thu, 08 Mar 2012 02:25:20 -0600
parents 8cb500493ec2
children 39928bf4622d
line wrap: on
line source
1 (ns com.aurellem.gb-driver
2 (:import com.aurellem.gb.Gb)
3 (:import java.io.File)
4 (:import (java.nio IntBuffer ByteOrder)))
6 (Gb/loadVBA)
8 (def yellow-rom-image
9 (File. "/home/r/proj/pokemon-escape/roms/yellow.gbc"))
11 (def yellow-save-file
12 (File. "/home/r/proj/pokemon-escape/roms/yellow.sav"))
14 (defn vba-init []
15 (.delete yellow-save-file)
16 (Gb/startEmulator (.getCanonicalPath yellow-rom-image)))
18 (defn cpu-data [size arr-fn]
19 (let [store (int-array size)]
20 (fn []
21 (arr-fn store)
22 store)))
24 (def ram
25 (cpu-data (Gb/getRAMSize) #(Gb/getRAM %)))
27 (def rom
28 (cpu-data (Gb/getROMSize) #(Gb/getROM %)))
30 (def working-ram
31 (cpu-data Gb/WRAM_SIZE #(Gb/getWRAM %)))
33 (def video-ram
34 (cpu-data Gb/VRAM_SIZE #(Gb/getVRAM %)))
36 (def registers
37 (cpu-data Gb/NUM_REGISTERS #(Gb/getRegisters %)))
39 (defn step
40 ([] (Gb/step))
41 ([mask] (Gb/step mask)))
43 (defn shutdown [] (Gb/shutdown))