I can't figure out how to call scanf properly. My current code adds 0x30 to my answer for some reason.
This is my current code
.file "get_int.s"
.section .rodata
.text
.globl get_int
.type get_int, @function
scanf_line:
.string "Test %d"
get_int:
pushq %rbp #save caller's rbp
movq %rsp, %rbp #set function's frame pointerr
movq $0, %rax #initalize return to 0
movq $scanf_line, %rdi #push scanf_line into 1st arg
call scanf #call scanf C function
exit:
leave
ret
.size get_int, .-get_int
If I were to enter decimal 5 I would get back 0x35 or decimal 53 in the rsi register.