diff clojure/com/aurellem/gb/util.clj @ 417:0b6624c1291c

made basic tone player.
author Robert McIntyre <rlm@mit.edu>
date Mon, 16 Apr 2012 14:08:56 -0500
parents 1f14c1b8af7e
children 385799ea1e9c
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/util.clj	Sat Apr 14 05:41:55 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/util.clj	Mon Apr 16 14:08:56 2012 -0500
     1.3 @@ -3,8 +3,10 @@
     1.4    (:import java.io.File)
     1.5    (:import [com.aurellem.gb.gb_driver SaveState]))
     1.6  
     1.7 -(defn A [state]
     1.8 -  (bit-shift-right (bit-and 0x0000FF00 (AF state)) 8))
     1.9 +(defn A
    1.10 +  ([state]
    1.11 +     (bit-shift-right (bit-and 0x0000FF00 (AF state)) 8))
    1.12 +  ([] (A @current-state)))
    1.13  
    1.14  (defn B [state]
    1.15    (bit-shift-right (bit-and 0x0000FF00 (BC state)) 8))
    1.16 @@ -112,8 +114,12 @@
    1.17    ([] (print-op @current-state)))
    1.18  
    1.19  (defn d-tick
    1.20 -  ([state]
    1.21 -  (-> state print-pc print-op tick)))
    1.22 +  ([] (d-tick 1))
    1.23 +  ([n] (d-tick n @current-state))
    1.24 +  ([n state]
    1.25 +     (reduce (fn [state _]
    1.26 +               (-> state print-pc print-op tick))
    1.27 +             state (range n))))
    1.28  
    1.29  (defn print-interrupt
    1.30    [^SaveState state]