diff clojure/com/aurellem/run/adv_choreo.clj @ 579:9f2b221bbf9b

row and columns increment correctly now.
author Robert McIntyre <rlm@mit.edu>
date Sat, 01 Sep 2012 06:03:08 -0500
parents 385799ea1e9c
children 46bbeac1b329
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/adv_choreo.clj	Sat Sep 01 05:14:37 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/adv_choreo.clj	Sat Sep 01 06:03:08 2012 -0500
     1.3 @@ -196,7 +196,7 @@
     1.4                  0xF1 0xE1 0xD1 0xC1])
     1.5  
     1.6                ;; RLM: for TESTING ONLY!!!
     1.7 -              ;;clear-screen (repeat 10 0)
     1.8 +              clear-screen (repeat 10 0)
     1.9                increment-row-column
    1.10                [;; D contains row and E contains column
    1.11                 
    1.12 @@ -205,10 +205,16 @@
    1.13                 0x1C ;; inc E
    1.14                 0x3E 20 0xBB ;; compare E to 20
    1.15                 0x20
    1.16 -               2
    1.17 +               3
    1.18 +               0x14
    1.19                 0x1E 0
    1.20                 
    1.21 -               
    1.22 +
    1.23 +               0x3E 18
    1.24 +               0xBA
    1.25 +               0x20
    1.26 +               2
    1.27 +               0x16 0
    1.28  
    1.29                 ;; 0x00 ;;0x1C ;; inc E
    1.30                 ;; 0x3E 20 0xBB ;; compare E to 20
    1.31 @@ -230,14 +236,26 @@
    1.32                 ;; (+ 0x97E0 (* 32 (+ 1 row)) column)
    1.33                 0xD5 0xC5 ;; push D E B C
    1.34  
    1.35 -               0x21 0x00 0x98 ;; load HL with 0x97E0
    1.36 +               ;; RLM: this should be 0x9800, investigate
    1.37 +               0x21 0xE0 0x97 ;; load HL with 0x97E0
    1.38                 
    1.39                 0x06 0
    1.40                 0x4B
    1.41                 0x09
    1.42  
    1.43 -               ;; 0x06 0
    1.44 -               ;; 0x0E 32     ;; load 32 into BC
    1.45 +
    1.46 +               0xAF ;; 0 -> A
    1.47 +               
    1.48 +               0x06 0
    1.49 +               0x0E 32     ;; load 32 into BC
    1.50 +
    1.51 +               0xBA
    1.52 +               0x20
    1.53 +               4
    1.54 +               0x09 ;; HL += 32
    1.55 +               0x3C
    1.56 +               0x18
    1.57 +               (->signed-8-bit -7)
    1.58  
    1.59                 ;; 0x14 ;; inc D to handle case where D == 0
    1.60                 ;; ;; D will never be > 20, so this will never overflow.
    1.61 @@ -256,6 +274,11 @@
    1.62                (flatten
    1.63                 [;; Render each nybble of A as a character
    1.64                  ;; there are two characters to a glyph.
    1.65 +                0x21
    1.66 +                (reverse (disect-bytes-2 data-start))
    1.67 +                ;; load row and column into DE
    1.68 +                0x2A 0x57 ;; row -> D
    1.69 +                0x2A 0x5F ;; column -> E
    1.70                 
    1.71                  set-HL-from-row-and-column
    1.72                  0xF1 ;; pop A, now A is equal to key input
    1.73 @@ -263,13 +286,13 @@
    1.74  
    1.75                  0xE6 0xF0 ;; clear second nybble
    1.76                  0xCB 0x37 ;; swap nybbles
    1.77 -                0x22 ;; store A in video RAM as a character (pun)
    1.78 +                0x77 ;; store A in video RAM as a character (pun)
    1.79                  increment-row-column
    1.80                  
    1.81                  set-HL-from-row-and-column
    1.82                  0xF1 ;; restore A
    1.83                  0xE6 0x0F ;; select second nybble
    1.84 -                0x22 ;; store second nybble as character
    1.85 +                0x77 ;; store second nybble as character
    1.86                  increment-row-column
    1.87                   ])
    1.88  
    1.89 @@ -286,8 +309,8 @@
    1.90           [;; Reset HL to initial value
    1.91            0x21
    1.92            (reverse (disect-bytes-2 data-start))
    1.93 -          0x23
    1.94 -          ;;0x7A 0x22 ;; D -> rows       -> to RAM
    1.95 +          ;;0x23
    1.96 +          0x7A 0x22 ;; D -> rows       -> to RAM
    1.97            0x7B 0x22 ;; E -> columns
    1.98            ])
    1.99