fix various problems with LOAD taking a real filename. More to do.

This commit is contained in:
Paul Gardner-Stephen committed 2019-05-05 01:26:37 +09:30
1 parent f14cf20c92
commit e547b56003
4 files changed
+77 -10

No files matched your search

+21 -1
View File
@@ -29,8 +29,12 @@ no_space_to_skip:
basic_execute_statement:
;; Skip over any white space and :
ldy #0
ldx #<basic_current_statement_ptr
jsr peek_under_roms
jsr basic_end_of_statement_check
bcs basic_end_of_line
;; jsr printf
;; .byte "LINE PTR = $"
;; .byte $f1,<basic_current_line_ptr,>basic_current_line_ptr
@@ -94,6 +98,12 @@ basic_skip_char:
jsr basic_consume_character
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:
;; Advance basic text pointer
inc basic_current_statement_ptr+0
@@ -101,6 +111,16 @@ basic_consume_character:
inc basic_current_statement_ptr+1
*
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:
+37 -7
View File
@@ -19,15 +19,45 @@ cmd_load:
ldy #>$0801
;; Set filename and length
lda #$24
sta $0400
lda #$01
lda #$00
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
lda #>$0401
lda basic_current_statement_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
bcc +
@@ -36,7 +66,7 @@ cmd_load:
;; error code to X, decrement, and handle normally
tax
dex
jmp do_basic_error
jmp do_LOAD_error
*
;; $YYXX is the last loaded address, so store it
@@ -58,7 +88,7 @@ cmd_load:
sta basic_current_line_ptr+1
;; Try to keep executing
jmp basic_execute_statement
jmp basic_execute_from_current_line
basic_relink_program:
+3
View File
@@ -5,6 +5,9 @@
;; XXX - Remember decimal position and exponent, and apply them
;; 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:
;; XXX check for "." or "E"
;; Other chars terminate the accumulation.
+16 -2
View File
@@ -31,7 +31,20 @@ load:
;; Display SEARCHING FOR
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
jsr iec_assert_atn
@@ -79,7 +92,7 @@ send_filename:
tya
pha
txa
jsr iec_tx_byte
pla
@@ -191,6 +204,7 @@ load_error:
;; XXX - Indicate KERNAL (not BASIC) LOAD error condtion
sec
lda #$02
;; Re-enable interrupts and return
cli