The MASM Forum

Miscellaneous => Linux Assembly => Topic started by: mulu64 on March 14, 2025, 05:01:30 AM

Title: Hello world with GAS and intel syntax
Post by: mulu64 on March 14, 2025, 05:01:30 AM
Not so easy to restart ...
I wanted to use GAS (GNU as) this time, because TASM seems dead and buried , and not available for Linux.
« .intel_syntax » directive is not enough ! Do not forget the « noprefix » directive ! Otherwise, compiler complains about « ambiguous operand size for `mov' » (it must consider register name as a variable ? The error is not clear for me).

But, here it goes in all its glory.

/* as hello_intel.s -o hello_intel.o
   ld hello_intel.o -o hello_intel.elf
*/

# Intel syntax
# « noprefix » is needed, for removing % before register name
.intel_syntax noprefix

.section .data
msg: .asciz "Hello, MASM32 !\n"
len: .long .-msg

.section .text
.globl _start

_start:
    # message to stdout
    mov eax,4
    mov ebx,1
    lea ecx,msg
    mov edx,len
    int 0x80

    # exit
    mov eax,1
    xor ebx,ebx
    int 0x80
Title: Re: Hello world with GAS and intel syntax
Post by: six_L on March 14, 2025, 01:37:06 PM
Hi,mulu64
Maybe you try to uasm (https://www.terraspace.co.uk/uasm.html (https://www.terraspace.co.uk/uasm.html)).
Title: Re: Hello world with GAS and intel syntax
Post by: mabdelouahab on March 14, 2025, 06:56:06 PM
Hi,mulu64
Try UASM because it's smoother than GAS
    ;   uasm -elf HelloworldUASM.asm
    ;   ld -m elf_i386  -o HelloworldUASM HelloworldUASM.o
    ;   ./HelloworldUASM
    .386
    .model flat
    public _start
.DATA
    msg DB  "Hello, MASM32 ",10
    len EQU $-msg       
.CODE
_start:
    ; # message to stdout
    mov eax,4
    mov ebx,1
    lea ecx,msg
    mov edx,len
    int 080h
    ;# exit
    mov eax,1
    xor ebx,ebx
    int 080h
end _start


 
Title: Re: Hello world with GAS and intel syntax
Post by: mulu64 on March 15, 2025, 12:10:07 AM
Hello,

Thank you for the suggestions.
UASM is in the official packages of archlinux, that's a good point for it.
But why on official website do we have last version published september of past year, and on github the last commit is three years ago ?
Title: Re: Hello world with GAS and intel syntax
Post by: jj2007 on March 15, 2025, 03:08:32 AM
Quote from: mulu64 on March 15, 2025, 12:10:07 AMBut why on official website do we have last version published september of past year

See UASM Assembler Development (https://masm32.com/board/index.php?board=51.0) with three posts by Johnsa mentioning version 2.58
Title: Re: Hello world with GAS and intel syntax
Post by: mulu64 on March 15, 2025, 05:22:21 AM
Quote from: jj2007 on March 15, 2025, 03:08:32 AM
Quote from: mulu64 on March 15, 2025, 12:10:07 AMBut why on official website do we have last version published september of past year

See [url="https://masm32.com/board/index.php?board=51.0"]UASM Assembler Development[/url] with three posts by Johnsa mentioning version 2.58

I've made a mistake in my previous post. That's the arch package which has been published september 2024.
I was wondering why the git version was 3 years before the archlinux package.
Proabably a correction for the package itself.
But that's great UASM is not abandoned.

For what i make with it, GAS is enough for me for the moment.
If GAS is becoming not enough for me, i will have a look to UASM.