Mercurial > vba-clojure
view clojure/com/aurellem/gb_driver.clj @ 67:8cb500493ec2
building code to play vbm files
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 08 Mar 2012 01:58:36 -0600 |
parents | 43d4fb2a6fc2 |
children | ff6f1acae59e |
line wrap: on
line source
1 (ns com.aurellem.gb-driver2 (:import com.aurellem.gb.Gb)3 (:import java.io.File)4 (:import (java.nio IntBuffer ByteOrder)))6 (Gb/loadVBA)8 (def yellow-rom-image9 (File. "/home/r/proj/pokemon-escape/roms/yellow.gbc"))11 (def yellow-save-file12 (File. "/home/r/proj/pokemon-escape/roms/yellow.sav"))14 (defn vba-init []15 (.delete yellow-save-file)16 (future17 (Gb/startEmulator (.getCanonicalPath yellow-rom-image))))19 (defn cpu-data [size arr-fn]20 (let [store (int-array size)]21 (fn []22 (arr-fn store)23 store)))25 (def ram26 (cpu-data (Gb/getRAMSize) #(Gb/getRAM %)))28 (def rom29 (cpu-data (Gb/getROMSize) #(Gb/getROM %)))31 (def working-ram32 (cpu-data Gb/WRAM_SIZE #(Gb/getWRAM %)))34 (def video-ram35 (cpu-data Gb/VRAM_SIZE #(Gb/getVRAM %)))37 (def registers38 (cpu-data Gb/NUM_REGISTERS #(Gb/getRegisters %)))40 (defn step41 ([] (Gb/step))42 ([mask] (Gb/step mask)))44 (defn shutdown [] (Gb/shutdown))