diff --git a/c64/basic/commands/cmd_load_verify.s b/c64/basic/commands/cmd_load_verify.s index e93888dc..048951b4 100644 --- a/c64/basic/commands/cmd_load_verify.s +++ b/c64/basic/commands/cmd_load_verify.s @@ -28,7 +28,7 @@ cmd_load: jsr fetch_filename bcs cmd_load_no_filename - // Try to fetch secondary address + // Try to fetch device and secondary address jsr fetch_device_secondary jmp cmd_load_got_params @@ -53,15 +53,7 @@ cmd_load_got_params: // input for tape wedge lda VERCKB // LOAD or VERIFY jsr JLOAD - - // Handle result - - php - pha - jsr print_return - pla - plp - bcs_16 do_kernal_error + jsr cmd_load_save_handle_result cmd_load_no_error: @@ -97,9 +89,24 @@ cmd_load_no_error: inx beq cmd_load_end // branch if direct mode - // XXX jmp basic_execute_from_current_line cmd_load_end: jmp basic_main_loop + + +// +// Handle result from Kernal - common for LOAD/VERIFY/SAVE +// + +cmd_load_save_handle_result: + + php + pha + jsr print_return + pla + plp + bcs_16 do_kernal_error + + rts diff --git a/c64/basic/commands/cmd_save.s b/c64/basic/commands/cmd_save.s index f94bf0c5..00a61f59 100644 --- a/c64/basic/commands/cmd_save.s +++ b/c64/basic/commands/cmd_save.s @@ -8,7 +8,7 @@ cmd_save: // Set default device and secondary address; channel is not important now jsr select_device - ldy #$00 // secondary address + ldy #$00 jsr JSETFLS // Fetch the file name @@ -16,10 +16,24 @@ cmd_save: jsr fetch_filename bcs_16 do_MISSING_FILENAME_error + // Try to fetch device + jsr fetch_device_secondary + // Setup the start and end addresses + lda #TXTTAB - // XXX - finish the implementation + // Setup the end address + + ldx VARTAB+0 + ldy VARTAB+1 + + // Perform saving + + jsr JSAVE + jsr cmd_load_save_handle_result + + // The end jmp basic_main_loop diff --git a/c64/basic/select_device.s b/c64/basic/select_device.s index ba23425d..40bb8d49 100644 --- a/c64/basic/select_device.s +++ b/c64/basic/select_device.s @@ -3,7 +3,7 @@ // #LAYOUT# * * #IGNORE -select_device: +select_device: // XXX check usage, probably more can be put into this common section // Take last device number, make sure it is a drive - 8 or above. Above 30, // although illegal for IEC we also consider a drive, as they exists