beta version of CZ80 released :)

This forum is for discussion pertaining to homebrew and indie software for the Dreamcast, such as homebrew games, emulators/interpreters, and other homebrew software/applications. Porting requests and developmental ideas are not to be made here; you can make those here. If you need any help burning discs for homebrew software, this is the place to ask as well.
ethoscapade
Insane DCEmu
Insane DCEmu
Posts: 280
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Wed Mar 17, 2004 4:45 pm
Has thanked: 0
Been thanked: 0

Post by ethoscapade »

wow, i had given up on this.

fantastic job, stef.

so... this being the spark that starts a whole new round of releases...

where are the releases?
User avatar
Untamed
Psychotic DCEmu
Psychotic DCEmu
Posts: 672
Joined: Sat Jan 10, 2004 5:28 am
Location: London, England
Has thanked: 0
Been thanked: 0

Post by Untamed »

Hawq wrote:Dont forget watches & musical xmas/bday cards, the Z80 just wont die ever it seems

Let's emulate musical bday cards on the Dreamcast!
"Ignorance can be cured, stupidity cannot."
Roofus wrote:Gay marriage and donkey rape are the same thing. Duh. :roll:
User avatar
Link2k4
DCEmu Banned
DCEmu Banned
Posts: 604
Joined: Sun May 16, 2004 3:56 am
Location: Detroit,Michigan
Has thanked: 0
Been thanked: 0

Post by Link2k4 »

Untamed wrote:
Hawq wrote:Dont forget watches & musical xmas/bday cards, the Z80 just wont die ever it seems

Let's emulate musical bday cards on the Dreamcast!
ROFLMAO
GPF
DC Developer
DC Developer
Posts: 529
Joined: Wed Oct 17, 2001 7:44 pm
Location: Texas
Has thanked: 0
Been thanked: 0
Contact:

Post by GPF »

Untamed wrote:
Hawq wrote:Dont forget watches & musical xmas/bday cards, the Z80 just wont die ever it seems

Let's emulate musical bday cards on the Dreamcast!
Thats just what we need people trading in musical xmas/birthday rom warez :)

Hey does anybody have the new Rudolph xmas card rom ? lol
doragasu
DCEmu Cool Poster
DCEmu Cool Poster
Posts: 1048
Joined: Thu May 16, 2002 5:01 pm
Location: Madrid, Spain
Has thanked: 0
Been thanked: 0

Post by doragasu »

And also All gameboys have a Z80 (even the GBA, for backwards compatibility with older gameboys).
Sir Savant
Somewhat Dumb Knight
Posts: 3653
Joined: Tue Oct 12, 2004 2:26 pm
Has thanked: 0
Been thanked: 0

Post by Sir Savant »

I think I have that rom, here is a link to it.

http://www.darksavant0.com/files/rudxmacard.ton

YAY, more emulators!
Alexvrb
DCEmu Ultra Poster
DCEmu Ultra Poster
Posts: 1754
Joined: Wed Jul 17, 2002 11:25 am
Has thanked: 0
Been thanked: 0

Post by Alexvrb »

Well, the Zilog chip was certainly superior in many ways to the 8080 is was compatible with. But in the next era of chips, they screwed up. So the Z80 continued to see new versions in more and more focused enviroments, but there was no popular successor. Heck, at one point they even had plans to make an x86 compatible chip as well, but they of course chickened out because they as a company preferred floundering.

Also, I can't believe nobody mentioned GB and GBC when talking about Z80. While they may not have succeeded with Z800 or whatever they called their planned successor chip, they did manage to get the good old Z80 to be very power efficient. My TI-83 lasts for many hours on those AAAs.
If you have twenty monkeys,
banging randomly on typewriters,
they will in twenty minutes produce the complete source code to World of Warcraft.
User avatar
Untamed
Psychotic DCEmu
Psychotic DCEmu
Posts: 672
Joined: Sat Jan 10, 2004 5:28 am
Location: London, England
Has thanked: 0
Been thanked: 0

Post by Untamed »

GPF wrote:
Untamed wrote:
Hawq wrote:Dont forget watches & musical xmas/bday cards, the Z80 just wont die ever it seems

Let's emulate musical bday cards on the Dreamcast!
Thats just what we need people trading in musical xmas/birthday rom warez :)

Hey does anybody have the new Rudolph xmas card rom ? lol


http://www.cardwarez.tk


...

If only that site were real. :(
"Ignorance can be cured, stupidity cannot."
Roofus wrote:Gay marriage and donkey rape are the same thing. Duh. :roll:
User avatar
Stef.D
DCEmu Respected
DCEmu Respected
Posts: 114
Joined: Wed Oct 15, 2003 1:46 am
Has thanked: 0
Been thanked: 0
Contact:

Post by Stef.D »

I was going to post that on DcEmu.co.uk forum, but site is down for now.
I quickly set up an autoframe skip feature for Genesis Plus.
I'm even surprised i never did it before, it took me about 2 mn to do it (it worked on first attempt). Actually all was already here : a function to know where is the current read position in sound buffer, streaming sound etc ...
I modified about 10 lines of code to get it running.
Code is a bit ugly, but it was just a test ... and it worked directly almost perfectly :)
I give only the sources since anyway with my built, autoframe skip make Genesis Plus almost unplayable because we have something as 3-4 FPS ! Software renderer is too slow, and seems that sound code is not nice too.

BlackAura> I mainly modified the snd_stream_poll function which now return the number of samples still required to fill sound buffer. Beside that, i compare this number with the sound buffer size for 1 frame (42000/60 for 42 Khz)... if it's greater then i do a frame skip (no VDP display) else i do complete frame render.... simple but efficient.
Now sound code need to be reworked and optimised. I remember i did that in rush just to get stuff working... but that's not optimised at all.

You can download my last Genesis Plus DC sources here :
http://gens.consolemul.com/download/GenPlus_DC.zip
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

Ooooh... Neat.

Well, this is a bit simpler than what I had in mind. For some reason, I didn't think of using the sound output to control the emulator. Duh...

Assuming it works correctly (I'll throw it into my copy, play a few games, and see if it blows up or not), there's really only one thing left to do to get it working properly - decrease the size of the buffer to reduce the sound delay.

As for optimizing it, off the top of my head...
  • Remove the mixing code in GP that mixes the two mono buffers into a single stereo buffer
  • Remove the unmixing code in the sound driver that unmixes a single stereo buffer into two mono buffers
  • Use DMA to transfer the sound data directly from the buffers
  • Find places where we're needlessly copying sound data, and put a stop to it
  • There's probably a few places we can simplify things
  • Try using the Gens sound system, which might be faster than the MAME one
If I remember correctly, the Gens sound system outputs as 32-bit values, and does all it's own mixing, right? I don't suppose there's any way to get it to output 16-bit values in a format we can transfer directly? If we have to convert back to 16-bit samples, we might lose any speed gain that we might get.

The way I had the system running in a PC test version of Genesis Plus was basically running the DAC emulation / FM timers each scanline, and then running the PSG and FM synths for an entire frame of audio at once, at the end of the frame. Probably not the most accurate way to do it (it'll break at least one game), but it seems to work well enough.
sakuragi
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 17
Joined: Thu Jan 27, 2005 6:43 pm
Location: France
Has thanked: 0
Been thanked: 0

Post by sakuragi »

Bravo Stef :wink: congratulations for all your work. Je me suis inscrit ici juste pour te dire bravo ^^. You think we can have a version of genesis plus with good sound in few times ? :P
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

Hang about... I just downloaded the source you linked to, and I can't find anything even resembling what you just described.
User avatar
Salamander2
Insane DCEmu
Insane DCEmu
Posts: 150
Joined: Mon Apr 05, 2004 8:38 pm
Location: Rio Grande,RS - Brazil
Has thanked: 0
Been thanked: 0

Post by Salamander2 »

Please, dont forget about the MSX2 and sega Master System emulation.
"...they are carrying the last hope: to save planet Gradius...on their wings..."
GRADIUS TRIBUTE for Dreamcast!
DcSteve
Modder Of Rage
Modder Of Rage
Posts: 805
Joined: Mon Mar 18, 2002 12:41 pm
Location: Midwest
Has thanked: 0
Been thanked: 0
Contact:

Post by DcSteve »

doesnt stef's source use software rendering, so what happens when u switch the sound changes from stef's builds into BA's built. Im pretty sure sound would be loud and clear now with hardware rendered:)
Check out the beats of rage community at http://borrevolution.vg-network.com/
User avatar
Stef.D
DCEmu Respected
DCEmu Respected
Posts: 114
Joined: Wed Oct 15, 2003 1:46 am
Has thanked: 0
Been thanked: 0
Contact:

Post by Stef.D »

BlackAura>
Ooooh... Neat.

Well, this is a bit simpler than what I had in mind. For some reason, I didn't think of using the sound output to control the emulator. Duh...
Actually we have 2 choices to synchronise emulation speed : Video Synchro (VBlank) or Sound synchro (Sound buffer wait).
Unfortunatly, we can't have perfect synchro for both of them.
If we choose to synchronise on V-Blank, we will have some annoying noises in sound (except if we interpolate it, but sound is then a bit distorded).
If we choose to synchronise on Sound Buffer (it's what i'm doing in Gens) then we'll have sometime some tears on the screen... we can always wait for VBlank but then we will miss some frames :-/

In my viewpoint, sound synchro is far more important, i really dislike having noises in sound, it's so irritating :p

What i'm doing in Gens : i'm just comparing the "current read segment" against "current write segment" in sound buffer... while i can write new sound segment without raising "current read segment" i do frame skip, else i do a complete frame... and i'm waiting for writing a new segment without overlapping "current read segment"... what i call segment is the sound buffer for a frame (buffer lenght = 44100 Hz / 60 Hz)

Assuming it works correctly (I'll throw it into my copy, play a few games, and see if it blows up or not), there's really only one thing left to do to get it working properly - decrease the size of the buffer to reduce the sound delay.
Hey, don't erase your sources ! mine are really old ;)
At least you can copy the snd_stream.c file and maybe doing some hand modifications to system_frame function because i assume you modified it.
I also modified the main loop (function emu_run in main.c) which normally does manual frame skip.
As for optimizing it, off the top of my head...
- Remove the mixing code in GP that mixes the two mono buffers into a single stereo buffer
- Remove the unmixing code in the sound driver that unmixes a single stereo buffer into two mono buffers
- Use DMA to transfer the sound data directly from the buffers
- Find places where we're needlessly copying sound data, and put a stop to it

There's probably a few places we can simplify things

- Try using the Gens sound system, which might be faster than the MAME one
Well, you're right, there are many ways of optimising the sound code, and we should use all these you mentionned :)
My built already use the Gens sound core, but it doesn't performs well on DC, it's almost as fast as MAME core :-/ i think it's due to it memory usage (use 32 bits, does more memory buffer access when updating...)
I think the best thing to do is to use an old MAME version (0.35 or 0.36) of the core (newers are quite slow and not really more accurate).
If I remember correctly, the Gens sound system outputs as 32-bit values, and does all it's own mixing, right? I don't suppose there's any way to get it to output 16-bit values in a format we can transfer directly? If we have to convert back to 16-bit samples, we might lose any speed gain that we might get.
Yeah, Gens sound engine work in entire 32 bits, because today's CPU computes 32 bits datas faster than 16 bits ones, and it was easier for final mixing. Unfortunatly on DC that doesn't help much, since it also takes x2 more memory.
The way I had the system running in a PC test version of Genesis Plus was basically running the DAC emulation / FM timers each scanline, and then running the PSG and FM synths for an entire frame of audio at once, at the end of the frame. Probably not the most accurate way to do it (it'll break at least one game), but it seems to work well enough.
It's the most common way of doing :)
PSG is used as DAC in AfterBurner 2, so this game won't product voice with this method, but that's not really important compared to the speed gain ;)
Hang about... I just downloaded the source you linked to, and I can't find anything even resembling what you just described.
I just checked the sources on the site, and they are correct.
As i said, that need very minors modifications compared to the old sound code. Just check in the snd_strem_pool function in the snd_stream.c file, now i do :

Code: Select all

return (needed_samples - got_samples);
at end of function to return the number of samples yet required...

then in system_frame(...) i also did some minors modification :

Code: Select all

if(snd.enabled)
{
    if (audio_update() >= snd.buffer_size) return 1;
}
returning 1 mean i want a frame skip for the next frame, else i return 0 :)

By the way, i used the Z80 CPU interface as you can see, and it works :)
That will probably help you to fix it... if needed. CZ80 seems to work pretty nicely actually :)


Sakuragi>
Bravo Stef congratulations for all your work. Je me suis inscrit ici juste pour te dire bravo ^^. You think we can have a version of genesis plus with good sound in few times ?
Merci ;)
Pour la prochaine version, je pense qu'il vaut mieux voir avec BlackAura ;)
J'ai juste modifi? la gestion du frameskip, mais au niveau du VDP je n'ai rien chang?, et c'est le plus important ? mon sens car sur ma version c'est injouable tellement c lent !




DcSteve>
doesnt stef's source use software rendering, so what happens when u switch the sound changes from stef's builds into BA's built. Im pretty sure sound would be loud and clear now with hardware rendered:)
Yeah my sources still use the software renderer and it's unplayable because it's slow as hell... sound code seems to be pretty slow also. I don't expect the BA version can run at full speed with sound enable... close to full speed, but not really full speed.
DcSteve
Modder Of Rage
Modder Of Rage
Posts: 805
Joined: Mon Mar 18, 2002 12:41 pm
Location: Midwest
Has thanked: 0
Been thanked: 0
Contact:

Post by DcSteve »

so BA> did anything good happen to the sound after incorperating these changes into your source?
Check out the beats of rage community at http://borrevolution.vg-network.com/
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7499
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 10 times
Contact:

Post by Quzar »

DcSteve wrote:so BA> did anything good happen to the sound after incorperating these changes into your source?
do you REALLLY think he wouldnt post that information anyways without you asking? and as a secondary note to that, if he wasnt going to post it, do you think you asking him would change his mind about posting it if he wasnt going to?

relax. go work on something instead of nagging him.
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
User avatar
MetaFox
Adventure Gamer
Adventure Gamer
Posts: 2818
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 12 times
Contact:

Post by MetaFox »

Well said quzar, it seems you and I are thinking on the same wavelength lately.

If you want to say something, but don't want to come off as a jerk, I say it. Likeways if I want to say something, but don't want to come off as a jerk, you say it.

It's getting kind of creepy. :P
User avatar
Salamander2
Insane DCEmu
Insane DCEmu
Posts: 150
Joined: Mon Apr 05, 2004 8:38 pm
Location: Rio Grande,RS - Brazil
Has thanked: 0
Been thanked: 0

Post by Salamander2 »

My question is WHEN.
"...they are carrying the last hope: to save planet Gradius...on their wings..."
GRADIUS TRIBUTE for Dreamcast!
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7499
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 10 times
Contact:

Post by Quzar »

Salamander2 wrote:My question is WHEN.
when what?
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
Locked