http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stack trouble



Hi,

I'm having some trouble programming the stack, I'm missing something here,
and it's gotta be something REALLY simple! Here's an example of my code:

	mov ax, 5
	push ax
	mov ax, 2
	pop bx
	add bx, ax
	push bx
	pop cx

If I run this in Debug, I get CX as 2, why is this so? Shouldn't it be 7?
Or what am I doing wrong? And yes, I know it can be done with

	mov cx, 5
	add cx, 2

But I have reasons (very numerous and hard to explain) why it has to be
like this, also the above isn't my exact code, it's just in the same
format, I don't have the code with me right now, sorry.

I hope somebody can clear up what I'm missing!

Ciao,

Lionel

=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html