0

I am new to assembly language. I was practising division in assembly language and I had a doubt about dividing using variables

num1 db 10

mov ax , num1 <br>
mov bl , 2  <br>
div bl

But this creates an error (39) wrong parameters: MOV ax , num1 (39) operands do not match: 16 bit register and 8 bit address

Can anyone help me understand this ?

Michael
  • 57,169
  • 9
  • 80
  • 125
  • 2
    It's exactly what it says. Your `num1` is a `db`, a single byte. `ax` is 16 bits, 2 bytes. You want `movzx ax, num1` to zero extend to the larger size. – Jester May 09 '20 at 11:36
  • 1
    Thanks for the help! movzx is not valid in emu8086 But I've used mov ah , 00 mov al , num1 This worked! – Tanmay Chandekar May 09 '20 at 12:26
  • Similar problem with emu8086 missing `movzx` is solved at https://stackoverflow.com/questions/61442174/palindrome-program-for-emu8086-in-assembly-language/61444797#61444797 – vitsoft May 09 '20 at 12:31

0 Answers0