Skip to main content
Topic: ATARI POKEY 8-bit Computer Sound on PIC32 (Read 18491 times) previous topic - next topic

ATARI POKEY 8-bit Computer Sound on PIC32


I successfully compiled the ASAP (Another Slight Atari Player) library [1] for a PIC32MX795F512H.  ASAP emulates a 6502 CPU and the famous POKEY sound chip [2] used for example in the ATARI 400/800 and XL/XE 8-bit computers.  To say it with Wikipedia's words: POKEY's sound is distinctive :)

About 60 tunes (worth about 2.5 hours of music) taken from ASMA (Atari SAP Music Archive) [3] are included and stored in the PICs flash memory.  D0 is the left and D1 the right PWM channel.

Please find the source code attached below.
The YouTube video can be found here:


Re: ATARI POKEY 8-bit Computer Sound on PIC32

Reply #1
Awesome! :) The youtube video of it playing is really good, the audio quality specifically. Are you doing direct audio to the computer, or is it speakers to camera?

Very old school, reminds me of playing spider man games on the game boy color, heh. Pokemon also had some really good tunes, especially one of the radio's, though I forget if that was in Pokemon silver on the GBC or Pokemon saphire on the GBA:SP. I am sadly too young to have experienced the joys of the Atari.

A few questions though, it looks the silkscreen is rather packed in places, for example the GND ---- and V+/3.3v---- lines seemed to be really smushed, and the power on the left ontop of the hole.  Did you use eagle, diptrace, or something else? It also seems like you did not seem to worry much about PCB size, I am guessing you did not go with batchpacb or dorkbot?
How did you fit all the songs onto the pic? I presume not trying to put the MP3's on the pic, but instead using different "algorithms" for the POKEY sound chip?

Again, awesome board. :) It looks extremely professional, especially the labeling of everything, congrats!

Re: ATARI POKEY 8-bit Computer Sound on PIC32

Reply #2
@hak8or: IMO the audio quality of the video is not very good.  At least the actual audio quality of the hardware sounds much better.  For the video it is speaker to iPhone :)

The board is a general purpose PIC32MX795F512H board I made quite some time ago.  I did not make it specifically for this project.  It is made using Eagle and I used the BatchPCB service.  It is open hardware, and you can find the latest version here: ... CUI32Stem/
Seeed is also selling it here:

If you reread the original posting, you will find that there are no MP3s being played back, but the actual 6502 code is run on an emulated 6502 CPU and the sound is rendered by an emulated POKEY sound chip.

Re: ATARI POKEY 8-bit Computer Sound on PIC32

Reply #3

some time ago Ian was so kind and sent me a free QFP proto board [1], and now here is my "free PCB build" of it :)  The build instructions and part list for the free PCB were a bit vague, until I figured out that it was meant to be a POKEY player ;)

Joking aside, there are one or two things which could be improved on the QFP board: The "fixed" pads of the QFT footprint (on the two sides where the pins of the IC are placed regardless of the pin count used) are a bit short, so heating them up with the soldering iron is a bit hard.  Also the holes in the proto-area are quite small.  I had to make most of them bigger with a fret saw, which was a bit painful, but doable.

The stereo headphone jack is located at the top left side next to the blue potentiometer which is used to digitally control the volume.  A small power switch and the Pause/Play button is at the top right side.  The other two buttons select the Next/Previous tune.  About 60 tunes worth of over 2 hours of music are stored in the 512 kB flash memory of the PIC32.

The headphones are driven directly with a 38 kHz PWM.  Two Schottky diodes are used to cut off the negative spikes from the headphone coils.  To decouple the audio output from the quite noisy supply voltage (caused by heavy MCU switching), a 74LS32 logic IC is provided with its own 3.0 V LDO regulator.  This way a very clean and noise free audio signal is achieved.

The board is supplied via the ICSP pins by directly connecting a LiPo battery [2].  When fully charged, the voltage is a bit higher than the maximum supply voltage specified in the PIC32 data sheet, but it seems to be not an issue in practice.  The LiPo is held in place by a double sided sticky tape, and protected from the PCB soldering joints by a thin plastic foil.  For ergonomic reasons I screwed some foam rubber onto two nuts which I soldered to the PCB beforehand.


As always, the source code and the full schematic is attached in the .zip file.  (P.S.: After discovering not just one but two (!) bugs in the 'C32 v2.0x' and 'XC32 v1.00' compilers (already approved by Microchip and hopefully being fixed in a future release) I went back to the 'C32 v1.10(B)' compiler and the old MPLAB IDE, which also feels faster and snappier compared to the new MPLAB X IDE written in Java.)

A YouTube video is available here:

Have fun,

[1] ... p-786.html
[2] ... p-593.html

Re: ATARI POKEY 8-bit Computer Sound on PIC32

Reply #4
Hi Markus, sounds pretty cool. Does this emulate all of the 6502 instructions, or just a select set of things?

Re: ATARI POKEY 8-bit Computer Sound on PIC32

Reply #5
I did not write the ASAP library, but you can take a look yourself in the function Cpu6502_DoFrame() in the file asap.c, and see if the instructions you need are handled.

Re: ATARI POKEY 8-bit Computer Sound on PIC32

Reply #6
@Sleepwalker3: if you are looking for a proven 6502 emulation, you may check CPU.c/CPU.h and the whole CPU subdir from the AppleWin project: ... urce/CPU.h ... ce/CPU.cpp ... ource/CPU/

Or the simpler/older one from linapple:

Re: ATARI POKEY 8-bit Computer Sound on PIC32

Reply #7
Thanks for sharing and the feedback on the breakouts, we'll update the boards.
Got a question? Please ask in the forum for the fastest answers.

Re: ATARI POKEY 8-bit Computer Sound on PIC32

Reply #8
[quote author="Sleepwalker3"]Hi Markus, sounds pretty cool. Does this emulate all of the 6502 instructions, or just a select set of things?[/quote]
Piotr Fusik, the author of the ASAP library just wrote in: According to him, it emulates all 6502 opcodes, including the undocumented ones. In the 1990s he spent much time reverse-engineering the undocumented instructions, he says :)