started work on VERIFY and SAVE commands
This commit is contained in:
1 parent
c5d7bb250f
commit
580cd65941
7 files changed
+225
-150
No files matched your search
@@ -17,13 +17,13 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8
|
|||||||
* improved support for tape adapters (for using regular casette players and other audio devices instead of Datasette) and emulators
|
* improved support for tape adapters (for using regular casette players and other audio devices instead of Datasette) and emulators
|
||||||
* built-in tape head align tool (only feasible to use on machines with extended memory, like Mega65)
|
* built-in tape head align tool (only feasible to use on machines with extended memory, like Mega65)
|
||||||
|
|
||||||
* extended `LOAD` command
|
* extended / tweaked `LOAD` / `VERIFY` commands
|
||||||
* start/end addresses are displayed, in the Final cartridge style
|
* start/end addresses are displayed, in the Final cartridge style
|
||||||
* command with just the file name tries to use the last device if it's number seems sane; otherwise uses 8
|
* command with just the file name tries to use the last device if it's number seems sane; otherwise uses 8
|
||||||
* secondary address over 255 is considered a start address
|
* command without parameters tries to load first file from drive chosen as above
|
||||||
|
|
||||||
* uses RAM under ROM and I/O: 61438 bytes free
|
* uses RAM under ROM and I/O: 61438 bytes free
|
||||||
* cold/warm start silences multiple SID chips - all $D4xx and $D5xx addresses, configured addresses
|
* cold/warm start silences multiple SID chips
|
||||||
* warm start due to BRK prints out the instruction address
|
* warm start due to BRK prints out the instruction address
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
.label CHARAC = $07 // [!] our implementation might be different XXX give more details
|
.label CHARAC = $07 // [!] our implementation might be different XXX give more details
|
||||||
.label ENDCHR = $08 // [!] our implementation might be different XXX give more details
|
.label ENDCHR = $08 // [!] our implementation might be different XXX give more details
|
||||||
.label TRMPOS = $09 // -- NOT IMPLEMENTED --
|
.label TRMPOS = $09 // -- NOT IMPLEMENTED --
|
||||||
.label VERCKB = $0A // -- NOT IMPLEMENTED --
|
.label VERCKB = $0A // flag used by BASIC, 0 - LOAD, 1 - VERIFY
|
||||||
.label COUNT = $0B // [!] our implementation might be different XXX give more details
|
.label COUNT = $0B // [!] our implementation might be different XXX give more details
|
||||||
.label DIMFLG = $0C // [!] our implementation might be different XXX give more details
|
.label DIMFLG = $0C // [!] our implementation might be different XXX give more details
|
||||||
.label VALTYP = $0D // -- NOT IMPLEMENTED --
|
.label VALTYP = $0D // -- NOT IMPLEMENTED --
|
||||||
|
|||||||
@@ -1,141 +0,0 @@
|
|||||||
// #LAYOUT# STD * #TAKE
|
|
||||||
// #LAYOUT# * BASIC_0 #TAKE
|
|
||||||
// #LAYOUT# * * #IGNORE
|
|
||||||
|
|
||||||
|
|
||||||
cmd_load:
|
|
||||||
|
|
||||||
// Parse filename
|
|
||||||
// (we can tell the KERNAL where it is in memory directly, since the
|
|
||||||
// KERNAL will be able to peek under ROMs to read it, since it will have
|
|
||||||
// to be able to peek under the ROMs for SAVE and VERIFY).
|
|
||||||
// Parse optional device #
|
|
||||||
// Parse optional secondary address
|
|
||||||
|
|
||||||
// XXX - C64 BASIC apparently does not clear variables after a LOAD in the
|
|
||||||
// middle of a program. For safety, we do.
|
|
||||||
jsr basic_do_clr
|
|
||||||
|
|
||||||
// Set filename and length
|
|
||||||
lda #$00
|
|
||||||
sta FNLEN
|
|
||||||
|
|
||||||
// Check for the file name
|
|
||||||
jsr basic_end_of_statement_check
|
|
||||||
bcc cmd_load_fetch_filename
|
|
||||||
|
|
||||||
// Try to load the first file from disk
|
|
||||||
|
|
||||||
lda #$01 // name length
|
|
||||||
ldx #<filename_any
|
|
||||||
ldy #>filename_any
|
|
||||||
jsr JSETNAM
|
|
||||||
jmp got_filename
|
|
||||||
|
|
||||||
cmd_load_fetch_filename:
|
|
||||||
|
|
||||||
jsr basic_fetch_and_consume_character
|
|
||||||
cmp #$22
|
|
||||||
beq !+
|
|
||||||
jmp do_SYNTAX_error
|
|
||||||
!:
|
|
||||||
// Filename starts here so set pointer
|
|
||||||
lda TXTPTR+0
|
|
||||||
sta FNADDR+0
|
|
||||||
lda TXTPTR+1
|
|
||||||
sta FNADDR+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 FNLEN
|
|
||||||
jmp getting_filename
|
|
||||||
|
|
||||||
got_filename:
|
|
||||||
|
|
||||||
// Now fetch the file number, start from the default one
|
|
||||||
jsr select_device
|
|
||||||
stx FA
|
|
||||||
jsr injest_comma
|
|
||||||
bcs got_devicenumber
|
|
||||||
|
|
||||||
jsr basic_parse_line_number
|
|
||||||
lda LINNUM+1
|
|
||||||
beq !+
|
|
||||||
jmp do_ILLEGAL_QUANTITY_error
|
|
||||||
!:
|
|
||||||
lda LINNUM+0
|
|
||||||
sta FA
|
|
||||||
|
|
||||||
got_devicenumber:
|
|
||||||
|
|
||||||
// Now fetch the secondary address
|
|
||||||
lda #$00
|
|
||||||
sta SA
|
|
||||||
jsr injest_comma
|
|
||||||
bcs cmd_load_got_secondaryaddress
|
|
||||||
jsr basic_parse_line_number
|
|
||||||
lda LINNUM+1
|
|
||||||
bne !+
|
|
||||||
lda LINNUM+0
|
|
||||||
sta SA
|
|
||||||
jmp cmd_load_got_secondaryaddress
|
|
||||||
!:
|
|
||||||
// Second parameter is above 255, this can not be a secondary address
|
|
||||||
// Use it as load address instead
|
|
||||||
// XXX temporary syntax, it would be better to use something
|
|
||||||
// XXX like 'LOAD"FILE",8 TO 49152'
|
|
||||||
ldx LINNUM+0
|
|
||||||
ldy LINNUM+1
|
|
||||||
bne got_loadaddress
|
|
||||||
|
|
||||||
cmd_load_got_secondaryaddress: // input for tape wedge
|
|
||||||
ldy TXTTAB+1
|
|
||||||
ldx TXTTAB+0
|
|
||||||
|
|
||||||
got_loadaddress:
|
|
||||||
lda #$00 // LOAD not verify
|
|
||||||
jsr JLOAD
|
|
||||||
php
|
|
||||||
pha
|
|
||||||
jsr print_return
|
|
||||||
pla
|
|
||||||
plp
|
|
||||||
bcc load_no_error
|
|
||||||
|
|
||||||
// A = KERNAL error code, which also almost match
|
|
||||||
// basic ERROR codes
|
|
||||||
tax
|
|
||||||
dex
|
|
||||||
bpl !+
|
|
||||||
ldx #B_ERR_BREAK
|
|
||||||
!:
|
|
||||||
jmp do_basic_error
|
|
||||||
|
|
||||||
load_no_error:
|
|
||||||
// $YYXX is the last loaded address, so store it
|
|
||||||
stx VARTAB+0
|
|
||||||
sty VARTAB+1
|
|
||||||
|
|
||||||
// Now relink the loaded program, as we cannot trust the line
|
|
||||||
// links supplied. For example, the VICE virtual drive emulation
|
|
||||||
// always supplies $0101 as the address of the next line.
|
|
||||||
jsr LINKPRG
|
|
||||||
|
|
||||||
// After LOADing, we either start the program from the beginning,
|
|
||||||
// or go back to the READY prompt if LOAD was called from direct mode.
|
|
||||||
|
|
||||||
// Reset to start of program
|
|
||||||
jsr init_oldtxt
|
|
||||||
|
|
||||||
// XXX - should run program if LOAD was used in program mode
|
|
||||||
jmp basic_main_loop
|
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
// #LAYOUT# STD * #TAKE
|
||||||
|
// #LAYOUT# * BASIC_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cmd_verify:
|
||||||
|
|
||||||
|
// LOAD and VERIFY are very similar, from BASIC perspective there is almost no difference;
|
||||||
|
// just different parameter passed to Kernal and different error message in case of failure
|
||||||
|
|
||||||
|
lda #$01 // mark operation as VERIFY
|
||||||
|
skip_2_bytes_trash_nvz
|
||||||
|
|
||||||
|
cmd_load:
|
||||||
|
|
||||||
|
lda #$00 // mark operation as LOAD
|
||||||
|
sta VERCKB
|
||||||
|
|
||||||
|
// C64 BASIC apparently does not clear variables after a LOAD in the
|
||||||
|
// middle of a program. For safety, we do.
|
||||||
|
jsr basic_do_clr
|
||||||
|
|
||||||
|
// Set default device and secondary address; channel is not important now
|
||||||
|
|
||||||
|
jsr select_device
|
||||||
|
ldy #$00 // secondary address
|
||||||
|
jsr JSETFLS
|
||||||
|
|
||||||
|
// Check if file name is supplied
|
||||||
|
|
||||||
|
jsr basic_end_of_statement_check
|
||||||
|
bcs cmd_load_no_filename
|
||||||
|
|
||||||
|
// Fetch the file name
|
||||||
|
|
||||||
|
jsr cmd_load_fetch_filename
|
||||||
|
|
||||||
|
// Try to fetch secondary address
|
||||||
|
|
||||||
|
jsr cmd_load_fetch_dev_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
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
cmd_load_got_params: // input for tape wedge
|
||||||
|
|
||||||
|
// Perform loading
|
||||||
|
|
||||||
|
ldy TXTTAB+1
|
||||||
|
ldx TXTTAB+0
|
||||||
|
lda VERCKB // LOAD or VERIFY
|
||||||
|
|
||||||
|
jsr JLOAD
|
||||||
|
|
||||||
|
// Handle result
|
||||||
|
|
||||||
|
php
|
||||||
|
pha
|
||||||
|
jsr print_return
|
||||||
|
pla
|
||||||
|
plp
|
||||||
|
bcc cmd_load_no_error
|
||||||
|
|
||||||
|
// .A = KERNAL error code, also almost matches BASIC error codes
|
||||||
|
|
||||||
|
tax
|
||||||
|
dex
|
||||||
|
bpl !+
|
||||||
|
ldx #B_ERR_BREAK
|
||||||
|
!:
|
||||||
|
jmp do_basic_error
|
||||||
|
|
||||||
|
cmd_load_no_error:
|
||||||
|
|
||||||
|
// Store last loaded address
|
||||||
|
|
||||||
|
stx VARTAB+0
|
||||||
|
sty VARTAB+1
|
||||||
|
|
||||||
|
// Now relink the loaded program, as we cannot trust the line
|
||||||
|
// links supplied. For example, the VICE virtual drive emulation
|
||||||
|
// always supplies $0101 as the address of the next line
|
||||||
|
|
||||||
|
jsr LINKPRG
|
||||||
|
|
||||||
|
// Now we either start the program from the beginning,
|
||||||
|
// or go back to the READY prompt if LOAD was called from direct mode.
|
||||||
|
|
||||||
|
// Reset to start of program
|
||||||
|
jsr init_oldtxt
|
||||||
|
|
||||||
|
// XXX - should run program if LOAD was used in program mode
|
||||||
|
jmp basic_main_loop
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// XXX move functions below to separate files, change names to neuytral
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cmd_load_fetch_filename:
|
||||||
|
|
||||||
|
// Search for opening quote
|
||||||
|
|
||||||
|
jsr basic_fetch_and_consume_character
|
||||||
|
cmp #$22
|
||||||
|
bne_16 do_SYNTAX_error
|
||||||
|
!:
|
||||||
|
// Filename starts here so set pointer
|
||||||
|
|
||||||
|
lda TXTPTR+0
|
||||||
|
sta FNADDR+0
|
||||||
|
lda TXTPTR+1
|
||||||
|
sta FNADDR+1
|
||||||
|
|
||||||
|
// Now search for end of line or closing quote
|
||||||
|
// so that we know the length of the filename
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
sta FNLEN
|
||||||
|
!:
|
||||||
|
jsr basic_fetch_and_consume_character
|
||||||
|
cmp #$22
|
||||||
|
beq cmd_load_fetch_filename_done
|
||||||
|
cmp #$00
|
||||||
|
beq !+
|
||||||
|
|
||||||
|
inc FNLEN
|
||||||
|
bne !-
|
||||||
|
|
||||||
|
!:
|
||||||
|
jsr basic_unconsume_character
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
cmd_load_fetch_filename_done:
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cmd_load_fetch_dev_secondary:
|
||||||
|
|
||||||
|
// Fetch the device number
|
||||||
|
|
||||||
|
jsr injest_comma
|
||||||
|
bcs cmd_load_fetch_dev_secondary
|
||||||
|
|
||||||
|
jsr basic_parse_line_number
|
||||||
|
lda LINNUM+1
|
||||||
|
bne_16 do_ILLEGAL_QUANTITY_error
|
||||||
|
|
||||||
|
lda LINNUM+0
|
||||||
|
sta FA
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
cmd_load_fetch_secondary:
|
||||||
|
|
||||||
|
// Fetch secondary address
|
||||||
|
|
||||||
|
jsr injest_comma
|
||||||
|
bcs cmd_load_fetch_dev_secondary_done
|
||||||
|
|
||||||
|
jsr basic_parse_line_number
|
||||||
|
lda LINNUM+1
|
||||||
|
bne_16 do_ILLEGAL_QUANTITY_error
|
||||||
|
|
||||||
|
lda LINNUM+0
|
||||||
|
sta SA
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
cmd_load_fetch_dev_secondary_done:
|
||||||
|
|
||||||
|
rts
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// #LAYOUT# STD * #TAKE
|
||||||
|
// #LAYOUT# * BASIC_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
cmd_save:
|
||||||
|
|
||||||
|
// Set default device and secondary address; channel is not important now
|
||||||
|
|
||||||
|
jsr select_device
|
||||||
|
ldy #$00 // secondary address
|
||||||
|
jsr JSETFLS
|
||||||
|
|
||||||
|
// Check if file name is supplied
|
||||||
|
|
||||||
|
jsr basic_end_of_statement_check
|
||||||
|
bcs_16 do_MISSING_FILENAME_error
|
||||||
|
|
||||||
|
// Fetch the file name
|
||||||
|
|
||||||
|
jsr cmd_load_fetch_filename
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// XXX - finish the implementation
|
||||||
|
|
||||||
|
jmp basic_main_loop
|
||||||
@@ -39,10 +39,6 @@ cmd_on:
|
|||||||
nop
|
nop
|
||||||
cmd_wait:
|
cmd_wait:
|
||||||
nop
|
nop
|
||||||
cmd_save:
|
|
||||||
nop
|
|
||||||
cmd_verify:
|
|
||||||
nop
|
|
||||||
cmd_def:
|
cmd_def:
|
||||||
nop
|
nop
|
||||||
cmd_poke:
|
cmd_poke:
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ wedge_arrow_L:
|
|||||||
ldy TXTTAB+1
|
ldy TXTTAB+1
|
||||||
ldx TXTTAB+0
|
ldx TXTTAB+0
|
||||||
|
|
||||||
jmp cmd_load_got_secondaryaddress
|
jmp cmd_load_got_params
|
||||||
|
|
||||||
#if CONFIG_TAPE_HEAD_ALIGN
|
#if CONFIG_TAPE_HEAD_ALIGN
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user