I am trying to write a program that compares single characters, but it says the buffer is not equal to 'S' even though I gave one as input, I know there comes a new-line and terminating sign after the input string but isn't [.buffer] just supposed to give the first character of the string?
section .text
global main
main:
jmp start_promt
start_promt:
section .data
.promt db "Choose one of the following instructions: (S)tart, (Q)uit",10,0
.promtLen equ $-.promt-1 ; memory address of begin of this instruction minus memory address of begin of promt gives length of promt
.bufsize dq 100
section .bss
.buffer resd 100
section .text
mov rax, 1 ; rax <- 0 (syscall number for 'write')
mov rdi, 1 ; rdi <- 0 (stdout file descriptor)
mov rsi, .promt ; address of prompt message
mov rdx, .promtLen ; size of promt message
syscall ; execute write(1, promt, promtLen)
xor rax, rax ; rax <- 0 (syscall number for 'read')
xor rdi, rdi ; rdi <- 0 (stdin file descriptor)
mov rsi, .buffer ; rsi <- address of the buffer. lea rsi, [rel buffer]
mov rdx, [.bufsize] ; rdx <- size of the buffer
syscall ; execute read(0, buffer, BUFSIZE)
mov rdx, [.buffer]
cmp rdx, 'S'
je start_game
cmp rdx, 'Q'
je quit
jmp start_promt
start_game:
; loop for user-instructions
; if done
;jmp start_promt
quit:
mov rax, 60
mov rdi, 0
syscall