Looking for DC optimization experts to help on emu port
-
- DCEmu Cool Newbie
- Posts: 16
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Sat Mar 02, 2013 7:47 pm
- Has thanked: 0
- Been thanked: 0
Re: Looking for DC optimization experts to help on emu port
Great stuff, thanks for that! Yes, some video modes on the PC are interleaved. CGA graphics modes are, as well as EGA and some VGA modes. That's a really clever little hack with the packed pixel modes though. Good idea there.
I also got a small bost by using RGB565 for the video output. It also boosts 256-color emulation speeds just slightly because the MCGA/VGA 8-bit palette mode actual color values are stored in the VGA DAC as 5-bit values. I don't have to bitshift red and blue at all anymore.
I also got a small bost by using RGB565 for the video output. It also boosts 256-color emulation speeds just slightly because the MCGA/VGA 8-bit palette mode actual color values are stored in the VGA DAC as 5-bit values. I don't have to bitshift red and blue at all anymore.
-
- DCEmu Cool Newbie
- Posts: 16
- Joined: Sat Mar 02, 2013 7:47 pm
- Has thanked: 0
- Been thanked: 0
Re: Looking for DC optimization experts to help on emu port
I've been working on this more, and I'd like to share what I've got so far. Here's a self-boot CDI image that comes with a 50 MB MS-DOS disk image with a selection of very, very old games and apps (nothing from after 1991 or so).
http://rubbermallet.org/fake86-0.13.3.15-dreamcast.rar
It requires that you have a DC keyboard. There are some annoying bugs in my virtual keyboard stuff so I just decided to disable that for this demo version. It also uses the regular DC controller for mouse emulation. Use the analog stick to move a mouse cursor, and button A = left click, B = right click.
Still no sound, and it's still pretty slow. It's about on par with a turbo 8088 system. I did add code to generate the sound, but there's just not enough horsepower in that SH4 to do everything at the same time so it couldn't fill the sample buffer quick enough.
What I really want to do is completely get rid of CPU-wasting polls of the KOS microsecond timer which I'm using now for handling timing, and move over to an IRQ-based callback from TMU1 at high speeds but I couldn't really figure out how to do that properly after spending at least an hour looking through the KOS documentation and code. What's the best way to set something like that up?
That should provide a drastic speed increase, and I'm also planning on setting up an instruction flow cache system. Like as in generating lists of function pointers for each opcode every time it runs into a new chunk of code to emulate, so that the next time that chunk is run it doesn't have to parse all the bytecode anymore as long as it hasn't been changed. With any luck I could get this thing to crank out high-end 286 performance using this method. At least, I hope.
Anyway, some of the games on this demo CD still run a bit too slow to enjoy. The older ones tend to work at full speed. I'd love comments and suggestions on this! Have fun.
Important notes:
- I've run into a few odd situations where the ctrl and alt keys didn't seem to register every time. It usually worked, but if you run into that problem... F11 is an alias for ctrl, F12 for alt.
- If a game you try to run asks you which video card is in the system, NEVER answer EGA! It's not supported yet. You can safely use CGA, Hercules, and MCGA video modes.
http://rubbermallet.org/fake86-0.13.3.15-dreamcast.rar
It requires that you have a DC keyboard. There are some annoying bugs in my virtual keyboard stuff so I just decided to disable that for this demo version. It also uses the regular DC controller for mouse emulation. Use the analog stick to move a mouse cursor, and button A = left click, B = right click.
Still no sound, and it's still pretty slow. It's about on par with a turbo 8088 system. I did add code to generate the sound, but there's just not enough horsepower in that SH4 to do everything at the same time so it couldn't fill the sample buffer quick enough.
What I really want to do is completely get rid of CPU-wasting polls of the KOS microsecond timer which I'm using now for handling timing, and move over to an IRQ-based callback from TMU1 at high speeds but I couldn't really figure out how to do that properly after spending at least an hour looking through the KOS documentation and code. What's the best way to set something like that up?
That should provide a drastic speed increase, and I'm also planning on setting up an instruction flow cache system. Like as in generating lists of function pointers for each opcode every time it runs into a new chunk of code to emulate, so that the next time that chunk is run it doesn't have to parse all the bytecode anymore as long as it hasn't been changed. With any luck I could get this thing to crank out high-end 286 performance using this method. At least, I hope.
Anyway, some of the games on this demo CD still run a bit too slow to enjoy. The older ones tend to work at full speed. I'd love comments and suggestions on this! Have fun.
Important notes:
- I've run into a few odd situations where the ctrl and alt keys didn't seem to register every time. It usually worked, but if you run into that problem... F11 is an alias for ctrl, F12 for alt.
- If a game you try to run asks you which video card is in the system, NEVER answer EGA! It's not supported yet. You can safely use CGA, Hercules, and MCGA video modes.
- BlueCrab
- The Crabby Overlord
- Posts: 5662
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Looking for DC optimization experts to help on emu port
About the simplest TMU1 code ever:
Where irq_handler is prototyped as follows:
And tps is the number of ticks you want per second.
Code: Select all
irq_set_handler(EXC_TMU1_TUNI1, irq_handler);
timer_prime(TMU1, tps, 1);
timer_clear(TMU1);
timer_start(TMU1);
Code: Select all
static void irq_handler(irq_t source, irq_context_t *context);
-
- DCEmu Cool Newbie
- Posts: 16
- Joined: Sat Mar 02, 2013 7:47 pm
- Has thanked: 0
- Been thanked: 0
Re: Looking for DC optimization experts to help on emu port
Awesome, thanks. I did see those timer functions in the docs but I was confused on what I would need to do with "irq_t source, irq_context_t *context" input arguments. I guess nothing in my case, right? Anyway, I added that and got rid of the timer polling. It makes a much smaller difference that I thought it would, but it's noticeable. I guess I really just need to work on optimizing the CPU core itself. I updated the download link in my last post to a new build with the timer callbacks.BlueCrab wrote:About the simplest TMU1 code ever:Where irq_handler is prototyped as follows:Code: Select all
irq_set_handler(EXC_TMU1_TUNI1, irq_handler); timer_prime(TMU1, tps, 1); timer_clear(TMU1); timer_start(TMU1);
And tps is the number of ticks you want per second.Code: Select all
static void irq_handler(irq_t source, irq_context_t *context);
- BlueCrab
- The Crabby Overlord
- Posts: 5662
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Looking for DC optimization experts to help on emu port
Pretty much. The first argument just tells you why you're getting the interrupt (in case you have multiple things going into the same function). The second one is the state of the registers when the interrupt happened.miker00lz wrote:Awesome, thanks. I did see those timer functions in the docs but I was confused on what I would need to do with "irq_t source, irq_context_t *context" input arguments. I guess nothing in my case, right?
-
- DCEmu Cool Newbie
- Posts: 13
- Joined: Sat Mar 16, 2013 2:28 pm
- Has thanked: 2 times
- Been thanked: 3 times
Re: Looking for DC optimization experts to help on emu port
To TapamN
thanks
helped me to support indexed 8bpp.
to miker00lz
I ported PC-9801 emulator to Dreamcast before .
http://neko.sourceforge.net
I had released new update.
it is running at decent speed (6Mhz - 9Mhz).
but frame rate is 10 - 12.
thanks
helped me to support indexed 8bpp.
to miker00lz
I ported PC-9801 emulator to Dreamcast before .
http://neko.sourceforge.net
I had released new update.
it is running at decent speed (6Mhz - 9Mhz).
but frame rate is 10 - 12.
- SiZiOUS
- DC Developer
- Posts: 404
- Joined: Fri Mar 05, 2004 2:22 pm
- Location: France
- Has thanked: 27 times
- Been thanked: 19 times
- Contact:
Re: Looking for DC optimization experts to help on emu port
miker00lz, I tested your emulator today on the real hardware, it's pretty slow but sounds good!
I made two videos on Youtube, here and here.
I made two videos on Youtube, here and here.
- Bouz
- DCEmu Junior
- Posts: 46
- Joined: Mon May 10, 2010 3:42 pm
- Location: St. Bauzille de Putois (France)
- Has thanked: 0
- Been thanked: 0
Re: Looking for DC optimization experts to help on emu port
Thanks for this, Sizious. Impressive how you manage to type on your keyboard and point the camera to the screen at the same time!
Really cool to see Windows run on a DC. One or to more optimizations and miker00lz will run Windows Vista!
Really cool to see Windows run on a DC. One or to more optimizations and miker00lz will run Windows Vista!
- SiZiOUS
- DC Developer
- Posts: 404
- Joined: Fri Mar 05, 2004 2:22 pm
- Location: France
- Has thanked: 27 times
- Been thanked: 19 times
- Contact:
Re: Looking for DC optimization experts to help on emu port
Yeah, I know, my vids suc*s, it's just for showing some applications running with Fake86
- RyoDC
- Mental DCEmu
- Posts: 366
- Joined: Wed Mar 30, 2011 12:13 pm
- Has thanked: 2 times
- Been thanked: 0
Re: Looking for DC optimization experts to help on emu port
i enjoyed mad gansta music on the back
How do I try to build a Dreamcast toolchain:
- SiZiOUS
- DC Developer
- Posts: 404
- Joined: Fri Mar 05, 2004 2:22 pm
- Location: France
- Has thanked: 27 times
- Been thanked: 19 times
- Contact:
Re: Looking for DC optimization experts to help on emu port
Oh, I forgot to remove the audio from one video...
I was listening to the new Tyga
I was listening to the new Tyga
- Anthony817
- Insane DCEmu
- Posts: 132
- Joined: Wed Mar 10, 2010 1:29 am
- Location: Fort Worth, Texas
- Has thanked: 12 times
- Been thanked: 4 times
Re: Looking for DC optimization experts to help on emu port
Hi. I wanted to ask if you were still working on this or had any updates to it? I can't believe I haven't found this sooner. Really awesome to see windows running on the DC!