I understand that in .data
section there are arrays of chars, and last bit of array is null (0). Also, 10
is a code for new line. My question is, why when in .data
section I delete 10
and left 0
program won't print anything, but when I delete 0
and left 10
program is working?
global main
extern printf
section .data
gwiazdka db '*',10,0 ;HERE is my question
section .text
main:
mov rbx, 0
petla:
mov rdi, qword gwiazdka
mov rsi, rbx
mov rax, 0
call printf
inc rbx
cmp rbx, 4
jne petla
mov rax, 1
int 80h
I want to build a square from stars and I don't get it why I can't print single chars without starting new line... I compile like that:
nasm -f elf64 program.asm
gcc program.o -o program
./program