Mercurial > vba-clojure
comparison clojure/com/aurellem/run/adv_choreo.clj @ 557:cd54ac4a8701
more cleanup code.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 31 Aug 2012 02:01:34 -0500 |
parents | 6e6b7961595b |
children | 6f8b15c2fb48 |
comparison
equal
deleted
inserted
replaced
556:6e6b7961595b | 557:cd54ac4a8701 |
---|---|
135 monitor-address-low (+ 1 data-start) | 135 monitor-address-low (+ 1 data-start) |
136 | 136 |
137 glyph-count-high (+ 2 data-start) | 137 glyph-count-high (+ 2 data-start) |
138 glyph-count-low (+ 3 data-start) | 138 glyph-count-low (+ 3 data-start) |
139 | 139 |
140 delay-address (+ 4 data-start)] | 140 delay-address (+ 4 data-start) |
141 | 141 |
142 | 142 load-data |
143 (flatten | 143 (flatten |
144 [;; data region | 144 [;; data region |
145 | 145 |
146 0x18 | 146 0x18 |
147 5 | 147 5 |
148 (disect-bytes-2 monitor-address) | 148 (disect-bytes-2 monitor-address) |
149 (disect-bytes-2 total-glyph-count) | 149 (disect-bytes-2 total-glyph-count) |
150 delay-count | 150 delay-count |
151 | 151 |
152 ;; save all registers | 152 ;; save all registers |
153 0xC5 0xD5 0xE5 0xF5 | 153 0xC5 0xD5 0xE5 0xF5 |
154 | 154 |
155 ;; load data from data region into registers | 155 ;; load data from data region into registers |
156 | 156 |
157 0x21 | 157 0x21 |
158 (disect-bytes-2 monitor-address-high) | 158 (disect-bytes-2 monitor-address-high) |
159 | 159 |
160 0x2A 0x47 ;; monitor-address-high -> B | 160 0x2A 0x47 ;; monitor-address-high -> B |
161 0x2A 0x4F ;; monitor-address-low -> C | 161 0x2A 0x4F ;; monitor-address-low -> C |
162 | 162 |
163 0x2A 0x57 ;; glyph-count-high -> D | 163 0x2A 0x57 ;; glyph-count-high -> D |
164 0x2A 0x5F ;; glyph-count-low -> E | 164 0x2A 0x5F ;; glyph-count-low -> E |
165 | 165 |
166 0x2A ;; delay -> A | 166 0x2A ;; delay -> A |
167 | 167 ]) |
168 | 168 |
169 | 169 handle-delay* |
170 | 170 (flatten |
171 ;; restore all registers | 171 [0xA7 ;; test if A is zero |
172 0xF1 0xE1 0xD1 0xC1 | 172 ;; if A is not 0, decrement and skip to cleanup |
173 ]))) | 173 0x20 |
174 5 | |
175 0x3D | |
176 0x77 | |
177 0xC3 | |
178 :cleanup-address-low | |
179 :cleanup-address-high]) | |
180 | |
181 | |
182 | |
183 cleanup | |
184 ;; restore all registers | |
185 [0xF1 0xE1 0xD1 0xC1] | |
186 | |
187 [cleanup-address-high | |
188 cleanup-address-low] (disect-bytes-2 | |
189 (+ start-address (count load-data) | |
190 (count handle-delay*))) | |
191 | |
192 handle-delay | |
193 (replace {:cleanup-address-low cleanup-address-low | |
194 :cleanup-address-high cleanup-address-high} | |
195 handle-delay*)] | |
196 (concat load-data handle-delay cleanup))) | |
197 | |
198 | |
174 | 199 |
175 (def main-program-base-address 0xC000) | 200 (def main-program-base-address 0xC000) |
176 | 201 |
177 (defn glyph-bootstrap-program | 202 (defn glyph-bootstrap-program |
178 [start-address delay-count total-glyph-count] | 203 [start-address delay-count total-glyph-count] |