more I/O work in BASIC

This commit is contained in:
FeralChild64 committed 2020-06-22 21:25:23 +02:00
1 parent 524d532433
commit e1d21e287f
10 files changed
+130 -29

No files matched your search

+7 -14
View File
@@ -16,26 +16,19 @@ cmd_load:
lda #$00 // mark operation as LOAD
jsr helper_load_init_params
jsr helper_load_setnam_any // if no file name found, use "*"
// Fetch the file name
jsr helper_load_fetch_filename
bcs cmd_load_no_filename
bcs !+
// Try to fetch device and secondary address
jsr fetch_device_secondary
jmp cmd_load_got_params
cmd_load_no_filename:
// If no file name is supplied, try to load first file from disc
lda #$01 // name length
ldx #<filename_any
ldy #>filename_any
jsr JSETNAM
// Try to fetch device number and secondary address
jsr helper_load_fetch_devnum
bcs !+
jsr helper_load_fetch_secondary
!:
// FALLTROUGH
cmd_load_got_params: // input for tape wedge
+12 -8
View File
@@ -5,22 +5,22 @@
cmd_save:
// Set default device and secondary address; channel is not important now
// Set default device and secondary address
jsr select_device
ldy #$00
jsr JSETFLS
jsr helper_load_init_params_no_VERCKB
// Fetch the file name
jsr helper_load_fetch_filename
bcs_16 do_MISSING_FILENAME_error
// Try to fetch device
// Try to fetch device number and secondary address
jsr fetch_device_secondary
// Setup the start and end addresses
jsr helper_load_fetch_devnum
bcs !+
jsr helper_load_fetch_secondary
!:
// Setup the start address
lda #TXTTAB
@@ -29,6 +29,10 @@ cmd_save:
ldx VARTAB+0
ldy VARTAB+1
// FALLTROUGH
cmd_save_do: // entry point for BSAVE
// Perform saving
jsr JSAVE
@@ -0,0 +1,20 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Tries to fetch device number - sets Carry if failure
//
helper_load_fetch_devnum:
// Fetch the device number
jsr fetch_coma_uint8
bcs !+
sta FA
!:
rts
@@ -0,0 +1,20 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Tries to fetch secondary address - sets Carry if failure
//
helper_load_fetch_secondary:
// Fetch the device number
jsr fetch_coma_uint8
bcs !+
sta SA
!:
rts
@@ -16,6 +16,10 @@ helper_load_init_params:
sta VERCKB
// FALLTROUGH
helper_load_init_params_no_VERCKB:
// Set default device, set secondary address to 0
jsr select_device
@@ -0,0 +1,15 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Set '*' as file name
//
helper_load_setnam_any:
lda #$01 // name length
ldx #<filename_any
ldy #>filename_any
jmp JSETNAM
+50 -1
View File
@@ -5,4 +5,53 @@
cmd_bsave:
jmp do_NOT_IMPLEMENTED_error // XXX implement the command
// Set default device and secondary address
jsr helper_load_init_params_no_VERCKB
// Fetch the file name
jsr helper_load_fetch_filename
bcs_16 do_MISSING_FILENAME_error
// Fetch device number
jsr injest_comma
bcs_16 do_SYNTAX_error
jsr helper_load_fetch_devnum
bcs_16 do_SYNTAX_error
// Fetch memory area start address
jsr injest_comma
bcs_16 do_SYNTAX_error
jsr basic_parse_line_number // XXX detect errors here
lda LINNUM+0
pha
lda LINNUM+1
pha
// Fetch memory area end address
jsr injest_comma
bcs_16 do_SYNTAX_error
jsr basic_parse_line_number // XXX detect errors here
// Setup start/end addresses
ldx LINNUM+0
ldy LINNUM+1
pla
sta LINNUM+1
pla
sta LINNUM+0
lda #LINNUM
// Perform SAVE - reuse regular command
jmp cmd_save_do
+1 -4
View File
@@ -24,11 +24,8 @@ cmd_merge:
!:
// Fetch device number
jsr fetch_coma_uint8
bcs !+
jsr helper_load_fetch_devnum
sta FA
!:
// Perform loading - just for a different address
sec
+1 -2
View File
@@ -17,8 +17,7 @@ fetch_coma_uint8:
fetch_uint8:
jsr injest_spaces
jsr basic_parse_line_number
// XXX this should also detect errors
jsr basic_parse_line_number // XXX detect errors here
lda LINNUM+1
bne_16 do_ILLEGAL_QUANTITY_error
lda LINNUM+0
Binary file not shown.