It is currently Fri Dec 15, 2017 3:24 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Thu Dec 29, 2011 8:37 pm 
Offline
User avatar

Joined: Thu Sep 23, 2010 7:28 pm
Posts: 232
i've been thinking about doing a secondary emulator for DOS as kind of a side project to my main one. i am wondering just how fast one could get. do you think it's possible to get much faster than NESticle? i was going to do it in 100% assembly, i'm working on the 6502 code right now.

any tips? i'm not aiming for accuracy, just pure speed. as long as it could play a fair amount of games properly, i'd be happy. i've got an old 25 MHz 486 laptop, think it's feasible to aim for full speed on that?

the PPU, of course, is going to be the tricky part. one thought i had was keep the whole 512x480 background rendered in memory (just the lower two bits of the pixel, since lots of games change attributes for background animation), only making small incremental changes when nametable blocks are changed. then i can just copy ready-to-go memory blocks for each scanline from the proper parts of the background, OR in the attribute bits, and write it to the PC's video RAM.

do you think the goal of full speed on 25 MHz is impossible?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 29, 2011 8:47 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19346
Location: NE Indiana, USA (NTSC)
Don't get too optimistic. PocketNES squeaks by on a 16.8 MHz ARM, but then it high-level emulates the NES PPU using the GBA PPU.

If you're caching the 512x480 pixel plane, the mid-screen bankswitching of Hatris in-game, Qix in-game, and Smash TV's title screen is going to be painful, and the bankswitching every few scanlines in Cosmic Epsilon even more so.

If you really want to sacrifice accuracy, you could port individual games to PC, as someone ported the disassembly of the original Super Mario Bros. to Sega Genesis instruction by instruction, and then call them game-specific emulators. Id Software's attempt at doing this to Super Mario Bros. led directly to the Commander Keen series.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 29, 2011 9:27 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3968
Isn't Loopynes comparable in performance to Nesticle, and a whole lot better?
Right now, I think Famtasia might be the fastest Windows-compatible emulator.

Anyway... back to the topic.

In order to make a really fast NES emulator for an old DOS machine, some random thoughts:
* Use Mode X. Mode X lets you use bit planes.
* Possibly use VGA hardware scrolling and dirty rectangles? That would be tricky to pull off, would it work?
* Use speedhacks to skip emulating some of the CPU.

Maybe tricks like these would work on a J2ME or Javascript NES emulator. Not the Mode X one, but blit scrolling, dirty rectangles, and speedhacks.

I don't think id ever disassembled Super Mario Bros, it was just their experiments on playing with the EGA scrolling registers.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 29, 2011 9:50 pm 
Offline
User avatar

Joined: Thu Sep 23, 2010 7:28 pm
Posts: 232
tepples wrote:
Don't get too optimistic. PocketNES squeaks by on a 16.8 MHz ARM, but then it high-level emulates the NES PPU using the GBA PPU.

If you're caching the 512x480 pixel plane, the mid-screen bankswitching of Hatris in-game, Qix in-game, and Smash TV's title screen is going to be painful, and the bankswitching every few scanlines in Cosmic Epsilon even more so.

If you really want to sacrifice accuracy, you could port individual games to PC, as someone ported the disassembly of the original Super Mario Bros. to Sega Genesis instruction by instruction, and then call them game-specific emulators. Id Software's attempt at doing this to Super Mario Bros. led directly to the Commander Keen series.


i have discussed porting that SMB code to the PC with a friend of mine several times, one of these days we were going to give it a shot actually. i bet that could run full speed on a 286 or even an 8088 if done carefully.

you've got a good point about games that bankswitch, that probably wouldn't work out to well then.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 29, 2011 9:54 pm 
Offline
User avatar

Joined: Thu Sep 23, 2010 7:28 pm
Posts: 232
Dwedit wrote:
Isn't Loopynes comparable in performance to Nesticle, and a whole lot better?
Right now, I think Famtasia might be the fastest Windows-compatible emulator.

Anyway... back to the topic.

In order to make a really fast NES emulator for an old DOS machine, some random thoughts:
* Use Mode X. Mode X lets you use bit planes.
* Possibly use VGA hardware scrolling and dirty rectangles? That would be tricky to pull off, would it work?
* Use speedhacks to skip emulating some of the CPU.

Maybe tricks like these would work on a J2ME or Javascript NES emulator. Not the Mode X one, but blit scrolling, dirty rectangles, and speedhacks.

I don't think id ever disassembled Super Mario Bros, it was just their experiments on playing with the EGA scrolling registers.


mode x is a great idea. i've never heard of dirty rectangles, but i don't think VGA hardware scrolling would handle all of the work. vertical scrolling could be done, but not horizontal -- that would still have to be done by software. there is a VGA register that can be used to specify the starting address of (0,0) in video RAM.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 29, 2011 10:17 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3968
This page says that VGA can do smooth horizontal scrolling.

Also, Pinball Fantasies did split screen hardware scrolling on VGA. (it also had a mod player that spat out 4-channel music through the PC speaker, amazing stuff)

I once tried NO$GMB on a 286 with CGA. It was pretty slow, it ran at about 8 FPS when running Sqrxz.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 30, 2011 1:12 am 
Offline
User avatar

Joined: Thu Sep 23, 2010 7:28 pm
Posts: 232
Dwedit wrote:
This page says that VGA can do smooth horizontal scrolling.

Also, Pinball Fantasies did split screen hardware scrolling on VGA. (it also had a mod player that spat out 4-channel music through the PC speaker, amazing stuff)

I once tried NO$GMB on a 286 with CGA. It was pretty slow, it ran at about 8 FPS when running Sqrxz.


huh, i wasn't aware it supported horizontal too. that might be useful. the complicating factor is that sprites have to be drawn too, without being affected by the scroll. too bad it doesn't have hardware support for multiple layers and transparency.

well, on a side note, i guess i need to add horizontal scrolling support to my VGA emu code in my PC emulator. i haven't seemed to run into any programs that tried to use that capability yet.

i recall using NO$GMB a long time ago on a 286 also, just to see how it ran. yeah it was pretty bad. maybe i'll give it a try on my XT just for fun. 4.77 furious megahertz. :P


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 30, 2011 12:38 pm 
Offline
User avatar

Joined: Wed Dec 06, 2006 8:18 pm
Posts: 2806
I programmed a second NES emulator to try to achieve reasonable performance on my Pentium 233mhz laptop. I wasn't doing any assembly programming though. It was still all C++ but I optimized graphics rendering and emulation enough to get 60fps performance out of it even with Blargg's APU emulation for sound.

I'm not sure if you could out perform Nesticle. I have a feeling it's heavily optimized for speed given its age and reputation. I never used LoopyNES much but it also was quite fast and I recall didn't have problems with various games like Ninja Gaiden 3 which Nesticle has issues with scrolling.

As GBA was mentioned, I wonder if the Sharp X68000 could emulate NES fairly well since I believe it has console graphics capability but can have a 68000 cpu clocked reasonably high with plenty of memory. Not having to do software graphics emulation certainly helps reduce resources needed.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 30, 2011 1:22 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 2:13 pm
Posts: 1667
Location: .ma.us
A SNES w/ SA-1 could probably emulate the NES pretty well, but I doubt at full speed.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 30, 2011 4:25 pm 
Offline
User avatar

Joined: Fri Oct 14, 2011 1:09 am
Posts: 248
JIT techniques could help a great deal with the CPU speed, but the PPU is a difficult problem to tackle, especially if you are aiming any kind of honorable level of accuracy.

VGA can do smooth 4-way scrolling, but the addresses only wrap at segment boundary if I recall correctly, meaning that if you scroll the screen 20 pixels to the left, what you get in the right edge of the screen is the 20 pixels of 1 scanline below. I may be mistaken at this, though.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group