| | |
Word Multiplication Problem
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Mar 2009
Posts: 123
Reputation:
Solved Threads: 0
Hello,
I need a little help for word multiplication, according to my notes, to multiply a word, we should put the multiplicand in AX, the multiplier in a register or memory variable and the result should appears in AX(low) and DX(high).
The problem is how to get the product ? It is found in two seperate registers, how to merge them together.
This is a simple example:
From the example above, the product is in AX and DX but how to access the product and save it in a memory variable?
Thanks in advance for your answer.
I need a little help for word multiplication, according to my notes, to multiply a word, we should put the multiplicand in AX, the multiplier in a register or memory variable and the result should appears in AX(low) and DX(high).
The problem is how to get the product ? It is found in two seperate registers, how to merge them together.
This is a simple example:
Assembly Syntax (Toggle Plain Text)
call GetDec mov bx, ax dec bx cwd imul bx
From the example above, the product is in AX and DX but how to access the product and save it in a memory variable?
Thanks in advance for your answer.
•
•
Join Date: Apr 2009
Posts: 39
Reputation:
Solved Threads: 5
If you have a 32 bit system you could just do something like
Either checking if it overflowed into dx or just zeroing everything out before hand
Or you could set aside space on the stack something along the lines of
And now your number resides at [ebp - 4]
Either checking if it overflowed into dx or just zeroing everything out before hand
Assembly Syntax (Toggle Plain Text)
mov cx, dx shl ecx, 16 mov cx, ax
Or you could set aside space on the stack something along the lines of
Assembly Syntax (Toggle Plain Text)
enter 0,4 ....code goes here... ....multiplication code..... mov [ebp - 2], dx mov [ebp - 4], ax
And now your number resides at [ebp - 4]
![]() |
Similar Threads
- $1 x $2 = ??? (Geeks' Lounge)
- Event problem...help...urgent... (Java)
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- New Problem with input output in Tk (Python)
Other Threads in the Assembly Forum
- Previous Thread: HOW-TO Swap some characters
- Next Thread: Quick MIPS question
Views: 466 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Assembly
3d 68hc11 6811 80386 :( adress array asm assembler assembly boot bootloader buffer compression cursor debug directory division docs dos draw emulator endtask error exceptions file int10h integer intel interrupt interrupts language loop newbie nohau osdevelopment print program range read remainder shape string text theory tsr x86





