Mercurial > vba-clojure
diff 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 diff
1.1 --- a/clojure/com/aurellem/gb_driver.clj Wed Mar 07 23:23:15 2012 -0600 1.2 +++ b/clojure/com/aurellem/gb_driver.clj Thu Mar 08 01:58:36 2012 -0600 1.3 @@ -8,7 +8,11 @@ 1.4 (def yellow-rom-image 1.5 (File. "/home/r/proj/pokemon-escape/roms/yellow.gbc")) 1.6 1.7 +(def yellow-save-file 1.8 + (File. "/home/r/proj/pokemon-escape/roms/yellow.sav")) 1.9 + 1.10 (defn vba-init [] 1.11 + (.delete yellow-save-file) 1.12 (future 1.13 (Gb/startEmulator (.getCanonicalPath yellow-rom-image)))) 1.14 1.15 @@ -33,28 +37,11 @@ 1.16 (def registers 1.17 (cpu-data Gb/NUM_REGISTERS #(Gb/getRegisters %))) 1.18 1.19 - 1.20 -(def key-mask 1.21 - {:a 0x0001 1.22 - :b 0x0002 1.23 - 1.24 - :l 0x0020 1.25 - :r 0x0010 1.26 - :u 0x0040 1.27 - :d 0x0080 1.28 - 1.29 - :0 0x0000 1.30 - 1.31 - :select 0x0004 1.32 - :start 0x0008 1.33 - :restart 0x0800}) 1.34 - 1.35 -(defn keycode [& keys] 1.36 - (reduce bit-or (map key-mask keys))) 1.37 - 1.38 (defn step 1.39 ([] (Gb/step)) 1.40 - ([& keys] (Gb/step (apply keycode keys)))) 1.41 + ([mask] (Gb/step mask))) 1.42 + 1.43 +(defn shutdown [] (Gb/shutdown)) 1.44 1.45 1.46