diff --git a/Programs/Examples/tune.asm b/Programs/Examples/tune.asm index 6c3bac0..59ddcec 100644 --- a/Programs/Examples/tune.asm +++ b/Programs/Examples/tune.asm @@ -17,6 +17,18 @@ ; Borrowing the screen's frame costs nothing and works, which is the whole reason to notice ; that a beat is a beat wherever it comes from. ; +; ---- What borrowing it costs ---- +; +; The frame is not slow. It is FIXED, and that is the different complaint. Every duration here +; is a whole number of 16.67 ms, so a note worth a third of a beat cannot be written at all - +; and the way round it is to pick a tempo whose subdivisions happen to land on whole frames, +; which is making the tune fit the machine rather than the other way round. The theme below +; was written to the frame and is a few cents of tempo away from what it wants to be. +; +; So what the timer wants is an ARBITRARY tick rather than a faster fixed one, and the reason +; the screen should not be the clock is that a display refresh and a music routine have no +; reason to share a rate. +; ; ---- What a patch costs and what a note costs ---- ; ; Setting the sound up is twenty-odd writes, done once before a single note is played. After @@ -137,7 +149,7 @@ start: ; ; Data Pointer 0 walks the table, and nothing in this loop is a CALL, so it stays where it ; was left without being saved anywhere. - SETD.0 Tune + SETD.0 Theme nextNote: LDA.0 ; The note. Zero is the end of the tune. @@ -197,6 +209,69 @@ Tune: 0d60 0d45 ; and home 0x00 +Theme: + 0x30 0d15 ; C + 0x35 0d15 ; F + 0x3C 0d15 ; C+ + 0x40 0d30 ; E+ + 0x48 0d30 ; C++ + 0x45 0d30 ; A+ + 0x47 0d30 ; B+ + 0x43 0d45 ; G+ + ; repeat four times. + 0x2A 0d7 ; Gs + 0x33 0d7 ; Ef + 0x3C 0d7 ; C+ + ; + 0x2A 0d7 ; Gs + 0x33 0d7 ; Ef + 0x3C 0d7 ; C+ + ; + 0x2A 0d7 ; Gs + 0x33 0d7 ; Ef + 0x3C 0d7 ; C+ + ; + 0x2A 0d7 ; Gs + 0x33 0d7 ; Ef + 0x3C 0d7 ; C+ + ; next chord + 0x2E 0d7 ; Bf + 0x35 0d7 ; F + 0x3E 0d7 ; D+ + ; next chord + 0x2E 0d7 ; Bf + 0x35 0d7 ; F + 0x3E 0d7 ; D+ + ; + ; next chord + 0x2E 0d7 ; Bf + 0x35 0d7 ; F + 0x3E 0d7 ; D+ + ; + ; next chord + 0x2E 0d7 ; Bf + 0x35 0d7 ; F + 0x3E 0d7 ; D+ + ; Finally on the C major + 0x30 0d7 ; C + 0x37 0d7 ; G + 0x40 0d7 ; E+ + ; + 0x30 0d7 ; C + 0x37 0d7 ; G + 0x40 0d7 ; E+ + ; + 0x30 0d7 ; C + 0x37 0d7 ; G + 0x40 0d7 ; E+ + ; + 0x30 0d7 ; C + 0x37 0d7 ; G + 0x40 0d7 ; E+ + ; + 0x18 0d60 ; C bass + 0x00 + #Vectors Boot start diff --git a/Tests/manifest b/Tests/manifest index 9f7f64e..bc83432 100644 --- a/Tests/manifest +++ b/Tests/manifest @@ -52,11 +52,16 @@ frames | Examples/frames.asm | run | - # picture draws a whole 320 by 200 bitmap and prints nothing, so what is recorded is only # that it ran and what it cost. Tests/video.sh is where the pixels are checked. picture | Examples/picture.asm | run | - | - -# tune plays eight notes and prints nothing, so what is recorded is that it ran, that it -# finished on its own, and how much of its time it spent asleep - which is nearly all of it, -# because the tempo is the screen's frame and a program waiting on a frame is not using the -# bus. Tests/sound.sh is where the samples are checked. -tune | Examples/tune.asm | run | - | 5000000 +# tune plays the Anachronaut Labs theme and prints nothing, so what is recorded is that it +# ran, that it finished on its own, and how much of its time it spent asleep - which is +# 99.8% of it, because the tempo is the screen's frame and a program waiting on a frame is +# not using the bus. Tests/sound.sh is where the samples are checked. +# +# THE BUDGET IS A DURATION, and that is the thing to know if this ever fails. 567 frames of +# music at 16,667 cycles a frame is 9.45 million, so twelve leaves room to lengthen the tune +# without coming back here - and a failure saying "cycle limit reached" means somebody added +# bars, not that anything broke. +tune | Examples/tune.asm | run | - | 12000000 8bitSieve | Examples/primeSieve/8bitSieve.asm | run | - | - 16bitSegmentedSieve | Examples/primeSieve/16bitSieve.asm | run | - | - # The four pointer rewrite. It emits exactly the same primes as the line above, which