changeset 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 8665160f0f3d
children 5d9a7a0ca09a
files clojure/com/aurellem/exp/item_bridge.clj clojure/com/aurellem/gb/util.clj
diffstat 2 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/exp/item_bridge.clj	Wed Mar 21 03:31:12 2012 -0500
     1.2 +++ b/clojure/com/aurellem/exp/item_bridge.clj	Wed Mar 21 03:38:46 2012 -0500
     1.3 @@ -62,7 +62,7 @@
     1.4                 (conj pcs (first (registers))))))))
     1.5  
     1.6  (defn loop-program []
     1.7 -  [0xF3     ;0xD31D  ;; disable-interrupts
     1.8 +  [0x00     ;0xD31D  ;; disable-interrupts
     1.9  
    1.10     0xC3     ;; loop forever
    1.11     0x1D
    1.12 @@ -71,14 +71,14 @@
    1.13  (def map-function-address-start 0xD36D)
    1.14  
    1.15  (defn test-loop []
    1.16 -  (capture-program-counter
    1.17 +  (continue!
    1.18     (-> (mid-game) 
    1.19         (set-memory-range 0xD31D (loop-program))
    1.20         (set-memory-range
    1.21          map-function-address-start
    1.22 -        [0xD3 0x1D])
    1.23 -       (IE! 0))
    1.24 -   1000))
    1.25 +        [0xD3 0x1D]))))
    1.26 +       
    1.27 +
    1.28  
    1.29  
    1.30  (defn-memo corrupt-moves []
     2.1 --- a/clojure/com/aurellem/gb/util.clj	Wed Mar 21 03:31:12 2012 -0500
     2.2 +++ b/clojure/com/aurellem/gb/util.clj	Wed Mar 21 03:38:46 2012 -0500
     2.3 @@ -34,10 +34,13 @@
     2.4                     (binary-str (reg-fn state))))
     2.5    state)
     2.6  
     2.7 -(defn view-memory [state mem]
     2.8 -  (println (format "mem 0x%04X = %s" mem
     2.9 -                   (binary-str (aget (memory state) mem))))
    2.10 -  state)
    2.11 +(defn view-memory
    2.12 +  ([^SaveState state mem]
    2.13 +     (println (format "mem 0x%04X = %s" mem
    2.14 +                      (binary-str (aget (memory state) mem))))
    2.15 +     state)
    2.16 +  ([mem]
    2.17 +     (view-memory @current-state mem)))
    2.18  
    2.19  (defn print-listing [state begin end]
    2.20    (dorun (map 
    2.21 @@ -47,13 +50,17 @@
    2.22            (range begin end)))
    2.23    state)
    2.24  
    2.25 -(defn print-pc [state]
    2.26 -  (println (format "PC: 0x%04X" (PC state)))
    2.27 -  state)
    2.28 +(defn print-pc
    2.29 +  ([^SaveState state]
    2.30 +     (println (format "PC: 0x%04X" (PC state)))
    2.31 +     state)
    2.32 +  ([] (print-pc @current-state))) 
    2.33  
    2.34 -(defn print-op [state]
    2.35 -  (println (format "OP: 0x%02X" (aget (memory state) (PC state))))
    2.36 -  state)
    2.37 +(defn print-op
    2.38 +  ([^SaveState state]
    2.39 +     (println (format "OP: 0x%02X" (aget (memory state) (PC state))))
    2.40 +     state)
    2.41 +  ([] (print-op @current-state)))
    2.42  
    2.43  (defn d-tick
    2.44    ([state]