fix various problems with LOAD taking a real filename. More to do.
This commit is contained in:
1 parent
f14cf20c92
commit
e547b56003
4 files changed
+77
-10
No files matched your search
@@ -29,8 +29,12 @@ no_space_to_skip:
|
|||||||
basic_execute_statement:
|
basic_execute_statement:
|
||||||
|
|
||||||
;; Skip over any white space and :
|
;; Skip over any white space and :
|
||||||
|
ldy #0
|
||||||
|
ldx #<basic_current_statement_ptr
|
||||||
|
jsr peek_under_roms
|
||||||
jsr basic_end_of_statement_check
|
jsr basic_end_of_statement_check
|
||||||
|
bcs basic_end_of_line
|
||||||
|
|
||||||
;; jsr printf
|
;; jsr printf
|
||||||
;; .byte "LINE PTR = $"
|
;; .byte "LINE PTR = $"
|
||||||
;; .byte $f1,<basic_current_line_ptr,>basic_current_line_ptr
|
;; .byte $f1,<basic_current_line_ptr,>basic_current_line_ptr
|
||||||
@@ -94,6 +98,12 @@ basic_skip_char:
|
|||||||
jsr basic_consume_character
|
jsr basic_consume_character
|
||||||
jmp basic_execute_statement
|
jmp basic_execute_statement
|
||||||
|
|
||||||
|
basic_fetch_and_consume_character:
|
||||||
|
ldy #0
|
||||||
|
ldx #<basic_current_statement_ptr
|
||||||
|
jsr peek_under_roms
|
||||||
|
;; FALL THROUGH
|
||||||
|
|
||||||
basic_consume_character:
|
basic_consume_character:
|
||||||
;; Advance basic text pointer
|
;; Advance basic text pointer
|
||||||
inc basic_current_statement_ptr+0
|
inc basic_current_statement_ptr+0
|
||||||
@@ -101,6 +111,16 @@ basic_consume_character:
|
|||||||
inc basic_current_statement_ptr+1
|
inc basic_current_statement_ptr+1
|
||||||
*
|
*
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
basic_unconsume_character:
|
||||||
|
lda basic_current_statement_ptr+0
|
||||||
|
sec
|
||||||
|
sbc #1
|
||||||
|
sta basic_current_statement_ptr+0
|
||||||
|
lda basic_current_statement_ptr+1
|
||||||
|
sbc #0
|
||||||
|
sta basic_current_statement_ptr+1
|
||||||
|
rts
|
||||||
|
|
||||||
basic_end_of_line:
|
basic_end_of_line:
|
||||||
|
|
||||||
|
|||||||
+37
-7
@@ -19,15 +19,45 @@ cmd_load:
|
|||||||
ldy #>$0801
|
ldy #>$0801
|
||||||
|
|
||||||
;; Set filename and length
|
;; Set filename and length
|
||||||
lda #$24
|
lda #$00
|
||||||
sta $0400
|
|
||||||
lda #$01
|
|
||||||
sta current_filename_length
|
sta current_filename_length
|
||||||
lda #<$0400
|
|
||||||
|
;; Without tape support, LOAD must have a filename
|
||||||
|
;; (This also skips any leading spaces)
|
||||||
|
jsr basic_end_of_statement_check
|
||||||
|
bcc +
|
||||||
|
jmp do_MISSING_FILENAME_error
|
||||||
|
*
|
||||||
|
jsr basic_fetch_and_consume_character
|
||||||
|
cmp #$22
|
||||||
|
beq +
|
||||||
|
jmp do_SYNTAX_ERROR
|
||||||
|
*
|
||||||
|
;; Filename starts here so set pointer
|
||||||
|
lda basic_current_statement_ptr+0
|
||||||
sta current_filename_ptr+0
|
sta current_filename_ptr+0
|
||||||
lda #>$0401
|
lda basic_current_statement_ptr+1
|
||||||
sta current_filename_ptr+1
|
sta current_filename_ptr+1
|
||||||
|
|
||||||
|
;; Now search for end of line or closing quote
|
||||||
|
;; so that we know the length of the filename
|
||||||
|
getting_filename:
|
||||||
|
jsr basic_fetch_and_consume_character
|
||||||
|
cmp #$22
|
||||||
|
beq got_filename
|
||||||
|
cmp #$00
|
||||||
|
bne +
|
||||||
|
jsr basic_unconsume_character
|
||||||
|
|
||||||
|
jmp got_filename
|
||||||
|
*
|
||||||
|
inc current_filename_length
|
||||||
|
jmp getting_filename
|
||||||
|
|
||||||
|
got_filename:
|
||||||
|
|
||||||
|
lda current_filename_length
|
||||||
|
|
||||||
jsr $ffd5
|
jsr $ffd5
|
||||||
bcc +
|
bcc +
|
||||||
|
|
||||||
@@ -36,7 +66,7 @@ cmd_load:
|
|||||||
;; error code to X, decrement, and handle normally
|
;; error code to X, decrement, and handle normally
|
||||||
tax
|
tax
|
||||||
dex
|
dex
|
||||||
jmp do_basic_error
|
jmp do_LOAD_error
|
||||||
|
|
||||||
*
|
*
|
||||||
;; $YYXX is the last loaded address, so store it
|
;; $YYXX is the last loaded address, so store it
|
||||||
@@ -58,7 +88,7 @@ cmd_load:
|
|||||||
sta basic_current_line_ptr+1
|
sta basic_current_line_ptr+1
|
||||||
|
|
||||||
;; Try to keep executing
|
;; Try to keep executing
|
||||||
jmp basic_execute_statement
|
jmp basic_execute_from_current_line
|
||||||
|
|
||||||
|
|
||||||
basic_relink_program:
|
basic_relink_program:
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
;; XXX - Remember decimal position and exponent, and apply them
|
;; XXX - Remember decimal position and exponent, and apply them
|
||||||
;; after to produce normalised floating point number.
|
;; after to produce normalised floating point number.
|
||||||
|
|
||||||
|
;; XXX - Doesn't use routines to access memory under ROMs etc.
|
||||||
|
;; This is important, because this routine operates on numbers in BASIC text.
|
||||||
|
|
||||||
ij_not_a_digit:
|
ij_not_a_digit:
|
||||||
;; XXX check for "." or "E"
|
;; XXX check for "." or "E"
|
||||||
;; Other chars terminate the accumulation.
|
;; Other chars terminate the accumulation.
|
||||||
|
|||||||
+16
-2
@@ -31,7 +31,20 @@ load:
|
|||||||
|
|
||||||
;; Display SEARCHING FOR
|
;; Display SEARCHING FOR
|
||||||
jsr printf
|
jsr printf
|
||||||
.byte "SEARCHING FOR <INSERT FILENAME HERE>",$0d,$0
|
.byte "SEARCHING FOR "
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
print_filename_loop:
|
||||||
|
cpy current_filename_length
|
||||||
|
beq +
|
||||||
|
lda (current_filename_ptr),y
|
||||||
|
jsr $ffd2
|
||||||
|
iny
|
||||||
|
jmp print_filename_loop
|
||||||
|
*
|
||||||
|
|
||||||
|
lda #$0d
|
||||||
|
jsr $ffd2
|
||||||
|
|
||||||
;; Begin sending under attention
|
;; Begin sending under attention
|
||||||
jsr iec_assert_atn
|
jsr iec_assert_atn
|
||||||
@@ -79,7 +92,7 @@ send_filename:
|
|||||||
tya
|
tya
|
||||||
pha
|
pha
|
||||||
txa
|
txa
|
||||||
|
|
||||||
jsr iec_tx_byte
|
jsr iec_tx_byte
|
||||||
|
|
||||||
pla
|
pla
|
||||||
@@ -191,6 +204,7 @@ load_error:
|
|||||||
|
|
||||||
;; XXX - Indicate KERNAL (not BASIC) LOAD error condtion
|
;; XXX - Indicate KERNAL (not BASIC) LOAD error condtion
|
||||||
sec
|
sec
|
||||||
|
lda #$02
|
||||||
|
|
||||||
;; Re-enable interrupts and return
|
;; Re-enable interrupts and return
|
||||||
cli
|
cli
|
||||||
|
|||||||
Reference in new issue
Block a user