Another Newbie Question 68k and z80 ??? :(

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
Alex Khan
Very interested
Posts: 77
Joined: Thu Jan 07, 2010 9:51 am

Another Newbie Question 68k and z80 ??? :(

Post by Alex Khan »

Hi,

I've been the forums reading all your posts and trying to gather as much information as I can about Sega game development.

There are some really knowledgeable people here.

I am a little confused about one subject.

The Sega megadrive used the 68k chip. So if I am programming a game I programming a game for 68k hardware.

Where does the z80 chip fit into all this was that not a computer chip for computers in the 80's ?

Does it have something to do with the sound although i thought sound was done by the "Yamaha" ???

Why are some forums memebers discussing programming for the z80 when the megadrives used a 68k ???

Totally baffled !!!

Please point me in the right direction.

:(
mic_
Very interested
Posts: 265
Joined: Tue Aug 12, 2008 12:26 pm
Location: Sweden
Contact:

Post by mic_ »

The Z80 acts as a control processor for the sound chips (the YM2612 and the SN). The sound chips are accessible from the 68k as well, but by off-loading the work to the Z80 you save precious cycles on the 68k to do other things (plus if you wanted to do PCM playback on the YM2612 you really want to avoid using the 68k for that, since there's no timer IRQ).
Alex Khan
Very interested
Posts: 77
Joined: Thu Jan 07, 2010 9:51 am

Post by Alex Khan »

Hi Mic_,

Okay so it can control the sound hardware z80 has to be used.

So I cannot use GensDev using C language to program sound for the Megadrive?

Do i have to learn z80 Assembly Language to integrate sound for the Megadrive ?

That would be Crazy writing the game in a higher language and hten programming sound in z80 assembly !!!

Is there a way around this problem ?
mic_
Very interested
Posts: 265
Joined: Tue Aug 12, 2008 12:26 pm
Location: Sweden
Contact:

Post by mic_ »

Like I said, you can access the sound chips from the 68k as well, it's just preferred not to do that.
You don't have to learn Z80 assembly unless you plan to write your own sound driver. TFM Music maker includes a prebuilt driver, and so does my MML compiler kit. There might be other options as well.
Alex Khan
Very interested
Posts: 77
Joined: Thu Jan 07, 2010 9:51 am

Post by Alex Khan »

Mic_

Thanks I have downloaded Tfm Music Maker looks can't figure out how to make any music with it because the documentation does not say how ???

Is there a tutorial on composing a single track ???

Secondly Sound Effects ... Tfm covers music how does one go about sound effects grunt, scream, slash etc ???

At first I thought it was midi file format and I thought Aha ! I can get those sound efects from the net.

Now I have found out it's VGM file format how does one go about effects in vgm format ???

Any Help would really be appreciated.
mic_
Very interested
Posts: 265
Joined: Tue Aug 12, 2008 12:26 pm
Location: Sweden
Contact:

Post by mic_ »

Aren't there example songs that come with TFM Music Maker? I thought I saw some kind of small tutorial video on its website as well. But in the end it's just another tracker, so if you've used trackers in the past then it should be easy to pick up. If not, you're going to have to learn, unless you want to come up with your own solution.

VGM is just a format used for logging music in emulators so that it can be played back on e.g a PC. While it would be possible to have the music and sound effects in a Genesis game as a bunch of VGM files, it would be very impractical and wasteful because it's a suboptimal format to say the least. Sampled sounds (like a scream) should just be raw PCM (the kind you'd find inside an uncompressed WAV file). There's no particular reason to have them inside some complicated container format.
Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru »

Alex Khan wrote:At first I thought it was midi file format
You actually could make MIDI player for SMD (and there is at least one commercial game with actual MIDI files inside). However, you should compose exclusive music for it, because there is many limitations, so you can't just pick any MIDI file and play it.

Anyway, the sound programming is not among the first things you should worry about, if you plan to make your game. Just start with the game itself, and leave the sound for later. You will have much more knowledge at the time when the sound will be really necessary.
Alex Khan
Very interested
Posts: 77
Joined: Thu Jan 07, 2010 9:51 am

Post by Alex Khan »

SHIRU! The Legend! :)

What a fantastic program you have made!

I had version 1.00 of TFM Music maker the manual was in Russian so I couldn't figure it out.

But I got version 1.4 and it has a English help Manual and I finally was able to compose a track :)

Thank You for the wonderful software.

One Question for you Shiru and one for Mic:

1) Can I use your TFM program to develop sound for my game which I want to distribute ? Do I have your permission ?

2) What I can't understand now is sound effects for the game a scream, a battle cry, a grunt etc ...

Will the megadrive play midi files for sound effects directly ? Is it that simple ?
I just have to call the sound file in my programming code should not the files be compressed in some format like vgm ?

Shiru you are right the programming should be a prority first and then art. But I am trying to do all my research first before I begin.

One Question for Mic

Mic if I have raw wav files wont that make the size of the ROM bigger ? Maximum Rom size is 4 MB!

Let me understand this I compose music through Shiru's TFM and save as PSG format.

But sound effects for game characters are in Raw wav format ???

Am i right ? Again the Big Bloated Rom question ...

Thank You for your patience.
Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru »

Alex Khan wrote:1) Can I use your TFM program to develop sound for my game which I want to distribute ? Do I have your permission ?
Yes. You don't need my permission. I'm lazy to choose the license type and write down all the legal stuff, in short: you are free to do whatever you want. Well, except for selling the editor, or hacking it to state that you are the author.
Alex Khan wrote:2) What I can't understand now is sound effects for the game a scream, a battle cry, a grunt etc ...
Screams and other sounds of this type could be done only using samples. If you check some commercial games, you'll hear that most of them use synth to all the effects except voice-like and some other types, just because these could not be synthesized.
Alex Khan wrote:Will the megadrive play midi files for sound effects directly ? Is it that simple ?
Megadrive can't directly play anything at all, you always should program your own player, or use one of ready-made. Most of the commercial games used third-party sound engines.

About samples size. You should remember that the samples on SMD are 8 bit mono, and they usually have very low sample rate, around 11 kHz. It is 93 seconds of sound per one megabyte. If you short of ROM space, audio compression could be also used.
Alex Khan
Very interested
Posts: 77
Joined: Thu Jan 07, 2010 9:51 am

Post by Alex Khan »

Thank You for giving me permission Shiru ! :)

Shiru I will have to write an entire sound engine ? For sound effects! :shock:

-I read on the Devster Forums that you wrote a sound engine for the Basixorgx Compiler?

-Shiru what do us low budget game developers do for game sound effects then ? Writing a sound engine is impossible are there any tools available for this?

Thank you for taking the time to answer my questions.

Waiting for your reply.
mic_
Very interested
Posts: 265
Joined: Tue Aug 12, 2008 12:26 pm
Location: Sweden
Contact:

Post by mic_ »

Mic if I have raw wav files wont that make the size of the ROM bigger ? Maximum Rom size is 4 MB!
These types of samples are usually very short. A one-second sample of a scream would take up 8000 bytes at 8kHz. If you think that's too much then you could use some kind of ADPCM format, but then your game would have to decode the data before sending it to the sound chip.
Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru »

Alex Khan wrote:Shiru I will have to write an entire sound engine ? For sound effects!
The game itself is more difficult to write.
Alex Khan wrote:-I read on the Devster Forums that you wrote a sound engine for the Basixorgx Compiler?
I don't remember well, I did music player for BEX, C, and Z80, and also I did PSG sound effects player in C. It is somewhere on this forum (edit: here).
Alex Khan wrote:-Shiru what do us low budget game developers do for game sound effects then ? Writing a sound engine is impossible are there any tools available for this?
Wrting a sound engine is not impossible. It was done many times by many people. If you can't make your own, or don't want to, then search for ready-made solution, or ask someone to make it for you (but make somewhat working demo of your game before).
Alex Khan
Very interested
Posts: 77
Joined: Thu Jan 07, 2010 9:51 am

Post by Alex Khan »

Thanks for the advice gentleman obviously I will have more questions as the game coding starts.
Post Reply