I’m trying to rewrite a little text game in assembly for fun, and I noticed that I’m only able to run the following code successfully once. If I run it again elsewhere, it will seemingly skip over the code.
I am compiling using the following command:
nasm -f elf64 -o test.o textgame.s && ld -o test test.o && ./test
JavaScript
x
mov rax, 0
mov rdi, 0
mov rsi, buffer
mov rdx, buffer_len
syscall
Advertisement
Answer
Solved! Thanks to Jester!
With a buffer_len of 1 there is no place for the linefeed so the next time around that will be read.