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
+6 -6
+6 -6
View File
@@ -46,7 +46,7 @@ token_search:
;; tokenise_work1 = offset in line of input
;; tokenise_work2 = length of token we are matching
;; tokenise_work3 = offset in token list
ldy #$00
lda #$00
sta tokenise_work1
sta tokenise_work3
next_kw_offset:
@@ -56,30 +56,30 @@ next_kw_offset:
;; Get count of bytes to compare
lda tokenise_work2
sta tokenise_work4
sta $0427
;; Load current position
ldx tokenise_work1
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
lda tokenise_work3
cmp #$ff
bne next_in_match
jmp done_searching_for_token
next_in_match:
next_in_match:
lda $0100,x
cmp packed_keywords,y
bne next_kw_offset
;; Advance to next chars in source and target
inx
iny
dec tokenise_work4 ; Have we compared all bytes yet?
bne next_in_match
;; Keyword matches!
inc $d020
tya
;; We actually point one by late, so rewind to find start of token
lda tokenise_work3