use expression parser for fetching filename

This commit is contained in:
FeralChild64 committed 2020-06-06 23:27:13 +02:00
1 parent 08f6fe9ed7
commit c150dbacc7
3 files changed
+16 -44

No files matched your search

+4 -7
View File
@@ -6,7 +6,8 @@
basic_main_loop: basic_main_loop:
// Tell user we are ready // Tell user we are ready
jsr ready_message ldx #30
jsr print_packed_message
// Enable Kernal messages // Enable Kernal messages
lda #$80 lda #$80
@@ -16,7 +17,6 @@ basic_read_next_line:
// Read a line of input // Read a line of input
ldx #$00 ldx #$00
read_line_loop: read_line_loop:
jsr JCHRIN jsr JCHRIN
bcs read_line_loop bcs read_line_loop
@@ -24,11 +24,8 @@ read_line_loop:
beq got_line_of_input beq got_line_of_input
// Not carriage return, so try to append to line so far // Not carriage return, so try to append to line so far
cpx #80 cpx #80
bcc !+ bcs_16 do_STRING_TOO_LONG_error // see Computes Mapping the 64 p93
// Report STRING TOO LONG error (Computes Mapping the 64 p93)
ldx #22
jmp do_basic_error
!:
sta BUF,x sta BUF,x
inx inx
jmp read_line_loop jmp read_line_loop
+12 -28
View File
@@ -14,40 +14,24 @@ fetch_filename:
jsr end_of_statement_check jsr end_of_statement_check
bcs fetch_filename_done bcs fetch_filename_done
// Search for opening quote // Call the expression parser, make sure it returned a string
jsr fetch_character jsr FRMEVL
cmp #$22
bne_16 do_SYNTAX_error
// Filename starts here so set pointer lda VALTYP
bpl_16 do_SYNTAX_error
lda TXTPTR+0 // Set the filename address and pointer
lda __FAC1+0
sta FNLEN
lda __FAC1+1
sta FNADDR+0 sta FNADDR+0
lda TXTPTR+1 lda __FAC1+2
sta FNADDR+1 sta FNADDR+1
// Now search for end of line or closing quote // Mark success
// so that we know the length of the filename
lda #$00
sta FNLEN
!:
jsr fetch_character
cmp #$22
beq fetch_filename_fail
cmp #$00
beq !+
inc FNLEN
bne !-
!:
jsr unconsume_character
// FALLTROUGH
fetch_filename_fail:
clc clc
-9
View File
@@ -1,9 +0,0 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
ready_message:
ldx #30
jmp print_packed_message