Code: Select all
or sp,sp
Code: Select all
cmp sp,sp
But is it really safe to assume that SP will NEVER be zero ?
Code: Select all
or sp,sp
Code: Select all
cmp sp,sp
After a few other instructions the interrupt handler returns with IRET 2, so the state of the flags register is returned to the code that called Int 16h.AJ wrote:That is indeed strange. I wonder what the context is? It's not just to test whether SP = 0, is it (is the next instruction a jz or a jnz)?
I have never defined a stack myself. I know that every PUSH/PUSHF/CALL/INT instruction decrements SP, and the most straightforward solution would be of course to define zero as the stack limit. But wouldn't it be possible to define a stack that "wraps" around to FFFEh after reaching a value of 0000h, like this:AJ wrote:In real mode, it would certainly not be safe to assume that SP is never zero (although you may want to test if it is, because that would mean that you are about to overrun the stack segment, IIRC).
Code: Select all
FFFE
FFFC
...
E002
E000 <- Stack limit
Unused
Memory
1FFE <- Starting address
1FFC
...
0002
0000
not quite...JamesM wrote:This is the exact reason the A20 hack had to be created...But wouldn't it be possible to define a stack that "wraps" around to FFFEh after reaching a value of 0000h, like this: