diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2023-03-09 15:45:39 -0500 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2023-03-09 15:45:39 -0500 |
commit | 967775313dbe04b40f5b70fcfdab02c573f3b57b (patch) | |
tree | c7a51d82e256b5e29ccb0dd5de1a47ca15bd39bf /alee-msp430.cpp | |
parent | 970bbb473c81975d3c7366260c8228fd4fcc8c4d (diff) |
add cppcheck and test targets; some code size reductions
Diffstat (limited to 'alee-msp430.cpp')
-rw-r--r-- | alee-msp430.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/alee-msp430.cpp b/alee-msp430.cpp index 86582a1..e9fe19d 100644 --- a/alee-msp430.cpp +++ b/alee-msp430.cpp @@ -19,6 +19,7 @@ #include "alee.hpp" #include "splitmemdict.hpp" +#include <cctype> #include <msp430.h> #include "core.fth.h" @@ -95,16 +96,14 @@ int main() static void readchar(State& state) { - auto len = state.dict.read(Dictionary::Input); - Addr addr = Dictionary::Input + sizeof(Cell) + - Dictionary::InputCells - len - 1; - - for (Cell i = 0; i < len; ++i, ++addr) - state.dict.writebyte(addr, state.dict.readbyte(addr + 1)); + auto idx = state.dict.read(Dictionary::Input); + Addr addr = Dictionary::Input + sizeof(Cell) + idx; while (!(IFG2 & UCA0RXIFG)); - state.dict.writebyte(addr, UCA0RXBUF); - state.dict.write(Dictionary::Input, len + 1); + auto c = UCA0RXBUF; + if (isupper(c)) + c += 32; + state.dict.writebyte(addr, c ? c : ' '); } void serput(int c) |