Package edu.cornell.cs.sam.core.instructions

Interface Summary
Instruction Interface for an instruction to be executed
 

Class Summary
SAM_ADD Adds two locations on the stack, taking into account type promotion to MA or PA.
SAM_ADDF Adds two floating point numbers on the stack
SAM_ADDSP Adds an integer to the stack pointer
SAM_AND Performs a logical AND on two stack locations
SAM_BITAND Performs bitwise AND on two stack locations
SAM_BITNAND Performs a bitwise NAND on two stack locations
SAM_BITNOR Performs bitwise NOR on two locations on the stack
SAM_BITNOT Performs bitwise negation on the top of the stack
SAM_BITOR Performs bitwise OR on two locations of the stack
SAM_BITXOR Performs bitwise XOR on two locations of the stack
SAM_CMP Compares two integers, and places -1, 0, or 1 on the stack if the first is respectively smaller, equal, or larger than the second (top)
SAM_CMPF Compares two floating pointer numbers, and places -1, 0, or 1 on the stack if the first is respectively smaller, equal, or larger than the second (top)
SAM_DIV Divides two integers on the stack
SAM_DIVF Divides two floating point numbers.
SAM_DUP Duplicates the top stack value
SAM_EQUAL Checks if two values are equal
SAM_FREE Deallocates the given address, which was allocated by SAM_MALLOC
SAM_FTOI Converts a floating point value to an integer by truncating
SAM_FTOIR Converts a floating point number to an integer by rounding.
SAM_GREATER Checks if the bottom integer is greater than the top integer
SAM_ISNEG Checks if an integer is negative
SAM_ISNIL Checks if a value is zero
SAM_ISPOS Checks if an integer is positive
SAM_ITOF Converts an integer to a floating point number
SAM_JSR Jumps to the opcode address, saving the old PC
SAM_JSRIND Jumps to the address on top of the stack, saving the old PC.
SAM_JUMP Jumps to the opcode address
SAM_JUMPC Jumps to the opcode address if the top of the stack is true (nonzero)
SAM_JUMPIND Jumps to the address on top of the stack
SAM_LESS Checks if the bottom integer is smaller than the top integer
SAM_LINK Sets the FBR to the current SP, saving the old FBR on the stack
SAM_LSHIFT Shifts an integer op bits to the left
SAM_LSHIFTIND Shifts left the integer below the top of the stack as many bits as specified by the top of the stack
SAM_MALLOC Allocates the requested memory space on the heap and pushes the resulting address on the stack
SAM_MOD Performs modulus on two integers
SAM_NAND Performs logical NAND on two integers
SAM_NOR Performs logical NOR on two integers
SAM_NOT Negates an integer (logical NOT)
SAM_OR Performs logical OR on two integers
SAM_POPFBR Pops the FBR off the stack
SAM_POPSP Restores the SP to the top value on the stack
SAM_PUSHABS Pushes the value at the operand address on the stack
SAM_PUSHFBR Pushes the FBR on the stack
SAM_PUSHIMM Pushes the operand integer on the stack
SAM_PUSHIMMCH Pushes the operand character on the stack
SAM_PUSHIMMF Pushes the operand floating point number on the stack
SAM_PUSHIMMMA Pushes the operand memory address on the stack
SAM_PUSHIMMPA Pushes the operand program address on the stack
SAM_PUSHIMMSTR Pushes the operand string on the heap, and store its address on the stack
SAM_PUSHIND Pushes the value at the address on top of the stack
SAM_PUSHOFF Pushes the value at the operand offset from the FBR on top of the stack
SAM_PUSHSP Save the stack pointer on the stack
SAM_READ Reads an integer from the video interface, and pushes that on the stack
SAM_READCH Reads a character from the video interface, and pushes it on the stack
SAM_READF Reads a floating point number from the video interface, and pushes that on the stack
SAM_READSTR Reads a string from the video interface, stores that on the heap, and places its address on the stack
SAM_RSHIFT Shifts an integer op bits to the right
SAM_RSHIFTIND Shifts right the integer below the top of the stack as many bits as specified by the top of the stack
SAM_RST Resets execution to the address on top of the stack
SAM_SKIP Pops a number off the stack, and skips that many instructions
SAM_STOP Stops execution
SAM_STOREABS Stores the value on top of the stack at the operand address
SAM_STOREIND Stores the value on top of the stack at the address stored below it
SAM_STOREOFF Stores the value on top of the stack at the operand offset from the FBR
SAM_SUB Subtracts the top of the stack from the bottom, taking into account type promotion to MA or PA
SAM_SUBF Subtracts two floating point numbers
SAM_SWAP Swaps the top two values of the stack
SAM_TIMES Multiplies two integers
SAM_TIMESF Multiplies two floating point numbers
SAM_UNLINK Restores the FBR from the stack
SAM_WRITE Pops an integer off the stack, and writes it to the video interface
SAM_WRITECH Pops a character off the stack, and writes it to the video interface
SAM_WRITEF Pops a floating point number off the stack and writes it to the video interface
SAM_WRITESTR Pops the address of a string off the stack, retrieves the string, and prints it on the video interface
SAM_XOR Performs logical XOR on two integers
SamAddressInstruction All instructions with a program address operand derive from this class.
SamCharInstruction All instructions with a character operand derive from this class
SamFloatInstruction All instructions with a floating point operand derive from this class
SamInstruction Base class for all SamInstructions Defines common features such as shortcut variables and methods, toString(), name, cpu/mem access, and an abstract exec().
SamIntInstruction All instructions with an integer operand are derived from this class.
SamStringInstruction All instructions with a String operand derive from this class