From 35a18609864470b3dc49f3a9a6cb6ec93e57300d Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Thu, 25 Feb 2021 12:43:11 -0500 Subject: - Implemented the multiply expression into the assembler. - Implemented support for the SIB addressing mode into the assembler. SIB is short for "Scale Index, and Base", and works much like x86's version of SIB (scale*index+base), although my version supports any scale value between 1, and 256. - Redid the line shifting routine in SuBEditor. It now uses memcpy, and memset to do that, and also supports shifting the line left, or right by any number of characters. --- programs/sub-suite/tmp-stuff/shift_line.c | 85 ------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 programs/sub-suite/tmp-stuff/shift_line.c (limited to 'programs/sub-suite/tmp-stuff/shift_line.c') diff --git a/programs/sub-suite/tmp-stuff/shift_line.c b/programs/sub-suite/tmp-stuff/shift_line.c deleted file mode 100644 index 365666b..0000000 --- a/programs/sub-suite/tmp-stuff/shift_line.c +++ /dev/null @@ -1,85 +0,0 @@ -#include - -const uint8_t bits[8] = { - 0x80, - 0x40, - 0x20, - 0x10, - 0x08, - 0x04, - 0x02, - 0x01 -}; - -int maxcol = 80; -int scr_str = 0; -int scr_row = 0; -int scr_col = 0; -uint8_t bitabl[16]; - -uint8_t bitpos(unsigned int row, uint8_t *mask) { - uint8_t bit = row & 7; - *mask = bits[bit]; - return row >> 3; - -} - -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); - bitabl[byte] |= mask; -} - -void clrbit(unsigned int row) { - uint8_t mask; - uint8_t byte = bitpos(row, &mask); - bitabl[byte] &= ~mask; -} - -int find_end(char *str, int start) { - int i; - for (i = start; str[i]; i++); - return i; -} - -void shift_line(char *str, int cursor, int left) { - /*int cursor = ((scr_row+scr_str)*maxcol)+scr_col;*/ - int end = find_end(str, cursor); - if (left) { - int i = end-1; - int j = end; - for (; i >= cursor; i--, j--) { - if (i < 0) { - i = 0; - str[i] = 0; - break; - } - str[j] = str[i]; - str[i] = 0; - - } - /*str[i+1] = (!str[i+1]) ? ' ' : str[i+1];*/ - end = find_end(str, i+2); - /*str[i+1] = (str[i+1] == ' ') ? 0 : str[i+1];*/ - if ((end/maxcol) > scr_row) { - setbit(end/maxcol); - } - } else { - int i = cursor; - int j = cursor-1; - for (; str[i]; i++, j++) { - str[j] = str[i]; - str[i] = 0; - } - end = find_end(str, i); - if (((end-1) % maxcol) == 0 && ((end-1)/maxcol) > scr_row) { - clrbit(end/maxcol); - } - } -} -- cgit v1.2.3-13-gbd6f