Mercurial > vba-clojure
diff clojure/com/aurellem/gb/characters.clj @ 176:95b2758dd517
wrote functions to read and write pokemon DV values and status
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 21 Mar 2012 22:13:43 -0500 |
parents | 06426d25c65b |
children | 67c42608ef9d |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/gb/characters.clj Wed Mar 21 18:17:37 2012 -0500 1.2 +++ b/clojure/com/aurellem/gb/characters.clj Wed Mar 21 22:13:43 2012 -0500 1.3 @@ -1,5 +1,5 @@ 1.4 (ns com.aurellem.gb.characters 1.5 - (:use (com.aurellem.gb gb-driver)) 1.6 + (:use (com.aurellem.gb gb-driver constants)) 1.7 (:import [com.aurellem.gb.gb_driver SaveState])) 1.8 1.9 (def character-code->character 1.10 @@ -114,5 +114,21 @@ 1.11 % 1.12 (format "[0x%02X]" %)) 1.13 codes))) 1.14 - 1.15 1.16 +(defn print-text 1.17 + ([^SaveState state begin end] 1.18 + (dorun 1.19 + (map (fn [character-code line] 1.20 + (println 1.21 + (format "0x%04X: " line) 1.22 + (str (character-code->character character-code)))) 1.23 + (subvec (vec (memory state)) begin end) 1.24 + (range begin end))) 1.25 + state) 1.26 + ([begin end] 1.27 + (print-text @current-state begin end))) 1.28 + 1.29 +(defn read-name [codes] 1.30 + (character-codes->str 1.31 + (take-while 1.32 + (partial not= end-of-name-marker) codes)))