view clojure/com/aurellem/run/basic_choreo.clj @ 563:a70d9223f6eb

added blank glyph.
author Robert McIntyre <rlm@mit.edu>
date Fri, 31 Aug 2012 09:37:18 -0500
parents b69a3dba8045
children 96ee9d72aeb9
line wrap: on
line source
1 ;;;; "Basic Choreography" -- just show off audio/video
3 (ns com.aurellem.run.basic-choreo
4 (:use (com.aurellem.gb saves gb-driver util constants
5 items vbm characters money
6 rlm-assembly))
7 (:use (com.aurellem.run util music title save-corruption
8 bootstrap-0 bootstrap-1 image
9 ram-display final-cut))
10 (:require clojure.string)
11 (:import [com.aurellem.gb.gb_driver SaveState])
12 (:import java.io.File))
14 ;; take over game
15 ;; [X] silence noise
16 ;; [X] preload audio/video programs
17 ;; [X] run picture program to display pinkie pie mark
18 ;; [X] play pony song
20 (defn-memo silence-noise
21 ([] (silence-noise (launch-main-bootstrap-program)))
22 ([script]
23 (->> script
24 (write-RAM 0xFF1A [0 0 0])
25 (relocate-main-bootstrap))))
27 (def music-program-start 0xC000)
28 (def image-program-start 0xCE00)
30 (defn-memo write-pony-music
31 ([] (write-pony-music (silence-noise)))
32 ([script]
33 (let [bytes (midi-bytes
34 pony-csv
35 music-program-start
36 0xC400
37 0xC800
38 0xCC00)]
39 (->> script
40 (write-RAM (:address (:voice-1 bytes))
41 (:data (:voice-1 bytes)))
42 (write-RAM (:address (:voice-2 bytes))
43 (:data (:voice-2 bytes)))
44 (write-RAM (:address (:noise bytes))
45 (:data (:noise bytes)))
46 (write-RAM (:address (:kernel bytes))
47 (:data (:kernel bytes)))))))
49 (defn-memo write-image-display-program
50 ([] (write-image-display-program (write-pony-music)))
51 ([script]
52 (let [goto-music
53 (flatten
54 [0xC3
55 (reverse (disect-bytes-2 music-program-start))])]
56 (->> script
57 (write-RAM
58 image-program-start
59 (concat
60 (display-image-kernel
61 image-program-start
62 pinkie-pie-mark)
63 goto-music))))))
65 (defn-memo activate-media
66 ([] (activate-media (write-image-display-program)))
67 ([script]
68 (->> script
69 (transfer-control image-program-start)
70 (do-nothing 1800))))
72 (def basic-render-dir
73 (File. user-home "proj/vba-clojure/render/basic3"))
75 (defn basic-steps [] (first (activate-media)))
77 (defn basic-step-1! []
78 (render-files!
79 basic-render-dir
80 (root) (basic-steps)))
82 (defn basic-step-2! []
83 (generate-composite-frames!
84 basic-render-dir))
86 (defn basic-step-3! [] (final-cut! basic-render-dir))