Search code examples
assemblyx86winefasm

Making a Portable Executable using FASM in Ubuntu


Stack Community !

I am currently on Ubuntu 17.10 and an assembly language learner. When I was on Windows, I used a library named 'win32a.inc' and "MyLib.inc" to read_eax and print_hex. The Syntax used to be like this:

format PE console
include 'win32a.inc'
entry start
section '.text' code readable executable
start:
     mov eax,0xffff
     call print_eax
push 0
call [ExitProcess]

include 'MyLib.inc'

But not having a good experience on Windows, made me switch to Linux. I did this to install fasm:

sudo apt-get install fasm

But when I try to make an executable (I plan to run it with wine) I get an error on terminal: 'win32a.inc' source file Missing.

'win32a.inc' is a default fasm library on Windows. I don't know how I could use it in Linux. I have the backup of all the Windows Libraries though ;_;

Is there a way I can make a portable executable in Linux using FASM ??


Solution

  • You can compile to any type of files supported by FASM on any OS.

    The trick is that Windows port of FASM treat the filenames as case insensitive, but Linux FASM treat them as case sensitive.

    So, check the case of the file names used in the include directives.

    The real filenames of the FASM default include libraries are all UPPERCASE. So, you need to use WIN32A.INC if you want to compile this code with the Linux (or any other Unix type OS) FASM.