diff --git a/c64/basic/basic_commands/cmd_load_verify.s b/c64/basic/basic_commands/cmd_load_verify.s index e77a22e4..45e1520c 100644 --- a/c64/basic/basic_commands/cmd_load_verify.s +++ b/c64/basic/basic_commands/cmd_load_verify.s @@ -50,6 +50,9 @@ cmd_load_got_params: // input for tape wedge ldy TXTTAB+1 ldx TXTTAB+0 + +cmd_load_loadmerge: // entry point for 'cmd_merge' + lda VERCKB // LOAD or VERIFY jsr JLOAD diff --git a/c64/basic/basic_commands_CC/cmd_bload.s b/c64/basic/basic_commands_CC/cmd_bload.s deleted file mode 100644 index 2feed6d0..00000000 --- a/c64/basic/basic_commands_CC/cmd_bload.s +++ /dev/null @@ -1,8 +0,0 @@ -// #LAYOUT# STD * #TAKE -// #LAYOUT# * BASIC_0 #TAKE -// #LAYOUT# * * #IGNORE - - -cmd_bload: - - jmp do_NOT_IMPLEMENTED_error // XXX implement the command diff --git a/c64/basic/basic_commands_CC/cmd_bload_bverify.s b/c64/basic/basic_commands_CC/cmd_bload_bverify.s new file mode 100644 index 00000000..aaab38d0 --- /dev/null +++ b/c64/basic/basic_commands_CC/cmd_bload_bverify.s @@ -0,0 +1,41 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + + +cmd_bverify: + + // 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_bload: + + lda #$00 // mark operation as LOAD + sta VERCKB + + // Set default device and secondary address; channel is not important now + + jsr select_device + ldy #$00 // secondary address 0 - it has to be loaded precisely where we want + jsr JSETFLS + + // Fetch the file name + + jsr fetch_filename + bcc !+ + + // No filename supplied - this should only be allowed for tape (device number below 8) + + lda FA + and #%11111000 + bne_16 do_MISSING_FILENAME_error + + lda #$00 + sta FNLEN +!: + // XXX finish the implementation + + jmp do_NOT_IMPLEMENTED_error diff --git a/c64/basic/basic_commands_CC/cmd_bverify.s b/c64/basic/basic_commands_CC/cmd_bverify.s deleted file mode 100644 index 3fdfdf8a..00000000 --- a/c64/basic/basic_commands_CC/cmd_bverify.s +++ /dev/null @@ -1,8 +0,0 @@ -// #LAYOUT# STD * #TAKE -// #LAYOUT# * BASIC_0 #TAKE -// #LAYOUT# * * #IGNORE - - -cmd_bverify: - - jmp do_NOT_IMPLEMENTED_error // XXX implement the command diff --git a/c64/basic/basic_commands_CC/cmd_merge.s b/c64/basic/basic_commands_CC/cmd_merge.s index f464369e..42410adb 100644 --- a/c64/basic/basic_commands_CC/cmd_merge.s +++ b/c64/basic/basic_commands_CC/cmd_merge.s @@ -5,4 +5,46 @@ cmd_merge: - jmp do_NOT_IMPLEMENTED_error // XXX implement the command + lda #$00 // mark operation as LOAD + sta VERCKB + + // Set default device and secondary address; channel is not important now + + jsr select_device + ldy #$00 // secondary address 0 - it has to be loaded precisely where we want + jsr JSETFLS + + // Fetch the file name + + jsr fetch_filename + bcc !+ + + // No filename supplied - this should only be allowed for tape (device number below 8) + + lda FA + and #%11111000 + bne_16 do_MISSING_FILENAME_error + + lda #$00 + sta FNLEN +!: + // Fetch device number + + jsr fetch_device_secondary_uint8 + bcs !+ + + sta FA +!: + // Perform loading - just for a different address + + sec + lda VARTAB+0 + sbc #$02 + sta VARTAB+0 + tax + bcs !+ + dec VARTAB+1 +!: + ldy VARTAB+1 + + jmp cmd_load_loadmerge // XXX check variable handling (VARTAB) after failure to load diff --git a/c64/basic/engine/fetch_device_secondary.s b/c64/basic/engine/fetch_device_secondary.s index 8094d303..3fb96a95 100644 --- a/c64/basic/engine/fetch_device_secondary.s +++ b/c64/basic/engine/fetch_device_secondary.s @@ -11,15 +11,9 @@ fetch_device_secondary: // Fetch the device number - jsr injest_comma - bcs fetch_secondary + jsr fetch_device_secondary_uint8 + bcs fetch_device_secondary_done - jsr injest_spaces - jsr basic_parse_line_number - lda LINNUM+1 - bne_16 do_ILLEGAL_QUANTITY_error - - lda LINNUM+0 sta FA // FALLTROUGH @@ -28,15 +22,9 @@ fetch_secondary: // Fetch secondary address - jsr injest_comma + jsr fetch_device_secondary_uint8 bcs fetch_device_secondary_done - jsr injest_spaces - jsr basic_parse_line_number - lda LINNUM+1 - bne_16 do_ILLEGAL_QUANTITY_error - - lda LINNUM+0 sta SA // FALLTROUGH @@ -44,3 +32,18 @@ fetch_secondary: fetch_device_secondary_done: rts + + +fetch_device_secondary_uint8: // also called by 'cmd_merge' + + jsr injest_comma + bcs !+ + + jsr injest_spaces + jsr basic_parse_line_number + lda LINNUM+1 + bne_16 do_ILLEGAL_QUANTITY_error + lda LINNUM+0 + clc +!: + rts