YM2612 hardware interfacing

For hardware talk only (please avoid ROM dumper stuff)
Post Reply
ryujin
Newbie
Posts: 2
Joined: Sun Dec 16, 2007 7:33 pm

YM2612 hardware interfacing

Post by ryujin » Sun Dec 16, 2007 7:45 pm

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.

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Re: YM2612 hardware interfacing

Post by Shiru » Mon Dec 17, 2007 1:24 am

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.

ryujin
Newbie
Posts: 2
Joined: Sun Dec 16, 2007 7:33 pm

Post by ryujin » Tue Jan 08, 2008 2:13 am

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?

Post Reply