flat assembler
Message board for the users of flat assembler.
Index
> Main > How a multiplatform code works? |
Author |
|
edfed 27 Jan 2010, 15:40
your code will be layered.
the application layer and the interface layer interface layer is the one connected to OS. |
|||
27 Jan 2010, 15:40 |
|
revolution 27 Jan 2010, 15:41
Teehee: You have to know the system/OS GUI interface to be able to show things like MessageBox.
There are some cross-platform libraries that attempt to make this easier, e.g. QT is one such library. There are others also. |
|||
27 Jan 2010, 15:41 |
|
Teehee 27 Jan 2010, 16:05
its something like:
Code: push 0 push 0 push text push 0 call [MessageBox] MessageBox: if (win) invoke Messagebox,etc else invoke LinuxMB,etc ret ? |
|||
27 Jan 2010, 16:05 |
|
Borsuc 27 Jan 2010, 17:13
That's the Windows API, which would work under Linux only if Wine is installed.
|
|||
27 Jan 2010, 17:13 |
|
LocoDelAssembly 27 Jan 2010, 17:28
Borsuc, I think you missed the conditional assembly part (although he should have used "call" without square brackets).
|
|||
27 Jan 2010, 17:28 |
|
f0dder 28 Jan 2010, 00:05
Teehee: conditional assembly would work, but it'd be a maintenance nightmare - you'll need to write an OS abstraction layer if you plan on getting anything done, and only use that abstraction layer from your client code. And then you have the wonderful task of implementing the abstraction layer for each OS...
If you only need simple stuff (console mode apps, file handling, memory) then it's a sort of manageable task, but add in GUI and support for more complex features... well, good luck. |
|||
28 Jan 2010, 00:05 |
|
DOS386 28 Jan 2010, 06:25
Teehee wrote: I'd like to know how my programs may run in Windows and Linux (for example). Impossible. You can mix Win32 with DOS, but NOT Win32 with Linux: Linux requires "?ELF" Sigi, while Windows needs "MZ" - one file can't have both. |
|||
28 Jan 2010, 06:25 |
|
LocoDelAssembly 28 Jan 2010, 08:15
Actually, since you mentioned Win32, you could write a COM with embedded ELF and then, when the binary is running under ntvdm you would construct a temporary PE file at run-time and then execute it and when running on Linux you would do nothing as it is already executing in 32-bit mode (I think someone in this forum did that or posted something about it long ago).
|
|||
28 Jan 2010, 08:15 |
|
revolution 28 Jan 2010, 08:25
LocoDelAssembly wrote: Actually, since you mentioned Win32, you could write a COM ..., when the binary is running under ntvdm you would construct a temporary PE file at run-time and then execute it ... |
|||
28 Jan 2010, 08:25 |
|
baldr 28 Jan 2010, 11:02
revolution,
Yes, it can (plain int 21/ax 4B00). DOSONLY from CONFIG.NT (or PIF advanced setting for Win9x) selects whether MZ or PE will be run. |
|||
28 Jan 2010, 11:02 |
|
ManOfSteel 28 Jan 2010, 12:07
@DOS386
I think he meant it to be assembled as one or the other depending on the target system. Something like: Code: SYSTEM equ 0 ; 0 = ELF (don't forget to link the ; object file with the appropriate libs) ;SYSTEM equ 1 ; 1 = PE match = 0,SYSTEM { format ELF public main } match = 1,SYSTEM { format PE GUI 4.0 entry main } main: ret |
|||
28 Jan 2010, 12:07 |
|
ManOfSteel 28 Jan 2010, 12:18
@Teehee
The best way IMO is, like revolution said, to use cross-platform toolkits like GTK+ and Qt, along with code like the above for conditional inclusion of "headers". Other than that, you can try edfed's method, IOW something like fasm, with system-independent code inside .inc files (e.g. %FASMDIR%/SOURCE/*) and system-dependent UI and API inside the main .asm file of every platform (e.g. %FASMDIR%/SOURCE/LIBC/FASM.ASM, %FASMDIR%/SOURCE/DOS/FASM.ASM). |
|||
28 Jan 2010, 12:18 |
|
Borsuc 28 Jan 2010, 17:33
LocoDelAssembly wrote: Borsuc, I think you missed the conditional assembly part (although he should have used "call" without square brackets). _________________ Previously known as The_Grey_Beast |
|||
28 Jan 2010, 17:33 |
|
LocoDelAssembly 31 Jan 2010, 03:29
Finally, I found it: http://board.flatassembler.net/topic.php?t=5625
The part that can run in DOS/Linux is in this link posted by rugxulo in that thread: http://www.deater.net/weave/vmwprod/asm/ |
|||
31 Jan 2010, 03:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.