Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me with stacks: addition and multiplication functions

Status
Not open for further replies.

mhamini

Member level 1
Member level 1
Joined
Aug 23, 2005
Messages
40
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Iran-Tehran
Activity points
1,690
Help With Stacks

Hello, I am creating a program to add and multiply large numbers using stacks. I have been working on the program all day and I believe I am on the verge of completing it, but right now the addition and multiplication functions are not doing their job correctly. I'm not entirely sure why, and I was hoping someone here could assist me in finding out the source of this problem. Thank you for your time and any help is appreciated, no matter how small.
 

Re: Help With Stacks

mhamini,

I think we need a bit more infomation on your problem to help you.

What system are you using PC, Uc..etc
What languge are you using? C, C++, Java ..etc
What exactly does your program do, explain, algorithm, or code please.
What is wrong with the result ? how does it differs from what you expect.

Maui
 

Re: Help With Stacks

i suppose youre programming in 8086 ASM?
if so, how big number?
if 8 bit just use AL, AH, BL, BH, CL, CH, DL, DH (whichever you find suitable) and then use the MUL instruction
if 16 bit just use AX, BX, CX, DX (whichever you find suitable) and then use the MUL instruction
if 32 bit you can just use EAX, EBX, ECX, EDX (whichever you find suitable) and then use the MUL instruction
if 64 bit youll need to use 2 registers (i believe its done by doing: EAX:EBX or something like that) still using MUL command
if your problem is in the stack, check and make sure youre using PUSH and POP right

the registers works like this (? can be A B C or D):
E?X is the 32 bit extension register
?X is a 16 bit register, and is also the lower word (16 bits) of E?X
?L is the lower byte (8 bits) of ?X
?H is the higher byte (8 bits) of ?X

hope this helps
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top