Simple assembler question about stack pointer
I'm currently learn开发者_StackOverflow社区ing assembler and writing some program in real mode. I have some troubles with stack understanding. Is it possible to push value in the stack if SS is not zero and SP = 0.(and if it's possible then how cpu changes the values of the registers after the push)
Yes, it's possible but you'd generally prefer not to. If you do it, the SP will wrap around from 0 to 65536, be combined as usual with SS, and you'll write to whatever address that works out to. In a typical case, it'll overwrite something that was at the base of the stack, and when you return to code that depends on the previous content, the behavior will be unpredictable (a quick crash is about the best you can hope for at that point).
精彩评论