Page 1 of 1

YM2612 hardware interfacing

Posted: Sun Dec 16, 2007 7:45 pm
by ryujin
Hi all.
I don't know if this forum may help me but i'll give it a try.
I'm currently building a device wich reads from an sd card vgm data dump and sends it to a ym2612 i got from my broken genesis( with a uprocessor ).
My main objective is to play genesis/MS music from that sd card, and i'm coding a PSG emulator. My problem resides in how to interface with YM. I have the following schematic i found : Image

Wich bits enable port 1 and 2. I'm currently using A0 = 1 / A1 = 0 to en port 1 and A0 = 0/ A1 =1 to en port 2. Since i want always to write i'm using RD# = 1, WR# = 0, CS# = 0, IC# =0.

Is this correct?

What is the average time i must wait between address and data bytes?
You're help will be very much appreciated.

Re: YM2612 hardware interfacing

Posted: Mon Dec 17, 2007 1:24 am
by Shiru
ryujin wrote:What is the average time i must wait between address and data bytes?
YM2612 is slow, so if you plan to use fast microcontroller (faster than Z80 @3.5MHz) you must check 'busy' flag instead of fixed delay. And if you'll do that in main loop, you'll waste much MCU resources.

TmEE said that '3 NOPs always enough', but he not answered how much code executed between writes and how much T-states he spend to actual write.

Posted: Tue Jan 08, 2008 2:13 am
by ryujin
In my routine an interrupt timer ( at 18khz ) triggers a functions wich writes all VGM data into YM2612 untill a pause in sound change occur. So far i'm only using the simple sample "grand piano" so all the VGM data is written at once.
I'm using the following pseudo-code

Set to read from bank 1

looping
Read busy flag
IF flag == 0 break from loop

Set to write to bank 1
Write address in data bus
Some delay ( microseconds )
Set to read from bank 1

looping
Read busy flag
IF flag == 0 break from loop
Set to write to bank 1
Write data in the data bus


Can someone help me with this?