# HG changeset patch # User Robert McIntyre # Date 1346497388 18000 # Node ID 9f2b221bbf9be0603223725d443cfee5ffa8a8cf # Parent 385799ea1e9cc5604acbfe3a63bd7156dfa9f255 row and columns increment correctly now. diff -r 385799ea1e9c -r 9f2b221bbf9b clojure/com/aurellem/run/adv_choreo.clj --- a/clojure/com/aurellem/run/adv_choreo.clj Sat Sep 01 05:14:37 2012 -0500 +++ b/clojure/com/aurellem/run/adv_choreo.clj Sat Sep 01 06:03:08 2012 -0500 @@ -196,7 +196,7 @@ 0xF1 0xE1 0xD1 0xC1]) ;; RLM: for TESTING ONLY!!! - ;;clear-screen (repeat 10 0) + clear-screen (repeat 10 0) increment-row-column [;; D contains row and E contains column @@ -205,10 +205,16 @@ 0x1C ;; inc E 0x3E 20 0xBB ;; compare E to 20 0x20 - 2 + 3 + 0x14 0x1E 0 - + + 0x3E 18 + 0xBA + 0x20 + 2 + 0x16 0 ;; 0x00 ;;0x1C ;; inc E ;; 0x3E 20 0xBB ;; compare E to 20 @@ -230,14 +236,26 @@ ;; (+ 0x97E0 (* 32 (+ 1 row)) column) 0xD5 0xC5 ;; push D E B C - 0x21 0x00 0x98 ;; load HL with 0x97E0 + ;; RLM: this should be 0x9800, investigate + 0x21 0xE0 0x97 ;; load HL with 0x97E0 0x06 0 0x4B 0x09 - ;; 0x06 0 - ;; 0x0E 32 ;; load 32 into BC + + 0xAF ;; 0 -> A + + 0x06 0 + 0x0E 32 ;; load 32 into BC + + 0xBA + 0x20 + 4 + 0x09 ;; HL += 32 + 0x3C + 0x18 + (->signed-8-bit -7) ;; 0x14 ;; inc D to handle case where D == 0 ;; ;; D will never be > 20, so this will never overflow. @@ -256,6 +274,11 @@ (flatten [;; Render each nybble of A as a character ;; there are two characters to a glyph. + 0x21 + (reverse (disect-bytes-2 data-start)) + ;; load row and column into DE + 0x2A 0x57 ;; row -> D + 0x2A 0x5F ;; column -> E set-HL-from-row-and-column 0xF1 ;; pop A, now A is equal to key input @@ -263,13 +286,13 @@ 0xE6 0xF0 ;; clear second nybble 0xCB 0x37 ;; swap nybbles - 0x22 ;; store A in video RAM as a character (pun) + 0x77 ;; store A in video RAM as a character (pun) increment-row-column set-HL-from-row-and-column 0xF1 ;; restore A 0xE6 0x0F ;; select second nybble - 0x22 ;; store second nybble as character + 0x77 ;; store second nybble as character increment-row-column ]) @@ -286,8 +309,8 @@ [;; Reset HL to initial value 0x21 (reverse (disect-bytes-2 data-start)) - 0x23 - ;;0x7A 0x22 ;; D -> rows -> to RAM + ;;0x23 + 0x7A 0x22 ;; D -> rows -> to RAM 0x7B 0x22 ;; E -> columns ])