Project by: Mike Kohn

Music Player

The W65C265 chip has 2 tone generators built in, so I decided for a second project to play some music. The tone generators, unlike toggling an I/O pin with a timer, generates a sine wave. Since this project is pretty similar to my previous SN76489 MIDI player I ended up using the same C program to play the .mid files. The idea is, the C program on the PC parses the .mid file and sends 2 bytes over to the chip, the first byte tells it which channel and volume to play at and the second byte tells the frequency using a MIDI representation.

The C .mid player was designed for the original SN76489 MIDI player circuit, so it really wants to talk to a circuit with 2 sound chips that have 3 voices each. In this case, the SXB board appears as 2 channels with one voice each. So only having 2 voices heavily limited the .mid files that would sound nice. It ended up the Bach Invention 13 sounds good with just two channels, so I used that one in the video below. It is possible that I could have used the extra timers on the chip to get more voices with a square waveforms, but I didn’t want to create extra hardware for mixing channels.

Unlike the LED blinking programs which are written in assembly, I wanted to show off the capability of Java Grinder for the 65C816 so this program is written in Java. I can already imagine all the odd comments about writing Java for a 65C816, but it’s actually pretty slick. There’s even an Atari 2600 game Space Revenge written in Java with Java Grinder for the 6502.

The thing I find most interesting is quality of the sound. Those tone generators sound really nice with the sine waveform. I still like the sound of the SN76489 (see the video and mp3’s on that page to compare) but the W65CSXB is really nice on the ears (minus having to turn those guitar amps up a little too high in order to capture the sound with my camera).

Source code:
ToneGenerator.java

Share your understanding!