Here's an example that I find rather useful from time to time.
You may have seen in the manual that when you multiply two 16bit numbers together, the result is a 32bit number that can then be used with the DIV32 command. But the 32bit multiply result is not available to the user, it's only in PBP system variables where you can't get at it.
This little routine let's you retrieve that 32 bit result.
Code:
A32bitVar var word[2]
Dummy var word
ASM
GetMulResult macro Dword
MOVE?WW R2, Dword ; Low Word
MOVE?WW R0, Dword + 2 ; High Word
endm
ENDASM
Dummy = 1000
Dummy = Dummy * Dummy
@ GetMulResult _A32bitVar
end
The 32 bit result for 1,000,000 is now contained in the two words of A32bitVar.
HTH,
Darrel Taylor
Bookmarks