tape wedge now accepts file name

This commit is contained in:
FeralChild64 committed 2020-06-28 22:47:55 +02:00
1 parent 01775af002
commit 3b11d1b881
5 files changed
+106 -42

No files matched your search

+11 -19
View File
@@ -37,7 +37,10 @@ shell_got_line:
// Store length of input buffer ready for tokenising
stx __tokenise_work1
// XXX we should probably store 0 at the end of used BUF
// Store 0 as the sentinel
lda #$00
sta BUF, x
// FALLTROUGH
@@ -76,10 +79,13 @@ shell_process_line:
// Check if a wedge should take over
#if CONFIG_DOS_WEDGE
ldx __tokenise_work1 // size of the input, DOS wedges needs this XXX this should not be needed
#endif
#if CONFIG_DOS_WEDGE || CONFIG_TAPE_WEDGE
ldx __tokenise_work1 // size of the input, wedges need this XXX this should not be needed
// Check if DOS wedge should take over
lda BUF
@@ -170,20 +176,6 @@ shell_add_delete_line:
shell_execute_line:
// Setup pointer to the statement
lda #<BUF
sta TXTPTR+0
lda #>BUF
sta TXTPTR+1
// There is no stored line, so zero that pointer out
lda #$00
sta OLDTXT+0
sta OLDTXT+1
// Put invalid line number in current line number value,
// so that we know we are in direct mode (Computes Mapping the 64 p19)
lda #$FF
sta CURLIN+1
jsr prepare_direct_execution
jmp execute_statements
@@ -0,0 +1,27 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Prepare interpreter to execute commands in direct mode
//
prepare_direct_execution:
// Setup pointer to the statement
lda #<BUF
sta TXTPTR+0
lda #>BUF
sta TXTPTR+1
// There is no stored line, so zero that pointer out
lda #$00
sta OLDTXT+0
sta OLDTXT+1
// Put invalid line number in current line number value,
// so that we know we are in direct mode (Computes Mapping the 64 p19)
lda #$FF
sta CURLIN+1
rts
+65 -20
View File
@@ -6,17 +6,16 @@
#if CONFIG_TAPE_WEDGE
// .X has to contain size of the buffer
wedge_tape:
lda #$FF
sta CURLIN+1 // in case of error do not print line number
// Prepare for execution
cpx #$02
bne_16 do_SYNTAX_error
jsr prepare_direct_execution
jsr fetch_character
lda BUF+1
// First character is a 'left arrow', we can ignore it - determine the command
jsr fetch_character
cmp #$4C // 'L'
beq wedge_arrow_L
@@ -30,12 +29,69 @@ wedge_tape:
jmp do_SYNTAX_error
#if CONFIG_TAPE_HEAD_ALIGN
wedge_arrow_H:
// Make sure the syntax is correct
jsr injest_spaces
jsr fetch_character
cmp #$00
bne_16 do_SYNTAX_error
jsr tape_head_align
jsr print_return
jmp do_BREAK_error
#endif
wedge_arrow_L:
// Execute 'arrow + L'
// Make sure the syntax is correct
jsr injest_spaces
jsr fetch_character
cmp #$00
beq wedge_arrow_L_no_filename // branch if no file name given
cmp #$22
bne_16 do_SYNTAX_error // branch if no opening quote
// Fetch the file name
lda TXTPTR+0
sta FNADDR+0
lda TXTPTR+1
sta FNADDR+1
ldx #$00
!:
jsr fetch_character
cmp #$00
beq !+
cmp #$22
beq !+
inx
bne !-
!:
stx FNLEN
lda #$00
sta FNLEN // default file name is empty
beq wedge_arrow_L_got_filename
wedge_arrow_L_no_filename:
sta FNLEN // .A is 0 here, default file name is empty
// FALLTROUGH
wedge_arrow_L_got_filename: // .A has to be 0
sta VERCKB // operation is LOAD, not VERIFY
ldy #$01
@@ -51,16 +107,5 @@ wedge_arrow_L:
jmp cmd_load_got_params
#if CONFIG_TAPE_HEAD_ALIGN
wedge_arrow_H:
jsr tape_head_align
jsr print_return
jmp do_BREAK_error
#endif
#endif // CONFIG_TAPE_WEDGE