lpereira/finf — pull request #2 by taylorrx (2013-01-14 00:27:14+00:00)
Title: Added new opcodes for variables, consts, EEPROM access, @, !, ?, etc...

Here are the opcodes added, with comments:

OP_AUTO, // stores a value in the first (0th) position in the EEPROM. On start of FINF,
// if that value == 1, assumes the text in the EEPROM is a program, and then loads and executes that text.
OP_RELAY, // add RELAY_BASE_PIN to the number on the stack in order to get the right pin number
OP_IN, // set pin to digital read
OP_OUT, // set pin to digital write
OP_ON, // turn digital pin on
OP_OFF, // turn digital pin off
OP_LED, // the LED pin number
OP_PWM, // set PWM on pin
OP_RESET, // reset the arduino board
OP_SAVE_TO_EEPROM, // reads text from Serial into the EEPROM. ^Z quits
OP_LOAD_FROM_EEPROM, // executes the text in the EEPROM. Text starts at the 1st postition.
// 0th positions indicates whether to autoload on device start.
OP_LIST_EEPROM, // outputs the text in the EEPROM to the serial device.
OP_ERASE_EEPROM, // erases all text in the EEPROM. Does this by putting a 0 in position 1. All other trxt is preserved.
OP_STORE, // ( value address "!" -- ) Implements the FORTH "!" opcode. Stores value in SRAM.
OP_FETCH, // ( address "@" -- memory-location-contents-as-int ) implements the FORTH "@" opcode. Pulls SRAM address-value to the stack.
OP_FETCH_AND_PRINT, // ( address "?" -- ) prints the value stored in an address
OP_VARIABLE, // ( "var or variable" varname -- ) creates a variable of name "varname". "var" or "variable" both execute this.
OP_EEPROM_STORE, // ( value eeprom-address "e!" -- ) stores an integer in an EEPROM address
OP_EEPROM_FETCH, // ( eeprom-address "e@" -- eeprom-address-contents ) gets the value of the EEPROM location, and puts it on the stack.
OP_EEPROM_FETCH_AND_PRINT, // ( eeprom-address "e?" -- ) prints the value at the given EEPROM address
OP_KEY, // waits for a keypress and stores the value on the stack
OP_STEPPER_MOTOR, // ( steps direction port 'step' -- ) run a stepper motor attached to an AdaFruit MShield
OP_DC_MOTOR, // ( speed direction port 'motor' -- ) run a DC motor attached to an AdaFruit MShield. Directions are 1,2, motors are 1-4.
OP_DC_MOTORS_FORWARD, // ( speed motor_bank 'forward' -- ) on an AdaFruit MShield, start both DC motors on the specified bank running so that a skid-steer two motor robot would move forward.
OP_DC_MOTORS_BACKWARD, // ( speed motor_bank 'back' -- ) on an AdaFruit MShield, start both DC motors on the specified bank running so that a skid-steer two motor robot would move backward.
OP_DC_MOTORS_TURN, // ( direction speed motor_bank 'turn' -- ) on an AdaFruit MShield, start both DC motors on the specified bank running so that a skid-steer two motor robot would turn in the specified direction.
OP_DC_MOTORS_STOP, // ( motor_bank 'stop' -- ) stop both motors attached to the specified bank of an AdaFruit MShield.
OP_GET_PAD_ADDRESS, // ( "pad" -- pad-address ) if area for the PAD has not been allocated, allocate PAD_LENGTH bytes. Return the location on the stack.
OP_DEFINE_CONST, // ( value "const" constname ) define a constant of value "value" and name "constname"
OP_READ_LINE, // ( memory-address max-length "readln" -- bytes-received ) read from the serial port into the memory locaiton specified,
// until max-length bytes are received, or carriage return or line feed are received.
OP_PRINT_MEMORY_STRING, // ( mwmory-address "print" -- ) prints the contents of a memory location to the serial port
OP_MOVE_MEMORY, // ( source-address target-address length "move" -- ) executes memmove
OP_GET_STRING_LENGTH, // ( memory-address "strlen" -- ) executes strlen