view clojure/com/aurellem/run/basic_choreo.clj @ 543:6c379ee3d46e

created video, but there are problems with it synching.
author Robert McIntyre <rlm@mit.edu>
date Mon, 25 Jun 2012 19:46:48 -0500
parents 614eddc5b38c
children 86d23b6d433f
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 0xC400
36 0xC800
37 0xCC00
38 music-program-start)]
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))))
74 (def basic-render-dir
75 (File. user-home "proj/vba-clojure/render/basic"))
77 (defn basic-steps [] (first (activate-media)))
79 (defn basic-step-1! []
80 (render-files!
81 basic-render-dir
82 (root) (basic-steps)))
84 (defn basic-step-2! []
85 (generate-composite-frames!
86 basic-render-dir
87 (basic-steps)))
89 (defn basic-step-3! [] (final-cut! basic-render-dir))