beautypg.com

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

Page 106

background image

RPBASIC-52 PROGRAMMING GUIDE

2-87

POP

Syntax:

POP variable [ ,variable,...]

Function:

Take s a valu e PU SHe d to a sta ck and assign s it to the variab le.

Mode:

Comm and, run

Use:

POP X,Y,Z

Cards:

All

D E S C R IP T I ON

Multiple variables can be POPped off the stack by separating the variables with commas. The first value
POPped is the last value PUSHed.

POP and PUSH are useful for transferring data values between subroutines. They allow you to write a
subroutine with arbitrary variable names. Data transfers to and from the subroutine can be performed by
PUSH a nd POP, rather than by equating variable nam es.

RELATED

PUSH, LD@, ST@

E R R O R

A - S T A C K

No variable on the stack when the POP instruction executed.

EXAMPLE

100 FOR N=0 TO 7
110 PUSH AIN(N)
120 NEXT
130 FOR N=0 TO 7
140 POP A
150 PRINT A*.00214
160 NEXT

>run

0
0
0
0
0
.536
3.445
2.334