ravipal
asked on
Switching Stacks
Inside a Interrupt Service Routine, I need to change the presently running program's Stack to the ISR's Stack. I have two questions.
1. What is the Code for this in Microsoft C? or can I use inline assembly?
2. How do I determine where to put the Stack Pointer? i.e how do I determine the amount of stack used?
1. What is the Code for this in Microsoft C? or can I use inline assembly?
2. How do I determine where to put the Stack Pointer? i.e how do I determine the amount of stack used?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks bculver, I need few clarifications on your code.
The 1024 you put in the char stack array, Is is a assumed figure ? or is that a fixed figure??
Why do you put 1024-2 to get ptr to the top of the stack?, is it not 1024-1?
What is the reason behind moving values to AX before moving them to SP and SS respectively?
Would appreciate your clarifications very much.
The 1024 you put in the char stack array, Is is a assumed figure ? or is that a fixed figure??
Why do you put 1024-2 to get ptr to the top of the stack?, is it not 1024-1?
What is the reason behind moving values to AX before moving them to SP and SS respectively?
Would appreciate your clarifications very much.
for C/C++ the inline asm is like this..
{
//Code
asm {
//asm code goes here,,
}
}
SP(Stack Pointer) is the assembler register....