comparison clojure/com/aurellem/gb_driver.clj @ 62:4699c7bab77d

added code to retrieve CPU registers
author Robert McIntyre <rlm@mit.edu>
date Wed, 07 Mar 2012 20:10:21 -0600
parents dc8b383ecefa
children c44cf1f5954c
comparison
equal deleted inserted replaced
61:dc8b383ecefa 62:4699c7bab77d
1 (ns com.aurellem.gb-driver 1 (ns com.aurellem.gb-driver
2 (:import com.aurellem.gb.Gb) 2 (:import com.aurellem.gb.Gb)
3 (:import (java.nio IntBuffer ByteOrder))) 3 (:import (java.nio IntBuffer ByteOrder)))
4 4
5 5 (defn vba-init []
6 (defn init-vba []
7 (Gb/loadVBA) 6 (Gb/loadVBA)
8 (future 7 (future
9 (Gb/startEmulator "/home/r/proj/pokemon-escape/roms/yellow.gbc"))) 8 (Gb/startEmulator "/home/r/proj/pokemon-escape/roms/yellow.gbc")))
10
11 9
12 (defn get-ram [] 10 (defn get-ram []
13 (let [ram-store (int-array (Gb/getRAMSize))] 11 (let [ram-store (int-array (Gb/getRAMSize))]
14 (Gb/getRAM ram-store) 12 (Gb/getRAM ram-store)
15 ram-store)) 13 ram-store))
16
17 14
18 (defn get-rom [] 15 (defn get-rom []
19 (let [rom-store (int-array (Gb/getROMSize))] 16 (let [rom-store (int-array (Gb/getROMSize))]
20 (Gb/getRAM rom-store) 17 (Gb/getRAM rom-store)
21 rom-store)) 18 rom-store))
27 24
28 (defn get-video-ram [] 25 (defn get-video-ram []
29 (let [ram-store (int-array Gb/VRAM_SIZE)] 26 (let [ram-store (int-array Gb/VRAM_SIZE)]
30 (Gb/getVRAM ram-store) 27 (Gb/getVRAM ram-store)
31 ram-store)) 28 ram-store))
29
30 (defn get-registers []
31 (let [register-store (int-array Gb/NUM_REGISTERS)]
32 (Gb/getRegisters register-store)
33 register-store))