PDA

View Full Version : beta version of CZ80 released :)



Stef
January 22nd, 2005, 16:39
I finally completed my Z80 emulator.
I just fixed a bug which making it crashing on dreamcast (reading/writing a word on odd address).
It hasn't been tested a lot so it's far from being bug free, but it's enough to make some tests and benchs :)
I tested it in Genesis Plus only against the current used Z80 core.
On x86 platform, it performs about ~1.6 times faster only, but on dreamcast it performs ~2.2 times faster :)

You can grab the sources here :
http://gens.consolemul.com/download/CZ80_090.zip

I did a cpu interface to make switch to a core from another quicker.
I'll upload it soon, be patient ;)

Cheers,

Edit : cpu interface files uploaded at http://gens.consolemul.com/download/cpu_z80.zip

quzar
January 22nd, 2005, 16:58
cool! i see the interface allows for two different wrapper CPU cores. CPU Z80 and CPU AZ80. what is AZ80? also, is there any chance you could try to make the wrapper compatible with mz80 as well?

im gonna try testing this with mame. thanks a bundle!

Stef
January 22nd, 2005, 17:01
cool! i see the interface allows for two different wrapper CPU cores. CPU Z80 and CPU AZ80. what is AZ80? also, is there any chance you could try to make the wrapper compatible with mz80 as well?

im gonna try testing this with mame. thanks a bundle!

AZ80 is a x86 asm Z80 i made for Gens sometime ago, not really interesting actually.. it was just to compare it versus CZ80 ;)

mz80 ? or cmz80 ?

quzar
January 22nd, 2005, 17:19
both have the same interface. mz80 is the x86 enhanced one, and cmz80 is a directly API compliant version of mz80 written in pure C. its what im currently using in NeoDC.

but thats not really important i guess, because cmz80 is already around 2x faster than the z80 core in genesisplus.

sorry if this is a hassle i'm asking of you, but is there any way you could make a cpu wrapper that wraps the functions of mame's z80 core to CZ80 ? so, instead of modifying the rest of the program, you simply add in the wrapper object and be done with it? I already tried to do this previously with C68k's cpu interface, but couldn't get it to work right, I guess I just dont understand either core's interfaces well enough.

wraggster
January 22nd, 2005, 18:59
excellent news

this is the boost the whole emu scene has needed :)

Sakuragi
January 23rd, 2005, 10:25
Bravo Stef ;) . Qu'elles machines utilisent le z80 au fait ? la megadrive , la neogeo , la saturn aussi non ? et surtout ça gere quoi ? :-[ . Merci pour tout ton travail en tout cas :-*

Stef
January 23rd, 2005, 12:00
but thats not really important i guess, because cmz80 is already around 2x faster than the z80 core in genesisplus.


I upgraded to the last version of MAME z80 core in Genesis Plus, some bugs fixed and a bit faster.
I modified and cleaned it a bit for easier interfacing.

I also tried to implement cmz80 in Genesis Plus... Weird, i guess i don't use it very well since it's only a bit faster than MAME core, and this is, on x86 architecture...
On dreamcast, speed is almost the same as MAME core.
I don't like the way we need to initiliase CMZ80 : complex structures to fill, long... and core doesn't seem really safe (with fetch for instance).

By the way ? how did you get cmz80 working on DC ? since i needed to fix a bug (actually the same as in CZ80, i.e. SH-X cpu can't read word data at odd address) before getting things to work :-/



sorry if this is a hassle i'm asking of you, but is there any way you could make a cpu wrapper that wraps the functions of mame's z80 core to CZ80 ? so, instead of modifying the rest of the program, you simply add in the wrapper object and be done with it? I already tried to do this previously with C68k's cpu interface, but couldn't get it to work right, I guess I just dont understand either core's interfaces well enough.

Unfortunatly it's just impossible to do a perfect cpu wrapper which permit to use CZ80 without modifying any lines of code in the rest of the program... specially for initialisation stuff. Almost all cores are different for that.
I uploaded a new version of CZ80, i only modified DAA opcode : *no anymore need of the LUT (as MAME z80 core actually) -> smaller code :)
http://gens.consolemul.com/download/CZ80_091.zip

I also uploaded my modified z80 cpu interface, it now implements CMZ80 as well... i also included :
- lastest version of MAME z80 (tweaked for Genesis Plus)
- CMZ80 fixed for dreamcast
- lastest version of CZ80
Get it here :
http://gens.consolemul.com/download/cpu_z80.zip

Of course this CPU interface has been done for Genesis Plus. And again, you'll need to modify some memomry function name and definition in Genesis Plus to get it working.
You can use the cpu interface in others projects but you'll need to modify initialisation stuff according to the emulated system etc...




Bravo Stef * . Qu'elles machines utilisent le z80 au fait ? la megadrive , la neogeo , la saturn aussi non ? et surtout ça gere quoi ? * *. Merci pour tout ton travail en tout cas *


Merci *:)
Beaucoup de (vieilles) machines utilisent le Z80...
La master system, la mégadrive, la NeoGeo, les ordinateurs personnels type Amstrad etc... (pas la saturn ^^)
Dans les plus vieilles machines, le Z80 est l'unité centrale, mais dans la mégadrive ou la néo-géo ce n'est qu'un sub-system pour gérer la partie sonore ;)

WHurricane16
January 23rd, 2005, 13:09
Awesome ;)

Sakuragi
January 23rd, 2005, 13:36
ok ^^ . Ta version va aider a avoir une émulation correcte du son dans genesis plus et neocd ? en plus d apporter un gain de rapidité . Desolé de t embeter mais je me demande ce qui gene surtout les devellopeurs d ému dans leur conception sur ces 2 émulateurs ;)

quzar
January 23rd, 2005, 16:08
I also tried to implement cmz80 in Genesis Plus... Weird, i guess i don't use it very well since it's only a bit faster than MAME core, and this is, on x86 architecture...
On dreamcast, speed is almost the same as MAME core.
I don't like the way we need to initiliase CMZ80 : complex structures to fill, long... and core doesn't seem really safe (with fetch for instance).

By the way ? how did you get cmz80 working on DC ? since i needed to fix a bug (actually the same as in CZ80, i.e. SH-X cpu can't read word data at odd address) before getting things to work :-/

I use cmz80 in NeoDC. Previously it had used mz80, which didnt work at all because of it's assembly=ness. It compiled fine, but maybe it DOESNT work and that could be why I am not getting any sound. (even though I replaced the z80 core, i am not getting any sound. i assume though that the sound code is broken, maybe the z80 is still broken.)

the only reason i say cmz80 was faster than mame core was because at one point i tried the mame z80 core in neoDC and it slowed it down considerably, whereas cmz80 made little difference (although now i see that may be because it simply doesnt work).

fox68k
January 23rd, 2005, 20:33
Great work Stef! ;D

I have tested it on Genesis Plus and it works ok. The sound looks to crap sometimes, but... what the hell, this is a really cool beta release! 8)

Sakuragi
January 24th, 2005, 09:15
Sound is better than the older in genesis plus ? ( loop etc ... )

fox68k
January 24th, 2005, 12:22
It sounds just like the older one. I think it should improve tweaking other parts of sound core. Probably DC related stuff.

dcsteve
January 24th, 2005, 12:44
im surprised that this new z80 seems to output the same results as gp dc pvr3. With c68k, pvr3 looks fullspeed with loopyness and some other sound problems. With FAME, which is supposed to be faster than c68k, and this new CZ80 which is 2 times faster, no difference in sound is noticable? Why?

quzar
January 24th, 2005, 12:55
because the sound being loopy is an independant problem to speed.

quzar
January 24th, 2005, 19:07
I got the code worked out so that it compiles in NeoDC, but whenever I go to call for the execution of some Z80 cycles, it resets the DC. Any reason you can think of?

my cflags are : "-ml -m4-single-only -fomit-frame-pointer -falign-loops -fstrict-aliasing"

if anything is missing from there that it requires, or anything there that might break it, please tell me =P

here's my cpuz80 file (everything that i changed):



// Z80 CPU interface

#include <stdio.h>

#include "../types.h"
#include "cpuz80.h"
#include "cz80/cz80.h"


/********************************************/
//NeoDC Specific//
/********************************************/

#include "../memory/memory.h"
#include "../neocd.h"


U8 subcpu_memspace[65536] __attribute__((aligned(32)));
int sound_code = 0;
int pending_command = 0;
int result_code = 0;
int z80_cycles = Z80_VBL_CYCLES;


//---------------------------------------------------------------------------
u32 FASTCALL PortRead(u32 adr)
{
static int bank[4];

switch( adr & 0xff)
{
case 0x0:
pending_command = 0;
return sound_code;
break;

case 0x4:
return YM2610_status_port_0_A_r(0);
break;

case 0x5:
return YM2610_read_port_0_r(0);
break;

case 0x6:
return YM2610_status_port_0_B_r(0);
break;

case 0x08:
{
bank[3] = 0x0800 * ((adr >> 8) & 0x7f);
return 0;
break;
}
case 0x09:
{
bank[2] = 0x1000 * ((adr >> 8) & 0x3f);
return 0;
break;
}
case 0x0a:
{
bank[1] = 0x2000 * ((adr >> 8) & 0x1f);
return 0;
break;
}
case 0x0b:
{
bank[0] = 0x4000 * ((adr >> 8) & 0x0f);
return 0;
break;
}
default:
printf("Unimplemented Z80 Read Port: %d\n",adr&0xff);
break;
};
return 0;
}

void FASTCALL PortWrite(u32 adr, u32 data)
{
switch( adr & 0xff)
{
case 0x4:
YM2610_control_port_0_A_w(0,data);
break;

case 0x5:
YM2610_data_port_0_A_w(0,data);
break;

case 0x6:
YM2610_control_port_0_B_w(0,data);
break;

case 0x7:
YM2610_data_port_0_B_w(0,data);
break;

case 0x8:
/* NMI enable / acknowledge? (the data written doesn't matter) */
break;

case 0xc:
result_code = data;
break;

case 0x18:
/* NMI disable? (the data written doesn't matter) */
break;

default:
printf("Unimplemented Z80 Write Port: %x data: %x\n",adr&0xff,data);
break;
}
}
/*****************************/

/********************************************/

void Z80_Init(void)
{
printf("Z80 cpu init start... ");

Cz80_Init(&CZ80);

Cz80_Set_Fetch(&CZ80, 0xFFFF0000, 0xffffffff, (u32)subcpu_memspace);
//Cz80_Set_Fetch(&CZ80, 0x2000, 0x3FFF, (u32)subcpu_memspace);

Cz80_Set_ReadB(&CZ80, NULL);
Cz80_Set_WriteB(&CZ80, NULL);

Cz80_Set_INPort(&CZ80, PortRead);
Cz80_Set_OUTPort(&CZ80, PortWrite);

// Cz80_Set_IRQ_Callback(&CZ80, neogeo_sound_irq);

Cz80_Reset(&CZ80);


Cz80_Exec(&CZ80, 100000);
printf("end !\n");

}

s32 Z80_Reset(void)
{
printf("Z80 cpu reset\n");
return Cz80_Reset(&CZ80);
}

s32 Z80_Exec(s32 cycles)
{
printf("Z80 cpu exec\n");
return Cz80_Exec(&CZ80, cycles);
}

void Z80_EndExec(void)
{
Cz80_Release_Cycle(&CZ80);
}

void Z80_SetIRQ(u32 vector)
{
printf("Z80 cpu set irq\n");
Cz80_Set_IRQ(&CZ80, vector);
}

void Z80_ClearIRQ(u32 vector)
{
printf("Z80 cpu clear irq\n");
Cz80_Clear_IRQ(&CZ80);
}

void Z80_SetNMI(void)
{
printf("Z80 cpu set nmi\n");
Cz80_Set_NMI(&CZ80);
}

void Z80_ClearNMI(void)
{
printf("Z80 cpu clear nmi\n");
Cz80_Clear_NMI(&CZ80);
}




Edit: I trimmed out a lot of unnecessary things in an attempt to reveal the problem, but still nothing =\.

BlackAura
January 25th, 2005, 04:24
I got it working in Genesis Plus (my DC still doesn't work right, so that took a while), but only if I hack CZ80 directly into the emulator. If I use the switching thingy, I just can't get anything to work. Crashes on the PC version, plain old doesn't work on the DC...

Otherwise, it seems to work pretty well.

The reason it won't help the sound is simple - the sound output is largely independent of the speed of the emulator. However, the current sound output expects the emulator to be running at exactly 60FPS, which it doesn't. The third preview version ran at probably 55 FPS on most games, because it dropped the odd frame here and there. With either FAME or CZ80, it tends to run at full speed, but that's still not 60FPS. It's actually something like 59.5FPS, which is enough difference to screw the sound output up. Just not as much. It's also horribly out of synch with everything else.

warmtoe
January 25th, 2005, 13:22
Cz80_Set_ReadB(&CZ80, NULL);
Cz80_Set_WriteB(&CZ80, NULL);


Don't these 2 lines have to set up a function pointer - setting them to null would probably cause the DC to reboot - I think.

Stef
January 25th, 2005, 14:03
* * Cz80_Set_ReadB(&CZ80, NULL);
* *Cz80_Set_WriteB(&CZ80, NULL);


Don't these 2 lines have to set up a function pointer - setting them to null would probably cause the DC to reboot - I think.

You're right.
Atually you can't do that because i don't test if pointer is null before calling readmem or writemem (waste of time).
If you don't have any specials stuff to do on read or/and write, just don't call SetReadxxx & SetWritexxx functions. By default CZ80 uses dummies functions.




I got it working in Genesis Plus (my DC still doesn't work right, so that took a while), but only if I hack CZ80 directly into the emulator. If I use the switching thingy, I just can't get anything to work. Crashes on the PC version, plain old doesn't work on the DC...


Soem functions need to be renamed in Genesis Plus : Z80 memories and irq functions.
for instance i replaced readmem16 and writemem16 by readmem8 and writemem8 since they actually work on a byte, and that can be confusing since CZ80 can directly read or write word if definition is enabled in cz80.h

Also (at least on PC version), don't forget that CZ80 needs FASTCALL convention for IO functions.

Sakuragi>
Ca va accélérer l'émulateur légèrement et donc indirectement faire en sorte que le son fonctionne mieux, mais sans implémenter un auto frame skip correct, le son ne pourra jamais être parfait, même à pleine vitesse...

quzar
January 25th, 2005, 15:31
Removing the Set Read and Write stopped it from crashing, now though I have a problem that the port calls arent happening correctly =\. I think it is a combination of me not setting up the z80 memory with the proper addressing (the original doesnt really specify in the same terms =\)

I think my problem is that I'm not translating the addresses correctly. In the interface, are the default addresses for the read/write handlers equivilant or are the pure examples? if they are examples, how would I set it properly?

I notice that for the port read/write the address is in u32 instead of u16 like for cmz80. Does this make a major difference?

Stef
January 25th, 2005, 15:47
Removing the Set Read and Write stopped it from crashing, now though I have a problem that the port calls *arent happening correctly =\. I think it is a combination of me not setting up the z80 memory with the proper addressing (the original doesnt really specify in the same terms =\)

I think my problem is that I'm not translating the addresses correctly. In the interface, are the default addresses for the read/write handlers equivilant or are the pure examples? if they are examples, how would I set it properly?

I notice that for the port read/write the address is in u32 instead of u16 like for cmz80. Does this make a major difference?

The default address used in the interface are used for genesis and can't be translated for NeoGeo.
How set it properly ? Well you should know where the program code can be fetched from... On genesis, the Z80 has 4 KB dedicated memory.
The memory can be read or write in the 0x0000-0x1FFF range from Z80, range is also mirrored at 0x2000-0x3FFF ... it's why i set fetch region in this way.
The Z80 address bus is 16 bits wide, you don't need to specify 32 bits address... i just did that for convenience for 32 bits CPU.
As for readmem8 function, in CZ80 return is "u32" but really only low 8 bits are used.

BlackAura
January 25th, 2005, 19:02
Soem functions need to be renamed in Genesis Plus : Z80 memories and irq functions.
for instance i replaced readmem16 and writemem16 by readmem8 and writemem8 since they actually work on a byte, and that can be confusing since CZ80 can directly read or write word if definition is enabled in cz80.h

Also (at least on PC version), don't forget that CZ80 needs FASTCALL convention for IO functions.

I already renamed the appropriate functions, so that's not the issue. It's probably not the FASTCALL calling convention either - I actually had to disable that, because my compiler (GCC on Linux) didn't understand it. I'm guessing that it's either Windows-specific, or GCC has a different name for it.

dcsteve
January 25th, 2005, 21:18
hmm, so what can be done to free up enough memory (if thats what it is), to gain .5 fps for true 60fps fullspeed, or at least so the sound is synced...

BlackAura
January 25th, 2005, 23:46
Some games (with C68k + Cz80) now run at full speed. The sound still isn't right, becuase the sound output code makes no attempt to keep things synchronized. So, we need sound output code that can do that, and maybe a little bit of frameskipping to smooth things out a bit. Doable, but it requires different sound code. I just hope I can actually get it to work properly this time...

Using FAME and Cz80, more games run at full speed. There are still some that don't, and some that actually run at exactly half speed (the intro for Zero Wing, the save/load menu in Sonic 3) no matter what I do with them.

So the problem isn't really one of speed. Not anymore. I think I can probably get it working, but it'll take a little while, depending on which way I do it. One way will work perfectly if the game is running at full speed, will have the odd click if it's not running at full speed, and is much easier to program. That's how NesterDC works. The other way requires more work, but will be able to adapt itself to the speed of the emulator, so even if it's running at 30FPS it'll still sound alright.

Stef
January 26th, 2005, 08:52
Some games (with C68k + Cz80) now run at full speed. The sound still isn't right, becuase the sound output code makes no attempt to keep things synchronized. So, we need sound output code that can do that, and maybe a little bit of frameskipping to smooth things out a bit. Doable, but it requires different sound code. I just hope I can actually get it to work properly this time...

Using FAME and Cz80, more games run at full speed. There are still some that don't, and some that actually run at exactly half speed (the intro for Zero Wing, the save/load menu in Sonic 3) no matter what I do with them.


You have the sound working with CZ80 ? actually i wasn't able to get sound output to work on my private Geneis Plus version, i probably missed something and i can't remember what... I just see that CZ80 was eatnig time, so i assumed it worked, i also compared execution versus MAME Z80 but i wasn't sure anyway...
Z80 is almost time used for digitalised voices and drums... some games uses it for complete sound processing, but it's rare. Did you experienced some problems compared to MAME Z80 core ? DAC sound missing or some stuff ?



So the problem isn't really one of speed. Not anymore. I think I can probably get it working, but it'll take a little while, depending on which way I do it. One way will work perfectly if the game is running at full speed, will have the odd click if it's not running at full speed, and is much easier to program. That's how NesterDC works. The other way requires more work, but will be able to adapt itself to the speed of the emulator, so even if it's running at 30FPS it'll still sound alright.

It's what i said (in french) in the last post... even with a full speed emulator, sound can't be ok. Emulation speed needs to be perfectly synchronised with sound buffer or use more complexe ways of outputing and interpolating the sound...

Is there any function in KOS to retrieve the current read position from the primary sound buffer ? If this function exists, i can write an auto frame skip function to make sound output perfect.

dcsteve
January 26th, 2005, 10:49
According to BlueCrab- hes not a 100% sure but this is what you need to look at stef for your Kos function.


int gpdc_snd_get_pos() {
current_play_pos = (int)g2_read_32(SPU_RAM_BASE + AICA_CHANNEL(0) + offsetof(aica_channel_t, pos));
current_play_pos &= ~1;
return current_play_pos;
}

now THAT is something im really looking foward to.

BlueCrab
January 26th, 2005, 11:43
According to BlueCrab- hes not a 100% sure but this is what you need to look at stef for your Kos function.


int gpdc_snd_get_pos() {
int current_play_pos = (int)g2_read_32(SPU_RAM_BASE + AICA_CHANNEL(0) + offsetof(aica_channel_t, pos));
current_play_pos &= ~1;
return current_play_pos;
}

now THAT is something im really looking foward to.
That's basically taken right out of gpdc_snd_stream_poll(), so, it may not be exactly what ya need. Let me know if it isn't, and I'll look for something else.

BlackAura
January 28th, 2005, 00:18
You have the sound working with CZ80 ?

Not very well, but it works. For some reason, it appears to have slowed down again. On the Dreamcast anyway. On the PC test version, it works fine. Is there a "best" way to compile C68k and Cz80? I'm currently using -Os on GCC 3.0.4.


Did you experienced some problems compared to MAME Z80 core ? DAC sound missing or some stuff ?

They were just sound output / generation things, when I was playing around with the sound code. It also works fine with the other (PC) version of Genesis Plus I have, which has the Gens sound emulators instead of the MAME ones. And it sounds a lot better too.

I think the best way to get sound output working would involve two things.

1 - Make the emulator able to output a variable number of samples per frame.
2 - Auto frameskipping to compensate for the odd dropped frame.

Basically, we keep a count of the number of samples consumed during the last frame. We then generate that same number of samples on the next frame, to replace those consumed by the sound hardware. If we missed a frame, those calculations pretty much go right out the window. I'm pretty sure that, with frameskipping, we can run internally at 60FPS even if we're only actually rendering 55. We'd need to work out how many samples will be consumed both by the previous frame and the next frame, and use that to generate the required number of samples.

It's a bit complex though. The other solution is to copy NesterDC. It simply created a small single-shot sample for each channel. At the end of each frame, it transfers the generated sound, and starts the hardware playing them back. Next frame, we do it again (but with double buffering). It gets rid of all the skipping problems, because we're not using a looping buffer anymore, but there will probably be an audiable click when we drop a frame, and possibly if we're generating the wrong number of samples.

Stef
January 28th, 2005, 19:23
I already posted that on dcemulation.com since forum was down for sometime :


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

Generate a variable number of sample by frame will distorde the sound, and anyway that's really not needed, we have far simpler ;)

Stef
February 8th, 2005, 08:30
Mekanaizer pointed me a stupid bug in sources i uploaded !
And unfortunatly since site is down now, i can't reupload the fix for the moment.
So, for all guys which tried to compile the sources, you should get an error like that :



-D_arch_dreamcast -D _GENS_SOUND_ * *-fverbose-asm -fexpensive-optimizations -O1

source/dreamcast/main.c: In function `emu_run':
source/dreamcast/main.c:198: `skip_frame' undeclared (first use in this function)
source/dreamcast/main.c:198: (Each undeclared identifier is reported only once
source/dreamcast/main.c:198: for each function it appears in.)

make.exe: *** [out/main.o] Error 1

Execution terminated


It's just because i still was in the IDE when i archived my sources, and some files weren't saved properly at this time.

Here's how fix it :

replace this part of code in the main.c file



static void emu_run()
{
* * *int res = 0;
* * *pvr_vertex_t vert;
* * *int still_going;
* * *uint32 last_time;
* * *uint32 this_time;

* * *int fps_count = 0;
* * *int vps_count = 0;

* * *still_going = 1;
* * *exec_frames = 0;
* * *draw_frames = 0;
* * *last_time = getTimer();

* * *while(still_going)
* * *{
* * * * * */* FPS counter stuff */
* * * * * *exec_frames++;

* * * * * */* Run a frame of emulation */
* * * * * *res = system_frame(res);
* * * * * *if(res == -1)
* * * * * *{
* * * * * * * * *system_reset();
* * * * * * * * *skip_frame = 0;
* * * * * *}

* * * * * */* Update the controllers */
* * * * * *if(update_input())
* * * * * * * * *still_going = 0;

* * * * * */* Update screen */
* * * * * *if (skip_frame != 2)
* * * * * *{



by this one




static void emu_run()
{
* * *int skip_frame = 0;
* * *pvr_vertex_t vert;
* * *int still_going;
* * *uint32 last_time;
* * *uint32 this_time;

* * *int fps_count = 0;
* * *int vps_count = 0;

* * *still_going = 1;
* * *exec_frames = 0;
* * *draw_frames = 0;
* * *last_time = getTimer();

* * *while(still_going)
* * *{
* * * * * */* FPS counter stuff */
* * * * * *exec_frames++;

* * * * * */* Run a frame of emulation */
* * * * * *skip_frame = system_frame(skip_frame);
* * * * * *if(skip_frame == -1)
* * * * * *{
* * * * * * * * *system_reset();
* * * * * * * * *skip_frame = 0;
* * * * * *}

* * * * * */* Update the controllers */
* * * * * *if(update_input())
* * * * * * * * *still_going = 0;

* * * * * */* Update screen */
* * * * * *if (!skip_frame)
* * * * * *{



Don't forget this version still use the software renderer, so auto frame skip make almost games just unplayable (about 1-3 FPS).
But it should runs descently with hardware renderer.

dcsteve
February 8th, 2005, 15:38
how difficult will it be to change to hardware rendering? Mekanazier tryed to switch the sound and maybe other things from this stef source into BA's and did not get positive results.