Write Genesis program to test YM2612

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
jotego
Interested
Posts: 22
Joined: Sat Jan 28, 2017 8:30 am
Location: Valencia (Spain)
Contact:

Write Genesis program to test YM2612

Post by jotego » Mon Feb 20, 2017 7:41 pm

Hello,

This is my first post. I am developing a Verilog version of YM2612, which will be used to run the Genesis on FPGA. I have been doing it with the help of Sauraen, who is a member of the forum. I am quite advanced with this and now I can actually run the Genesis on FPGA. I have some issues with my sound module, which I call JT12, and I need to debug it and verify it extensively before realising it open source to everyone.

I want to write a simple C program that just runs a series of tests on the YM2612. I will run it on a real Megadrive, the Exodus emulator and the FPGA project we are working on. I have found the gendev project, but I have not been able to make it for Ubuntu. So I am using now code::blocks and sgdk for Windows. I have been able to compile the Hello world example.

I am looking for someone who has an example C file where he writes to the YM2612 registers to make some sound. I am not doing it right somehow as my code gets stuck here:

Code: Select all

void waitbusy() {
    volatile char *ym = (char*)0xa06000;
    while( (*ym)&0x80 );
}
I have previously grabbed access to the Z80 bus like this:

Code: Select all

volatile int *pw  = (int *)0xa11100;
*pw = 0x100;
Could someone give me a hand here? Either with an example file or pointing at issues in my code?

Thank you and sorry for making my first post a demand.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Write Genesis program to test YM2612

Post by Stef » Mon Feb 20, 2017 8:52 pm

Your methods look correct but if you use SGDK, why are you rewriting all these methods which already exists ?
Z80_requestBus(..)
Z80_releaseBus()
YM_writeRegSafe(..)
YM2612_writeRegSafe(..)

I think there is everything you need to do some basic YM tests.

r57shell
Very interested
Posts: 478
Joined: Sun Dec 23, 2012 1:30 pm
Location: Russia
Contact:

Re: Write Genesis program to test YM2612

Post by r57shell » Tue Feb 21, 2017 5:55 am

Problem is that you can't read anything from YM2612 except status.
Sauren have found debug stuff, but I doubt it's usable from MD.
Image

jotego
Interested
Posts: 22
Joined: Sat Jan 28, 2017 8:30 am
Location: Valencia (Spain)
Contact:

Re: Write Genesis program to test YM2612

Post by jotego » Tue Feb 21, 2017 8:42 am

Stef wrote:Your methods look correct but if you use SGDK, why are you rewriting all these methods which already exists ?
Z80_requestBus(..)
Z80_releaseBus()
YM_writeRegSafe(..)
YM2612_writeRegSafe(..)

I think there is everything you need to do some basic YM tests.
Thank you! I used these functions and was able to get sound out. I can work out from there. :D

jotego
Interested
Posts: 22
Joined: Sat Jan 28, 2017 8:30 am
Location: Valencia (Spain)
Contact:

Re: Write Genesis program to test YM2612

Post by jotego » Tue Feb 21, 2017 8:45 am

r57shell wrote:Problem is that you can't read anything from YM2612 except status.
Sauren have found debug stuff, but I doubt it's usable from MD.
The operator data output mode should work from MD too... except there is no way to output the data to a memory... :|

Indeed I just need to check some minor things that Nemesis and Sauraen did not cover on their experiments and then write a test bench to compare my implementation with the original.

r57shell
Very interested
Posts: 478
Joined: Sun Dec 23, 2012 1:30 pm
Location: Russia
Contact:

Re: Write Genesis program to test YM2612

Post by r57shell » Tue Feb 21, 2017 8:03 pm

operator output is too fast to figure out what did you read.
Image

Post Reply