Recent Changes - Search:
Email iofreak@yahoo.com with comments and/or suggestions.

Aibo General

Aibo Development

Wiki Help

Aibo Links

R-Code » Stack

Stack Statements

Perform stack related operations.

Models

ERS-210 ERS-220 ERS-31x ERS-7

OperationSyntaxDescription
Copy to stackPUSH:varCopy the specified variable or constant value and place on the top of the stack.
Remove from stackPOP[:var]Move the value on the top of the stack to a variable. If a variable name is ommited, the value at the top of the stack is discarded.
Clone stack topDUPCopy the topmost stack value and PUSH it back onto the stack.
Jump on TrueJT:labelPOP value from the stack top, if the value is true (1), then jump to the specified label.
Jump on FalseJF:labelPOP value from the stack top, if the value is false (0), then jump to the specified label.

Stack statement syntax has the following parts:

PartDescription
varThe user defined Variable name.
labelThe user defined label to jump to.

Example(s)


   LOCAL:x   // declare a local variable x
   LET:x:1   // x = 1
   PUSH:10   // place 10 on the stack
   PUSH:x    // place the value of x on the stack
   MUL       // stack value is now x * 10
   PUSH:1    // place 1 on the stack 
   ADD       // stack value is now 10 + 1
   POP:x     // x = top of stack
   PRINT:"x = %d":x // output x = 11
 

Remarks

Stack operations cannot cross subroutine/scope boundaries.

Edit - History - Print - Recent Changes - Search - Site Terms of Use
Page last modified on February 07, 2006, at 08:54 PM CST