changeset 432:8e88366a81b9

reordered assembly in music-kernel.
author Robert McIntyre <rlm@mit.edu>
date Tue, 24 Apr 2012 23:51:30 -0500
parents b73cb1b937d5
children 985c90ffa1fe
files clojure/com/aurellem/run/music.clj
diffstat 1 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/music.clj	Tue Apr 24 23:18:40 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/music.clj	Tue Apr 24 23:51:30 2012 -0500
     1.3 @@ -226,11 +226,14 @@
     1.4     ]) 
     1.5  
     1.6  (defn music-step []
     1.7 +  ;; C == current-ticks
     1.8 +  ;; A == desired-ticks
     1.9 +
    1.10    (flatten
    1.11     [
    1.12      0xF5 ;; push A
    1.13      0xF0
    1.14 -    0x05 ;; load current ticks
    1.15 +    0x05 ;; load current ticks from 0xF005
    1.16      0xB8 ;; 
    1.17      0x30 ;; increment C only if last result caused carry
    1.18      0x01
    1.19 @@ -255,16 +258,9 @@
    1.20  
    1.21  (defn music-kernel []
    1.22    (flatten
    1.23 -   [(clear-music-registers)
    1.24 -
    1.25 -    0x21
    1.26 -    0x00
    1.27 -    0xD0 ;; set HL to 0xD000 == music-start
    1.28 -    0x0E
    1.29 -    0x00 ;; 0->C
    1.30 -    0x06
    1.31 -    0x00 ;; 0->B
    1.32 -
    1.33 +   [;; global initilization section
    1.34 +    (clear-music-registers)
    1.35 +    
    1.36      0x3E
    1.37      0x01
    1.38      0xE0
    1.39 @@ -275,6 +271,16 @@
    1.40      0xE0
    1.41      0x07 ;; set TAC to 65536 Hz and activate timer
    1.42  
    1.43 +    ;; local initilization section
    1.44 +    0x21
    1.45 +    0x00
    1.46 +    0xD0 ;; set HL to 0xD000 == music-start
    1.47 +    0x0E
    1.48 +    0x00 ;; 0->C
    1.49 +    0x06
    1.50 +    0x00 ;; 0->B
    1.51 +
    1.52 +
    1.53  
    1.54      0xAF ;; initialiaze A to zero
    1.55