Page 1 of 2

Crazy Driver (simple but complete game)

Posted: Sat Aug 10, 2013 2:26 pm
by M-374 LX
Crazy Driver is a simple homebrew driving game for Sega Genesis written mostly in C. Ports to Game Boy Advance and PC are also planned.

Gameplay
As the name suggests, you are a crazy driver in this game. All you want is to drive fast!

Crazy Driver is a simple driving game where you only need to avoid crashing into other cars. By driving faster, you get a higher score.

Controls
D-pad left/right: steer
A/B/C: accelerate like crazy!
Start: pause

Technical side features
•Usage of sprites and VDP planes A and B
•Vertical scrolling
•FM sound effects
•Music using FM, DAC samples and PSG

Screenshots
Image
Image

Video
This video shows the game running on the real hardware: http://www.youtube.com/watch?v=m-ydfPYw-jk

Download
v1.1: Link
v1.0: Link
Source code included in both links.

Posted: Sat Aug 10, 2013 3:00 pm
by sigflup
Nice!! Thank you for your work

Posted: Sat Aug 10, 2013 8:22 pm
by haroldoop
Nice game.

Posted: Thu Aug 22, 2013 1:17 pm
by nolddor
how many levels are the game?

Posted: Thu Aug 22, 2013 10:48 pm
by M-374 LX
nolddor wrote:how many levels are the game?
The level number is stored as a byte. As a result, the level number could be up to 255 and wrap back to 1.

However, the last playable level in my tests was around 20.

Posted: Tue Sep 03, 2013 7:47 pm
by M-374 LX
I have finally had the opportunity to test the game on the real hardware.

The PSG notes are fine in the music, but random FM notes are played instead of the desired ones. Besides, the engine sound effect can be heard sometimes, but not always, and the crash sound effect seems to be never heard. Does anyone know why this happens?

Posted: Tue Sep 03, 2013 9:11 pm
by Chilly Willy
Probably not waiting long enough after setting the FM register. You really should wait on the BUSY bit in the FM status.

Posted: Tue Sep 03, 2013 9:49 pm
by M-374 LX
Here are some of the functions related to the audio:

Code: Select all

void z80_halt()
{
	volatile ushort* z80 = (ushort*)Z80_RESET;
	*z80 = 0x100;

	z80 = (ushort*)Z80_BUSREQ;
	*z80 = 0x100;

	while(*z80 & 0x100);
}

void fm_write(uchar reg, uchar val, uchar part)
{
	volatile uchar* ctrl;
	volatile uchar* data;

	if(part == 0)
	{
		ctrl = (uchar*)FM_REG_1;
		data = (uchar*)FM_DAT_1;
	}
	else
	{
		ctrl = (uchar*)FM_REG_2;
		data = (uchar*)FM_DAT_2;
	}

	while(*ctrl & 0x80);
	*ctrl = reg;

	while(*ctrl & 0x80);
	*data = val;
}
Is anything wrong?

Posted: Wed Sep 04, 2013 3:15 am
by Chilly Willy
Yes - according to Sega, you must NEVER use the second part (as you call it) for reading the status. It will return not busy even when it is. ALWAYS read the status from the first part (0x4000). That's in the same bulletin as where they mention that the VDP isn't reset by the reset, so you have to check for DMA on reset before trying to use it or it may fail.

Posted: Wed Sep 04, 2013 4:16 pm
by M-374 LX
The audio on the real hardware is fine now. Thanks, Chilly Willy.

However, according to the Genesis Technical Overview document, the status of the YM2612 can be read from "any of the four locations". This seems to be another mistake in that document.

Posted: Wed Sep 04, 2013 5:05 pm
by TmEE co.(TM)
I has been verified that status register is read from all addresses by other people and Yamaha OPN family docs also say that. Maybe there's more to the address decode that it seems on the MD around YM...

Posted: Wed Sep 04, 2013 5:31 pm
by Chilly Willy
TmEE co.(TM) wrote:It has been verified that status register is read from all addresses by other people and Yamaha OPN family docs also say that. Maybe there's more to the address decode that it seems on the MD around YM...
Must be something to do with the Sega... maybe this is only an issue on models with the built-in FM rather than the discrete FM. If someone has a model with the separate YM2612, they could try the older version to see if it still has sound problems. But Sega's note on the FM is in response to an issue just like this one - "missing" or bad sounds, and is specifically stated to be the result of missing the busy status by reading the "wrong" register and getting a bad status.

Posted: Wed Sep 18, 2013 6:10 pm
by M-374 LX
A new version is now available. It features new music, now using DAC samples. Also, the audio issues on the real hardware and the bug that caused the game to run faster have been fixed.

I would like to thank Chilly Willy, who is now in the "Thanks to" section of the credits.

Posted: Wed Sep 18, 2013 10:59 pm
by Chilly Willy
No problem, but the facebook link requires you to be logged into facebook... and I'm not a fb member.

Posted: Wed Sep 18, 2013 11:07 pm
by M-374 LX
Chilly Willy wrote:No problem, but the facebook link requires you to be logged into facebook... and I'm not a fb member.
Wrong link. :oops:
It is now fixed.