Recompiling assembly language to C

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

Moderator: Moderators

Posts: 20
Joined: Wed Mar 06, 2019 6:00 pm

Re: Recompiling assembly language to C

Post by coto » Wed Mar 06, 2019 7:11 pm

Problem is compiler ABIs. The ABIs optimize the target processor hardware so the code fits that model. Added optimization which mostly end up as jump tables and symbols that may or be used as static placeholders for a given bit range. A decompiler that actually maps data relatively accurate such as IDA seems to be the best way for me to quickly analyze and modify code which will actually work.

I use C because that is "portable assembler". Also C++ takes quite the toll on embedded devices such as the NintendoDS since it goes through a vtable through Name mangled functions that will actually resemble an ABI. That way you are allowed to overload functions or overload operators, or be able to handle the object through C++ standard ABI rather than hardcoding something that isn't portable. For instance the ARM ABI offers a debugging-stack library that allows for hardware exceptions to be caught in a try{} catch{} block. While it doesn't get the speed and bare-metal logic the code has, it actually allows to debug your code from withing your code if something fails. (nothing like supervisor mode of a hardware exception mode can't do, but you get a "map" of your objects rather than just bits that do god knows what (if say, the cpu just corrupted stack data or something like that)

I think someone should just apply a reverse-model the way the hardware vendor API compiler generates assembled code, to actually generate readable code. Problem is optimization removes further sensitive data the HLL has.
Last edited by coto on Sun Mar 10, 2019 9:37 am, edited 1 time in total.

Posts: 111
Joined: Tue Oct 16, 2018 5:46 am
Location: Gothenburg, Sweden

Re: Recompiling assembly language to C

Post by pwnskar » Fri Mar 08, 2019 10:53 am

tepples wrote:Just speculating, but another advantage of transpiling assembly language to HLL is that it might help get a proposal for a port of a retro game to a modern console past the console maker's concept approval department. I haven't seen a modern console's devkit or NDA myself, but I imagine some console makers have become more skittish about using an emulator so as not to leave open the possibility of anything like ROM injection on Nintendo's Virtual Console and Popstation on PSP.
I think emulation is already heavily used on consoles for things like digital releases of classic retro games, so that shouldn't be an issue.

This topic might be a bit too advanced for me but it sound like what you are suggesting would be better for when you actually want to add platform specific features or content rather than just having a carbon copy port as if you're playing on an emulator. Or if you want to port the code to a platform that's on an equal level horse power as the source platform.

Post Reply