token search now basically works.

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-25 23:04:39 +09:30
1 parent 04e5dd326f
commit c6167d37cb
1 file changed
+5 -5
+5 -5
View File
@@ -46,7 +46,7 @@ token_search:
;; tokenise_work1 = offset in line of input ;; tokenise_work1 = offset in line of input
;; tokenise_work2 = length of token we are matching ;; tokenise_work2 = length of token we are matching
;; tokenise_work3 = offset in token list ;; tokenise_work3 = offset in token list
ldy #$00 lda #$00
sta tokenise_work1 sta tokenise_work1
sta tokenise_work3 sta tokenise_work3
next_kw_offset: next_kw_offset:
@@ -56,13 +56,12 @@ next_kw_offset:
;; Get count of bytes to compare ;; Get count of bytes to compare
lda tokenise_work2 lda tokenise_work2
sta tokenise_work4 sta tokenise_work4
sta $0427
;; Load current position ;; Load current position
ldx tokenise_work1
ldy tokenise_work3 ldy tokenise_work3
ldx tokenise_work1
;; Advance offset in compressed token list ;; Advance offset in compressed token list, and stop at the end
inc tokenise_work3 inc tokenise_work3
lda tokenise_work3 lda tokenise_work3
cmp #$ff cmp #$ff
@@ -75,11 +74,12 @@ next_in_match:
;; Advance to next chars in source and target ;; Advance to next chars in source and target
inx inx
iny iny
dec tokenise_work4 ; Have we compared all bytes yet? dec tokenise_work4 ; Have we compared all bytes yet?
bne next_in_match bne next_in_match
;; Keyword matches! ;; Keyword matches!
inc $d020 inc $d020
tya
;; We actually point one by late, so rewind to find start of token ;; We actually point one by late, so rewind to find start of token
lda tokenise_work3 lda tokenise_work3