0100000010110010
0011000101101110
0100010001011010
+0100001110000010
+0100000001100010
0100001111000010
0100001110100100
0100001111000010
-0100010000100100
-0100001111000010
0100001100100100
0100000000111111
0100010001000100
0100111101001011
1001001110000010
0100000000001100
-0010010000010100
+0010010000011100
1001001001111111
0010000000001111
1001001000011001
0100000000000010
0101001110110010
0100000000001010
-0011110000101000
+0011110000100110
0100101101001111
0001001010010010
0100000000000010
1001000001111011
0000000000001101
+0010000000001000
+0100000001111111
+0000000000001010
+0001001010010010
+0100000000000010
+0011110000001100
+1001000001111111
+0000000000001101
0010010000001001
1001000001111011
0000000000001010
0101001100111111
1001111110000010
0100000000001010
-0011100000001011
-1001001110000010
-0100000000001100
-0010010000000110
-0100000001111111
-0000000000001010
-0001001010010010
-0100000000000010
+0011100000000001
0100001100001010
-0011110000000010
-0100001000011010
-0100000000001100
0100001000011111
0100000000001010
0100001000011110
0100001111001111
0000000000000000
1001001100001010
-0010001110111111
+0010001111000001
0100101010000010
0100000000001010
0100000100111001
0100000000001010
0100000100110000
0001001000001011
-0001001010110000
-0011001011001000
0100000001111011
0000000000100000
-0011110000000010
0001001010110000
-0011001011001000
+0011001011000100
1001111101001011
0010111111111100
0100000100111011
0100000100110000
0001001010110000
-0011001011001000
+0011001011000100
1001000001111111
0000000000101001
0010001111111011
0001001010110000
-0011001011110110
+0011001011110010
0100000100110000
0001001000001011
0001001000001010
0011110000000101
0001001010110000
-0011001100001110
+0011001100000100
0011110000000100
0001001010110000
0011001000001110
0001001010110000
-0011001011110110
+0011001011110010
1001000001111111
0000000000101000
0010011111110110
0100001111001111
0000000000000000
0001001010110000
-0011001011001000
+0011001011000100
1001111101001010
0010110000000011
1001001000011011
0011110011001110
0100101000001111
0001001010110000
-0011001110110100
+0011001110101010
0100111100001001
1001001100001111
0010010000000011
0011110111111110
0100101000001111
0001001010110000
-0011001110110100
+0011001110101010
0100111100001011
1001100100001111
0010010000000011
0100000000011110
0100101000001111
0001001010110000
-0011001110110100
+0011001110101010
1001101100001111
0010010000000011
0001001010110000
-0011001110010100
+0011001110001010
0100001100011111
0001001010110000
-0011001110010100
+0011001110001010
0100000100111001
0100000100111010
0100000100111011
0001001000001011
0001001000001010
0001001010110000
-0011001110001000
+0011001101111110
1001000000111111
0100111000100000
0011100000000101
0011110000000001
0100001100011011
0001001010110000
-0011001110010100
+0011001110001010
0100101100001111
0001001010110000
-0011001110010100
+0011001110001010
0100000100111010
0100000100111011
0100000100110000
1001001100011111
0010010000000100
0001001010110000
-0011001110001000
+0011001101111110
1001001100001111
0010000000000010
0100101110000010
0101110000101101
0100110110001100
0000000000000000
-1001001100001111
-0011100000000101
+1001001100011111
+0011100000000100
1001011100011101
0000000000000100
-0011010000000111
+0011010000001001
+0011110000000101
1001001100001111
-0010000000000011
-1001110110001110
+0010010000000110
+1001110110000111
0000000000000100
-0011010000000010
+0011010000000011
0100111010100010
0100000000011100
0100000100110000
+0100111000000111
+0101000000110111
+0000000000000110
+0100000100110000
0100011000001110
0101111100001111
0101011000001111
0100111010000010
0100000000011100
0001001010110000
-0011001110010100
+0011001110001010
0100000100110000
0100001100001101
0011110000000111
0100001000011111
0100000000000110
0001001010110000
-0011001110110100
+0011001110101010
0101111100001111
0101001000011111
0100000000100000
1000011010100110
0000000000000010
0001001010110000
-0011001110001000
+0011001101111110
0100000000110000
0011110000011110
1100001000110010
0100000000110000
0011110000011110
0001001010110000
-0011001110001000
+0011001101111110
0001001010110000
0011011010100100
0100000000110000
0100000000110000
0011110000011110
0001001010110000
-0011001110001000
+0011001101111110
0100011000001110
1001111110000110
0000000000000000
0011010000010000
0011110000001011
0001001010110000
-0011001110001000
+0011001101111110
0100011000001110
1001011000101111
0011010000001010
0011110000000101
0001001010110000
-0011001110001000
+0011001101111110
0100011000001110
1001011000101111
0010000000000100
0100000000110000
0011110000011110
0001001010110000
-0011001110001000
+0011001101111110
0001001010110000
0011011100110000
0011110001110010
0001001010110000
-0011001100011110
+0011001100010100
0100000000110000
0011110000011110
0001001010110000
0101001000011011
0100000000001000
0001001010110000
-0011001110001000
+0011001101111110
0100111110001011
0000000000000000
0101001100011010
0100000000110000
0011110000011110
0001001010110000
-0011001110001000
+0011001101111110
0100111100001011
0001001010110000
-0011001110001000
+0011001101111110
0100101100001110
0101111000001110
0101001000011110
0100000000110000
0011110000011110
0001001010110000
-0011001101101110
+0011001101100100
0100000000110000
0011110000011110
0100001100001111
0100000000011100
0011110001111001
0001001010110000
-0011001110011100
+0011001110010010
0100111100001011
0001001010110000
-0011001110001000
+0011001101111110
1001001100001111
0010010000000010
0100000000110000
0001000000001110
0100111000001111
0001001010110000
-0011001110010100
+0011001110001010
0100000000110000
0011110000011110
0001001010110000
-0011001110001000
+0011001101111110
0001001010110000
0011011101001110
0100000001111111
0100000000110000
0011110000011110
0001001010110000
-0011010011110100
+0011010011101010
0100000000110000
0011110000011110
0100001100001111
0011111111101100
0100001100011111
0001001010110000
-0011010110100110
+0011010110011100
0100000000110000
0011110000011110
0001001010110000
0100000000110000
0011110000011110
0001001010110000
-0011010000001100
+0011010000000010
0100000000110000
0011110000011110
0001001010110000
0100001000011011
0100000000000010
0001001010110000
-0011001110001000
+0011001101111110
0001001010001011
0011110100001011
0001001010110000
-0011001110011100
+0011001110010010
0100111110000010
0100000000011100
0011110100000110
0000000000000000
0011110100000000
0001001010110000
-0011001110001000
+0011001101111110
0100111100001011
0001001010110000
-0011001110001000
+0011001101111110
0100101100001110
1111000000111110
1111111111111110
0100000000100010
0011111110110100
0001001010110000
-0011001110001000
+0011001101111110
0100111100001010
0001001010110000
-0011001110001000
+0011001101111110
0100001000011011
0100000000011100
0001001010110000
-0011001110100010
+0011001110011000
0100101000001111
0001001010110000
-0011001110100010
+0011001110011000
0100101100001111
0001001010110000
-0011001110100010
+0011001110011000
0011110011100100
0100001100011111
0011110000000010
0001001010110000
-0011001110001000
+0011001101111110
0001001010110000
-0011010111100000
+0011010111010110
0011110011011101
0100011100011111
0000000000000010
0011111011001111
1100001000110010
0001001010110000
-0011001110001000
+0011001101111110
0100111110000010
0000000100110010
0100011010010010
0011111110001010
0100110000001011
0001001010110000
-0011001110001000
+0011001101111110
0100101110000110
0000000000000000
0011110010101001
0000000000000011
0000000000000000
0001001010110000
-0011001110101010
+0011001110100000
0011110001100001
0001000010000110
0011110001011111
0001001010110000
-0011001110001000
+0011001101111110
0100111100001011
0001001010110000
-0011001110001000
+0011001101111110
0100101100001110
0101111000001110
0101111110001110
0000000000000000
0011110001010101
0001001010110000
-0011001110001000
+0011001101111110
0001001010110000
0011011000001000
0011110001010000
0001001010110000
-0011001110001000
+0011001101111110
0101111100001111
0101011000001111
0100111100101111
0000000000000010
0100011000101111
0001001010110000
-0011001110010100
+0011001110001010
0100011010100110
0000000000000100
0100101110000110
0000000000000010
0011110001000000
0001001010110000
-0011001110001000
+0011001101111110
0100011000001110
1001111110000110
0000000000000000
0011010000111010
0011110000000101
0001001010110000
-0011001110001000
+0011001101111110
0100011000001110
1001011000101111
0011010000110100
0000000000000000
0011110000010011
0001001010110000
-0011001110001000
+0011001101111110
0100111110000010
0100000000001100
0011110000001110
0100001111001111
0000000000000000
0001001010110000
-0011001110001000
+0011001101111110
0001001010110000
0011000110100000
0011110000000101
0001001010110000
-0011010001100010
+0011010001011000
0011110000000010
0001001010110000
-0011010011011010
+0011010011010000
0100000100111000
0100000100111001
0100000100111010
0100000100110000
0001001000001011
0001001010110000
-0011001110001000
+0011001101111110
0100111100001011
1001000000111111
0100111000100000
0100001000011111
0100000000011100
0001001010110000
-0011001110100010
+0011001110011000
0101101100001011
0101000000111011
1110111111101000
0100001000011111
0100000000011100
0001001010110000
-0011001110100010
+0011001110011000
0101101100001011
0101001000011011
0100000000100000
0011011101100100
0011110000001000
0001001010110000
-0011001110100010
+0011001110011000
0100101100001111
0101111100001111
0101001000011111
s += '\r'
for n in (pc, atoi):
- #for n in (pc, ):
send(n, s)
- if s.startswith('bye'):
- #things don't match after this
- break
prompt(n)
- if 0:
- print
- print 's :', s.rstrip()
- print 'pc :', pc.before
- print 'atoi:', atoi.before
-
print_side(atoi.before, pc.before)
default_config.getchar = &uart_getchar;
default_config.puts = &uart_puts;
+ // stack top is zero
+ mathStackArray[MATH_STACK_SIZE - 1] = 0;
+
// terminate the strings
lineBufferArray[0] = 0;
- wordBufferArray[0] = 0;
+ //wordBufferArray[0] = 0;
cmdListArray[0] =0;
/* The following allow re-configuring the location/size of all configurable
* arrays. Then the stack sizes and user program space sizes can be
- * (re-)specified by changing the table and calling init_msp4th() again. See
+ * (re-)specified by changing the table and calling msp4th_init() again. See
* test430.c for a configuration example.
*
* THE ONLY BOUNDARY CHECKS ARE:
* table locations.
*
* Changing the values in the msp4th_* locations and calling
- * init_msp4th() again restarts the interpreter with the new layout;
+ * msp4th_init() again restarts the interpreter with the new layout;
*/
mathStackPtr = c->mathStackStart;
addrStackPtr = c->addrStackStart;
{
uint8_t c;
- c = getKeyB();
- while (c <= ' ') {
+ do {
c = getKeyB();
- }
+ } while (c <= ' ');
return (c);
}
{
uint8_t c;
- c = getKeyB();
- while (c != ')') {
+ do {
c = getKeyB();
- }
+ } while (c != ')');
c = nextPrintableChar();
#define k ANOS // count
#define m ASTACK(2) // limit
- ANOS += n; // inc/dec the count
+ k += n; // inc/dec the count
- if ( ! ( ((n >= 0) && (k >= m))
- || ((n <= 0) && (k <= m)))) {
+ if (((n > 0) && (k < m)) || ((n < 0) && (k > m))) {
// loop
progCounter = j;
} else {
// done, cleanup
- popAddrStack();
- popAddrStack();
- popAddrStack();
+ addrStackPtr += 3;
}
#undef j
#undef k
+/*
+ * msp4th settings
+ */
#define MATH_STACK_SIZE 32
#define ADDR_STACK_SIZE 64
-#define CMD_LIST_SIZE 128
-#define PROG_SPACE 256
-#define USR_OPCODE_SIZE 32
+
+//total length of all user programs in opcodes
+#define USER_PROG_SIZE 256
+
+//max number of user-defined words
+#define USER_OPCODE_MAPPING_SIZE 32
+
+//total string length of all word names (+ 1x<space> each)
+#define USER_CMD_LIST_SIZE 128
+
+//maximum input line length
#define LINE_BUFFER_SIZE 128
+
+//maximum word character width
#define WORD_BUFFER_SIZE 32
*/
int16_t mathStackArray[MATH_STACK_SIZE];
int16_t addrStackArray[ADDR_STACK_SIZE];
-int16_t progArray[USR_OPCODE_SIZE];
-int16_t progOpcodesArray[USR_OPCODE_SIZE];
-uint8_t cmdListArray[CMD_LIST_SIZE];
-uint8_t lineBufferArray[CMD_LIST_SIZE];
-uint8_t wordBufferArray[CMD_LIST_SIZE];
+int16_t progArray[USER_PROG_SIZE];
+int16_t progOpcodesArray[USER_OPCODE_MAPPING_SIZE];
+uint8_t cmdListArray[USER_CMD_LIST_SIZE];
+uint8_t lineBufferArray[LINE_BUFFER_SIZE];
+uint8_t wordBufferArray[WORD_BUFFER_SIZE];
struct msp4th_config config;
config.getchar = &my_getchar;
config.puts = &my_puts;
+ // stack top is zero
+ mathStackArray[MATH_STACK_SIZE - 1] = 0;
+
// terminate the strings
lineBufferArray[0] = 0;
- wordBufferArray[0] = 0;
+ //wordBufferArray[0] = 0;
cmdListArray[0] = 0;