msp4th: no special (redundant) str_t type, cleanup
authorDan White <dan@whiteaudio.com>
Wed, 8 May 2013 21:21:16 +0000 (16:21 -0500)
committerDan White <dan@whiteaudio.com>
Wed, 8 May 2013 21:21:16 +0000 (16:21 -0500)
msp4th/msp4th.c
msp4th/ns430-uart.c
msp4th/ns430.h
ns430-uart.h

index 0d542e6fdcdd2fed392e506b3c31124dc4904eac..21dfc0fdce674966a562c70fe4ecf202f942ebce 100644 (file)
@@ -28,7 +28,6 @@
 #else
 // mixins to test msp4th on PC
 #include <stdint.h>
-typedef uint8_t str_t;
 #endif
 
 
@@ -310,15 +309,13 @@ const int16_t progBi[] = { // address actually start at 10000
 // our "special" pointer, direct word access to all address space
 volatile int16_t *dirMemory;
 
-// set to 1 to kill program
-int16_t xit;
+int16_t xit; // set to 1 to kill program
 
 uint16_t progCounter;
 
 uint8_t lineBuffer[LINE_SIZE];      /* input line buffer */
-uint16_t lineBufferIdx;             /* input line buffer pointer */
-
-uint8_t wordBuffer[WORD_SIZE];      // just get a word
+uint16_t lineBufferIdx;             /* input line buffer index */
+uint8_t wordBuffer[WORD_SIZE];      /* holds the currently-parsed word */
 
 
 
@@ -354,18 +351,6 @@ uint16_t cmdListIdx;    // next open space for user word strings
 
 
 
-
-static int16_t RAMerrors(void){
-    int16_t errors;
-#if defined(MSP430)
-    __asm__ __volatile__ ( "mov r9, %0\n" : [res] "=r" (errors));
-#else
-    errors = 0;
-#endif
-    return errors;
-}
-
-
 void msp4th_puts(uint8_t *s)
 {
     uint16_t i = 0;
@@ -380,7 +365,8 @@ void msp4th_puts(uint8_t *s)
 }
 
 
-uint8_t getKeyB(){
+uint8_t getKeyB()
+{
     uint8_t c;
 
     c = lineBuffer[lineBufferIdx++];
@@ -504,9 +490,9 @@ void getWord(void)
 
 void listFunction()
 {
-    msp4th_puts((str_t *)cmdListBi);
-    msp4th_puts((str_t *)cmdListBi2);
-    msp4th_puts((str_t *)cmdList);
+    msp4th_puts((uint8_t *)cmdListBi);
+    msp4th_puts((uint8_t *)cmdListBi2);
+    msp4th_puts((uint8_t *)cmdList);
 }
 
 
@@ -567,12 +553,15 @@ void ndropFunc(void)
 }
 
 
-int16_t lookupToken(uint8_t *x, uint8_t *l){    // looking for x in l
+int16_t lookupToken(uint8_t *x, uint8_t *l) // looking for x in l
+{
   int16_t i,j,k,n;
+
+  i = 0;
   j = 0;
   k = 0;
-  n=1;
-  i=0;
+  n = 1;
+
   while(l[i] != 0){
     if(x[j] != 0){   
       // we expect the next char to match
@@ -613,7 +602,8 @@ int16_t lookupToken(uint8_t *x, uint8_t *l){    // looking for x in l
 }
 
 
-void luFunc(){
+void luFunc()
+{
   int16_t i;
   
   i = lookupToken(wordBuffer, (uint8_t *)cmdListBi);
@@ -992,8 +982,7 @@ void execN(int16_t opcode){
       }
       break;    
 
-    case 27: // eram  ( -- nRAMerrors )
-      pushMathStack(RAMerrors());
+    case 27: // eram  ( -- ) \ UNUSED NOP
       break;
       
     case 28: // .h  ( a -- )
@@ -1036,7 +1025,7 @@ void execN(int16_t opcode){
       break;
 
     case 38: // pwrd  ( -- ) \ print word buffer
-      msp4th_puts((str_t *)wordBuffer);
+      msp4th_puts((uint8_t *)wordBuffer);
       break;
 
     case 39: // emit  ( c -- )
index 439f135324b4afdce3292a4d9684a4c21a65df1f..c6649cbac0c96a61238af02611b62fba8f250027 100644 (file)
@@ -24,7 +24,7 @@ uint8_t uart_getchar(void)
 } 
 
 
-void uart_puts(str_t *s)
+void uart_puts(uint8_t *s)
 {
     uint16_t i = 0;
     uint8_t c = 1;
index 712f1d66c3baa16f5a6b4ab4c5c6502a7db0b852..dffdeb536576b96b82e14c6a80de6815e6a0e48c 100644 (file)
@@ -8,6 +8,4 @@ typedef signed int int16_t;
 typedef unsigned long uint32_t;
 typedef signed long int32_t;
 
-typedef __attribute__((aligned (2))) uint8_t str_t;
-
 #endif
index 1dd5478cea8026eec42f8fa168f21eb3829bfbb1..deef0a412a79f4fd9429b2cb67aaf873281a0006 100644 (file)
@@ -34,7 +34,7 @@
 
 void uart_putchar(uint8_t c);
 uint8_t uart_getchar(void);
-void uart_puts(str_t *s);
+void uart_puts(uint8_t *s);
 
 
 #endif