< Futurebasic < Language < Reference

PUSH

statements

Syntax

PUSH(var)
PUSH {BYTE|WORD|LONG}(address&)

Description

These statements put 1, 2 or 4 bytes onto the CPU stack, and adjust the stack pointer by a corresponding amount. PUSH is the opposite of POP.

If you use the first syntax, the data is copied from var, which must be a variable. The number of bytes put onto the stack depends on the data type of var:

"Image Was Here"

(No other variable types are valid with PUSH(var).)

If you use the second syntax, the data is copied from the memory which begins at address&, which must be a long integer expression or a POINTER variable. The number of bytes put onto the stack depends on which keyword you use:

"Image Was Here"

In CPU68k compiles, PUSH always adjusts the stack pointer by an even number of bytes. If you use PUSH(byteVar) or PUSH BYTE(address&) in a CPU68k compile, the stack pointer will be adjusted by 2 bytes, even though only one byte is copied from byteVar or address&.

PUSH is meant for careful use by advanced programmers. Your system can crash if the stack pointer is not adjusted carefully.

See Also

POP

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.