Reputation: 334
I'm trying to learn Assembly. I tried to sum float numbers, then I wanted to print result to. But I couldn't. How can I do it;
section .data
float1 dd 3.14
float2 dd 1.59
float3 dd 0.0
prompt db 'Result: ', 0
section .text
global _start
_start:
movss xmm0, [float1]
movss xmm1, [float2]
addss xmm0, xmm1
movss [float3], xmm0
mov rax, 1
mov rdi, 1
mov rsi, prompt
mov rdx, 9
syscall
fistp dword [float3]
mov rax, 1
mov rdi, 1
mov rsi, float3
mov rdx, 5
syscall
mov rax, 60
xor rdi, rdi
syscall
Current output is 'Result: �R%', when I run with 'cat -e': 'Result: ^@^@^@^@M-^@R%'. How can I print my float value?
Upvotes: 1
Views: 46