Mercurial > vba-clojure
changeset 551:b69a3dba8045
condensed gameboy program into a contigous sequence of bytes.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 30 Aug 2012 11:19:52 -0500 |
parents | 23572082c4a5 |
children | 9068685e7d96 |
files | .hgignore clojure/com/aurellem/run/adv_choreo.clj clojure/com/aurellem/run/basic_choreo.clj clojure/com/aurellem/run/music.clj font/0.png font/1.png font/2.png font/3.png font/4.png font/5.png font/6.png font/7.png font/8.png font/9.png font/A.png font/B.png font/C.png font/D.png font/E.png font/F.png |
diffstat | 20 files changed, 72 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/.hgignore Thu Aug 30 09:32:57 2012 -0500 1.2 +++ b/.hgignore Thu Aug 30 11:19:52 2012 -0500 1.3 @@ -17,4 +17,5 @@ 1.4 java/.ant-targets-build.xml 1.5 html/* 1.6 java/lib/* 1.7 -render/* 1.8 \ No newline at end of file 1.9 +render/* 1.10 +zophar/* 1.11 \ No newline at end of file
2.1 --- a/clojure/com/aurellem/run/adv_choreo.clj Thu Aug 30 09:32:57 2012 -0500 2.2 +++ b/clojure/com/aurellem/run/adv_choreo.clj Thu Aug 30 11:19:52 2012 -0500 2.3 @@ -28,3 +28,68 @@ 2.4 ;; the game. 2.5 2.6 2.7 +;; Symbol size and type. 2.8 + 2.9 +;; use fonts from zophar's domain: 2.10 +;; http://www.zophar.net/utilities/fonts/8x8-font-archive.html 2.11 + 2.12 +;; Green font on black background for matrix look. 2.13 + 2.14 + 2.15 + 2.16 +;; [ ] get single long ram write. 2.17 + 2.18 + 2.19 + 2.20 + 2.21 +(defn program-data [base-address] 2.22 + (let [image-program 2.23 + (display-image-kernel 2.24 + base-address 2.25 + pinkie-pie-mark) 2.26 + 2.27 + music-base-address (+ (count image-program) base-address) 2.28 + 2.29 + initial-music-data 2.30 + (midi-bytes pony-csv 0 0 0 0) 2.31 + 2.32 + data-lengths 2.33 + (map (comp count :data) 2.34 + [(:kernel initial-music-data) 2.35 + (:voice-1 initial-music-data) 2.36 + (:voice-2 initial-music-data)]);; noise not needed 2.37 + addresses 2.38 + (map (partial + music-base-address) (reductions + 0 data-lengths)) 2.39 + 2.40 + final-music-data 2.41 + (apply (partial midi-bytes pony-csv) addresses) 2.42 + 2.43 + music-program 2.44 + (concat 2.45 + (:data (:kernel final-music-data)) 2.46 + (:data (:voice-1 final-music-data)) 2.47 + (:data (:voice-2 final-music-data)) 2.48 + (:data (:noise final-music-data)))] 2.49 + 2.50 + (concat 2.51 + image-program ;; image program falls through to music program 2.52 + music-program))) 2.53 + 2.54 + 2.55 + 2.56 +(def main-program-base-address 0xC000) 2.57 + 2.58 +(defn write-all-program-data 2.59 + ([] (write-all-program-data (silence-noise))) 2.60 + ([script] 2.61 + (let [base-address main-program-base-address] 2.62 + (->> script 2.63 + (write-RAM base-address (program-data base-address)))))) 2.64 + 2.65 +(defn activate-program 2.66 + ([] (activate-program (write-all-program-data))) 2.67 + ([script] 2.68 + (->> script 2.69 + (transfer-control main-program-base-address) 2.70 + (do-nothing 1800)))) 2.71 + 2.72 \ No newline at end of file
3.1 --- a/clojure/com/aurellem/run/basic_choreo.clj Thu Aug 30 09:32:57 2012 -0500 3.2 +++ b/clojure/com/aurellem/run/basic_choreo.clj Thu Aug 30 11:19:52 2012 -0500 3.3 @@ -32,10 +32,10 @@ 3.4 ([script] 3.5 (let [bytes (midi-bytes 3.6 pony-csv 3.7 + music-program-start 3.8 0xC400 3.9 0xC800 3.10 - 0xCC00 3.11 - music-program-start)] 3.12 + 0xCC00)] 3.13 (->> script 3.14 (write-RAM (:address (:voice-1 bytes)) 3.15 (:data (:voice-1 bytes)))
4.1 --- a/clojure/com/aurellem/run/music.clj Thu Aug 30 09:32:57 2012 -0500 4.2 +++ b/clojure/com/aurellem/run/music.clj Thu Aug 30 11:19:52 2012 -0500 4.3 @@ -586,8 +586,8 @@ 4.4 (map #(get % :duty 0) duty-info))})) 4.5 4.6 (defn midi-bytes 4.7 - ([^File midi-file voice-1-target voice-2-target 4.8 - noise-target program-target] 4.9 + ([^File midi-file program-target 4.10 + voice-1-target voice-2-target noise-target] 4.11 (let [mini-midi (midi->mini-midi midi-file) 4.12 long-silence (flatten (note-codes 20 0 3000)) 4.13 long-noise-silence 4.14 @@ -614,7 +614,7 @@ 4.15 :kernel {:address program-target 4.16 :data kernel}})) 4.17 ([^File midi-file] 4.18 - (midi-bytes midi-file 0xC400 0xC800 0xCC00 0xC000))) 4.19 + (midi-bytes midi-file 0xC000 0xC400 0xC800 0xCC00))) 4.20 4.21 (defn play-midi [^File midi-file] 4.22 (let [bytes (midi-bytes midi-file)]
5.1 Binary file font/0.png has changed
6.1 Binary file font/1.png has changed
7.1 Binary file font/2.png has changed
8.1 Binary file font/3.png has changed
9.1 Binary file font/4.png has changed
10.1 Binary file font/5.png has changed
11.1 Binary file font/6.png has changed
12.1 Binary file font/7.png has changed
13.1 Binary file font/8.png has changed
14.1 Binary file font/9.png has changed
15.1 Binary file font/A.png has changed
16.1 Binary file font/B.png has changed
17.1 Binary file font/C.png has changed
18.1 Binary file font/D.png has changed
19.1 Binary file font/E.png has changed
20.1 Binary file font/F.png has changed