nesdev.com
http://forums.nesdev.com/

Emulator in an (not-so) old PC
http://forums.nesdev.com/viewtopic.php?f=5&t=15808
Page 1 of 1

Author:  Zepper [ Sun Apr 16, 2017 8:20 am ]
Post subject:  Emulator in an (not-so) old PC

I tried RockNES in an old PC, a Pentium 4 with SiS chipset (video/audio). I don't remember the board/system date, but lacks support for widescreen, and even on Windows 7, drivers are not "easily" located through Windows Update - in fact, most of them must be "hunted" Google-ing with a huge luck to find. ^_^;; Anyway, it's another thing.

The emulator works, but only in windowed mode and 1x (original size), with a frame rate around 50Hz. Fullscreen has problems - the program window is still visible in the screen edges, and no game image. Of course, this might be related to the gcc compilation flags, CPU optimizations and so on.

Well, anything specific to compile it with gcc, or just a bit of lucky, and lots of try-and-error builds? ;)

Author:  calima [ Sun Apr 16, 2017 11:40 am ]
Post subject:  Re: Emulator in an (not-so) old PC

Sis is terrible, invest 5$ in a PCI or AGP GPU from a decent vendor.

Author:  Dwedit [ Sun Apr 16, 2017 11:55 am ]
Post subject:  Re: Emulator in an (not-so) old PC

LoopyNES can run in the most ancient of ancient (early pentium or later) PCs, and that's with standard VGA. It's all about the software that's actually running that matters.

Author:  Zepper [ Sun Apr 16, 2017 7:59 pm ]
Post subject:  Re: Emulator in an (not-so) old PC

Dwedit wrote:
LoopyNES can run in the most ancient of ancient (early pentium or later) PCs, and that's with standard VGA. It's all about the software that's actually running that matters.

With a major detail - it was written 100% in ASM. No external modules, no sh*t. Pure ASM.

The Pentium 4 PC is a second PC I own. It's the first time I run my emulator in old hardware, and I want to improve it a bit.

Author:  Dwedit [ Sun Apr 16, 2017 9:09 pm ]
Post subject:  Re: Emulator in an (not-so) old PC

Anyway, I'd be using a small hardware surface for video (256x240), blitting to there, then stretching the hardware surface to the window. On many video cards, that automatically interpolates too.
This can be done with DirectDraw, Direct3D9, or OpenGL.
That would probably take care of any performance bottlenecks on a larger screen size.

Hardest part about learning the graphics APIs is finding good boilerplate code that sets stuff up and gets things ready to go. After that, it's not that hard (make the calls to lock the surface, blit there, unlock the surface, blit to the screen, etc...)

Author:  Zepper [ Mon Apr 17, 2017 4:47 pm ]
Post subject:  Re: Emulator in an (not-so) old PC

Well, Allegro has an option -stretch_blit_to_hdc — Blits an Allegro memory bitmap to a Windows device context.

At anyway, I'd like to know gcc flags for Pentium 4, and others too... for optimizations. Currently, I've found that i586/686 makes the emulator compatible, but slow. With a "native" flag, the speed is better.

Author:  calima [ Tue Apr 18, 2017 1:26 am ]
Post subject:  Re: Emulator in an (not-so) old PC

-march=pentium4. See the gcc manual for other options.

P4 is an oddball thing where it differs from other generations so much that arch optimization really matters.

Author:  Zepper [ Tue Apr 18, 2017 4:09 pm ]
Post subject:  Re: Emulator in an (not-so) old PC

calima wrote:
-march=pentium4. See the gcc manual for other options.

P4 is an oddball thing where it differs from other generations so much that arch optimization really matters.

Are you sure P4 only? I noticed a major difference with i586 and native options while compiling & running in my Core i5 2nd gen.

Author:  Dwedit [ Tue Apr 18, 2017 4:48 pm ]
Post subject:  Re: Emulator in an (not-so) old PC

Pentium 4 has very large pipelines, and is extremely sensitive to cache misses and other pipeline stalls.
They pretty much canned that generation and went back a step, building their next architectures after the Pentium III instead.

Author:  Dwedit [ Tue Apr 18, 2017 4:51 pm ]
Post subject:  Re: Emulator in an (not-so) old PC

Zepper wrote:
Well, Allegro has an option -stretch_blit_to_hdc — Blits an Allegro memory bitmap to a Windows device context.

You don't want this one. The source surface is in system RAM, and the destination surface is a device context, either the primary surface (VRAM) or a DIB section (system RAM). You want both source and destination to be in VRAM.

Author:  calima [ Wed Apr 19, 2017 1:36 am ]
Post subject:  Re: Emulator in an (not-so) old PC

Naturally any processor benefits from tuned optimizations. It's just larger for some.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/