Mercurial > vba-clojure
diff clojure/com/aurellem/gb/util.clj @ 174:5ce074824fac
made functions more convienent for repl use.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 21 Mar 2012 03:38:46 -0500 |
parents | 3a3bb2197b7f |
children | 95b2758dd517 |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/gb/util.clj Wed Mar 21 03:31:12 2012 -0500 1.2 +++ b/clojure/com/aurellem/gb/util.clj Wed Mar 21 03:38:46 2012 -0500 1.3 @@ -34,10 +34,13 @@ 1.4 (binary-str (reg-fn state)))) 1.5 state) 1.6 1.7 -(defn view-memory [state mem] 1.8 - (println (format "mem 0x%04X = %s" mem 1.9 - (binary-str (aget (memory state) mem)))) 1.10 - state) 1.11 +(defn view-memory 1.12 + ([^SaveState state mem] 1.13 + (println (format "mem 0x%04X = %s" mem 1.14 + (binary-str (aget (memory state) mem)))) 1.15 + state) 1.16 + ([mem] 1.17 + (view-memory @current-state mem))) 1.18 1.19 (defn print-listing [state begin end] 1.20 (dorun (map 1.21 @@ -47,13 +50,17 @@ 1.22 (range begin end))) 1.23 state) 1.24 1.25 -(defn print-pc [state] 1.26 - (println (format "PC: 0x%04X" (PC state))) 1.27 - state) 1.28 +(defn print-pc 1.29 + ([^SaveState state] 1.30 + (println (format "PC: 0x%04X" (PC state))) 1.31 + state) 1.32 + ([] (print-pc @current-state))) 1.33 1.34 -(defn print-op [state] 1.35 - (println (format "OP: 0x%02X" (aget (memory state) (PC state)))) 1.36 - state) 1.37 +(defn print-op 1.38 + ([^SaveState state] 1.39 + (println (format "OP: 0x%02X" (aget (memory state) (PC state)))) 1.40 + state) 1.41 + ([] (print-op @current-state))) 1.42 1.43 (defn d-tick 1.44 ([state]