# HG changeset patch # User Robert McIntyre # Date 1346489790 18000 # Node ID 40f62391db9df25e25164d73dfd9941bcc3a1164 # Parent 58a25fa1517604937bbb868e2bd6776fc73c5daf implemented row and column increment logic. diff -r 58a25fa15176 -r 40f62391db9d clojure/com/aurellem/run/adv_choreo.clj --- a/clojure/com/aurellem/run/adv_choreo.clj Sat Sep 01 03:42:16 2012 -0500 +++ b/clojure/com/aurellem/run/adv_choreo.clj Sat Sep 01 03:56:30 2012 -0500 @@ -232,9 +232,42 @@ ;; restore all registers 0xF1 0xE1 0xD1 0xC1]) + increment-row-column + [;; D contains row and E contains column + + ;; every time column (E) reaches 20, set + ;; column to 0 and increment row + 0x1C ;; inc E + 0x3E 20 0xBB ;; compare E to 20 + 0x20 ;; if E is 20 + 3 + 0x1E 0 ;; set E to zero + 0x14 ;; (inc D) -> D + + ;; every time row (D) reaches 18, set row to 0 + 0x3E 18 0xBA ;; compare D to 18 + 0x20 ;; if D is 18 + 2 + 0x16 0] ;; set D to zero + + set-HL-from-row-and-column + [;; formula for memory offset is: + ;; (+ 0x9800 (* 32 row) column) + 0xD5 + + 0xD1 + + ] + + + + render-glyph (flatten - [0 0 + [set-HL-from-row-and-column + increment-row-column + ;; Render each nybble of A as a character + ;; there are two characters to a glyph. ]) @@ -252,10 +285,10 @@ ;; Reset HL to initial value 0x21 (reverse (disect-bytes-2 data-start)) - 0x78 0x22 ;; BC -> save glyphs-rendered + 0x78 0x22 ;; BC -> glyphs-rendered to RAM 0x79 0x22 ;; - 0x7A 0x22 ;; D -> rows + 0x7A 0x22 ;; D -> rows -> to RAM 0x7B 0x22 ;; E -> columns ])