summaryrefslogtreecommitdiff
path: root/programs/sub-suite/shift_line.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-01-27 13:42:57 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2021-01-27 13:42:57 -0500
commitcd6982e5da1f5facdc1e0154b3a27c01e8b076c9 (patch)
treec8db5ade59d054c6f88ff2ab2cb99df45b250fad /programs/sub-suite/shift_line.c
parent1700d8d10453ffe046438de0e6fbd496def915a1 (diff)
- Fixed some bugs in the emulator.
- Started work on implementing the Super VIA emulation. - Added support for disabling disassembly per instruction, when in debug mode. - Did some more work on rewriting the SuB Suite to work with the new calling convention. - Rewrote the symbol handling code in the emulator's assembler, to make it both simpler, and to add support for arbitrarily deep symbol scopes. - Added support for arbitrarily deep local symbol scopes. For example, to declare a symbol of depth 2, you add two '@' characters to the start of the symbol name. In other words, the number of '@' characters before the symbol name is what determines the scope of that symbol. And to use a symbol thats outside the current scope, you would use the same syntax as using a struct member, so you would do `global.local`.
Diffstat (limited to 'programs/sub-suite/shift_line.c')
-rw-r--r--programs/sub-suite/shift_line.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/programs/sub-suite/shift_line.c b/programs/sub-suite/shift_line.c
index 255d21b..365666b 100644
--- a/programs/sub-suite/shift_line.c
+++ b/programs/sub-suite/shift_line.c
@@ -24,6 +24,12 @@ uint8_t bitpos(unsigned int row, uint8_t *mask) {
}
+uint8_t getbit(unsigned int row, unsigned int offset) {
+ uint8_t mask;
+ uint8_t byte = bitpos(row+offset, &mask);
+ return (bitabl[byte] & mask);
+}
+
void setbit(unsigned int row) {
uint8_t mask;
uint8_t byte = bitpos(row, &mask);
@@ -48,7 +54,7 @@ void shift_line(char *str, int cursor, int left) {
if (left) {
int i = end-1;
int j = end;
- for (; i > cursor; i--, j--) {
+ for (; i >= cursor; i--, j--) {
if (i < 0) {
i = 0;
str[i] = 0;
@@ -72,7 +78,7 @@ void shift_line(char *str, int cursor, int left) {
str[i] = 0;
}
end = find_end(str, i);
- if ((end % maxcol) == 0 && (end/maxcol) > scr_row) {
+ if (((end-1) % maxcol) == 0 && ((end-1)/maxcol) > scr_row) {
clrbit(end/maxcol);
}
}