Search code examples
assembly8051

How to solve mul wit byte memsize and gain 2 byte answer. asm a51


In my program i need make mul with 2 variable. Memsize is only 1 byte. For example:
First = 63h
Second = 64h
Result is more then 1 byte. How can i make mul?
'helps Devolus'
Okay. Mul is simple. What about div
If I have 270F / 64. How can i do it with only 1 byte mem size?


Solution

  • mul ab
    

    The value from the akkumulator is multiplied with the value in register B. The lower byte from the result is in the akkumulator and the higher byte is in B. So you must store your values appropriately.

    So in your example 64h * 63h = 26ACh in Register B you will have 26 and in the akkumulator you will have AC.