Mercurial > vba-clojure
comparison clojure/com/aurellem/run/image.clj @ 513:3dbb863eb801
accuracy of displayed image is much improved, but there the palettes are still messed up.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 22 Jun 2012 18:58:47 -0500 |
parents | 7ba07a6adb0c |
children | a00981db92da |
comparison
equal
deleted
inserted
replaced
512:7ba07a6adb0c | 513:3dbb863eb801 |
---|---|
468 | 468 |
469 (let [len (count image-data) | 469 (let [len (count image-data) |
470 gen-program | 470 gen-program |
471 (fn [program-length] | 471 (fn [program-length] |
472 (flatten | 472 (flatten |
473 [0x21 ;; load data address start into HL | 473 [0x01 ;; load data address start into BC |
474 (reverse | 474 (reverse |
475 (disect-bytes-2 (+ base-address program-length))) | 475 (disect-bytes-2 (+ base-address program-length))) |
476 | 476 |
477 0x01 ;; load target address into BC | 477 0x21 ;; load target address into HL |
478 (reverse (disect-bytes-2 target-address)) | 478 (reverse (disect-bytes-2 target-address)) |
479 | 479 |
480 0x1E ;; total-rows (18) -> E | 480 0x1E ;; total-rows (18) -> E |
481 1 | 481 18 |
482 | 482 |
483 0x16 ;; total columns (20) -> D | 483 0x16 ;; total columns (20) -> D |
484 20 | 484 20 |
485 | 485 |
486 ;; wite one block (8x8 pixels) to screen. | |
487 0x3E | |
488 16 ;; load 16 into A | |
489 | |
490 0xF5 ;; push A | |
491 | |
492 ;; data x-fer loop start | 486 ;; data x-fer loop start |
493 0x2A ;; (HL) -> A; HL++; | 487 0x0A ;; (BC) -> A; |
494 0x02 ;; A -> (BC); | |
495 0x03 ;; INC BC; | 488 0x03 ;; INC BC; |
496 | 489 0x22 ;; A -> (HL); HL++; |
497 | 490 |
498 0xF1 ;; pop A | 491 |
499 | |
500 0x3D ;; dec A | |
501 0x20 ;; | |
502 (->signed-8-bit -8) ;; continue writing block | |
503 | 492 |
504 0x15 ;; dec D | 493 0x15 ;; dec D |
505 0x20 | 494 0x20 |
506 (->signed-8-bit -13) ;; continue writing row | 495 (->signed-8-bit -6) ;; continue writing row |
507 | 496 |
508 ;; row is complete, advance to next row | 497 ;; row is complete, advance to next row |
509 ;; HL += 192 | 498 ;; HL += 12 |
510 | 499 |
511 0xC5 ;; push BC | 500 0xC5 ;; push BC |
512 | 501 |
513 0x06 ;; 0 -> B | 502 0x06 ;; 0 -> B |
514 0 | 503 0 |
515 | 504 |
516 0x0E | 505 0x0E |
517 0 ;; 192 -> C | 506 12 ;; 12 -> C |
518 | 507 |
519 0x09 ;; HL + BC -> HL | 508 0x09 ;; HL + BC -> HL |
520 | 509 |
521 0xC1 ;; pop BC | 510 0xC1 ;; pop BC |
522 | 511 |
523 0x1D ;; dec E | 512 0x1D ;; dec E |
524 0x20 | 513 0x20 |
525 (->signed-8-bit -23) ;; contunue writing picture | 514 (->signed-8-bit -18) ;; contunue writing picture |
526 | 515 |
527 0xC3 | 516 0xC3 |
528 (reverse | 517 (reverse |
529 (disect-bytes-2 | 518 (disect-bytes-2 |
530 (+ len base-address program-length)))]))] | 519 (+ len base-address program-length)))]))] |