I cannot use div operator in x86 again after using it the first time. When I input number 106, 106 divided by 25. First, i move 25 into %ebx then use div and it worked fine. But when I move 5 into %ebx again then take the remainder 6 divided by 5, it says floating exception. Even though, I already move the remainder to %eax, i can't use div anymore
.data
message:
.ascii"Enter the number of cents: \0"
quarter:
.ascii" Quarter(s)\n\0"
dime:
.ascii" Dime(s)\n\0"
nickel:
.ascii" Nickel(s)\n\0"
penny:
.ascii" Penny(s)\n\0"
.text
.global _start
_start:
mov $message, %eax
call PrintStringC
call ScanInt
mov $25, %ebx
div %ebx
# print out change in Quarter
call PrintInt
mov $quarter, %eax
call PrintStringC
mov %edx, %eax # move remainder to eax
mov $5, %ebx # move 5 to ebx
div %ebx # Cannot use div again.
call PrintInt
mov $dime, %eax
call PrintStringC