Mercurial > vba-clojure
annotate 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 |
rev | line source |
---|---|
rlm@60 | 1 (ns com.aurellem.gb-driver |
rlm@60 | 2 (:import com.aurellem.gb.Gb) |
rlm@60 | 3 (:import (java.nio IntBuffer ByteOrder))) |
rlm@48 | 4 |
rlm@62 | 5 (defn vba-init [] |
rlm@60 | 6 (Gb/loadVBA) |
rlm@60 | 7 (future |
rlm@60 | 8 (Gb/startEmulator "/home/r/proj/pokemon-escape/roms/yellow.gbc"))) |
rlm@60 | 9 |
rlm@64 | 10 (defn cpu-data [size arr-fn] |
rlm@64 | 11 (let [store (int-array size)] |
rlm@64 | 12 (fn [] |
rlm@64 | 13 (arr-fn store) |
rlm@64 | 14 store))) |
rlm@60 | 15 |
rlm@64 | 16 (def ram |
rlm@64 | 17 (cpu-data (Gb/getRAMSize) #(Gb/getRAM %))) |
rlm@61 | 18 |
rlm@64 | 19 (def rom |
rlm@64 | 20 (cpu-data (Gb/getROMSize) #(Gb/getROM %))) |
rlm@61 | 21 |
rlm@64 | 22 (def working-ram |
rlm@64 | 23 (cpu-data Gb/WRAM_SIZE #(Gb/getWRAM %))) |
rlm@62 | 24 |
rlm@64 | 25 (def video-ram |
rlm@64 | 26 (cpu-data Gb/VRAM_SIZE #(Gb/getVRAM %))) |
rlm@64 | 27 |
rlm@64 | 28 (def registers |
rlm@64 | 29 (cpu-data Gb/NUM_REGISTERS #(Gb/getRegisters %))) |
rlm@64 | 30 |
rlm@64 | 31 |