motimehl
motimehl

Reputation: 1

The scanf is not working to me in assebmly

; ---- Setting up sections ----

section .data
intFormat db "%d", 10, 0
floatFormat db "%f", 10, 0
x db 1

extern GetStdHandle, printf, scanf\

section .bss
temp_input: resb 256\

section .text
global Start\

Start:\

;Saving values
push rcx
push rsi
push rdi
push rax
push rbx
push rdx
push r8
push r9\

sub rsp, 32
;read a number
mov rcx, intFormat
mov rsi, temp_input
xor rax, rax
call scanf
add rsp, 32\

mov rax, temp_input
mov [x], rax
;Returning values
pop r9
pop r8
pop rdx
pop rbx
pop rax
pop rdi
pop rsi
pop rcx\

;Saving values
push rcx
push rsi
push rdi
push rax
push rdx
push r8
push r9
;Handling expression\

mov rax, x\

sub rsp, 32
mov rcx, intFormat
mov rdx, rax
call printf
add rsp, 32\

;Returning values
pop r9
pop r8
pop rdx
pop rax
pop rdi
pop rsi
pop rcx\

If I write a number then nothing is printed and if I write a string then the location in memory is printed and not the value I want what is input to be printed

Upvotes: -2

Views: 18

Answers (0)

Related Questions