changeset 578:385799ea1e9c

implemented row glyph drawing.
author Robert McIntyre <rlm@mit.edu>
date Sat, 01 Sep 2012 05:14:37 -0500
parents df3a7eac39d7
children 9f2b221bbf9b
files clojure/com/aurellem/gb/util.clj clojure/com/aurellem/run/adv_choreo.clj
diffstat 2 files changed, 36 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/util.clj	Sat Sep 01 04:42:41 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/util.clj	Sat Sep 01 05:14:37 2012 -0500
     1.3 @@ -80,7 +80,7 @@
     1.4  
     1.5  (defn view-memory
     1.6    ([^SaveState state mem]
     1.7 -     (let [val (aget (memory state) mem)]
     1.8 +     (let [val (accurate-memory state mem)]
     1.9         (println (format "0x%04X = %s 0x%02X %d" mem
    1.10                          (binary-str val) val val)))
    1.11       state)
     2.1 --- a/clojure/com/aurellem/run/adv_choreo.clj	Sat Sep 01 04:42:41 2012 -0500
     2.2 +++ b/clojure/com/aurellem/run/adv_choreo.clj	Sat Sep 01 05:14:37 2012 -0500
     2.3 @@ -196,7 +196,7 @@
     2.4                  0xF1 0xE1 0xD1 0xC1])
     2.5  
     2.6                ;; RLM: for TESTING ONLY!!!
     2.7 -              clear-screen (repeat 10 0)
     2.8 +              ;;clear-screen (repeat 10 0)
     2.9                increment-row-column
    2.10                [;; D contains row and E contains column
    2.11                 
    2.12 @@ -204,16 +204,25 @@
    2.13                 ;; column to 0 and increment row
    2.14                 0x1C ;; inc E
    2.15                 0x3E 20 0xBB ;; compare E to 20
    2.16 -               0x20 ;; if E is 20
    2.17 -                 3
    2.18 -                 0x1E 0 ;; set E to zero
    2.19 -                 0x14   ;; (inc D) -> D
    2.20 +               0x20
    2.21 +               2
    2.22 +               0x1E 0
    2.23 +               
    2.24 +               
    2.25  
    2.26 -               ;; every time row (D) reaches 18, set row to 0                
    2.27 -               0x3E 18 0xBA ;; compare D to 18
    2.28 -               0x20 ;; if D is 18
    2.29 -                 2
    2.30 -                 0x16 0] ;; set D to zero
    2.31 +               ;; 0x00 ;;0x1C ;; inc E
    2.32 +               ;; 0x3E 20 0xBB ;; compare E to 20
    2.33 +               ;; 0x20 ;; if E is 20
    2.34 +               ;;   3
    2.35 +               ;;   0x1E 0 ;; set E to zero
    2.36 +               ;;   0x00; 0x14   ;; (inc D) -> D
    2.37 +
    2.38 +               ;; ;; every time row (D) reaches 18, set row to 0                
    2.39 +               ;; 0x3E 18 0xBA ;; compare D to 18
    2.40 +               ;; 0x20 ;; if D is 18
    2.41 +               ;;   2
    2.42 +               ;;   0x16 0
    2.43 +               ] ;; set D to zero
    2.44                 
    2.45                set-HL-from-row-and-column
    2.46                [;; formula for memory offset is:
    2.47 @@ -221,20 +230,24 @@
    2.48                 ;; (+ 0x97E0 (* 32 (+ 1 row)) column)
    2.49                 0xD5 0xC5 ;; push D E B C
    2.50  
    2.51 -               0x21 0xE0 0x97 ;; load HL with 0x97E0
    2.52 +               0x21 0x00 0x98 ;; load HL with 0x97E0
    2.53                 
    2.54                 0x06 0
    2.55 -               0x0E 32     ;; load 32 into BC
    2.56 +               0x4B
    2.57 +               0x09
    2.58  
    2.59 -               0x14 ;; inc D to handle case where D == 0
    2.60 -               ;; D will never be > 20, so this will never overflow.
    2.61 +               ;; 0x06 0
    2.62 +               ;; 0x0E 32     ;; load 32 into BC
    2.63  
    2.64 -               ;; do 
    2.65 -                 0x09 ;; HL += 32
    2.66 -                 0x15 ;; dec D
    2.67 -               ;; while D != 0
    2.68 -               0x20 
    2.69 -               (->signed-8-bit -4)
    2.70 +               ;; 0x14 ;; inc D to handle case where D == 0
    2.71 +               ;; ;; D will never be > 20, so this will never overflow.
    2.72 +
    2.73 +               ;; ;; do 
    2.74 +               ;;   0x09 ;; HL += 32
    2.75 +               ;;   0x15 ;; dec D
    2.76 +               ;; ;; while D != 0
    2.77 +               ;; 0x20 
    2.78 +               ;; (->signed-8-bit -4)
    2.79                 
    2.80                 0xC1 0xD1 ;; pop C B E D
    2.81                 ]
    2.82 @@ -273,7 +286,8 @@
    2.83           [;; Reset HL to initial value
    2.84            0x21
    2.85            (reverse (disect-bytes-2 data-start))
    2.86 -          0x7A 0x22 ;; D -> rows       -> to RAM
    2.87 +          0x23
    2.88 +          ;;0x7A 0x22 ;; D -> rows       -> to RAM
    2.89            0x7B 0x22 ;; E -> columns
    2.90            ])
    2.91