I'm trying to make an assembly program that converts years to days.
This is my code:
section .data
SYS_EXIT equ 60
years db 100
days dw 0
yearToDay dw 365
section .text
_start:
; converting years to days
mov ax, byte[age]
mul word[yearToMonth]
mov word[days], ax
mov word[days+2], dx
exit_here:
mov rax, SYS_EXIT
xor rdi, rdi
syscall
I get this error message whenever I try to run it:
file.asm:15: error: mismatch in operand sizes
Isn't it that whenever the source variable (the multiplier) is in word-size, you should move the multiplicand to ax
, and the product will be stored in dx:ax
?