Page 1 of 1

Status of Assembly?

Posted: Wed 20 Dec, 2017 12:48 am
by Danfun64
I'm curious as to how much assembly code is left in PCem, especially how much is necessary to even run this software. Mainly because I was hoping you could replace it all so it can run on other architectures like ARM. Can any of you say how much assembly remains in PCem?

Re: Status of Assembly?

Posted: Wed 20 Dec, 2017 1:45 am
by leilei
It's only in the recompilers. The immediate issue is only really in that references to the recompilers are still there after disabling them, so interpreter-only builds aren't possible for the time being (but could be with a bunch more ifdefs)

Also if it's the Pi you're thinking of, don't expect much optimism on a platform whose popular operating system had recently regressed its video driver and can't run glxgears past 30fps anymore, and an ARM recompiler would be necessary to make that work well anyway, along with a EGL or OMX backend to get around the VC4 driver's GL incapabilities. Be aware that the popular console emulators on Pi (which make up its secondhand marketing for gamer appeal) were already optimized years prior for the GP2X and other ARM devices.

Not a fan of the general "replace/remove all assembly" mindset of the GNU world especially when it comes to emulators. Gutting the recompilers for their ideal "clean and portable" codebase under the pressure of a vocal minority would make it another Bochs. That's what this thread seems to come across as for me anyway

See also: this thread

Re: Status of Assembly?

Posted: Wed 20 Dec, 2017 3:24 am
by Chilly Willy
Removing ASM code from any app would be a horrible idea. ASM helps a lot with performance. If one wants to compile on multiple operating system, then check for the OS version used at compile time. You can write code for multiple operating systems and only compile the code that is needed by doing a simple OS check in your code. You can even have an OS check for different operating systems to use the code that is supported by that OS. Works very good for keeping support on older operating systems. Anyways, never remove ASM code. It's the base/foundation for all programming languages. ;)

Re: Status of Assembly?

Posted: Wed 20 Dec, 2017 3:41 am
by omarsis81
You might find some answers here viewtopic.php?f=3&t=495

Re: Status of Assembly?

Posted: Wed 20 Dec, 2017 3:59 am
by Danfun64
Well, I imagine that the assembly code could be kept as long as it was completely optional/not necessary to run the program period...

Hypothetically speaking of course...

edit: I already saw that thread, and ironically the OP was advocating for more assembly. Also there wasn't any indication that it would have been made optional.

Re: Status of Assembly?

Posted: Wed 20 Dec, 2017 9:21 am
by SarahWalker
You could probably hack the emulator to remove any references to any of the recompilers, which _might_ get it running on ARM (assuming there aren't any other issues there). Performance would be absolutely dreadful though.

One of my aims with the new recompiler is to make is easier to port to other architectures, and an ARM port is definitely on my list. You're unlikely to see anything of this until towards the end of next year I'm afraid.

Re: Status of Assembly?

Posted: Wed 20 Dec, 2017 6:25 pm
by A. Naim
I like the general idea of WebASM, but think it's too tied to the ideas and needs of webpages.

If there was some sort of generic, retargetable ASM that could be optimized per-platform that was aimed at speed first... But I don't know enough about ASM to say how feasible it is.

Certainly, it would be feasible for some purposes.

Re: Status of Assembly?

Posted: Thu 21 Dec, 2017 10:04 am
by SarahWalker
Not feasible for PCem's purposes I'm afraid. PCem needs to generate object code directly for the host CPU on the fly for performance reasons.

Re: Status of Assembly?

Posted: Thu 21 Dec, 2017 7:59 pm
by A. Naim
SarahWalker wrote:Not feasible for PCem's purposes I'm afraid. PCem needs to generate object code directly for the host CPU on the fly for performance reasons.
Good to know.