My dear friend:
At 1st I will apologize for my poor Enghish.
I hope you can understand what I mean.
Now I will use AT89C51 (a chip compatible with MCS-51 products) to explain:
Suppose there are two tasks: Task1 and Task2
When operate Task1, the value of OS stack pointer----SP is 00H ( SP==00H ),and the stack range from 00H to 1FH. This stack pointer is also the Task1's data stack pointer.
Before OS switch from Task1 to Task2, the programme will execute an interruption (the interruption can be T1 overflow,or T0 overflow,or other else.But this interruption must be planed when you write the programme,it means you want the interruption appear at that time), this interruption will cause 4 things happen:
1st.
Push some registers' value into stack ,such as ACC,B,R0,R1....PSW.... any register you use in Task1,but will change its value in Task2.
2nd.
Give the new value to SP,the value should be Task2's stack pointer----SP is 20H,and the stack range from 20H to 3FH.This stack pointer is also the Task2's data stack pointer.
3
Pop the Task2's data out from the stack.
4.
Operate Task2.
I hope above is the answer you need.
If any question, sand me an E-mail, and I will try my best
aaaaaaaaaalyl@163.com