Mercurial > vba-clojure
changeset 562:114f58b5b6d0
new glyph rendering skeleton complete.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 31 Aug 2012 09:22:52 -0500 |
parents | c57398047795 |
children | a70d9223f6eb |
files | clojure/com/aurellem/run/adv_choreo.clj |
diffstat | 1 files changed, 45 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/run/adv_choreo.clj Fri Aug 31 08:50:32 2012 -0500 1.2 +++ b/clojure/com/aurellem/run/adv_choreo.clj Fri Aug 31 09:22:52 2012 -0500 1.3 @@ -129,90 +129,83 @@ 1.4 1.5 (defn glyph-display-program 1.6 [start-address 1.7 - monitor-address 1.8 - delay-count 1.9 - total-glyph-count] 1.10 + max-glyphs] 1.11 (let [data-start (+ 2 start-address) 1.12 + [max-glyphs-high max-glyphs-low] 1.13 + (disect-bytes-2 max-glyphs) 1.14 load-data 1.15 (flatten 1.16 [;; data region 1.17 - 1.18 0x18 1.19 - 5 1.20 - (disect-bytes-2 monitor-address) 1.21 - (disect-bytes-2 total-glyph-count) 1.22 - delay-count 1.23 + 2 1.24 + 0 0 ;; current num of glyphs-rendered 1.25 1.26 ;; save all registers 1.27 0xC5 0xD5 0xE5 0xF5 1.28 1.29 ;; load data from data region into registers 1.30 - 0x21 1.31 + 1.32 + 0xF5 ;; push A 1.33 + 0x21 ;; begin data load 1.34 (reverse (disect-bytes-2 data-start)) 1.35 + 1.36 + 0x2A 0x47 ;; glyphs-rendered -> BC 1.37 + 0x2A 0x4F 1.38 1.39 - 0x2A 0x47 ;; monitor-address-high -> B 1.40 - 0x2A 0x4F ;; monitor-address-low -> C 1.41 - 1.42 - 0x2A 0x57 ;; glyph-count-high -> D 1.43 - 0x2A 0x5F ;; glyph-count-low -> E 1.44 - 1.45 - 0x7E ;; delay -> A 1.46 + 0x16 max-glyphs-high ;; load max-glyphs 1.47 + 0x1E max-glyphs-low ;; into DE 1.48 ]) 1.49 1.50 - handle-delay* 1.51 - (flatten 1.52 - [0xA7 ;; test if delay is zero 1.53 - ;; if delay is not 0, decrement and skip to cleanup 1.54 - 0x28 ;; JR Z, skip this section if A==0 1.55 - 4 1.56 - 0x3D ;; dec A 1.57 - 0x77 ;; (dec delay) -> delay 1.58 - 0x18 1.59 - :to-cleanup]) 1.60 - 1.61 handle-glyph-count* 1.62 (flatten 1.63 - [;; if glyph-count is 0, go directly to stack-cleanup 1.64 - 0x79 0xB0 ;; check if BC == 0 1.65 - 0x20 ;; JR NZ, skip if BC !=0 1.66 - 2 1.67 - 0x18 1.68 - :to-stack-cleanup 1.69 + [;; if glyphs-rendered = max-glyph count, go directly 1.70 + ;; to stack-cleanup 1.71 + 1.72 + 0x47 0xBA ;; compare B to D 1.73 + 0x20 ;; skip next section B != D 1.74 + 7 ;; this is equal to the number of instructions in the next 1.75 + ;; indented region! 1.76 + 1.77 + 0x79 0xBB ;; compare C to E 1.78 + 0x20 ;; JR NZ, skip if C != E 1.79 + 3 1.80 + 0xF1 ;; pop AF for stack maintainance! 1.81 + 0x18 1.82 + :to-stack-cleanup 1.83 ]) 1.84 1.85 - display-glyph [0 0 0] 1.86 + display-glyph 1.87 + (flatten 1.88 + [0xF1 ;; pop A, now A is equal to key input 1.89 + 1.90 + 0 0 0 1.91 + 1.92 + 1.93 + ]) 1.94 + 1.95 + 1.96 cleanup 1.97 ;; restore all registers 1.98 + (flatten 1.99 + [0x03 ;; (inc glyphs-rednered) -> glyphs-rendered 1.100 1.101 - (flatten 1.102 - [0x03 ;; (inc monitor-address) -> monitor-address 1.103 - 0x1B ;; (dec glyph-count) -> glyph-count 1.104 - 1.105 ;; Reset HL to initial value 1.106 0x21 1.107 (reverse (disect-bytes-2 data-start)) 1.108 1.109 - 0x78 0x22 ;; B -> monitor-address-high 1.110 - 0x79 0x22 ;; C -> monitor-address-low 1.111 - 1.112 - 0x7A 0x22 ;; D -> glyph-count-high 1.113 - 0x7B 0x22 ;; E -> glyph-count-low 1.114 + 0x78 0x22 ;; B -> save glyphs-rendered 1.115 + 0x79 0x22 ;; 1.116 ]) 1.117 1.118 stack-cleanup 1.119 [0xF1 0xE1 0xD1 0xC1] 1.120 1.121 - handle-delay 1.122 - (replace {:to-cleanup 1.123 - (+ (count display-glyph) (count handle-glyph-count*))} 1.124 - handle-delay*) 1.125 - 1.126 handle-glyph-count 1.127 (replace {:to-stack-cleanup 1.128 (+ (count display-glyph) (count cleanup))} 1.129 handle-glyph-count*)] 1.130 (concat load-data 1.131 - handle-delay handle-glyph-count 1.132 + handle-glyph-count 1.133 display-glyph 1.134 cleanup stack-cleanup))) 1.135 1.136 @@ -225,10 +218,9 @@ 1.137 1.138 glyph-display (glyph-display-program 1.139 (+ (count init) 1.140 - ;;(count header) 1.141 + (count header) 1.142 start-address) 1.143 - main-program-base-address 100 1.144 - 200) 1.145 + 2000) 1.146 ;;(- (count (program-data 0)) 100)) 1.147 1.148 state-machine-start-address 1.149 @@ -248,7 +240,7 @@ 1.150 (count header) 1.151 (count state-machine)))])] 1.152 1.153 - (concat init glyph-display header state-machine return-to-header))) 1.154 + (concat init header glyph-display state-machine return-to-header))) 1.155 1.156 1.157