Jack Gassett

POKEY Branch to play around with.

Recommended Posts

POKEY was in the first couple builds but I took it out of the later ones, so the current RetroCade SOC does not have POKEY.

 

If you want to play around with the POKEY I  made a new branch the puts the POKEY in Wishbone slot 12 and uses the MOD files audiomixer input, so mod files won't play in this branch.

https://github.com/GadgetFactory/ZPUino-HDL/tree/POKEY/zpu/hdl/zpuino/boards/papilio-pro/S6LX9/variants/retrocade

 

Attached is the bit file which is the ZPUino Soft Processor only.

 

Here is an example sketch I put together a while back that just makes the POKEY output a tone. POKEY has not been tested and Alvie said there was a problem when he tried to verify it earlier, so keep that in mind as you play around with it.

 

//YMZ294//#include "YMZ294.h"#define YMZ294_WR 10#define YMZ294_CS 11#define YMZ294_A0 12#define ADDR_FREQ_A 0x00#define ADDR_FREQ_B 0x02#define ADDR_FREQ_C 0x04#define ADDR_NOISE 0x06#define ADDR_MIXER 0x07#define ADDR_LEVEL_A 0x08#define ADDR_LEVEL_B 0x09#define ADDR_LEVEL_C 0x0A#define ADDR_FREQ_E 0x0B#define ADDR_SHAPE_E 0x0D#define YM2149BASE IO_SLOT(11)#define YM2149REG(x) REGISTER(YM2149BASE,x)#define POKEYBASE IO_SLOT(12)#define POKEYREG(x) REGISTER(POKEYBASE,x)//#define HAVE_YM#define HAVE_POKEY#define AUDIOPIN WING_B_1//#define AUDIOPINEXTRA WING_A_13int tp[] = {//MIDI note number  15289, 14431, 13621, 12856, 12135, 11454, 10811, 10204,//0-7  9631, 9091, 8581, 8099, 7645, 7215, 6810, 6428,//8-15  6067, 5727, 5405, 5102, 4816, 4545, 4290, 4050,//16-23  3822, 3608, 3405, 3214, 3034, 2863, 2703, 2551,//24-31  2408, 2273, 2145, 2025, 1911, 1804, 1703, 1607,//32-39  1517, 1432, 1351, 1276, 1204, 1136, 1073, 1012,//40-47  956, 902, 851, 804, 758, 716, 676, 638,//48-55  602, 568, 536, 506, 478, 451, 426, 402,//56-63  379, 358, 338, 319, 301, 284, 268, 253,//64-71  239, 225, 213, 201, 190, 179, 169, 159,//72-79  150, 142, 134, 127, 119, 113, 106, 100,//80-87  95, 89, 84, 80, 75, 71, 67, 63,//88-95  60, 56, 53, 50, 47, 45, 42, 40,//96-103  38, 36, 34, 32, 30, 28, 27, 25,//104-111  24, 22, 21, 20, 19, 18, 17, 16,//112-119  15, 14, 13, 13, 12, 11, 11, 10,//120-127  0//off};void write_data(unsigned char address, unsigned char data){  YM2149REG(address) = data;}void set_ch(unsigned char address, int i){  write_data(address, tp[i]);  write_data(address+1, (tp[i] >> 8));  }//YMZ294 related : set the volume between 0x00 (mute) and 0xff(full)//For the simplicity it sets the volume of the 3 channels at the same time.//Just make another signature if youwant to control channel per channel.void setVolumeYMZ294(byte pVolume){  write_data(ADDR_LEVEL_A, pVolume & 0x0f);  write_data(ADDR_LEVEL_B, pVolume & 0x0f);  write_data(ADDR_LEVEL_C, pVolume & 0x0f);  }//makes the setup for the Yamaha YMZ294 componentvoid setupYMZ294(){  //no noise   write_data(ADDR_NOISE, 0x00);  //mixer  //write_data(ADDR_MIXER, 0x3e);  write_data(ADDR_MIXER, 0x38);  //set volume to MUTE  setVolumeYMZ294(0x00);  }void setup(){	pinMode(AUDIOPIN,OUTPUT);	digitalWrite(AUDIOPIN,HIGH);	outputPinForFunction(AUDIOPIN, 8);	pinModePPS(AUDIOPIN, HIGH);#ifdef AUDIOPINEXTRA	pinMode(AUDIOPINEXTRA,OUTPUT);	outputPinForFunction(AUDIOPINEXTRA, 8);	pinModePPS(AUDIOPINEXTRA, HIGH);#endif       ///Setup the pin modes for the YMZ294   //setupYMZ294();      //don't forget to set the volume or you wont hear a thing...   //setVolumeYMZ294(0xff);    POKEYREG(0x01) = 0xef;   //POKEYREG(0x00) = 118;  //C 60 262   //POKEYREG(0x00) = 111;  //C# 61 278      //POKEYREG(0x00) = 105;  //D 62 293   POKEYREG(0x00) = 99;  //D# 63 312   }void loop(){}

zpuino-1.0-PapilioPro-S6LX9-RetroCade-1.0-POKEY-Branch.bit

PokeyTest.zip

Share this post


Link to post
Share on other sites

Yep that works great... i'll have to see if I can next find some SAP register dumps to try playing through it. I've already manually had all 4 voices going, happy 8 bit days from my childhood!  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now