flat assembler
Message board for the users of flat assembler.

Index > Programming Language Design > Machine / ISA independent macro assembler language

Author
Thread Post new topic Reply to topic
al_Fazline



Joined: 24 Oct 2018
Posts: 54
al_Fazline 26 Oct 2018, 11:34
The biggest problem in programming user-mode applications in assembly is that you usually write a program for just one ISA, and then it's bound to that ISA, such as FASM v1 is bound to ia32 and even switching from ia32 to x86_64, is still a big question. Also, even though there is FASM for DOS, it does not work on XT class DOS machines, since it is relying on i386-only instructions.

So, I am wondering, if it's feasible to overcome this limitation, using a sufficiently powerful macro assembler, such as fasmg, in such a way that everything that makes the program depend on particular instruction set (i386, amd64, arm, mips) is contained entirely in a separate module, and program itself is contained in a different module.

This way, if something like fasmg is written in fasmg itself, in such a way, it should became portable to any machine without changing anything in the source, except switching to a different ISA module. And that ISA macro-set, written once, becomes universally useful for all programs.

My idea is not same as implemented in fasmg, I know it's written with portability in mind, but it still uses x86 instruction set directly in the code. My idea is that in main program you only use a limited set of macros from ISA module, so that you can switch the ISA module and get the same program but on different CPU and/or OS.

Perhaps this idea was already discussed in this forum, even numerous times but I don't know what to search for to find it.

Also, I wonder if fasmg is only one of a kind or there are other powerful abstract macro engines of this kind.
Post 26 Oct 2018, 11:34
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 27 Oct 2018, 07:45
Well, that’s exactly what is done in many HLLs: having platform-dependent code as a separate entity that is linked to a program. Say, if you use only routines from the standard library of a HLL you get a piece of code that can be compiled for any platform that has a compiler for the language.

If you’re talking about achieving the goal without rebuilding the program at all (not only without changing its source code) then… well, technically, that’s what .NET, Java and stuff like that tries to achieve by using high-level bytecode that is universal across all the platforms and gets translated to a platform-dependent code as late as possible. But the problem here is that even if the format of the executable file is supported on all platforms you still have to install a separate (pretty large) package on the users’ machines that will perform the conversion from the bytecode to the actual machine codes. So, it is basically something between the source code and the machine code but has the disadvantages of both.
Post 27 Oct 2018, 07:45
View user's profile Send private message Visit poster's website Reply with quote
al_Fazline



Joined: 24 Oct 2018
Posts: 54
al_Fazline 27 Oct 2018, 10:17
I know that regular HLL like C do something similar, but here I'm specifically asking about implementing it as part of some macro-assembler.

If it's fasm, that as you can see you can achieve SSSO, easily. It's very hard to compile some more or less complex source into a binary getting byte-by-byte identical result on different machines. That's a separate problem of its own and it's solved in some environments, but it's far from being as straightforward as FASM.

So my question is regarding specifically macro-assemblers not just any HLLs
Post 27 Oct 2018, 10:17
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.