Can I have a routine(just like calcmod) of it so I can learn from it?
I want to do something with outputting 2 notes at once(not 4, though. I want to figure that out on my own when I get a routine for 2.)
Thank you in advance!
As I suggested in the chat, take a look at
QuadPlayer - there's a routine in Source/Source/Quad.asm, but more usefully there's a rough explanation of how it works in the documentation under the heading "How it works".
yeong, do you understand the concepts of outputting one note at once? If not, let me explain it. Basically, a note in music has a wavelength. A standard A note, for example, is 440Hz, which means that there are 440 cycles per second in the note, periods of a sinusoidal wave. Indeed, if you think about the shape of a sinusoid, that means the wave crosses the X axis 880 times per second. Since we have only two states for the calculator link port, off and on, we approximate notes with something called PWM; in this case, we would turn the link port line high 440 times per second and low 440 times per second, switching it every 1/880th of a second.
If you want to do two notes at once, all you need to do is keep two timers, one for each of the channels, so you know when to change the state of one or the other link line. The hardest part about this is doing proper clock cycle counting, to make sure that the timing comes out right.