Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 31

Thread: beta version of CZ80 released :)

                  
   
  1. #21
    DCEmu Coder
    Join Date
    Apr 2004
    Location
    FRANCE
    Posts
    80
    Rep Power
    0

    Default Re: beta version of CZ80 released :)

    [quote author=quzar link=board=dcemu;num=1106437151;start=15#19 date=01/25/05 at 16:31:20]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?[/quote]

    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.

  2. #22
    DCEmu Coder
    Join Date
    Apr 2004
    Posts
    227
    Rep Power
    78

    Default Re: beta version of CZ80 released :)

    [quote author=Stef link=board=dcemu;num=1106437151;start=15#18 date=01/25/05 at 15:03:20]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.[/quote]

    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.

  3. #23

    Default Re: beta version of CZ80 released :)

    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...

  4. #24
    DCEmu Coder
    Join Date
    Apr 2004
    Posts
    227
    Rep Power
    78

    Default Re: beta version of CZ80 released :)

    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.

  5. #25
    DCEmu Coder
    Join Date
    Apr 2004
    Location
    FRANCE
    Posts
    80
    Rep Power
    0

    Default Re: beta version of CZ80 released :)

    [quote author=BlackAura link=board=dcemu;num=1106437151;start=15#23 date=01/26/05 at 00:46:57]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.
    [/quote]

    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.

  6. #26

    Default Re: beta version of CZ80 released :)

    According to BlueCrab- hes not a 100% sure but this is what you need to look at stef for your Kos function.

    Code:
     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.

  7. #27
    The Long Claw of the Law BlueCrab's Avatar
    Join Date
    Apr 2004
    Age
    38
    Posts
    1,215
    Rep Power
    50

    Default Re: beta version of CZ80 released :)

    [quote author=dcsteve link=board=dcemu;num=1106437151;start=15#25 date=01/26/05 at 11:49:59]According to BlueCrab- hes not a 100% sure but this is what you need to look at stef for your Kos function.

    Code:
     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.[/quote]
    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.
    Sylverant PSO Server
    http://crabemu.sourceforge.net/
    irc.freenode.net #dreamcastdev #dcemuuk #yabause #ljsdcdev

  8. #28
    DCEmu Coder
    Join Date
    Apr 2004
    Posts
    227
    Rep Power
    78

    Default Re: beta version of CZ80 released :)

    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.

  9. #29
    DCEmu Coder
    Join Date
    Apr 2004
    Location
    FRANCE
    Posts
    80
    Rep Power
    0

    Default Re: beta version of CZ80 released :)

    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

  10. #30
    DCEmu Coder
    Join Date
    Apr 2004
    Location
    FRANCE
    Posts
    80
    Rep Power
    0

    Default Re: beta version of CZ80 released :)

    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

    Code:
    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


    Code:
    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.

Page 3 of 4 FirstFirst 1234 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •