msp4th: shorten names
authorDan White <dan@whiteaudio.com>
Sat, 11 May 2013 01:48:44 +0000 (20:48 -0500)
committerDan White <dan@whiteaudio.com>
Sat, 11 May 2013 01:48:44 +0000 (20:48 -0500)
msp4th/main.c
msp4th/msp4th.c
msp4th/msp4th.h
msp4th/test4th.c

index aa7672cf9a28906f626d95e41d6aa34cbe2031a1..02b876d08788f6e05215455d996cca33db3e44e8 100644 (file)
@@ -123,8 +123,8 @@ struct msp4th_config __attribute__ ((section(".noinit"))) default_config;
 
 static __inline__ void setup_default_msp4th(void)
 {
-    default_config.mathStackStartAddress = &mathStackArray[MATH_STACK_SIZE - 1];
-    default_config.addrStackStartAddress = &addrStackArray[ADDR_STACK_SIZE - 1];
+    default_config.mathStackStart = &mathStackArray[MATH_STACK_SIZE - 1];
+    default_config.addrStackStart = &addrStackArray[ADDR_STACK_SIZE - 1];
     default_config.prog = &progArray[0];
     default_config.progOpcodes = &progOpcodesArray[0];
     default_config.cmdList = &cmdListArray[0];
index 27232bdb1bd011e6220368c124610d6e8bad5ecb..9ed7b542f9e3d49872b95ff34e2ffbc516f95a6e 100644 (file)
@@ -336,8 +336,8 @@ int16_t *mathStackPtr;
 int16_t *addrStackPtr;
 #endif
 
-int16_t *mathStackStartAddress;
-int16_t *addrStackStartAddress;
+int16_t *mathStackStart;
+int16_t *addrStackStart;
 
 int16_t *prog;          // user programs (opcodes) are placed here
 
@@ -521,7 +521,7 @@ int16_t popMathStack(void)
     i = *mathStackPtr;
 
     // prevent stack under-flow
-    if (mathStackPtr < mathStackStartAddress) {
+    if (mathStackPtr < mathStackStart) {
         mathStackPtr++;
     }
 
@@ -1076,7 +1076,7 @@ void execN(int16_t opcode){
       break;    
 
     case 27: // depth  ( -- n ) \ math stack depth
-      pushMathStack(mathStackStartAddress - mathStackPtr);
+      pushMathStack(mathStackStart - mathStackPtr);
       break;
       
     case 28: // .h  ( a -- )
@@ -1333,7 +1333,7 @@ void execN(int16_t opcode){
     case 72: // s.  ( -- ) \ print stack contents, TOS on right
       { // addr is strictly local to this block
           int16_t *addr;
-          addr = mathStackStartAddress;
+          addr = mathStackStart;
           while (addr >= mathStackPtr) {
               printNumber(*addr);
               addr--;
@@ -1344,7 +1344,7 @@ void execN(int16_t opcode){
     case 73: // sh.  ( -- ) \ print stack contents in hex, TOS on right
       { // addr is strictly local to this block
           int16_t *addr;
-          addr = mathStackStartAddress;
+          addr = mathStackStart;
           while (addr >= mathStackPtr) {
               printHexWord(*addr);
               msp4th_putchar(' ');
@@ -1380,10 +1380,10 @@ void msp4th_init(struct msp4th_config *c)
      * Changing the values in the msp4th_* locations and calling
      * init_msp4th() again restarts the interpreter with the new layout;
      */
-    mathStackPtr = c->mathStackStartAddress;
-    addrStackPtr = c->addrStackStartAddress;
-    mathStackStartAddress = c->mathStackStartAddress;
-    addrStackStartAddress = c->addrStackStartAddress;
+    mathStackPtr = c->mathStackStart;
+    addrStackPtr = c->addrStackStart;
+    mathStackStart = c->mathStackStart;
+    addrStackStart = c->addrStackStart;
     prog = c->prog;
     progOpcodes = c->progOpcodes;
     cmdList = c->cmdList;
index ce777a353a2ac44f7e8bbb1c57a180500e0c57d4..f7a0f4b86cdff81ecbc7f4c21b5a09d7193a86d5 100644 (file)
@@ -7,8 +7,8 @@
  */
 
 struct msp4th_config {
-    int16_t *mathStackStartAddress;
-    int16_t *addrStackStartAddress;
+    int16_t *mathStackStart;
+    int16_t *addrStackStart;
     int16_t *prog;
     int16_t *progOpcodes;
     uint8_t *cmdList;
index 825a95a7bf03ac7972cffc73bc3649c02b9ca544..c7e539075c793c791021cf9bda25c1466dbd48a8 100644 (file)
@@ -27,22 +27,8 @@ uint8_t cmdListArray[CMD_LIST_SIZE];
 uint8_t lineBufferArray[CMD_LIST_SIZE];
 uint8_t wordBufferArray[CMD_LIST_SIZE];
 
-struct msp4th_config default_config;
+struct msp4th_config config;
 
-/*
-int16_t *msp4th_mathStackStartAddress;
-int16_t *msp4th_addrStackStartAddress;
-int16_t *msp4th_prog;
-int16_t *msp4th_progOpcodes;
-uint8_t *msp4th_cmdList;
-uint8_t *msp4th_lineBuffer;
-int16_t msp4th_lineBufferLength;
-uint8_t *msp4th_wordBuffer;
-int16_t msp4th_wordBufferLength;
-*/
-
-//void (*msp4th_putchar)(uint8_t);
-//uint8_t (*msp4th_getchar)(void);
 
 
 
@@ -64,17 +50,17 @@ void config_msp4th(void)
 {
     int16_t i;
 
-    default_config.mathStackStartAddress = &mathStackArray[MATH_STACK_SIZE - 1];
-    default_config.addrStackStartAddress = &addrStackArray[ADDR_STACK_SIZE - 1];
-    default_config.prog = &progArray[0];
-    default_config.progOpcodes = &progOpcodesArray[0];
-    default_config.cmdList = &cmdListArray[0];
-    default_config.lineBuffer = &lineBufferArray[0];
-    default_config.lineBufferLength = LINE_BUFFER_SIZE;
-    default_config.wordBuffer = &wordBufferArray[0];
-    default_config.wordBufferLength = WORD_BUFFER_SIZE;
-    default_config.putchar = &my_putchar;
-    default_config.getchar = &my_getchar;
+    config.mathStackStart = &mathStackArray[MATH_STACK_SIZE - 1];
+    config.addrStackStart = &addrStackArray[ADDR_STACK_SIZE - 1];
+    config.prog = &progArray[0];
+    config.progOpcodes = &progOpcodesArray[0];
+    config.cmdList = &cmdListArray[0];
+    config.lineBuffer = &lineBufferArray[0];
+    config.lineBufferLength = LINE_BUFFER_SIZE;
+    config.wordBuffer = &wordBufferArray[0];
+    config.wordBufferLength = WORD_BUFFER_SIZE;
+    config.putchar = &my_putchar;
+    config.getchar = &my_getchar;
 
     // terminate the strings
     lineBufferArray[0] = 0;
@@ -98,7 +84,7 @@ int main(void)
 {
     config_msp4th();
 
-    msp4th_init(&default_config);
+    msp4th_init(&config);
     msp4th_processLoop();
 
     return 0;