From a232e9f691187fdb05c35c14d4152d17f4babaf5 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Tue, 8 Dec 2020 10:42:10 -0500 Subject: - Implemented support for the Orthogonal extension into both the assembler, and the emulator. I finally figured out how I could get support for the Ortho extension implemented into the old assembler. The only reason for doing this, is to buy me some while I start work on the new assembler, and to help me get an idea for how to do the same in the new assembler. --- lexer.c | 67 +++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 34 insertions(+), 33 deletions(-) (limited to 'lexer.c') diff --git a/lexer.c b/lexer.c index 873fe6d..bb3701a 100644 --- a/lexer.c +++ b/lexer.c @@ -844,8 +844,7 @@ uint64_t lex(char *str, uint64_t address, uint16_t bline, uint8_t dbg) { } } if (!isop) { - uint8_t spaces = 0; - if (l->tok && l->tok->type == TOK_ORTHO && l->tok->byte == SET) { + if (l->tok && l->tok->id == TOK_ORTHO && l->tok->byte == SET) { for (k = 0; k < 8; k++) { int upper = toupper(lexeme[0]); if (upper == set_cc[k][0]) { @@ -856,40 +855,42 @@ uint64_t lex(char *str, uint64_t address, uint16_t bline, uint8_t dbg) { } } } - } - for (; isdelm(str[i+spaces], dbg) == 16; spaces++); - uint8_t ret = get_ptok(str[i+spaces], dbg); - if (ret == PTOK_COLON || ret == PTOK_EQU) { - islocal = (lex_type == TOK_LOCAL); - } - lex_type = TOK_SYM; - l->count++; - t = make_token(lex_type, islocal, space, tab, 0, "", NULL); - memcpy(sym, lexeme, j+1); - if (dbg) { - printf("lex(): spaces: %u\n", spaces); - } - if (is_struct) { - create_struct(cur_sym, l, t, lt, sym, dbg); - islocal = 0; - } else if ((str[i+spaces] != ':' && str[i+spaces] != '=')) { - uint8_t sym_struct = 0; - symbol *s; - /*tmp_sym = (s && s->isstruct) ? NULL : tmp_sym;*/ - if (tmp_sym) { - t->sym = find_member(lexeme, tmp_sym, dbg); - tmp_sym = NULL; - } else { - t->sym = get_sym(lexeme, address, t, islocal, dbg); + } else { + uint8_t spaces = 0; + for (; isdelm(str[i+spaces], dbg) == 16; spaces++); + uint8_t ret = get_ptok(str[i+spaces], dbg); + if (ret == PTOK_COLON || ret == PTOK_EQU) { + islocal = (lex_type == TOK_LOCAL); } - isfixup += (t && t->sym == NULL); - islocal = 0; + lex_type = TOK_SYM; + l->count++; + t = make_token(lex_type, islocal, space, tab, 0, "", NULL); + memcpy(sym, lexeme, j+1); if (dbg) { - printf("lex(): isfixup: %u\n", isfixup); + printf("lex(): spaces: %u\n", spaces); + } + if (is_struct) { + create_struct(cur_sym, l, t, lt, sym, dbg); + islocal = 0; + } else if ((str[i+spaces] != ':' && str[i+spaces] != '=')) { + uint8_t sym_struct = 0; + symbol *s; + /*tmp_sym = (s && s->isstruct) ? NULL : tmp_sym;*/ + if (tmp_sym) { + t->sym = find_member(lexeme, tmp_sym, dbg); + tmp_sym = NULL; + } else { + t->sym = get_sym(lexeme, address, t, islocal, dbg); + } + isfixup += (t && t->sym == NULL); + islocal = 0; + if (dbg) { + printf("lex(): isfixup: %u\n", isfixup); + } + } + if (!is_struct && t && t->sym && t->sym->isstruct) { + tmp_sym = t->sym; } - } - if (!is_struct && t && t->sym && t->sym->isstruct) { - tmp_sym = t->sym; } } break; -- cgit v1.2.3-13-gbd6f