Mercurial > vba-clojure
comparison clojure/com/aurellem/run/adv_choreo.clj @ 560:3194a4f438ca
restored previous functionality of glyph-display program.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 31 Aug 2012 05:00:33 -0500 |
parents | 91e99cc36bda |
children | c57398047795 |
comparison
equal
deleted
inserted
replaced
559:91e99cc36bda | 560:3194a4f438ca |
---|---|
124 "1") ;; no-effect | 124 "1") ;; no-effect |
125 2))])] | 125 2))])] |
126 (concat A B ))) | 126 (concat A B ))) |
127 | 127 |
128 | 128 |
129 ;; handle-delay* | 129 |
130 ;; (flatten | |
131 ;; [0xA7 ;; test if delay is zero | |
132 ;; ;; if delay is not 0, decrement and skip to cleanup | |
133 ;; 0x28 ;; JR Z, skip this section if A==0 | |
134 ;; 4 | |
135 ;; 0x3D ;; dec A | |
136 ;; 0x77 ;; (dec delay) -> delay | |
137 ;; 0x18 | |
138 ;; :to-cleanup]) | |
139 | |
140 ;; handle-glyph-count* | |
141 ;; (flatten | |
142 ;; [;; if glyph-count is 0, go directly to stack-cleanup | |
143 | |
144 ;; ;;0x79 0xB0 ;; check if BC == 0 | |
145 ;; 0 0 | |
146 ;; 0x20 ;; JR NZ, skip if BC !=0 | |
147 ;; 2 | |
148 ;; 0 0 | |
149 ;; ;;0x18 | |
150 ;; ;;:to-stack-cleanup | |
151 ;; ]) | |
152 ;; handle-glyph-count* [0 0 0 0] | |
153 | |
154 | |
155 ;; handle-delay | |
156 ;; (replace {:to-cleanup | |
157 ;; (+ (count display-glyph) (count handle-glyph-count*))} | |
158 ;; handle-delay*) | |
159 | |
160 ;; handle-glyph-count | |
161 ;; (replace {:to-stack-cleanup | |
162 ;; (+ (count display-glyph) (count cleanup))} | |
163 ;; handle-glyph-count*) | |
164 | |
165 | |
166 (defn glyph-display-program | 130 (defn glyph-display-program |
167 [start-address | 131 [start-address |
168 monitor-address | 132 monitor-address |
169 delay-count | 133 delay-count |
170 total-glyph-count] | 134 total-glyph-count] |
193 0x2A 0x5F ;; glyph-count-low -> E | 157 0x2A 0x5F ;; glyph-count-low -> E |
194 | 158 |
195 0x7E ;; delay -> A | 159 0x7E ;; delay -> A |
196 ]) | 160 ]) |
197 | 161 |
162 handle-delay* | |
163 (flatten | |
164 [0xA7 ;; test if delay is zero | |
165 ;; if delay is not 0, decrement and skip to cleanup | |
166 0x28 ;; JR Z, skip this section if A==0 | |
167 4 | |
168 0x3D ;; dec A | |
169 0x77 ;; (dec delay) -> delay | |
170 0x18 | |
171 :to-cleanup]) | |
172 | |
173 handle-glyph-count* | |
174 (flatten | |
175 [;; if glyph-count is 0, go directly to stack-cleanup | |
176 0x79 0xB0 ;; check if BC == 0 | |
177 0x20 ;; JR NZ, skip if BC !=0 | |
178 2 | |
179 0x18 | |
180 :to-stack-cleanup | |
181 ]) | |
182 | |
198 display-glyph [0 0 0] | 183 display-glyph [0 0 0] |
199 cleanup | 184 cleanup |
200 ;; restore all registers | 185 ;; restore all registers |
201 | 186 |
202 (flatten | 187 (flatten |
214 0x7B 0x22 ;; E -> glyph-count-low | 199 0x7B 0x22 ;; E -> glyph-count-low |
215 ]) | 200 ]) |
216 | 201 |
217 stack-cleanup | 202 stack-cleanup |
218 [0xF1 0xE1 0xD1 0xC1] | 203 [0xF1 0xE1 0xD1 0xC1] |
219 | 204 |
205 handle-delay | |
206 (replace {:to-cleanup | |
207 (+ (count display-glyph) (count handle-glyph-count*))} | |
208 handle-delay*) | |
209 | |
210 handle-glyph-count | |
211 (replace {:to-stack-cleanup | |
212 (+ (count display-glyph) (count cleanup))} | |
213 handle-glyph-count*) | |
220 ] | 214 ] |
221 (concat load-data | 215 (concat load-data |
222 ;;handle-delay handle-glyph-count | 216 handle-delay handle-glyph-count |
223 display-glyph | 217 display-glyph |
224 cleanup stack-cleanup))) | 218 cleanup stack-cleanup))) |
225 | 219 |
226 | 220 |
227 | 221 |