fix several bugs with storing BASIC lines
This commit is contained in:
1 parent
d2e4822f37
commit
5a5be5d8ec
4 files changed
+39
-13
No files matched your search
@@ -10,38 +10,49 @@ basic_find_line:
|
||||
|
||||
basic_find_line_loop:
|
||||
;; Then search for line number
|
||||
;; Line number
|
||||
;; Line number
|
||||
|
||||
ldy #3
|
||||
ldx #<basic_current_line_ptr
|
||||
jsr peek_under_roms
|
||||
cmp basic_line_number+1
|
||||
beq +
|
||||
bcs line_num_too_high
|
||||
bne not_this_line
|
||||
*
|
||||
|
||||
dey
|
||||
jsr peek_under_roms
|
||||
cmp basic_line_number+0
|
||||
beq +
|
||||
bcs line_num_too_high
|
||||
bne not_this_line
|
||||
|
||||
*
|
||||
clc
|
||||
rts
|
||||
not_this_line:
|
||||
;; Not this line, so advance to next line
|
||||
ldy #0
|
||||
ldx #<basic_current_line_ptr
|
||||
jsr peek_pointer_null_check
|
||||
bcs more_lines_exist
|
||||
|
||||
;; no more lines exist, return failure
|
||||
line_num_too_high:
|
||||
line_num_too_high:
|
||||
sec
|
||||
rts
|
||||
more_lines_exist:
|
||||
;; A = high byte of line
|
||||
pha
|
||||
dey
|
||||
|
||||
;; XXX - Add program mangled check here to be triggered
|
||||
;; if the link goes backwards.
|
||||
;; Follow link to next line
|
||||
ldy #0
|
||||
ldx #<basic_current_line_ptr
|
||||
jsr peek_under_roms
|
||||
sta $0100
|
||||
iny
|
||||
jsr peek_under_roms
|
||||
sta basic_current_line_ptr+0
|
||||
pla
|
||||
sta basic_current_line_ptr+1
|
||||
lda $0100
|
||||
sta basic_current_line_ptr+0
|
||||
|
||||
jmp basic_find_line_loop
|
||||
Reference in new issue
Block a user