Emulator in an (not-so) old PC

You can talk about almost anything that you want to on this board.

Moderator: Moderators

Post Reply
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Emulator in an (not-so) old PC

Post by Zepper »

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? ;)
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: Emulator in an (not-so) old PC

Post by calima »

Sis is terrible, invest 5$ in a PCI or AGP GPU from a decent vendor.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Emulator in an (not-so) old PC

Post by Dwedit »

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.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Emulator in an (not-so) old PC

Post by Zepper »

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.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Emulator in an (not-so) old PC

Post by Dwedit »

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...)
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Emulator in an (not-so) old PC

Post by Zepper »

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.
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: Emulator in an (not-so) old PC

Post by calima »

-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.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Emulator in an (not-so) old PC

Post by Zepper »

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.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Emulator in an (not-so) old PC

Post by Dwedit »

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.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Emulator in an (not-so) old PC

Post by Dwedit »

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.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: Emulator in an (not-so) old PC

Post by calima »

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