I am having problems with this program.
It assembles but will not run. it will not even start - anyone see the error?

global _start
section .data
$STR00000   db "hello world",0
section .bss
$u_exitcode resd 1
section .text
extern _iwbstrcpy
extern _iwb_finish
extern _iwbprint
_start:
    push    rbp ; set up stack frame, must be alligned
%line 1+0 k.iwb
%line 2+0 k.iwb
    mov rax, 0x0a
    push rax
    mov rax, 1
    push rax
    mov rax, 0x0d
    push rax
    mov rax, 1
    push rax
    mov rax,STR00000
    push qword [rax]
mov rax, 0
    push rax
    mov rax, 3
    push rax
    call _iwbprint
    add rsp,28
%line 3+0 k.iwb
    xor rax,rax
    mov rdx,rax
    mov rax, $u_exitcode
    mov rsi,rax
    mov [rsi],rdx
%line 4+0 k.iwb
    pop rbp
    jmp _iwb_finish

Recommended Answers

Is this just a Hello World? If so, start with a working model. https://www.devdungeon.com/content/hello-world-nasm-assembler

Jump to Post

The hello world above doesn't match other hello worlds. I didn't step through your code for reasons since there are working hello worlds for the taking. Use another example from the web and if that fails I worry your nasm setup has issues.

Jump to Post

All 5 Replies

I know it is a hello world. It is a nasm file that I converted from 32 bit nasm to 64 bit nasm.
I have missed something and do not know what. When executed it just says no such file or directory. I tried to run it with gdb but got the same error with no usefull information.

The hello world above doesn't match other hello worlds. I didn't step through your code for reasons since there are working hello worlds for the taking. Use another example from the web and if that fails I worry your nasm setup has issues.

I stripped the program of all external reference - it fails to start - does not even get to _start on run under gdb???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.