comparison clojure/com/aurellem/run/adv_choreo.clj @ 581:5f09601abe8c

saving progress.
author Robert McIntyre <rlm@mit.edu>
date Sat, 01 Sep 2012 09:35:07 -0500
parents 46bbeac1b329
children 393b49a83394
comparison
equal deleted inserted replaced
580:46bbeac1b329 581:5f09601abe8c
229 ;; 2 229 ;; 2
230 ;; 0x16 0 230 ;; 0x16 0
231 ] ;; set D to zero 231 ] ;; set D to zero
232 232
233 set-HL-from-row-and-column 233 set-HL-from-row-and-column
234 (flatten
234 [;; formula for memory offset is: 235 [;; formula for memory offset is:
235 ;; (+ 0x9800 (* 32 row) column) == 236 ;; (+ 0x9800 (* 32 row) column) ==
236 ;; (+ 0x97E0 (* 32 (+ 1 row)) column) 237 ;; (+ 0x97E0 (* 32 (+ 1 row)) column)
237 238 0xD5 ;; push DE
238 239
239 ;; RLM: this should be 0x9800, investigate 240 ;; RLM: this should be 0x9800, investigate
240 0x21 0x00 0x98 ;; load HL with 0x97E0 241 0x21 0x00 0x98 ;; load HL with something
241 242
242 0x06 0 243 0x06 0
243 0x4B 244 0x4B ;; columns (E) -> BC
244 0x09 245 0x09 ;; HL += columns
245 246
246 247
247 0xAF ;; 0 -> A 248 0xAF ;; 0 -> A
248 249
249 0x06 0 250 0x06 0
250 0x0E 32 ;; load 32 into BC 251 0x0E 32 ;; load 32 into BC
251 252
252 0xBA 253 0xBA ;; CP A D
253 0x20 254 0x20
254 4 255 4
256 ;;(+ 32 3)
255 0x09 ;; HL += 32 257 0x09 ;; HL += 32
258 ;;(repeat 32 0x23)
256 0x3C 259 0x3C
257 0x18 260 0x18
261 ;;(->signed-8-bit (+ -6 -32))
258 (->signed-8-bit -7) 262 (->signed-8-bit -7)
259
260 ;; 0x14 ;; inc D to handle case where D == 0 263 ;; 0x14 ;; inc D to handle case where D == 0
261 ;; ;; D will never be > 20, so this will never overflow. 264 ;; ;; D will never be > 20, so this will never overflow.
262 265
263 ;; ;; do 266 ;; ;; do
264 ;; 0x09 ;; HL += 32 267 ;; 0x09 ;; HL += 32
265 ;; 0x15 ;; dec D 268 ;; 0x15 ;; dec D
266 ;; ;; while D != 0 269 ;; ;; while D != 0
267 ;; 0x20 270 ;; 0x20
268 ;; (->signed-8-bit -4) 271 ;; (->signed-8-bit -4)
269 272
270 273 0xD1 ;; pop DE
271 ] 274 ])
272 275
273 render-glyph 276 render-glyph
274 (flatten 277 (flatten
275 [;; Render each nybble of A as a character 278 [;; Render each nybble of A as a character
276 ;; there are two characters to a glyph. 279 ;; there are two characters to a glyph.
277 0x21 280 0x21
278 (reverse (disect-bytes-2 data-start)) 281 (reverse (disect-bytes-2 data-start))
279 ;; load row and column into DE 282 ;; load row and column into DE
280 0x2A 0x57 ;; row -> D 283 0x2A 0x57 ;; row -> D
281 0x2A 0x5F ;; column -> E 284 0x2A 0x5F ;; column -> E
282 285
286
283 set-HL-from-row-and-column 287 set-HL-from-row-and-column
288
284 0xF1 ;; pop A, now A is equal to key input 289 0xF1 ;; pop A, now A is equal to key input
285 0x3E 0xFF 290 0x3E 0xFF ;; RLM: TESTING set A = 0xFF
286 0xF5 ;; save A 291 0xF5 ;; save A
287 292
288 0xE6 0xF0 ;; clear second nybble 293 0xE6 0xF0 ;; clear second nybble
289 0xCB 0x37 ;; swap nybbles 294 0xCB 0x37 ;; swap nybbles
290 0x77 ;; store A in video RAM as a character (pun) 295 0x77 ;; store A in video RAM as a character (pun)
291 increment-row-column 296 increment-row-column
292 297
298
293 set-HL-from-row-and-column 299 set-HL-from-row-and-column
300
294 0xF1 ;; restore A 301 0xF1 ;; restore A
295 0xE6 0x0F ;; select second nybble 302 0xE6 0x0F ;; select second nybble
296 0x77 ;; store second nybble as character 303 0x77 ;; store second nybble as character
297 increment-row-column 304 increment-row-column
298 ]) 305 ])