NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: nullptr on May 03, 2013, 09:42:53 PM
-
Hi folks, i'm beginner in asm.
probably someone had this same problem, but i can't find the right post and hard to any tutorials for linux x64 assembly.
What i'm doing wrong? I've written simple terminal program that asks user to enter his name and then welcomes him by his name. The program only displays only question string and hi string, but not input.
[BITS 64]
SECTION .TEXT
global _start
_start:
mov rax, 1
mov rdi, 1
mov rsi, tTxt
mov rdx, LEN_TTXT
syscall
xor rax, rax
xor rdi, rdi
mov rsi, buff_Name
mov rdx, LEN_BNAME
syscall
mov rax, 1
mov rdi, 1
mov rsi, tHi
mov rdx, LEN_THI
syscall
mov rax, 1
mov rdi, 1
mov rsi, buff_Name
mov rdx, LEN_BNAME
syscall
xor rdi, rdi
mov rax, 60
syscall
SECTION .DATA
tTxt: db "What is your name? "
LEN_TTXT: equ $ - tTxt
buff_Name: times 20 db 0
LEN_BNAME: equ $ - buff_Name
tHi db "Hi "
LEN_THI: equ $ - tHi
SECTION .BSS
thanks in advance.
-
I'm not very familiar with 64-bit coding, and can't test it for ya. Your code "looks" right to me. The only thing that looks like a potential problem is that section names are case sensitive. ".TEXT" probably isn't a problem, but ".DATA" might be making your section readonly. Try lowercase ".text" and ".data" and see it that helps...
Best,
Frank
-
You're right Frank. Now it works as it should, thanks