comparison clojure/com/aurellem/run/adv_choreo.clj @ 589:d9d86f6018e8

cleanup.
author Robert McIntyre <rlm@mit.edu>
date Sat, 01 Sep 2012 10:15:04 -0500
parents 6e9368c371d5
children ba185915c24f
comparison
equal deleted inserted replaced
588:6e9368c371d5 589:d9d86f6018e8
41 (defn program-data [base-address] 41 (defn program-data [base-address]
42 (let [image-program 42 (let [image-program
43 (display-image-kernel 43 (display-image-kernel
44 base-address 44 base-address
45 45
46 ;;pinkie-pie-mark 46 pinkie-pie-mark
47 test-image-color 47 ;;test-image-color
48
49 ) 48 )
50 49
51 50
52 music-base-address (+ (count image-program) base-address) 51 music-base-address (+ (count image-program) base-address)
53 52
72 (:data (:voice-2 final-music-data)) 71 (:data (:voice-2 final-music-data))
73 (:data (:noise final-music-data)))] 72 (:data (:noise final-music-data)))]
74 73
75 (concat 74 (concat
76 image-program ;; image program falls through to music program 75 image-program ;; image program falls through to music program
77 76 music-program)))
78 (infinite-loop)
79 ;;music-program
80
81 )))
82
83
84
85 77
86 (def glyphs 78 (def glyphs
87 "The sixteen 8x8 glyphs which make up the \"terminal\" font." 79 "The sixteen 8x8 glyphs which make up the \"terminal\" font."
88 (mapv #(ImageIO/read 80 (mapv #(ImageIO/read
89 (File. user-home (str "proj/vba-clojure/font/" % ".png"))) 81 (File. user-home (str "proj/vba-clojure/font/" % ".png")))
299 291
300 glyph-display (glyph-display-program 292 glyph-display (glyph-display-program
301 (+ (count init) 293 (+ (count init)
302 (count header) 294 (count header)
303 start-address)) 295 start-address))
304 ;;(- (count (program-data 0)) 100))
305 296
306 state-machine-start-address 297 state-machine-start-address
307 (+ start-address (count init) (count header) (count glyph-display)) 298 (+ start-address (count init) (count header) (count glyph-display))
308 state-machine 299 state-machine
309 (bootstrap-state-machine state-machine-start-address) 300 (bootstrap-state-machine state-machine-start-address)
312 (flatten 303 (flatten
313 [0xC3 304 [0xC3
314 (reverse (disect-bytes-2 305 (reverse (disect-bytes-2
315 (+ (count init) start-address)))])] 306 (+ (count init) start-address)))])]
316 (concat init header glyph-display state-machine return-to-header))) 307 (concat init header glyph-display state-machine return-to-header)))
317
318
319 308
320 (defn-memo begin-glyph-bootstrap 309 (defn-memo begin-glyph-bootstrap
321 ([] (begin-glyph-bootstrap (launch-main-bootstrap-program))) 310 ([] (begin-glyph-bootstrap (launch-main-bootstrap-program)))
322 ([script] 311 ([script]
323 (let [glyph-init (glyph-init-program relocated-bootstrap-start) 312 (let [glyph-init (glyph-init-program relocated-bootstrap-start)
332 321
333 (write-RAM 322 (write-RAM
334 relocated-bootstrap-start 323 relocated-bootstrap-start
335 (concat glyph-init glyph-program)) 324 (concat glyph-init glyph-program))
336 (transfer-control relocated-bootstrap-start) 325 (transfer-control relocated-bootstrap-start)
337 (do-nothing 1) 326 (do-nothing 1)))))
338
339 ))))
340 327
341 (defn write-all-program-data 328 (defn write-all-program-data
342 ([] (write-all-program-data (begin-glyph-bootstrap))) 329 ([] (write-all-program-data (begin-glyph-bootstrap)))
343 ([script] 330 ([script]
344 (let [base-address main-program-base-address] 331 (let [base-address main-program-base-address]
348 (defn activate-program 335 (defn activate-program
349 ([] (activate-program (write-all-program-data))) 336 ([] (activate-program (write-all-program-data)))
350 ([script] 337 ([script]
351 (->> script 338 (->> script
352 (transfer-control main-program-base-address) 339 (transfer-control main-program-base-address)
353 ;;(do-nothing 1800) 340 (do-nothing 1800))))
354 (do-nothing 50)
355 )))
356 341
357 342
358 ;; possible screen writing programs 343 ;; possible screen writing programs
359 344
360 ;; (program needs to stop executing at some point) 345 ;; (program needs to stop executing at some point)