home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
3x400
/
includes.lzh
/
PUSHPOP.RPG
< prev
next >
Wrap
Text File
|
1988-08-19
|
1KB
|
27 lines
CSR PUSH BEGSR
C SI IFGE TOS TOP OF STACK?
* If the Stack Pointer is equal to the Stack Limit (top of Stack)
* then send the message "** TOS **" back to the caller.
C MOVE TOP STACK
C ELSE
* Increment the Stack Pointer by a factor of 1.
C ADD 1 SI INCREMENT SI
* Put the stack-variable onto the stack.
C MOVE STACK S,SI
C END
CSR ENDSR
/SPACE
CSR POP BEGSR
C SI IFLE 0 TOP OF STACK?
* If the Stack Pointer is equal to 0, then
* send the bottom of stack message "** TOS **"
* back to the caller.
C MOVE TOP STACK
C ELSE
* Put the stack element into the stack-variable.
C MOVE S,SI STACK
* Decrement the Stack Pointer by a factor of 1.
C SUB 1 SI INCREMENT SI
C END
CSR ENDSR