# HG changeset patch # User Robert McIntyre # Date 1335329490 18000 # Node ID 8e88366a81b92c48afde8186751b894529be4344 # Parent b73cb1b937d581fdf230740edce63c611da131f6 reordered assembly in music-kernel. diff -r b73cb1b937d5 -r 8e88366a81b9 clojure/com/aurellem/run/music.clj --- a/clojure/com/aurellem/run/music.clj Tue Apr 24 23:18:40 2012 -0500 +++ b/clojure/com/aurellem/run/music.clj Tue Apr 24 23:51:30 2012 -0500 @@ -226,11 +226,14 @@ ]) (defn music-step [] + ;; C == current-ticks + ;; A == desired-ticks + (flatten [ 0xF5 ;; push A 0xF0 - 0x05 ;; load current ticks + 0x05 ;; load current ticks from 0xF005 0xB8 ;; 0x30 ;; increment C only if last result caused carry 0x01 @@ -255,16 +258,9 @@ (defn music-kernel [] (flatten - [(clear-music-registers) - - 0x21 - 0x00 - 0xD0 ;; set HL to 0xD000 == music-start - 0x0E - 0x00 ;; 0->C - 0x06 - 0x00 ;; 0->B - + [;; global initilization section + (clear-music-registers) + 0x3E 0x01 0xE0 @@ -275,6 +271,16 @@ 0xE0 0x07 ;; set TAC to 65536 Hz and activate timer + ;; local initilization section + 0x21 + 0x00 + 0xD0 ;; set HL to 0xD000 == music-start + 0x0E + 0x00 ;; 0->C + 0x06 + 0x00 ;; 0->B + + 0xAF ;; initialiaze A to zero