Mercurial > vba-clojure
view clojure/com/aurellem/gb/characters.clj @ 207:a67f1df5d096
More hardcode expeditions.
author | Dylan Holmes <ocsenave@gmail.com> |
---|---|
date | Fri, 23 Mar 2012 04:43:44 -0500 |
parents | 67c42608ef9d |
children | 57258c269bcb |
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" ;; begin messsage8 0x4E "[...]" ; ocsenave: scroll pokedex page9 0x4F "\n" ; newline10 0x50 "#";;"end-of-pokemon-name-sentinel"11 0x51 "\n\n" ;; ocsenave: clear screen12 0x54 "[POKE]"13 0x55 "_" ;; ocsenave: breaking space?14 0x57 ">" ;; ocsenave: end message15 0x5F ">" ;; ocsenave: end pokedex entry??16 0x60 "A-bold"17 0x61 "B-bold"18 0x62 "C-bold"19 0x63 "D-bold"20 0x64 "E-bold"21 0x65 "F-bold"22 0x66 "G-bold"23 0x67 "H-bold"24 0x68 "I-bold"25 0x69 "V-bold"26 0x6A "S-bold"27 0x6B "L-bold"28 0x6C "M-bold"29 0x7F " " ;space30 0x80 "A"31 0x81 "B"32 0x82 "C"33 0x83 "D"34 0x84 "E"35 0x85 "F"36 0x86 "G"37 0x87 "H"38 0x88 "I"39 0x89 "J"40 0x8A "K"41 0x8B "L"42 0x8C "M"43 0x8D "N"44 0x8E "O"45 0x8F "P"46 0x90 "Q"47 0x91 "R"48 0x92 "S"49 0x93 "T"50 0x94 "U"51 0x95 "V"52 0x96 "W"53 0x97 "X"54 0x98 "Y"55 0x99 "Z"56 0x9A "("57 0x9B ")"58 0x9C ":"59 0x9D ";"60 0xA0 "a"61 0xA1 "b"62 0xA2 "c"63 0xA3 "d"64 0xA4 "e"65 0xA5 "f"66 0xA6 "g"67 0xA7 "h"68 0xA8 "i"69 0xA9 "j"70 0xAA "k"71 0xAB "l"72 0xAC "m"73 0xAD "n"74 0xAE "o"75 0xAF "p"76 0xB0 "q"77 0xB1 "r"78 0xB2 "s"79 0xB3 "t"80 0xB4 "u"81 0xB5 "v"82 0xB6 "w"83 0xB7 "x"84 0xB8 "y"85 0xB9 "z"86 0xBA "[e]" ;é87 0xBB "'d" ;ocsenave88 0xBC "'l" ;ocsenave89 0xBD "'s" ;ocsenave90 0xBE "'t" ;ocsenave91 0xBF "'v" ; ocsenave93 0xE0 "'"94 0xE1 "PK"95 0xE2 "MN"96 0xE3 "-"97 0xE4 "'r" ;ocsenave98 0xE5 "'m" ;ocsenave99 0xE6 "?"100 0xE7 "!"101 0xE8 "."102 0xEF "male-symbol"103 0xF0 "$" ;;"pokemon-money-symbol"104 0xF1 "."105 0xF2 "/"106 0xF3 ","107 0xF4 ", "108 0xF5 "female-symbol" ;; ocsenave109 0xF6 "0 "110 0xF7 "1"111 0xF8 "2"112 0xF9 "3"113 0xFA "4"114 0xFB "5"115 0xFC "6"116 0xFD "7"117 0xFE "8"118 0xFF "9"119 })121 (def character->character-code122 (zipmap (vals character-code->character)123 (keys character-code->character)))125 (defn str->character-codes [s]126 (map character->character-code (map str s)))128 (defn character-codes->str [codes]129 (apply str130 (map #(character-code->character131 %132 (format "[0x%02X]" %))133 codes)))137 (defn print-text138 ([^SaveState state begin end]139 (dorun140 (map (fn [character-code line]141 (println142 (format "0x%04X: " line)143 (str (character-code->character character-code))))144 (subvec (vec (memory state)) begin end)145 (range begin end)))146 state)147 ([begin end]148 (print-text @current-state begin end)))150 (defn read-name [codes]151 (character-codes->str152 (take-while153 (partial not= end-of-name-marker) codes)))