RE: Simple C++/Asembler question

I was going to fix your problem and write it correct but sometimes Google
takes the work out of everything.  If you search down through this tutorial
his first little simple program does exactly what you want it adds two
numbers together and it takes into account converting the numbers from the
characters you get to the numbers you need as I had said in my previous
email.  So here is the link it should help you greatly.

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Celia Rodriguez
Sent: Thursday, March 31, 2011 2:17 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Simple C++/Asembler question

Hi Everyone,

Is there someone who can help me on this little simple problem?
I am sure that my main problem is that I do  not understand how the
registers and storage areas work.
The following is a simple console program.  It adds two numbers entered  by
the user. and displays the answer.  My problem is when the anser is > then 9
I have tried adding the two numbers to eax  and displaying from eax, and
moving the numbers to ah, al and adding the two numbers,  all I display is
I hate to bother you with this such a small problem,  but I really do not
understand why I cannot display what is in register eax.
I will greatly appreciate anyone's help on this.

Thank you,

// reads the first digit then clears the buffer
        lea ecx,b;
        call putstr;
        call getch;
        cmp eax,'0';
        je loop10
        sub eax, '0';
        mov x, eax;

        call getch;

        // reads the second digit
        lea ecx,b;   
        call putstr;
        call getch;
        sub eax,'0';
        mov y, eax;

        mov ebx,x;
        mov ecx,y;
add eax,ebx;
add eax,ecx;
// this part does work when adding two  numbers < 10
        add ecx,ebx;

//cmp eax , '10';

add eax,'0';

add ecx,'0';

        call putch;             


        }0;//return 0;   

View the list's information and change your settings at

View the list's information and change your settings at

Other related posts: