beautypg.com

Rpbasic-52 programming guide, Push – Remote Processing BASIC 52 User Manual

Page 109

background image

RPBASIC-52 PROGRAMMING GUIDE

2-90

PUSH

Syntax:

P U S H expr1 [,expr2 ,...]
Where:

expr is a numeric value

Function:

Puts the value o f expr to the argument stack. The first value PUSHed and is the last POPped.

Mode:

Comm and, run

Use:

PUS H X ,Y

Cards:

All

D E S C R IP T I ON

PUSH and POP instructions pass valu es to Basic su broutines. The las t value pushed is the last expression in
the PUSH instruction, and is also the first popped off the stack. Multiple expressions can be pushed onto the
argument stack by separating the expressions w ith commas.

The PU SH and P OP instruction s alleviate som e of the problem s of global variables in Basic. The y eliminate
the need to equate subroutine variables to global variables used by the program which called the subroutine.

The stack is cleared when a new program is loaded using EXECUTE.

RELATED

POP, LD@, ST@

E R R O R

A - S T A C K

Attempt to push too many values on the argument stack. Typically no more than 32 values may
be PUS Hed onto th e stack before it is full.

EXAMPLE

Please refer to the POP example.