fix bugs in pack_word and tokenising
This commit is contained in:
1 parent
1bb72973fa
commit
eedf82f1fd
2 files changed
+30
-3
No files matched your search
+28
-3
@@ -26,8 +26,23 @@ pack_word:
|
|||||||
;; is incomplete, which is important for searching for abbreviated
|
;; is incomplete, which is important for searching for abbreviated
|
||||||
;; key words.)
|
;; key words.)
|
||||||
|
|
||||||
|
stx $0441
|
||||||
|
|
||||||
|
ldx #$0f
|
||||||
|
lda #$20
|
||||||
|
*
|
||||||
|
sta $0658,x
|
||||||
|
dex
|
||||||
|
bpl -
|
||||||
|
|
||||||
|
ldx $0441
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
sta $043f
|
||||||
|
|
||||||
;; Make sure we have a sane request
|
;; Make sure we have a sane request
|
||||||
lda tokenise_work1
|
lda tokenise_work1
|
||||||
|
sta $0440
|
||||||
bne +
|
bne +
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
@@ -38,8 +53,12 @@ pack_word:
|
|||||||
sta tokenise_work3
|
sta tokenise_work3
|
||||||
|
|
||||||
pack_char_loop:
|
pack_char_loop:
|
||||||
|
|
||||||
|
inc $043f
|
||||||
|
|
||||||
;; Get the next char
|
;; Get the next char
|
||||||
lda $0200,x
|
lda $0200,x
|
||||||
|
|
||||||
;; Work out what type of character we have, and thus
|
;; Work out what type of character we have, and thus
|
||||||
;; how we need to pack it.
|
;; how we need to pack it.
|
||||||
jsr get_packed_char_index
|
jsr get_packed_char_index
|
||||||
@@ -59,13 +78,15 @@ pack_char_loop:
|
|||||||
;; No nybl exists before the exception char, so prefix with $FE or $FF
|
;; No nybl exists before the exception char, so prefix with $FE or $FF
|
||||||
;; based on whether we are at the end of the input string or not
|
;; based on whether we are at the end of the input string or not
|
||||||
inx
|
inx
|
||||||
cpx tokenise_work1
|
lda tokenise_work1
|
||||||
|
cmp #$01
|
||||||
beq at_end
|
beq at_end
|
||||||
lda #$FF
|
lda #$FF
|
||||||
.byte $2C
|
.byte $2C
|
||||||
at_end: LDA #$FE
|
at_end: LDA #$FE
|
||||||
dex
|
dex
|
||||||
jsr write_unpacked_char
|
jsr write_unpacked_char
|
||||||
|
;; Fall through
|
||||||
|
|
||||||
output_exception_byte:
|
output_exception_byte:
|
||||||
lda $0200,x
|
lda $0200,x
|
||||||
@@ -96,7 +117,8 @@ write_literal_and_terminate_if_required:
|
|||||||
end_string_if_required:
|
end_string_if_required:
|
||||||
;; Check if X points to last char of string to be packed
|
;; Check if X points to last char of string to be packed
|
||||||
inx
|
inx
|
||||||
cpx tokenise_work1
|
lda tokenise_work1
|
||||||
|
cmp #$01
|
||||||
beq +
|
beq +
|
||||||
dex
|
dex
|
||||||
jmp consider_next_char
|
jmp consider_next_char
|
||||||
@@ -182,8 +204,11 @@ nothing_to_flush:
|
|||||||
|
|
||||||
consider_next_char:
|
consider_next_char:
|
||||||
;; Pack next char
|
;; Pack next char
|
||||||
|
lda tokenise_work1
|
||||||
|
sta $0680,x
|
||||||
|
inc $0658,x
|
||||||
inx
|
inx
|
||||||
cpx tokenise_work1
|
dec tokenise_work1
|
||||||
bne pack_char_loop
|
bne pack_char_loop
|
||||||
|
|
||||||
;; Add 1 to length if nybl waiting to be flushed
|
;; Add 1 to length if nybl waiting to be flushed
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ tokenise_char:
|
|||||||
cmp $0113
|
cmp $0113
|
||||||
bne +
|
bne +
|
||||||
|
|
||||||
|
;; End of line reached
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
stx $0450
|
stx $0450
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user