1
votes

The SASM IDE is a crosplatform IDE with NASM support. It provides debugging functions to observe the registers during the execution of the program. The following code compiles with NASM without any issue.

    section .data
hello   db "Hello World!",0xa
len equ $-hello

    section .text
    global  _start

_start:
    mov eax, 4
    mov ebx, 1
    mov ecx, hello
    mov edx, len
    int 80h

    mov eax, 1 ; exit(0)
    mov ebx, 0
    int 80h 

But if you try to execute the same code in the SASM IDE it doesn't work. Here the complete error message.

[14:46:07] Warning! Errors have occurred in the build: /tmp/SASM/program.o:/tmp/SASM/program.asm:9: multiple definition of _start' /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/crt1.o:(.text+0x0): first defined here /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/crt1.o: In function_start': (.text+0x20): undefined reference to `main' collect2: Fehler: ld gab 1 als Ende-Status zurück [14:46:07] Before debugging you need to build the program.

Because it doesn't work I guess there must be a difference between the SASM IDE and NASM (Usually I thought SASM is more or less just a GUI for NASM).

What must be fulfilled to compile the program in SASM ?

1
SASM seems to say you should use CMAIN macro for entry point, not _start.Sami Kuhmonen

1 Answers

0
votes

Okay, it works with the following modifications. (include in the first line and change _start to CMAIN)

%include "io64.inc"

      section .data
hello   db "Hello World!",0xa
len equ $-hello

    section .text
    global  CMAIN

CMAIN:
    mov eax, 4
    mov ebx, 1
    mov ecx, hello
    mov edx, len
    int 80h

    mov eax, 1 ; exit(0)
    mov ebx, 0
    int 80h 

But for me the more important question is, what's the difference between SASM and NASM ? In my opinion that's not a NASM Support anymore because native NASM programs are not executable without modifications. Or are there settings to execute such programs ?