Mercurial > vba-clojure
view clojure/com/aurellem/run/basic_choreo.clj @ 552:9068685e7d96
moduralized main-bootstrap-program
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 30 Aug 2012 12:09:15 -0500 |
parents | b69a3dba8045 |
children | 96ee9d72aeb9 |
line wrap: on
line source
1 ;;;; "Basic Choreography" -- just show off audio/video3 (ns com.aurellem.run.basic-choreo4 (:use (com.aurellem.gb saves gb-driver util constants5 items vbm characters money6 rlm-assembly))7 (:use (com.aurellem.run util music title save-corruption8 bootstrap-0 bootstrap-1 image9 ram-display final-cut))10 (:require clojure.string)11 (:import [com.aurellem.gb.gb_driver SaveState])12 (:import java.io.File))14 ;; take over game15 ;; [X] silence noise16 ;; [X] preload audio/video programs17 ;; [X] run picture program to display pinkie pie mark18 ;; [X] play pony song20 (defn-memo silence-noise21 ([] (silence-noise (launch-main-bootstrap-program)))22 ([script]23 (->> script24 (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-music31 ([] (write-pony-music (silence-noise)))32 ([script]33 (let [bytes (midi-bytes34 pony-csv35 music-program-start36 0xC40037 0xC80038 0xCC00)]39 (->> script40 (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-program50 ([] (write-image-display-program (write-pony-music)))51 ([script]52 (let [goto-music53 (flatten54 [0xC355 (reverse (disect-bytes-2 music-program-start))])]56 (->> script57 (write-RAM58 image-program-start59 (concat60 (display-image-kernel61 image-program-start62 pinkie-pie-mark)63 goto-music))))))65 (defn-memo activate-media66 ([] (activate-media (write-image-display-program)))67 ([script]68 (->> script69 (transfer-control image-program-start)70 (do-nothing 1800))))72 (def basic-render-dir73 (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-dir80 (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))