changeset 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
files clojure/com/aurellem/run/image.clj
diffstat 1 files changed, 11 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/image.clj	Fri Jun 22 18:38:22 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/image.clj	Fri Jun 22 18:58:47 2012 -0500
     1.3 @@ -470,43 +470,32 @@
     1.4          gen-program
     1.5          (fn [program-length]
     1.6            (flatten 
     1.7 -           [0x21 ;; load data address start into HL
     1.8 +           [0x01 ;; load data address start into BC
     1.9              (reverse
    1.10               (disect-bytes-2 (+ base-address program-length)))
    1.11  
    1.12 -            0x01 ;; load target address into BC
    1.13 +            0x21 ;; load target address into HL
    1.14              (reverse (disect-bytes-2 target-address))
    1.15  
    1.16              0x1E ;; total-rows (18) -> E
    1.17 -            1
    1.18 +            18
    1.19  
    1.20              0x16 ;; total columns (20) -> D
    1.21              20
    1.22              
    1.23 -            ;; wite one block (8x8 pixels) to screen.
    1.24 -            0x3E
    1.25 -            16   ;; load 16 into A
    1.26 +            ;; data x-fer loop start
    1.27 +            0x0A ;; (BC) -> A;
    1.28 +            0x03 ;; INC BC;
    1.29 +            0x22 ;; A -> (HL); HL++;
    1.30  
    1.31 -            0xF5 ;; push A
    1.32 -            
    1.33 -            ;; data x-fer loop start
    1.34 -            0x2A ;; (HL) -> A; HL++;
    1.35 -            0x02 ;; A -> (BC);
    1.36 -            0x03 ;; INC BC;
    1.37  
    1.38  
    1.39 -            0xF1 ;; pop A
    1.40 -            
    1.41 -            0x3D ;; dec A
    1.42 -            0x20 ;; 
    1.43 -            (->signed-8-bit -8) ;; continue writing block
    1.44 -
    1.45              0x15 ;; dec D 
    1.46              0x20
    1.47 -            (->signed-8-bit -13) ;; continue writing row
    1.48 +            (->signed-8-bit -6) ;; continue writing row
    1.49  
    1.50              ;; row is complete, advance to next row
    1.51 -            ;; HL += 192
    1.52 +            ;; HL += 12
    1.53  
    1.54              0xC5 ;; push BC
    1.55  
    1.56 @@ -514,7 +503,7 @@
    1.57              0
    1.58  
    1.59              0x0E
    1.60 -            0  ;; 192 -> C
    1.61 +            12  ;; 12 -> C
    1.62  
    1.63              0x09 ;; HL + BC -> HL 
    1.64  
    1.65 @@ -522,7 +511,7 @@
    1.66              
    1.67              0x1D ;; dec E
    1.68              0x20
    1.69 -            (->signed-8-bit -23) ;; contunue writing picture
    1.70 +            (->signed-8-bit -18) ;; contunue writing picture
    1.71  
    1.72              0xC3
    1.73              (reverse