Mercurial > vba-clojure
comparison clojure/com/aurellem/gb/util.clj @ 273:69184558fcf3
further improvements on hxc-pokemon-base.
author | Dylan Holmes <ocsenave@gmail.com> |
---|---|
date | Tue, 27 Mar 2012 02:05:16 -0500 |
parents | 22f58fa47c3c |
children | eec3e69500d9 |
comparison
equal
deleted
inserted
replaced
272:a60ea8632ff4 | 273:69184558fcf3 |
---|---|
26 | 26 |
27 (defn binary-str [num] | 27 (defn binary-str [num] |
28 (format "%08d" | 28 (format "%08d" |
29 (Integer/parseInt | 29 (Integer/parseInt |
30 (Integer/toBinaryString num) 10))) | 30 (Integer/toBinaryString num) 10))) |
31 | |
31 | 32 |
32 (defn view-register [state name reg-fn] | 33 (defn view-register [state name reg-fn] |
33 (println (format "%s: %s" name | 34 (println (format "%s: %s" name |
34 (binary-str (reg-fn state)))) | 35 (binary-str (reg-fn state)))) |
35 state) | 36 state) |
120 | 121 |
121 | 122 |
122 | 123 |
123 (defn disect-bytes-2 | 124 (defn disect-bytes-2 |
124 "return a vector consiting of the last 16 bytes of the | 125 "return a vector consiting of the last 16 bytes of the |
125 integer expressed as two 8 bit nimbers (inside an integer) | 126 integer expressed as two 8 bit numbers (inside an integer) |
126 in the form [high-bits low-bits." | 127 in the form [high-bits low-bits]." |
127 [num] | 128 [num] |
128 [(bit-shift-right | 129 [(bit-shift-right |
129 (bit-and num 0xFF00) 8) | 130 (bit-and num 0xFF00) 8) |
130 (bit-and num 0xFF)]) | 131 (bit-and num 0xFF)]) |
131 | 132 |