diff 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
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/adv_choreo.clj	Sat Sep 01 06:15:23 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/adv_choreo.clj	Sat Sep 01 09:35:07 2012 -0500
     1.3 @@ -231,17 +231,18 @@
     1.4                 ] ;; set D to zero
     1.5                 
     1.6                set-HL-from-row-and-column
     1.7 +              (flatten
     1.8                [;; formula for memory offset is:
     1.9                 ;; (+ 0x9800 (* 32 row) column) == 
    1.10                 ;; (+ 0x97E0 (* 32 (+ 1 row)) column)
    1.11 -              
    1.12 +               0xD5 ;; push DE
    1.13  
    1.14                 ;; RLM: this should be 0x9800, investigate
    1.15 -               0x21 0x00 0x98 ;; load HL with 0x97E0
    1.16 +               0x21 0x00 0x98 ;; load HL with something
    1.17                 
    1.18                 0x06 0
    1.19 -               0x4B
    1.20 -               0x09
    1.21 +               0x4B  ;; columns (E) -> BC
    1.22 +               0x09  ;; HL += columns
    1.23  
    1.24  
    1.25                 0xAF ;; 0 -> A
    1.26 @@ -249,14 +250,16 @@
    1.27                 0x06 0
    1.28                 0x0E 32     ;; load 32 into BC
    1.29  
    1.30 -               0xBA
    1.31 +               0xBA ;; CP A D
    1.32                 0x20
    1.33                 4
    1.34 +               ;;(+ 32 3)
    1.35                 0x09 ;; HL += 32
    1.36 +               ;;(repeat 32 0x23)
    1.37                 0x3C
    1.38                 0x18
    1.39 +               ;;(->signed-8-bit (+ -6 -32))
    1.40                 (->signed-8-bit -7)
    1.41 -
    1.42                 ;; 0x14 ;; inc D to handle case where D == 0
    1.43                 ;; ;; D will never be > 20, so this will never overflow.
    1.44  
    1.45 @@ -267,8 +270,8 @@
    1.46                 ;; 0x20 
    1.47                 ;; (->signed-8-bit -4)
    1.48                 
    1.49 -             
    1.50 -               ]
    1.51 +               0xD1 ;; pop DE
    1.52 +               ])
    1.53                
    1.54                render-glyph
    1.55                (flatten
    1.56 @@ -279,18 +282,22 @@
    1.57                  ;; load row and column into DE
    1.58                  0x2A 0x57 ;; row -> D
    1.59                  0x2A 0x5F ;; column -> E
    1.60 -               
    1.61 +
    1.62 +                
    1.63                  set-HL-from-row-and-column
    1.64 +
    1.65                  0xF1 ;; pop A, now A is equal to key input
    1.66 -                0x3E 0xFF
    1.67 +                0x3E 0xFF ;; RLM: TESTING set A = 0xFF
    1.68                  0xF5 ;; save A
    1.69  
    1.70                  0xE6 0xF0 ;; clear second nybble
    1.71                  0xCB 0x37 ;; swap nybbles
    1.72                  0x77 ;; store A in video RAM as a character (pun)
    1.73                  increment-row-column
    1.74 -                
    1.75 +
    1.76 +
    1.77                  set-HL-from-row-and-column
    1.78 +
    1.79                  0xF1 ;; restore A
    1.80                  0xE6 0x0F ;; select second nybble
    1.81                  0x77 ;; store second nybble as character