comparison clojure/com/aurellem/run/adv_choreo.clj @ 588:6e9368c371d5

added blank character.
author Robert McIntyre <rlm@mit.edu>
date Sat, 01 Sep 2012 10:11:18 -0500
parents e180f52b2079
children d9d86f6018e8
comparison
equal deleted inserted replaced
587:e180f52b2079 588:6e9368c371d5
85 85
86 (def glyphs 86 (def glyphs
87 "The sixteen 8x8 glyphs which make up the \"terminal\" font." 87 "The sixteen 8x8 glyphs which make up the \"terminal\" font."
88 (mapv #(ImageIO/read 88 (mapv #(ImageIO/read
89 (File. user-home (str "proj/vba-clojure/font/" % ".png"))) 89 (File. user-home (str "proj/vba-clojure/font/" % ".png")))
90 ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"])) 90 ["0" "1" "2" "3" "4" "5" "6" "7" "8"
91 "9" "A" "B" "C" "D" "E" "F" "_"]))
92
91 93
92 (defn glyph-init-program 94 (defn glyph-init-program
93 [start-address] 95 [start-address]
94 (let [zero-glyph (image->gb-image (glyphs 0)) 96 (let [zero-glyph (image->gb-image (glyphs 0))
95 97
146 0x21 148 0x21
147 (reverse (disect-bytes-2 data-start)) 149 (reverse (disect-bytes-2 data-start))
148 ;; load row and column into DE 150 ;; load row and column into DE
149 0x2A 0x57 ;; row -> D 151 0x2A 0x57 ;; row -> D
150 0x2A 0x5F ;; column -> E 152 0x2A 0x5F ;; column -> E
151
152
153 ]) 153 ])
154 154
155 155
156 display-glyph 156 display-glyph
157 (let [init* 157 (let [init*
172 (select-LCD-bank 0) 172 (select-LCD-bank 0)
173 ;; write 0x00 to memory locations 173 ;; write 0x00 to memory locations
174 ;; 0x9800 to 0x9A34 174 ;; 0x9800 to 0x9A34
175 0x21 175 0x21
176 0x00 0x98 ;; load 0x9800 into HL 176 0x00 0x98 ;; load 0x9800 into HL
177
178 177
179 0x16 3 ;; 3 -> D 178 0x16 3 ;; 3 -> D
180 0x1E 190 ;; 188 -> E 179 0x1E 190 ;; 188 -> E
181 180
182 ;; Empty space Character ID 181 ;; Empty space Character ID
238 4 237 4
239 0x09 ;; HL += 32 238 0x09 ;; HL += 32
240 0x3C 239 0x3C
241 0x18 240 0x18
242 241
243 (->signed-8-bit -7) 242 (->signed-8-bit -7)])
244 ])
245 243
246 render-glyph 244 render-glyph
247 (flatten 245 (flatten
248 [;; Render each nybble of A as a character 246 [;; Render each nybble of A as a character
249 ;; there are two characters to a glyph. 247 ;; there are two characters to a glyph.
262 set-HL-from-row-and-column 260 set-HL-from-row-and-column
263 261
264 0xF1 ;; restore A 262 0xF1 ;; restore A
265 0xE6 0x0F ;; select second nybble 263 0xE6 0x0F ;; select second nybble
266 0x77 ;; store second nybble as character 264 0x77 ;; store second nybble as character
267 increment-row-column 265 increment-row-column])
268 ])
269 266
270 267
271 init (replace 268 init (replace
272 {:clear-screen-length (count clear-screen)} init*) 269 {:clear-screen-length (count clear-screen)} init*)
273 ] 270 ]