From d31aed21b27fbda68abe088d657ba18455607cc4 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Mon, 17 Aug 2020 20:37:44 -0400 Subject: - Fixed some bugs in the emulator's assembler. - Simplified the effective address functions. - Made SuBEditor a bit faster. - JSR, and RTS now support using the RS prefix, which is used to specify the return address size, with an RS prefix of 0 being a return address size of 64 bits, rather than 8 bits. --- programs/sub-suite/lexer.s | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'programs/sub-suite/lexer.s') diff --git a/programs/sub-suite/lexer.s b/programs/sub-suite/lexer.s index dc5a3b0..3a856b5 100644 --- a/programs/sub-suite/lexer.s +++ b/programs/sub-suite/lexer.s @@ -119,11 +119,11 @@ ptok_dot: ldb idx1 ; Get the directive ID. cpb #7 ; Have we reached the end of the directive table? beq @end ; Yes, so we're done. - lda.w #dir ; Get pointer to the start of the directive table. + lda.w #dir ; No, so get the start of the directive table. clc ; Prepare for a non carrying add. adc.w idx2 ; Offset the pointer, by the length of the previous string. pha.q ; Preserve the directive string pointer. - jsr strcaseptr ; Is the lexeme buffer, the same as the directive string? + jsr strcaseg ; Is the lexeme buffer, the same as the directive string? pla.q ; Get the directive string pointer back. beq @found ; Yes, so create a new token. inc idx1 ; No, so increment the directive ID. @@ -156,10 +156,14 @@ ptok_min: lda #EXPR_MINUS ; Set the expresion type to EXPR_MINUS. bra ptok_expr ; Set up the token. ptok_gt: + lda #EXPR_LOW ; Set the expresion type to EXPR_LOW. bra ptok_expr ; Set up the token. ptok_lt: lda #EXPR_HIGH ; Set the expresion type to EXPR_HIGH. + bra ptok_expr ; Set up the token. +ptok_pipe: + lda #EXPR_OR ; Set the expresion type to EXPR_OR. ptok_expr: lda #TOK_EXPR ; Set the lexeme type to TOK_EXPR. sta lex_type ; @@ -254,19 +258,23 @@ ptok_alph: stb.q idx1 ; Reset the second index. jsr set_lexptr ; Set up the lexeme buffer. @isop_loop: - lda.w #mne ; Get pointer to the start of the instruction table. + ldb idx1 ; Get the instruction ID. + cpb #OPNUM-1 ; Have we reached the end of the mnemonic table? + beq @end ; Yes, so we're done. + lda.w #mne ; No, so get the start of the mnemonic table. clc ; Prepare for a non carrying add. adc.w idx2 ; Offset the pointer, by the length of the previous string. + pha.q ; Preserve the mnemonic string pointer. jsr strcaseg ; Is the lexeme buffer, the same as the mnemonic string? + pla.q ; Get the mnemonic string pointer back. beq @found ; Yes, so create a new token. - ldb idx1 ; No, so Get the instruction ID. - cpb #OPNUM-1 ; Have we reached the end of the instruction table? beq @end ; Yes, so we're done. inc idx1 ; No, so increment the instruction ID. @offset: - lda #14 ; Get the base size of the instruction table. - clc ; Prepare for a non carrying multiply. - mul idx1 ; Multiply the base offset, by the instruction ID. + jsr strlen ; Get the string's length. + inc ; Add one to the length. + clc ; Prepare for a non carrying add. + adc.w idx2 ; Add the string offset to the current length sta.w idx2 ; Save the offset in the third index. bra @isop_loop ; Keep looping. @found: -- cgit v1.2.3-13-gbd6f