diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2021-01-27 13:42:57 -0500 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2021-01-27 13:42:57 -0500 |
commit | cd6982e5da1f5facdc1e0154b3a27c01e8b076c9 (patch) | |
tree | c8db5ade59d054c6f88ff2ab2cb99df45b250fad /programs/sub-suite/lexer.s | |
parent | 1700d8d10453ffe046438de0e6fbd496def915a1 (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/lexer.s')
-rw-r--r-- | programs/sub-suite/lexer.s | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/programs/sub-suite/lexer.s b/programs/sub-suite/lexer.s index b2850aa..0d712ff 100644 --- a/programs/sub-suite/lexer.s +++ b/programs/sub-suite/lexer.s @@ -65,7 +65,7 @@ lex: ;@nextlline: ; ldb #1 ; No, so set the second pointer to the last line. ; jsr set_ptr ; -; ldy #ln.next ; Set the next last line to the current line. +; ldy #line.next ; Set the next last line to the current line. ; lda.q cline ; ; sta.q (ptr2), y ; ; bra @initline ; Initialize the line. @@ -76,11 +76,11 @@ lex: ; ldb #1 ; Set the second pointer to the current line. ; jsr set_ptr ; ; and #0 ; Reset A. -; ldy #ln.next ; Reset the next line. +; ldy #line.next ; Reset the next line. ; sta.q (ptr2), y ; -; ldy #ln.tok ; Reset the token. +; ldy #line.tok ; Reset the token. ; sta.q (ptr2), y ; -; ldy #ln.bline ; Reset the number of blank lines. +; ldy #line.bline ; Reset the number of blank lines. ; sta.w (ptr2), y ; ; tay ; Reset Y. @loop: @@ -225,11 +225,10 @@ ptok_dot: beq @found ; Yes, so create a new token. inc idx1 ; No, so increment the directive ID. @getlen: + mov d, a ; Get the string. 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. + add.w idx2, a ; Add the string offset to the current length bra @dir_loop ; Keep looping. @found: lda #TOK_DIR ; Set the lexeme type to TOK_DIR. @@ -443,11 +442,10 @@ ptok_alph: beq @found ; Yes, so create a new token. inc idx1 ; No, so increment the instruction ID. @offset: + mov d, a ; Get the string. 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. + add.w idx2, a ; Add the string offset to the current length bra @isop_loop ; Keep looping. @found: lda #TOK_MNE ; Set the lexeme type to TOK_MNE. |