Floating point exception core dumped. I am using 64 bit assembly. I think i'm getting the error where I use the div instruction from what I've seen about the error,(people seem to get it when they don't clear RDX) but as i am clearing it with the xor function I don't know whats wrong with my code.
section .text
global _start ;must be declared for linker (ld)
_start:
mov rdi,1 ;tell linker entry point
mov rax,rdi
push rax
jmp loop
loop:
pop rax
cmp rax,19
jle test3
mov rax,1;quit
syscall ;quit
test3:
add rdi,1
push rdi
mov rax,rdi
xor rdx,rdx
mov rbx,3
div rbx
cmp rdx,0
je fizz
jmp test5
test5:
mov rax,rdi
xor rdx,rdx
mov rbx,5
div rbx
cmp rdx,0
je buzz
jmp loop
fizz:
mov rdx,5 ;message length
mov rcx,msg ;message to write
mov rbx,1 ;file descriptor (stdout)
mov rax,4 ;system call number (sys_write)
syscall ;call kernel
jmp loop
buzz:
mov rdx,5 ;message length
mov rcx,msg2 ;message to write
mov rbx,1 ;file descriptor (stdout)
mov rax,4 ;system call number (sys_write)
syscall ;call kernel
jmp loop
section .data
msg db 'fizz',10
msg2 db 'buzz',10