Mercurial > vba-clojure
comparison clojure/com/aurellem/gb_driver.clj @ 64:02bca9640f3f
refactor clojure level
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 07 Mar 2012 20:47:25 -0600 |
parents | c44cf1f5954c |
children | 60c768964937 |
comparison
equal
deleted
inserted
replaced
63:c44cf1f5954c | 64:02bca9640f3f |
---|---|
5 (defn vba-init [] | 5 (defn vba-init [] |
6 (Gb/loadVBA) | 6 (Gb/loadVBA) |
7 (future | 7 (future |
8 (Gb/startEmulator "/home/r/proj/pokemon-escape/roms/yellow.gbc"))) | 8 (Gb/startEmulator "/home/r/proj/pokemon-escape/roms/yellow.gbc"))) |
9 | 9 |
10 (defn get-ram [] | 10 (defn cpu-data [size arr-fn] |
11 (let [ram-store (int-array (Gb/getRAMSize))] | 11 (let [store (int-array size)] |
12 (Gb/getRAM ram-store) | 12 (fn [] |
13 ram-store)) | 13 (arr-fn store) |
14 store))) | |
14 | 15 |
15 (defn get-rom [] | 16 (def ram |
16 (let [rom-store (int-array (Gb/getROMSize))] | 17 (cpu-data (Gb/getRAMSize) #(Gb/getRAM %))) |
17 (Gb/getR0M rom-store) | |
18 rom-store)) | |
19 | 18 |
20 (defn get-working-ram [] | 19 (def rom |
21 (let [ram-store (int-array Gb/WRAM_SIZE)] | 20 (cpu-data (Gb/getROMSize) #(Gb/getROM %))) |
22 (Gb/getWRAM ram-store) | |
23 ram-store)) | |
24 | 21 |
25 (defn get-video-ram [] | 22 (def working-ram |
26 (let [ram-store (int-array Gb/VRAM_SIZE)] | 23 (cpu-data Gb/WRAM_SIZE #(Gb/getWRAM %))) |
27 (Gb/getVRAM ram-store) | |
28 ram-store)) | |
29 | 24 |
30 (defn get-registers [] | 25 (def video-ram |
31 (let [register-store (int-array Gb/NUM_REGISTERS)] | 26 (cpu-data Gb/VRAM_SIZE #(Gb/getVRAM %))) |
32 (Gb/getRegisters register-store) | 27 |
33 register-store)) | 28 (def registers |
29 (cpu-data Gb/NUM_REGISTERS #(Gb/getRegisters %))) | |
30 | |
31 |