News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Hello world with GAS and intel syntax

Started by mulu64, March 14, 2025, 05:01:30 AM

Previous topic - Next topic

mulu64

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

six_L

#1
Hi,mulu64
Maybe you try to uasm (https://www.terraspace.co.uk/uasm.html).
Say you, Say me, Say the codes together for ever.

mabdelouahab

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


 

mulu64

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 ?

jj2007

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 with three posts by Johnsa mentioning version 2.58

mulu64

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.