What's new

PC-Engine

Cyberman

Moderator
Moderator
Thats odd. I have a 733 Mhz P3 and its running pretty good on it. I don't know why my code always has problems running on Athlons :( . Anyways, you can use the Backspace key to unthrottle it but there is no FPS display though. If you want, I can upload one which does.
What are the setting you are using for the compiler and what compiler? Currently I always compile for 386 processors due to the differences in pentium et al. If you use the most generic settings (not those optimal for your platform) that might change the speed issue on Athalon. Might be worth some experimentation.

Cyb
 

AamirM

New member
Hi,

I use MSVC 7.1 or 8 compiler. I optimization related compiler options I set are:

1) /O2 -- everybody knows this
2) Enable funtion inlining (/Ob2)
3) Frame pointer ommision (/Oy)
4) Optimize for P1 and up (/G6)

Thats pretty much it. I heard that there are some patches available from AMD to fix some things. Exophase, do you have those applied? My own written asm code doesn't use SSE/MMX so that shouldn't be a problem. If something timing related wasn't supported then an error should've been displayed. Is the video jumpy/stuttering as well? or is it just the sound?

stay safe,

AamirM
 
OP
E

Exophase

Emulator Developer
It's difficult to tell. I turned superfast rendering on, and although that wrecks the display it makes the onscreen messages readible. There are no fps dips when the audio skips. For the game I tested, it happens much less than it seemed to in TurboEngine, but on the other hand that also seemed different depending on game. Some, like GunBoat, sounded really awful.
 

AamirM

New member
Hi,

Ok, managed to fix all the non-working games except the following four:

- Battle Royale
- Champion Forever
- Double Dungeons
- Gai Flame

All these games, except Battle Royale, get stuck due to timer reload not being set correctly in time. Battle Royale, as you mentioned, is waiting for timer to be -1. How is this possible? Docs indicate that the instant timer underflows from zero, it is reloaded and the next value you read is the reload value. Every emulator except latest Magic Engine fails to run this specific game.

stay safe,

AamirM
 

AamirM

New member
Hi,

I decided to restart work on this. I have now completely written a new PSG and rewritten CPU emulator in C now :) . New PSG generates samples cycle accurately and I also added a new high quality PSG emulation mode where the PSG is run at ~220KHz and resampled back to 44.1 KHz. Will be adding LFO support as well now soon. Next thing on the list is to rewrite the VDC/VCE. I will be trying to run both the PSG and VDC in parallel with the CPU which maybe slow but will be more accurate.

I was looking at some CD-ROM stuff as well and I found this place with many, if not all, PCE docs at one place. So this maybe convenient for people trying to write PCE emu.

Exophase, you told me that you'll give the recording of Hani in the Sky but you never did. Can you please give it to me now?

stay safe,

AamirM
 
OP
E

Exophase

Emulator Developer
Hi,

I decided to restart work on this. I have now completely written a new PSG and rewritten CPU emulator in C now :) . New PSG generates samples cycle accurately and I also added a new high quality PSG emulation mode where the PSG is run at ~220KHz and resampled back to 44.1 KHz. Will be adding LFO support as well now soon. Next thing on the list is to rewrite the VDC/VCE. I will be trying to run both the PSG and VDC in parallel with the CPU which maybe slow but will be more accurate.

I was looking at some CD-ROM stuff as well and I found this place with many, if not all, PCE docs at one place. So this maybe convenient for people trying to write PCE emu.

Exophase, you told me that you'll give the recording of Hani in the Sky but you never did. Can you please give it to me now?

stay safe,

AamirM

I'll give it to you if you find me on IRC. Exophase on efnet. Personally, I think that "cycle accurate PSG" is nonsense, since it's a write only device with no feedback to the CPU and the user will never hear the difference. It's your emulator, though.

Unfortunately, those CD documents only describe how to program the syscard, ie from a game writer's point of view. In order to emulate it at a low level (and you will have to, because some games don't use the syscard) you have to emulate the SCSI interface.
 

AamirM

New member
Hi,
Exophase said:
I'll give it to you if you find me on IRC. Exophase on efnet. Personally, I think that "cycle accurate PSG" is nonsense, since it's a write only device with no feedback to the CPU and the user will never hear the difference. It's your emulator, though.
I didn't say "cycle accurate PSG". If you read carefully I wrote "PSG generates samples cycle accurately" which is a different thing. And if you didn't knew, it does make a difference. You can compare yourself when I'll release it. Sound is much more cleaner.
Exophase said:
Unfortunately, those CD documents only describe how to program the syscard, ie from a game writer's point of view. In order to emulate it at a low level (and you will have to, because some games don't use the syscard) you have to emulate the SCSI interface.
I know. I just stumbled at this place which has all the docs at one place.

Sorry for my lack of experience with IRC but how do I "find" you on IRC? :)

stay safe,

AamirM
 

AamirM

New member
Hi,

Nearly finished the new VDC renderer and timing system today. I've been working on it pretty much the whole day today and I started last night. Now I am very happy with it :) . Everything is now implmented. Pretty much all the glitches are now gone (as far as I tested). But a few games got broken which I still have to fix. Next thing on the list is SuperGraFX. Doesn't look too hard.

One thing I was wondering, are there any delays when interrupts happen? For example when vblank status goes high and its interrupt actually happens?

stay safe,

AamirM
 

AamirM

New member
Hi,

Finished SuperGraFX emulation as well. Every game except Daimakaimura works perfectly :) . I haven't looked as to whats the problem with Daimakaimura is, though I think it isn't timing related.

The emulator is now as slow as hell.

EDIT:
Solved the Daimakaimura issue. Turns out that the game uses ST0-2 instructions which weren't writing correctly to the selected VDC :) . Now all SuperGraFX games run correctly :) .

stay safe,

AamirM
 
Last edited:

AamirM

New member
Hi,

Added new GUI today and added loads of stuff today. If I don't feel lazy, I would probably be releasing this tommorrow. Here is a screenshot of the new emulator (yes, I said "new" because about 90% of it has been rewritten) running Supergrafx game Daimakaimura:



stay safe,

AamirM
 

AamirM

New member
Hi,

No, not really. Though, I am estimating that one will need at least 1.8-2 GHz P4 to run it without any problems. I haven't optimized anything yet. I'll optimize later on. That is, when I get people bitching about its speed ;) .

stay safe,

AamirM
 

Cyberman

Moderator
Moderator
I could be a smart ... anyhow what is your guess as to why it's slow as Hades trying to become Antarctica?
My guess is it's relates to emulating the hardware (well duh) have you profiled execution yet?

Cyb
 

AamirM

New member
Hi,

Well lets see how this new Turbo Engine works then, I guess, people will understand why its slow.

The main CPU, H6280, is ran cycle-by-cycle all the time. Note that most games use it in high speed mode (7.16MHz) so running a CPU cyclically at that much speed is already very slow. Then, whenever a write to VDC occurs, the VDC is advanced until it catches up to the CPU. A line will only be rendered, when VDC has been advanced by a line. Renderer, currently, doesn't do any tile caching (I want simplicity right now). The PSG runs in same way. But it is being run at 352800 Hz and being resampled to 44100hz using blargg's awesome high quality polyphase FIR filter with impulse width of 32. And if you're emulating Supergrafx, add in another VDC running like that. So all in all, its slow and its expected.

This doesn't mean I am not going to optimize it. The obvious place first is to add caching support to the renderer. I also have another idea to speed up the VDC. Instead of running VDC whenever a write occurs, I can just timestamp the writes and only apply relevant writes while renderering.

stay safe,

AamirM
 

Cyberman

Moderator
Moderator
Without spending some time analyzing the architectural I am uncertain of how much one can improve the H6280 and VDC coupling. Most emulators dynamically adjust the number of CPU cycles it executes in the DR or interpretor then lets the rest of the system catch up (where asynchronise operation is OK of course :D ).

I don't know enough about the instruction set of the 65C02 variant of the H6280 to really come up with a decent dynamic recompiling scheme for fast coupling between the VDC and the H6280. Yes it would be over kill, maybe, depends I've played with color computer 3 emulation with some rather amusing results (in speed).

Cyb
 
OP
E

Exophase

Emulator Developer
Doing a dynarec for PC-Engine is far from necessary to get it working well on much slower PCs than what AamirM is speccing. A decently done interpreter and video renderer should run fine at one tenth the CPU power of 1.8 to 2GHz. Nonetheless, I've thought about recompiling Hu6280 anyway (sort of for fun), and if you're really interested I can give you my notes on it. But I don't really see why anyone would be, and keeping high "cycle accuracy" with a recompiler is much more painful.

I am curious as to what you mean by "cycle by cycle" - it seems to imply that emulation is done at precision that's higher than one instruction at a time. But with the way you're describing the emulation of VDC and PSG there are no state changes that can happen inbetween instructions. Technically state changes can happen inbetween instructions, but the only feedback that can happen must be done at instruction edges. Likewise, CPU internal state only changes mid-instruction.

It's also unclear if you're referring to CPU cycles or master cycles. But since you mentioned the "fast" clock as being relevant then I'll assume you mean CPU cycles.

Of course, I'm entirely unconvinced that the PSG emulation needs to be done in the way you're doing it. Yes, it might sound better than how you were doing it before, but that doesn't mean that it will sound better than other methods done at native sample rates. Compare it with Mednafen for reference (the author of Mednafen is pretty serious about getting sound done right)
 

AamirM

New member
Hi,

Okay, I am not gonna be free for some time so I decided to release it today. There are a few stuff I wanted to add but I am not going to have the time. Download from here. Had to upload to this because I can't access my site :( . I'll reply to the posts above when I get some time to read it :) .

stay safe,

AamirM
 

Mednafen

New member
For PC Engine PSG emulation, Mednafen originally generated samples at 3.58MHz, averaged even/odd samples together to get 1.79MHz, and resampled that to the output playback rate using a large FIR resampler and...libsamplerate, I think.
Even though I did optimize it, I could never get it running at an acceptable speed on older computers. My newer FIR resampler I've written for 0.9.0(which will probably be released after the socialist revolution following the complete global economic collapse next October. ;)) would probably fair a bit better, as it can make use of SIMD instructions, though it's hard on the CPU cache/memory bandwidth.

Now Mednafen just uses Blip_Buffer, effectively resampling each channel from its playback rate to the output rate, and putting a cap on how high the playback frequency can go(and in that case, just outputting an average of the waveform buffer, which is kind of bugged, but doesn't cause major problems with any games AFAIK, only my crazy demos).

You may have to emulate it at 3.58MHz, 7.16MHz, or perhaps even 21.477MHz, if you want to be totally completely accurate; some tests I had a friend run on his PC Engine/SuperGrafx/CoreGrafx(can't remember) produced some very peculiar results that led me to believe the HuC6280 is creating different volume levels through high-frequency PWM, though I haven't confirmed it with an oscilloscope or anything. Of course, you don't need to emulate that to get games running acceptably...


Does the new TurboEngine handle the "SPEED-UP" password in Youkai Douchuuki correctly?
 

iddqd

New member
AamirM, please upload an example cheat file (in .dat format).:unsure: And whether you will add built-in cheat finder like ArtMoney?
 
Last edited:

Top