From: Dan White Date: Sat, 11 May 2013 01:48:44 +0000 (-0500) Subject: msp4th: shorten names X-Git-Tag: cheetah~90 X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=525df934d4de7a3ca8973e932435d4d0c8ce6502;p=430.git msp4th: shorten names --- diff --git a/msp4th/main.c b/msp4th/main.c index aa7672c..02b876d 100644 --- a/msp4th/main.c +++ b/msp4th/main.c @@ -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]; diff --git a/msp4th/msp4th.c b/msp4th/msp4th.c index 27232bd..9ed7b54 100644 --- a/msp4th/msp4th.c +++ b/msp4th/msp4th.c @@ -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; diff --git a/msp4th/msp4th.h b/msp4th/msp4th.h index ce777a3..f7a0f4b 100644 --- a/msp4th/msp4th.h +++ b/msp4th/msp4th.h @@ -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; diff --git a/msp4th/test4th.c b/msp4th/test4th.c index 825a95a..c7e5390 100644 --- a/msp4th/test4th.c +++ b/msp4th/test4th.c @@ -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;