Jump to content
IGNORED

POKEY in FPGA


candle

Recommended Posts

After few days of work i've managed to implement POKEY's audio module

As for now there are only registers D200-D209 and 2 bits of D20F, but this is enough to simulate sound output of real thing

High-pass filters still waits for their tests, but everything else is confirmed to be working as it should. Apart from hi-pass filters i need to check ouput when POKEY is used for saw-tooth generation or sine-wave - but i need some examples for this

 

if someone has strong nerves, may listen to draconus theme after day 2 of chip development

 

for less resistant people here is draconus in version after day 3

 

day four was spent on bugfixes that didn't improove sound output that much,

 

but day 5th seems to be final one - again draconus

 

at this moment logic POKEY's logic implemented inside FPGA takes only 9% of its resources

 

a tak wyglada aktualny "setup" (no... troche balagan)

here is a "setpu" i'm using so far for this (sorry for the mess, wasn't ment for publishing this, but its almost 4AM, and i don't want to get on quest for camere right now)

fpga-pokey-setup.jpg

 

this core in stereo version will become part of SoundBoard

Link to comment
Share on other sites

Nice. It actually sounds "purer" than real Pokey - I suppose maybe you don't get the decay after wave peak/troughs as much as the real sound system.

 

The Delta RMT tune would be good for testing filters.

 

Saw/triangle should be fairly straightforward to test - just plug values in and compare to a real machine.

 

Saw uses Voice 1&3 in 1.79 MHz mode with Filter turned on for 1. Use 2 close values for AUDF in both voices (usually 1 or 2 apart), AUDC value for both should be $AF.

 

Triangle, same deal except don't turn on the filter.

 

In the case of both, the useful AUDF values tend to be around $10 thru $50 or thereabouts.

Edited by Rybags
Link to comment
Share on other sites

the lowest ones - just for reset

pokey sound is degenerated by caps on output and then the effect is amplified by lm358 on Atari motherboard

what is on output more remainds saw tooth than square wave

so this is external to pokey

Link to comment
Share on other sites

it surely will be included, as the goal is to have a working copy of all what inside the pokey in the end of the day

 

anyway, i'm more than open for any test programs (as simple as possible) that would try to challange current emulation

Link to comment
Share on other sites

Given that you're using only the 9% or so of the FPGA... shouldn't that then mean you probably could emulate the sound portion for at least a dozen extra Pokeys with ease.

 

OK... at $D0x0 = 15 + the original, 64 voices, or 32 in 16 bit mode.

Link to comment
Share on other sites

i want to add paula-like sound device for sampled music playback, and some sort of fm sythesis

sid and audio portion of ricoh 2a03

i think i would start from latter one, if only someone could provide me with example music assuming base register for audio portion of ricoh chip at d600

Link to comment
Share on other sites

it surely will be included, as the goal is to have a working copy of all what inside the pokey in the end of the day

 

anyway, i'm more than open for any test programs (as simple as possible) that would try to challange current emulation

 

Indeed, I mean the 2-tone mode. The 2-tone-filter is a serious and useful feature.

 

Here's a tune I composed one year ago. It indeed makes use of the 2-tone-filter features (after 2:57 minutes).

 

One of the purposes of this tune is to test emulators. It makes use of sawtooth, pulse wave, triangle, 2-tone, 16bit-filter, etc.

 

On most current emulators it will not exactly sound as it should, so make sure you run it on the real machine.

 

 

I'm not sure how to transform this into a test-song for your FPGA board. Maybe just record what values it's writing to which registers. However, handling the pulsewave feature is really timing-critical, so doubt it will be easy to make this tune sound as on real atari.

Link to comment
Share on other sites

as expected, sine is missing due to cut-off frequency of used DAC (or rather lack of DAC at all - this is only PWM with low-pass filter producing semi-costant voltage with cuttoff frequency at about 225kHz) and its not related to emulation, but lack of two-tone generation is and is very audiable

could you provide me with register content to produce constant two-tone output as used in this tune?

 

instrumentarium without two tone generator

Edited by candle
Link to comment
Share on other sites

could you provide me with register content to produce constant two-tone output as used in this tune?

 

You already supported bit0&1 of $D20F.

 

Writing 0xxx0x11 to $D20F is the normal mode: 2tone inactive.

Writing 1xxx1x11 to $D20F is the mode I'm using in the demo tune.

 

Explanation of this setting: bit 3 is set to 1 to activate 2tone mode itself. Then writing bits to the serial port will select the tone setting. Otherwise you can FORCE it to bitvalue 1 when setting also bit 7 of $D20F. That's why both bit 3&7 need to be set.

 

There are other possible modes, f.e. 0xxx1x11, and this can also give some strange effects now and then, but as far as I remember correctly this isn't of much use for music.

Link to comment
Share on other sites

seems to be working now

instrumentarium with dual-tone generator

 

it might be infected by data currently transmitted

this "feature" would not be supported fully untill whole rest of POKEY chip will be synthetised

 

let me know what you think about current emulation quality (disregarding lack of sine that is - can't do untill i change the DAC)

Edited by candle
Link to comment
Share on other sites

Great!!! The 2-tone-filter instrument sounds very good.

 

However, I listened with some more care now. The sawtooth emulation seems messed up a bit. The sound-type (timbre) itself sounds fine, but the resulting pitch is slightly too high. I have no idea though what causes this.

Link to comment
Share on other sites

if i find some time for this i'll make "real" dac as it is inside pokey chip - will see then

for now its just PWM running at 50mhz clock and reloaded every 256 ticks with new audio data

audio data is produced by "pokey" circuitry on every falling edge of phi2 signal asynchronously from 50mhz one

this forms low-pass filter, and because of pwm converter is far from beign perfect some aliasing effects may occour

beside this we have 44khz sampling from pc soundcard, and mp3 compression

won't make thing prettier

Link to comment
Share on other sites

Hey, you saved a lot of my time ;) I started to write a pokey in VHDL several months ago, but then I quickly found that even the big CPLD is not enough for at least clean voices, so I put it on ice. The FPGA is a solution, of course, but it would require more components around and also an external multichannel ADC or microcontroller to fully replace the Pokey chip. This is far from a simple and cheap Pokey drop in replacement I wanted to originally create. However, eventually I´d like to create such thing in a cheap ARM microcontroller.

Link to comment
Share on other sites

actually it would fit inside xc95288

 

For the barebone 4 channel audio perhaps yes, but I wanted a full replacement with 8 channels. In addition this CPLD is

very expensive. One can have five ARM cortex M3 MCUs for the same price.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...