Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - SMS Programming...

Reply to topic
Author Message
  • Joined: 12 Jul 1999
  • Posts: 891
Reply with quote
SMS Programming...
Post Posted: Thu Jul 15, 1999 8:02 am
Umm... it seems to me that there is enough SMS emulators floating around as it is. We really don't need any more, as the existing ones are pretty much perfect.
Now, why doesn't anybody want to program games for the SMS? Wouldn't that be easier than trying to program an emulator?
  View user's profile Send private message
Eric
  • Guest
Reply with quote
Post Posted: Thu Jul 15, 1999 9:05 pm
I'm interested in SMS development.

I'd like to see people writing simple SMS programs, and sending them in to this site. Hopefully, we can get a library of useful SMS programming utilities started. To get people started, here are some ideas:

A routine to move tile data from ROM into VDP ram, and put the tile into the screen tile map.
A text file, that can be included into a program consisting of tile data for all 256 extended ASCII characters (in 2-bit color).
A routine that takes an ASCII string and "prints" it on screen.
A routine that takes "concert pitch" notes as input and programs the PSG appropriately to generate that pitch.

I'm going to clean up a few sample programs I've written and post them to this site as well.

Eric
 
Chris
  • Guest
Reply with quote
SMS Music Editor
Post Posted: Fri Jul 16, 1999 2:52 am
A program I would love to write would be a PSG music editor under Windows 95. It will have a
score editor, a piano editor, a straight-up brut log event editor and everything. The sound will
be played via Windows MIDI ports and the songs will be saved to raw binary. I think I'll call it
.RAW or something. I'm going to have things like frequency pitch bending, pesuedo pitch
bending, a time signature and tempo operators. Basically it's going to perform like a MIDI
sequencer except you can't change musical patches on the fly (the sound chip can't do
that) and I may add on a little feature that will let you edit the noise track like a drum
track, with fixed frequencies to make it sound like drums. The only problem is how
could you sort out the file to make it useable in a game? Actually, I think I'll have two
formats: RAW which would contain raw Z80 instructions and ASC or ASCII files which
will contain a log of Z80 instructions to play music. Then later on if someone decides
to write a game for the SMS in Assembler they can copy the logged music instructions
to a subroutine and update the sounds every VBlank or gameloop.

If there's anything I love, it's music. I want to work on this so bad but I don't have enough
knowledge to do it. First I need to study all of Visual C++ then I would have to study Windows
MIDI functions or hardware and stuff. I guess I'll be able to do it one day.

Chris :o)
 
  • Joined: 12 Jul 1999
  • Posts: 891
Reply with quote
Re: SMS Music Editor
Post Posted: Fri Jul 16, 1999 7:50 am
Quote
> A program I would love to write would be a PSG music editor under Windows 95. It will have a
> score editor, a piano editor, a straight-up brut log event editor and everything. The sound will
> be played via Windows MIDI ports and the songs will be saved to raw binary. I think I'll call it
> .RAW or something. I'm going to have things like frequency pitch bending, pesuedo pitch
> bending, a time signature and tempo operators. Basically it's going to perform like a MIDI
> sequencer except you can't change musical patches on the fly (the sound chip can't do
> that) and I may add on a little feature that will let you edit the noise track like a drum
> track, with fixed frequencies to make it sound like drums. The only problem is how
> could you sort out the file to make it useable in a game? Actually, I think I'll have two
> formats: RAW which would contain raw Z80 instructions and ASC or ASCII files which
> will contain a log of Z80 instructions to play music. Then later on if someone decides
> to write a game for the SMS in Assembler they can copy the logged music instructions
> to a subroutine and update the sounds every VBlank or gameloop.

> If there's anything I love, it's music. I want to work on this so bad but I don't have enough
> knowledge to do it. First I need to study all of Visual C++ then I would have to study Windows
> MIDI functions or hardware and stuff. I guess I'll be able to do it one day.

> Chris :o)

What a brilliant idea!
Maybe there is an easier way, though.
Try writing a program in Visual Basic that converts 3-channel MIDI into the .RAW or .ASC files that you mentioned. Actually, I think that better names would be .PSG and .Z80 .
For help in the Windows MIDI function, try asking Paul Jensen of GYM2MID fame (a program that converts genecyst *.GYM PSG log files into MIDI files so that you can play them in any MIDI format 0 compatible player.
Pauls e-mail is: pj@emulationzone.org
GYM2MID can be found somewhere on Emulation Zones' projects section.
  View user's profile Send private message
Chris
  • Guest
Reply with quote
Problems with Visual Basic
Post Posted: Fri Jul 16, 1999 8:37 am
Quote
> What a brilliant idea!
> Maybe there is an easier way, though.
> Try writing a program in Visual Basic that converts 3-channel MIDI into the .RAW or .ASC files that you mentioned. Actually, I think that better names would be .PSG and .Z80 .
> For help in the Windows MIDI function, try asking Paul Jensen of GYM2MID fame (a program that converts genecyst *.GYM PSG log files into MIDI files so that you can play them in any MIDI format 0 compatible player.
> Pauls e-mail is: pj@emulationzone.org
> GYM2MID can be found somewhere on Emulation Zones' projects section.

I know Visual Basic a hell of a lot better than C. When I was writing my NES emulator in VB I was like
] [ this close to completing the m6502 core. I could read from both the 16k ROM and 8k VROM banks
and I could get it to correctly interpret m6502 instructions. Everything was great except for a few
things:

1) When I wrote it to use a game loop, the program would freeze and I couldn't click on the menus or
anything. The only thing you could do is hit F1 to show the CPU status form and the directional
keys.
2) When I wrote it to use the Visual Basic timer, everything would work just fine except everything would
only update by interval 1, which was god forsakenly slow!
3)How could I display the graphics? One method I was thinking of was declaring a big name and
character/sprite array that would BlitBlt the graphics onto the screen via Windows GDI but would this
be wise?

But enough of that, back to this PSG music editor. Now, here's what I could do in VB:

1)Design all of the forms
2)Make it read and write from .PSG and Z80 files
3)Look for a Windows DLL and write private functions that send sound data to the MIDI port
4)I could probably design the score view by hand drawing all of the little musical nick nacks, such as
quarter notes, 16teens notes, etc, save them to a .BMP file, and display the graphics via Windows
GDI BlitBlt I guess.
5)The file format will be .PSG and all reading/writing will be done though those files. Z80 files will
be a special feature and you won't be able to play the text instructions. Only the binary PSG files.

Now, there's the major problems:
1)How could I immitate the PSG's noise channel? I can't think of any patches that can do that.
2)Would it be easier to just use the MIDI precussion patch for the drum set feature? Would this
hinder the noise sound accuracy when converted to the SMS?


To tell you the truth, I'm starting to get pumped and ready. I never really took the time to plan
out and go over these things. The more I think about, the more I want to do it and drop my emulators
for a while. It's not like I'm doing anything special with those anyway so what the hell.

Chris :o)

 
Eric
  • Guest
Reply with quote
Re: Problems with Visual Basic
Post Posted: Fri Jul 16, 1999 3:48 pm
Quote
> 1) When I wrote it to use a game loop, the program would freeze and I couldn't click on the menus or
> anything. The only thing you could do is hit F1 to show the CPU status form and the directional
> keys.

There are a few solutions to this problem, here are two:

1.) In your game loop periodically peek at the program's windows message loop, if a message is waiting, allow Windows to process it.

2.) Multi-threading. Multi-threading is complicated and exceedingly difficult to debug. However, it's perfect for emulator programs in Windows.

Eric
 
  • Joined: 12 Jul 1999
  • Posts: 891
Reply with quote
Re: Problems with Visual Basic
Post Posted: Fri Jul 16, 1999 4:21 pm
Quote
> I know Visual Basic a hell of a lot better than C. When I was writing my NES emulator in VB I was like
> ] [ this close to completing the m6502 core. I could read from both the 16k ROM and 8k VROM banks
> and I could get it to correctly interpret m6502 instructions. Everything was great except for a few
> things:

> 1) When I wrote it to use a game loop, the program would freeze and I couldn't click on the menus or
> anything. The only thing you could do is hit F1 to show the CPU status form and the directional
> keys.
> 2) When I wrote it to use the Visual Basic timer, everything would work just fine except everything would
> only update by interval 1, which was god forsakenly slow!

Have a look at the source code for VBEmu -a Space Invaders emulator written completely in VB. It even uses a Z80.bas module.
It also uses the API timer which is apparently a lot faster.
I can send you the source if you really want.

Quote
> 3)How could I display the graphics? One method I was thinking of was declaring a big name and
> character/sprite array that would BlitBlt the graphics onto the screen via Windows GDI but would this
> be wise?

See above

Quote
> But enough of that, back to this PSG music editor. Now, here's what I could do in VB:

> 1)Design all of the forms
> 2)Make it read and write from .PSG and Z80 files
> 3)Look for a Windows DLL and write private functions that send sound data to the MIDI port
> 4)I could probably design the score view by hand drawing all of the little musical nick nacks, such as
> quarter notes, 16teens notes, etc, save them to a .BMP file, and display the graphics via Windows
> GDI BlitBlt I guess.

I can send you a nice little *COUGHpiratedCOUGH* program for you to get some ideas from. It's called Encore and is *really* good for checking out staves, notes, etc. Not heaps good for making MIDI files, though. Cakewalk is heaps better at that.

Quote
> 5)The file format will be .PSG and all reading/writing will be done though those files. Z80 files will
> be a special feature and you won't be able to play the text instructions. Only the binary PSG files.

Oh my god! You mean to say that I actually came up with a *useful* suggestion? Wow! ;)

Quote
> Now, there's the major problems:
> 1)How could I immitate the PSG's noise channel? I can't think of any patches that can do that.
> 2)Would it be easier to just use the MIDI precussion patch for the drum set feature? Would this
> hinder the noise sound accuracy when converted to the SMS?

Erm. I dunno. To tell the truth, I can't even get my VB frontends to write to a .ini file or call a program.
Just try messing around with it, I suppose. :)

Quote
>
> To tell you the truth, I'm starting to get pumped and ready. I never really took the time to plan
> out and go over these things. The more I think about, the more I want to do it and drop my emulators
> for a while. It's not like I'm doing anything special with those anyway so what the hell.

> Chris :o)
>

Geez, you're even getting ME exited about that. I think that your idea is, well, unfknblvbl :)
  View user's profile Send private message
Chris
  • Guest
Reply with quote
Portability Issues
Post Posted: Fri Jul 16, 1999 5:12 pm
I just noticed something too. This program is very portable!! How many systems can you think of that
use a Z80 processor and uses a PSG chip for it's sound? Colecovision, Master System, SG1000,
SC3000, MSX, and much, much more. And to make sure it's portable, I'll add a little option that
will let you type in the location of the sound hardware, for instance $7F, and the program will
automatically change itself to the new location and update all previous sound writes. Man my
stomach feels funny, my waist is aching, I'm excited!

Chris :o)
 
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
Post Posted: Sat Jul 17, 1999 9:56 am
Quote
> I'm going to clean up a few sample programs I've written and post them to this site as well.

I'm going to release mine even if they were very badly wrote (I learned the concept of CPU assembly by writing these programs..)
  View user's profile Send private message Visit poster's website
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
Tech Docs
Post Posted: Sat Jul 17, 1999 10:03 am
Quote
> 1)How could I immitate the PSG's noise channel? I can't think of any patches that can do that.

This is called emulation. Get tech docs from the site and that should be enough to make a good PSG
emulation.
  View user's profile Send private message Visit poster's website
Chris
  • Guest
Reply with quote
Hey man, a doc won't cut it
Post Posted: Sat Jul 17, 1999 6:10 pm
Quote
> This is called emulation. Get tech docs from the site and that should be enough to make a good PSG
> emulation.

There isn't a document in this vast world that could tell me how to immitate the PSG channel in MIDI.
MIDI wasn't designed to create noises effects like on the SMS or NES. There aren't any midi
patches that can effectively immitate the sounds of the PSG noise channel, not unless you have crappy
wave table sysnthesis. The only one that may come close are the Sea Breeze and Breath sound patches
since the sounds become drolled when low and hitch hatch at high. Trust me on this one Zoop. I've
worked with MIDI for a long time. I've worked with MIDI way longer than programming even. If you
don't believe me ask Paul.

Chris :o)
 
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
Re: Hey man, a doc won't cut it
Post Posted: Sat Jul 17, 1999 11:41 pm
Quote
> There isn't a document in this vast world that could tell me how to immitate the PSG channel in MIDI.
> MIDI wasn't designed to create noises effects like on the SMS or NES. There aren't any midi

There won't be a doc to tell you how to make your program, man.
Try to use your brain.

Quote
> patches that can effectively immitate the sounds of the PSG noise channel, not unless you have crappy
> wave table sysnthesis. The only one that may come close are the Sea Breeze and Breath sound patches
> since the sounds become drolled when low and hitch hatch at high. Trust me on this one Zoop. I've
> worked with MIDI for a long time. I've worked with MIDI way longer than programming even. If you
> don't believe me ask Paul.

> Chris :o)
  View user's profile Send private message Visit poster's website
Limbs a Flyin'
  • Guest
Reply with quote
Re: Hey man, a doc won't cut it
Post Posted: Sun Jul 18, 1999 4:42 pm
perhaps the applause instument? even though my awe64's implementation has a long attack, so by the time it gets loud enough to be noticed, the psg sound has finished.. hrmm..


Quote
> There isn't a document in this vast world that could tell me how to immitate the PSG channel in MIDI.
> MIDI wasn't designed to create noises effects like on the SMS or NES. There aren't any midi
> patches that can effectively immitate the sounds of the PSG noise channel, not unless you have crappy
> wave table sysnthesis. The only one that may come close are the Sea Breeze and Breath sound patches
> since the sounds become drolled when low and hitch hatch at high. Trust me on this one Zoop. I've
> worked with MIDI for a long time. I've worked with MIDI way longer than programming even. If you
> don't believe me ask Paul.

> Chris :o)
 
Reply to topic



Back to the top of this page

Back to SMS Power!