Mercurial > vba-clojure
view clojure/com/aurellem/gb/characters.clj @ 185:c8ec477beeac
added world directory for practice worldbuilding.
author | Dylan Holmes <ocsenave@gmail.com> |
---|---|
date | Thu, 22 Mar 2012 07:02:50 -0500 |
parents | 95b2758dd517 |
children | 67c42608ef9d |
line wrap: on
line source
1 (ns com.aurellem.gb.characters2 (:use (com.aurellem.gb gb-driver constants))3 (:import [com.aurellem.gb.gb_driver SaveState]))5 (def character-code->character6 {7 0x00 "end-of-name-sentinel"8 0x50 "end-of-pokemon-name-sentinel"9 0x60 "A-bold"10 0x61 "B-bold"11 0x62 "C-bold"12 0x63 "D-bold"13 0x64 "E-bold"14 0x65 "F-bold"15 0x66 "G-bold"16 0x67 "H-bold"17 0x68 "I-bold"18 0x69 "V-bold"19 0x6A "S-bold"20 0x6B "L-bold"21 0x6C "M-bold"22 0x80 "A"23 0x81 "B"24 0x82 "C"25 0x83 "D"26 0x84 "E"27 0x85 "F"28 0x86 "G"29 0x87 "H"30 0x88 "I"31 0x89 "J"32 0x8A "K"33 0x8B "L"34 0x8C "M"35 0x8D "N"36 0x8E "O"37 0x8F "P"38 0x90 "Q"39 0x91 "R"40 0x92 "S"41 0x93 "T"42 0x94 "U"43 0x95 "V"44 0x96 "W"45 0x97 "X"46 0x98 "Y"47 0x99 "Z"48 0x9A "("49 0x9B ")"50 0x9C ":"51 0x9D ";"52 0xA0 "a"53 0xA1 "b"54 0xA2 "c"55 0xA3 "d"56 0xA4 "e"57 0xA5 "f"58 0xA6 "g"59 0xA7 "h"60 0xA8 "i"61 0xA9 "j"62 0xAA "k"63 0xAB "l"64 0xAC "m"65 0xAD "n"66 0xAE "o"67 0xAF "p"68 0xB0 "q"69 0xB1 "r"70 0xB2 "s"71 0xB3 "t"72 0xB4 "u"73 0xB5 "v"74 0xB6 "w"75 0xB7 "x"76 0xB8 "y"77 0xB9 "z"78 0xBA "e-with-grave"79 0xE0 "'"80 0xE1 "PK"81 0xE2 "MN"82 0xE3 "-"83 0xE6 "?"84 0xE7 "!"85 0xE8 "."86 0xEF "male-symbol"87 0xF0 "pokemon-money-symbol"88 0xF1 "."89 0xF2 "/"90 0xF3 ","91 0xF4 "female-symbol"92 0xF6 "0 "93 0xF7 "1"94 0xF8 "2"95 0xF9 "3"96 0xFA "4"97 0xFB "5"98 0xFC "6"99 0xFD "7"100 0xFE "8"101 0xFF "9"102 })104 (def character->character-code105 (zipmap (vals character-code->character)106 (keys character-code->character)))108 (defn str->character-codes [s]109 (map character->character-code (map str s)))111 (defn character-codes->str [codes]112 (apply str113 (map #(character-code->character114 %115 (format "[0x%02X]" %))116 codes)))118 (defn print-text119 ([^SaveState state begin end]120 (dorun121 (map (fn [character-code line]122 (println123 (format "0x%04X: " line)124 (str (character-code->character character-code))))125 (subvec (vec (memory state)) begin end)126 (range begin end)))127 state)128 ([begin end]129 (print-text @current-state begin end)))131 (defn read-name [codes]132 (character-codes->str133 (take-while134 (partial not= end-of-name-marker) codes)))