Mercurial > vba-clojure
comparison clojure/com/aurellem/run/adv_choreo.clj @ 556:6e6b7961595b
created scaffold for displaying terminal characters.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 31 Aug 2012 01:48:31 -0500 |
parents | 2d9bf762a073 |
children | cd54ac4a8701 |
comparison
equal
deleted
inserted
replaced
555:2d9bf762a073 | 556:6e6b7961595b |
---|---|
125 2))])] | 125 2))])] |
126 (concat A B ))) | 126 (concat A B ))) |
127 | 127 |
128 (defn glyph-display-program | 128 (defn glyph-display-program |
129 [start-address | 129 [start-address |
130 monitor-address | |
130 delay-count | 131 delay-count |
131 total-glyph-count] | 132 total-glyph-count] |
132 [0xC5 | 133 (let [data-start (+ 2 start-address) |
133 0xD5 | 134 monitor-address-high (+ 0 data-start) |
134 0xE5 | 135 monitor-address-low (+ 1 data-start) |
135 0xF5 | 136 |
136 | 137 glyph-count-high (+ 2 data-start) |
137 | 138 glyph-count-low (+ 3 data-start) |
138 | 139 |
139 0xF1 | 140 delay-address (+ 4 data-start)] |
140 0xE1 | 141 |
141 0xD1 | 142 |
142 0xC1 | 143 (flatten |
143 | 144 [;; data region |
144 ]) | 145 |
145 | 146 0x18 |
147 5 | |
148 (disect-bytes-2 monitor-address) | |
149 (disect-bytes-2 total-glyph-count) | |
150 delay-count | |
151 | |
152 ;; save all registers | |
153 0xC5 0xD5 0xE5 0xF5 | |
154 | |
155 ;; load data from data region into registers | |
156 | |
157 0x21 | |
158 (disect-bytes-2 monitor-address-high) | |
159 | |
160 0x2A 0x47 ;; monitor-address-high -> B | |
161 0x2A 0x4F ;; monitor-address-low -> C | |
162 | |
163 0x2A 0x57 ;; glyph-count-high -> D | |
164 0x2A 0x5F ;; glyph-count-low -> E | |
165 | |
166 0x2A ;; delay -> A | |
167 | |
168 | |
169 | |
170 | |
171 ;; restore all registers | |
172 0xF1 0xE1 0xD1 0xC1 | |
173 ]))) | |
174 | |
175 (def main-program-base-address 0xC000) | |
146 | 176 |
147 (defn glyph-bootstrap-program | 177 (defn glyph-bootstrap-program |
148 [start-address delay-count total-glyph-count] | 178 [start-address delay-count total-glyph-count] |
149 (let [init [0xAF 0x4F 0x47] ;; 0->A; 0->C; 0->B | 179 (let [init [0xAF 0x4F 0x47] ;; 0->A; 0->C; 0->B |
150 header (concat (frame-metronome) (read-user-input)) | 180 header (concat (frame-metronome) (read-user-input)) |
151 | 181 |
152 glyph-display (glyph-display-program | 182 glyph-display (glyph-display-program |
153 (+ (count init) (count header) | 183 (+ (count init) (count header) |
154 start-address) | 184 start-address) |
155 0 0) ;; ONLY FOR TESTING | 185 main-program-base-address 100 |
186 (- (count (program-data 0)) 100)) | |
156 | 187 |
157 state-machine-start-address | 188 state-machine-start-address |
158 (+ start-address (count init) (count header) (count glyph-display)) | 189 (+ start-address (count init) (count header) (count glyph-display)) |
159 state-machine | 190 state-machine |
160 (bootstrap-state-machine state-machine-start-address) | 191 (bootstrap-state-machine state-machine-start-address) |
171 (count header) | 202 (count header) |
172 (count state-machine)))])] | 203 (count state-machine)))])] |
173 | 204 |
174 (concat init glyph-display header state-machine return-to-header))) | 205 (concat init glyph-display header state-machine return-to-header))) |
175 | 206 |
176 (def main-program-base-address 0xC000) | 207 |
177 | 208 |
178 (defn begin-glyph-bootstrap | 209 (defn begin-glyph-bootstrap |
179 ([] (begin-glyph-bootstrap (launch-main-bootstrap-program))) | 210 ([] (begin-glyph-bootstrap (launch-main-bootstrap-program))) |
180 ([script] | 211 ([script] |
181 (let [glyph-init (glyph-init-program relocated-bootstrap-start) | 212 (let [glyph-init (glyph-init-program relocated-bootstrap-start) |