SP <- 1;
N(the number of actual arguments) <- 0;
Repeat{ //macro call
S(SP) <- -1;
S(SP+1) <- MDT index from MDT;
insert actual argument to S(SP+2, ..., S(SP+N+1);
S(SP+1) <- S(SP+1)+1;
repeat{ //macro call in macro
read S(SP) from MDT;
match actual arguments using S(SP+2),...,S(SP+N+1);
complete the instruction;
S(SP+1) <- S(SP+1)+1;
if(ENDM) SP <- S(SP); //go to sp before macro call
if(macro call){
S(SP+n+2) <- SP;
SP <- SP+N+2;
S(SP+1) <-MNT의 MDT index;
insert actual arguments to S(SP+2),...,S(SP+N+1);
S(SP+1) <- S(SP+1)+1;
}
else{ print the expanded instruction; }
}
until(S(SP)!=-1)
}
else{ print read instruction;}
}
until (NOT END instruction)
END expanded macro procedure;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am taking a system programming class, and in the class I learned intel 8086 processor. I'm studying recursive macro call algorithm. But I wonder why first s(sp) becomes -1 when stack pointer(==sp) is 1. I know little about intel 8086 processor.
here's pseudo code
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page