Mercurial > vba-clojure
comparison clojure/com/aurellem/run/basic_choreo.clj @ 541:cd557c922cec
working on basic choreo.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 25 Jun 2012 15:32:16 -0500 |
parents | |
children | 614eddc5b38c |
comparison
equal
deleted
inserted
replaced
540:7f8030812ac2 | 541:cd557c922cec |
---|---|
1 (ns com.aurellem.run.basic_choreo | |
2 (:use (com.aurellem.gb saves gb-driver util constants | |
3 items vbm characters money | |
4 rlm-assembly)) | |
5 (:use (com.aurellem.run util music title save-corruption | |
6 bootstrap-0 bootstrap-1 image | |
7 ram-display)) | |
8 (:require clojure.string) | |
9 (:import [com.aurellem.gb.gb_driver SaveState]) | |
10 (:import java.io.File)) | |
11 | |
12 | |
13 | |
14 ;; take over game | |
15 ;; [X] silence noise | |
16 ;; [ ] run picture program to display pinkie pie mark | |
17 ;; [ ] play pony song | |
18 | |
19 | |
20 (defn-memo silence-noise | |
21 ([] (silence-noise (relocate-main-bootstrap))) | |
22 ([script] | |
23 (->> script | |
24 (write-RAM 0xFF1A [0 0 0])))) | |
25 | |
26 (def music-program-start 0xC000) | |
27 (def image-program-start 0xCE00) | |
28 | |
29 (defn-memo write-pony-music-data | |
30 ([] (write-pony-music-data (silence-noise))) | |
31 ([script] | |
32 (let [bytes (midi-bytes | |
33 pony-csv | |
34 0xC400 | |
35 0xC800 | |
36 0xCC00 | |
37 0xC000)] | |
38 (->> script | |
39 (write-RAM (:address (:voice-1 bytes)) | |
40 (:data (:voice-1 bytes))) | |
41 (write-RAM (:address (:voice-2 bytes)) | |
42 (:data (:voice-2 bytes))) | |
43 (write-RAM (:address (:noise bytes)) | |
44 (:data (:noise bytes))) | |
45 (write-RAM (:address (:kernel bytes)) | |
46 (:data (:kernel bytes))))))) | |
47 | |
48 (defn-memo write-image-display-program | |
49 ([] (write-image-display-program (write-pony-music-data))) | |
50 ([script] | |
51 (let [return-to-bootstrap | |
52 (flatten | |
53 [0xC3 | |
54 (disect-bytes-2 relocated-bootstrap-start)])] | |
55 (->> script | |
56 (write-RAM | |
57 image-program-start | |
58 (concat | |
59 (display-image-kernel | |
60 image-program-start | |
61 pinkie-pie-mark) | |
62 return-to-bootstrap)))))) | |
63 | |
64 (defn-memo activate-media | |
65 ([] (activate-media (write-image-display-program))) | |
66 ([script] | |
67 (->> script | |
68 (transfer-control image-program-start) | |
69 (do-nothing 100) | |
70 (transfer-control music-program-start)))) | |
71 | |
72 |