??? 08/07/05 21:16 Read: times |
#98965 - Mmmmm? Responding to: ???'s previous message |
Jan Waclawek said:
Ian, note , what is that "whatever" pushed onto the stack last: it is the content of the stack before the first push - i.e. the return address - recovered by the xch a,@r0 instructions (r0 has been filled by sp and decremented down to the position of return address).
It is similar with the other, restore context, routine - first the return address gets popped out into dptr, but later it gets stored back into stack so after all popsare done it is just at the top of the stack. Btw, this is the key to answer to Oleg's puzzle. Interesting. First thing I would say is code like this needs to be heavily commented and even then I would tend to avoid stack manipulation if at all possible. Also it appears to save/restore the context only of register bank zero. If the current bank is not zero then R0 in that bank gets destroyed. Or have I missed something else. Ian |