Mercurial > vba-clojure
comparison clojure/com/aurellem/gb/characters.clj @ 145:412ca096a9ba
major refactoring complete.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 19 Mar 2012 21:23:46 -0500 |
parents | |
children | 279e9ee6fccb |
comparison
equal
deleted
inserted
replaced
144:ec477931f077 | 145:412ca096a9ba |
---|---|
1 (ns com.aurellem.gb.characters | |
2 (:use (com.aurellem.gb gb-driver)) | |
3 (:import [com.aurellem.gb.gb_driver SaveState])) | |
4 | |
5 (def character-code->character | |
6 { | |
7 0x00 "end-of-name-sentinel" | |
8 0x60 "A-bold" | |
9 0x61 "B-bold" | |
10 0x62 "C-bold" | |
11 0x63 "D-bold" | |
12 0x64 "E-bold" | |
13 0x65 "F-bold" | |
14 0x66 "G-bold" | |
15 0x67 "H-bold" | |
16 0x68 "I-bold" | |
17 0x69 "V-bold" | |
18 0x6A "S-bold" | |
19 0x6B "L-bold" | |
20 0x6C "M-bold" | |
21 0x80 "A" | |
22 0x81 "B" | |
23 0x82 "C" | |
24 0x83 "D" | |
25 0x84 "E" | |
26 0x85 "F" | |
27 0x86 "G" | |
28 0x87 "H" | |
29 0x88 "I" | |
30 0x89 "J" | |
31 0x8A "K" | |
32 0x8B "L" | |
33 0x8C "M" | |
34 0x8D "N" | |
35 0x8E "O" | |
36 0x8F "P" | |
37 0x90 "Q" | |
38 0x91 "R" | |
39 0x92 "S" | |
40 0x93 "T" | |
41 0x94 "U" | |
42 0x95 "V" | |
43 0x96 "W" | |
44 0x97 "X" | |
45 0x98 "Y" | |
46 0x99 "Z" | |
47 0x9A "(" | |
48 0x9B ")" | |
49 0x9C ":" | |
50 0x9D ";" | |
51 0xA0 "a" | |
52 0xA1 "b" | |
53 0xA2 "c" | |
54 0xA3 "d" | |
55 0xA4 "e" | |
56 0xA5 "f" | |
57 0xA6 "g" | |
58 0xA7 "h" | |
59 0xA8 "i" | |
60 0xA9 "j" | |
61 0xAA "k" | |
62 0xAB "l" | |
63 0xAC "m" | |
64 0xAD "n" | |
65 0xAE "o" | |
66 0xAF "p" | |
67 0xB0 "q" | |
68 0xB1 "r" | |
69 0xB2 "s" | |
70 0xB3 "t" | |
71 0xB4 "u" | |
72 0xB5 "v" | |
73 0xB6 "w" | |
74 0xB7 "x" | |
75 0xB8 "y" | |
76 0xB9 "z" | |
77 0xBA "e-with-grave" | |
78 0xE0 "'" | |
79 0xE1 "PK" | |
80 0xE2 "MN" | |
81 0xE6 "?" | |
82 0xE7 "!" | |
83 0xE8 "." | |
84 0xEF "male-symbol" | |
85 0xF0 "pokemon-money-symbol" | |
86 0xF1 "." | |
87 0xF2 "/" | |
88 0xF3 "," | |
89 0xF4 "female-symbol" | |
90 0xF6 "0 " | |
91 0xF7 "1" | |
92 0xF8 "2" | |
93 0xF9 "3" | |
94 0xFA "4" | |
95 0xFB "5" | |
96 0xFC "6" | |
97 0xFD "7" | |
98 0xFE "8" | |
99 0xFF "9" | |
100 }) | |
101 | |
102 (def character->character-code | |
103 (zipmap (vals character-code->character) | |
104 (keys character-code->character))) | |
105 | |
106 (defn str->character-codes [s] | |
107 (map character->character-code (map str s))) | |
108 | |
109 (defn character-codes->str [codes] | |
110 (apply str | |
111 (map #(character-code->character | |
112 % | |
113 (format "[0x%02X]" %)) | |
114 codes))) | |
115 | |
116 |