diff --git a/docs/intro.tex b/docs/intro.tex index 7b435264f..3140f65d0 100644 --- a/docs/intro.tex +++ b/docs/intro.tex @@ -54,3 +54,8 @@ \subsection{Fractals} The fractals can then be shown by typing \texttt{koch weed1 bush1 bush2}. When a fractal have finished drawing, press any key to continue. +\subsection{Music} + +The mmldemo package demonstrates the MML music capabilities. To run: + +\texttt{s" mmldemo" load frere-jaques sarias-song} diff --git a/docs/manual.tex b/docs/manual.tex index 455015a62..800a67c33 100644 --- a/docs/manual.tex +++ b/docs/manual.tex @@ -26,6 +26,7 @@ \input{editor.tex} \input{forth.tex} \input{gfx.tex} +\input{mml.tex} \appendix \input{asm.tex} \input{memmap.tex} diff --git a/docs/mml.tex b/docs/mml.tex new file mode 100644 index 000000000..3f0215af0 --- /dev/null +++ b/docs/mml.tex @@ -0,0 +1,25 @@ +\chapter{Music} + +\section{Music Macro Language} + +Music Macro Language (MML) has been used since the 1970s to sequence music on computer and video game systems. MML support is included in durexForth, starting with version 1.3. The package is loaded with \texttt{s" mml" load"}. Two demonstration songs can be found in the \texttt{mmldemo} package. + +MML songs are played using the Forth word \texttt{play-mml} which takes three strings, one MML melody for each of the three SID voices. An example song is as follows: + +\begin{verbatim} +: frere-jaques +s" o3l4fgaffgafab->c&cc&cl8cdcl8cdcc&cc&cl8cdcl8cdc$] Used to step down or up one octave. +\item[l] Followed by a number, specifies the default length used by notes or rests which do not explicitly specify one. +\item[\&] Ties two notes together. +\end{description} diff --git a/forth_src/mml.fs b/forth_src/mml.fs index 5e2ea2cb8..b184b71cf 100644 --- a/forth_src/mml.fs +++ b/forth_src/mml.fs @@ -272,11 +272,23 @@ default-pause lda, default-pause 3 + sta, :- sid lda,y d400 sta,y dey, -branch bpl, ;asm +:asm notdone +dex, dex, +0 lda,# voice sta, +.strget jsr, 0 ora,# +branch bne, +voice inc, +.strget jsr, 0 ora,# +branch bne, +voice inc, +.strget jsr, 0 ora,# +branch bne, +0 lda,# 0 sta,x 1 sta,x ;asm +:+ :+ :+ +0 sta,x ;asm + : play voice0 do-commands voice1 do-commands voice2 do-commands voicedone -a2 c@ wait begin strget while +a2 c@ wait begin notdone while voice0 voicetick voice1 voicetick voice2 voicetick voicedone diff --git a/forth_src/mmldemo.fs b/forth_src/mmldemo.fs index 3abc88f1d..6a88a94f1 100644 --- a/forth_src/mmldemo.fs +++ b/forth_src/mmldemo.fs @@ -1,8 +1,11 @@ s" mml" load -: mmldemo -# saria's song (zelda lost woods theme) +: frere-jaques +s" o3l4fgaffgafab->c&cc&cl8cdcl8cdcc&cc&cl8cdcl8cdcerd4crerd4crercrd4e8frg2&g4r1r1c8
d8cre8drf8ercrc8c8dre2&e4c8c8
d8crefrde1&e2r4"