TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: ALL
from: ED BEROSET
date: 1998-01-30 05:48:00
subject: Re: Directly writing to memor

From: Ed Beroset 
Subject: Re: Directly writing to memor
At 20:28 1/28/98, you wrote:
>
> *** Darryl Gregorash wrote in a message to Scott McNay:
>
> DG>> mov ss:[sp], eax
> DG>> sub sp,4
>
>
> SM> Shouldn't that be the other way around?
>
>DG> I don't think so; it mimics a PUSH.
>
>Last I heard, SP pointed at the top of the stack, so that SS:[SP] would 
efer
>to the last item.  Meaning, to add another value to the stack, you must 
irst
>decrement sp, then move the new value, as in:
>
>  sub sp,4
>  mov ss:[sp],eax
You're correct.  The stack pointer is decremented before the register is
copied to memory.  
> SM> (assuming, of course, that mov ax,ss:[sp] worked ;)
>
>DG> Why wouldn't it?
>
>Did you try it?  Microsoft's DEBUG says "error", and OpenDOS's DEBUG says
>"Incorrect name of index register".
That's because it's not a legal addressing mode.  If you examine a chart of
the  ModR/M byte addressing forms, you'll see that there is no way to
specify [sp] as a destination address.
Ed
-!-
---
---------------
* Origin: The Circuit! Board * Spokane * (1:346/100)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.