summaryrefslogtreecommitdiff
path: root/lexer.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-02-25 12:43:11 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2021-02-25 12:43:11 -0500
commit35a18609864470b3dc49f3a9a6cb6ec93e57300d (patch)
treec52364211b25723b2cf4595ed6c4bc2d45195062 /lexer.c
parent8d7f27d9a0b61d3694a62f3e54be885d8073f02b (diff)
- 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.
Diffstat (limited to 'lexer.c')
-rw-r--r--lexer.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lexer.c b/lexer.c
index f12feb3..2c618d2 100644
--- a/lexer.c
+++ b/lexer.c
@@ -700,11 +700,12 @@ int get_expr_type(char **p, uint64_t address, void *val, int *found_reg, char st
char *scope_name = NULL;
switch (ptok) {
- case PTOK_PLUS : type = EXPR_PLUS ; str++; break;
- case PTOK_MINUS: type = EXPR_MINUS; str++; break;
- case PTOK_PIPE : type = EXPR_OR ; str++; break;
- case PTOK_GT : type = (get_ptok(str[1], dbg) == PTOK_GT) ? (EXPR_RSHFT) : (EXPR_LOW) ; str += 2; break;
- case PTOK_LT : type = (get_ptok(str[1], dbg) == PTOK_LT) ? (EXPR_LSHFT) : (EXPR_HIGH); str += 2; break;
+ case PTOK_PLUS : type = EXPR_PLUS ; str++; break;
+ case PTOK_MINUS : type = EXPR_MINUS ; str++; break;
+ case PTOK_ASTRSK: type = EXPR_MUL ; str++; break;
+ case PTOK_PIPE : type = EXPR_OR ; str++; break;
+ case PTOK_GT : type = (get_ptok(str[1], dbg) == PTOK_GT) ? (EXPR_RSHFT) : (EXPR_LOW) ; str += 2; break;
+ case PTOK_LT : type = (get_ptok(str[1], dbg) == PTOK_LT) ? (EXPR_LSHFT) : (EXPR_HIGH); str += 2; break;
case PTOK_DOLLAR:
case PTOK_PERCENT:
case PTOK_NUMBER:
@@ -815,6 +816,7 @@ expr *parse_expr(char **line, uint64_t address, int *found_reg, int is_left, cha
break;
case EXPR_HIGH :
case EXPR_LOW : expr_type = 1; break;
+ case EXPR_MUL :
case EXPR_OR :
case EXPR_LSHFT :
case EXPR_RSHFT : expr_type = 2; break;
@@ -1062,6 +1064,7 @@ uint64_t lex(char *str, uint64_t address, uint16_t bline, uint8_t dbg) {
break;
case PTOK_PLUS:
case PTOK_MINUS:
+ case PTOK_ASTRSK:
case PTOK_GT:
case PTOK_LT:
case PTOK_PIPE: