I have gone thru the tutorial i was doing about 8byte multiplication (8byte X a word).
I understood the tutorial and the code. But there is something that i need to clarify, about DX:AX registers when using MUL.
When we multiply a word against a word, the possible result is 4 bytes(2 word). In the case where the result is a word, the full result would be stored in AX register.
However, when the result is more than a word, part of the answer is stored in DX.
My question: What part of the result is stored in DX and which part is stored in AX?
Let's take 60000 * 2222 as an example.
The result would be: 133,320,000, which is 7F24D40h
How would this info be stored in DX:AX?
I know that if we were to do code for a word x word multiplication, we would have to:
multiplicand EQU 60000
multiplier EQU 2222
result dd ?
lea bx, result
multi:
mov ax, multiplicand
mul multiplier ; i'm told it is faster to put it in a reg.
mov , ax ; store 1st word
add bx, 2
mov , dx
That would put 7F24D40h in result.
The problem i have is visualising the moving of data from ax:dx into result. Pls forgive me for my lengthy post and stupid question.
The result is in DX:AX, meaning DX holds the upper word, while AX holds the lower.
In your example:
dx = 07F2h
ax = 4D40h
Mirno
Thanx Mirno. U r always there for me around this time. Do u have icq or stuff like that?
Another simple question:
Is data stored as hex numbers or binary numbers in the registers?
Let's say 133,320,000.
They are stored as hex numbers? Never as decimals?
I'm at work (don't have a connection at home), and its getting to the end of the day!
The idea of format of a number is a purely human concept. In a register there is no format, only a number.
Technically it will be a binary number, as that is how the data will be really store. The only reason we use hex is that it groups 4 bits into one easy to remember symbol.
Numbers are universal, only there representation is specific. So don't think of a number as hex, decimal, binary, octal, trinary, or anything else, unless you are displaying it!
remember: 10 + 10h = 11010b :D
Mirno
Oic. So, I need not worry about what is being added up, whether it's hex or binary, as both would end up being the same.
Thanx.