intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF

int e l 4.25 DESCRIPTION OF STATEMENTS STATEMENT: PUSH[expr] MODE: COMMAND AND / OR RUN TYPE: ASSIGNMENT The arithmetic expression, or expressions following the PUSH statement are evaluated and then sequentially placed on MCS BASIC-52's ARGUMENT STACK. This statement, in conjunction with the POP statement provide a simple means of passing parameters to assembly language routines. In addition, the PUSH and POP statements can be used to pass parameters to BASIC subroutines and to "SWAP" variables. The last value PUSHED onto the ARGUMENT STACK will be the first value POPPED off the ARGUMENT STACK. VARIATIONS:

More than one expression can be pushed onto the ARGUMENT stack with a single PUSH statement. The expressions are simply followed by a comma: PUSH[expr],[expr],..[expr]. The last value PUSHED onto the ARGUMENT STACK will be the last expression [expr] encountered in the PUSH STATEMENT. EXAMPLES: SWAPPING SUBROUTINE VARIABLES PASSING >10 A=10 >10 PUSH 1,3,2 >20 B=20 >20 GOSUB 100 >30 PRINT A,C >3O POP R1,R2 >40 PUSH A,C >40 PRINT R1,R2 >50 POP A,B >5O END >60 PRINT A,B >100 REM QUADRATIC A=2,B=3,C=1 IN EXAMPLE >RUN >110 POP A,B,C >120 PUSH (-B+SQR(B*B-4*A*C))/(2*A) 10 20 >130 PUSH (-B-SOR(B*B-4*A*C))/(2*A) 20 10 >140 RETURN >RUN READY > -1 -.5 READY > - 60 -