diff --git a/STATUS.md b/STATUS.md index f849504d..36031357 100644 --- a/STATUS.md +++ b/STATUS.md @@ -140,7 +140,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFD5` | `$F49E` | `LOAD` | DONE | | | `($0330)` | `$F4A5` | `LOAD` | DONE | | | `$FFD8` | `$F5DD` | `SAVE` | DONE | main routine not done yet | -| `($0332)` | `$F5ED` | `SAVE` | NOT DONE | | +| `($0332)` | `$F5ED` | `SAVE` | NOT DONE | work in progress, not tested yet | | `$FFDB` | | `SETTIM` | DONE | | | `$FFDE` | | `RDTIM` | DONE | | | `$FFE1` | `$F6ED` | `STOP` | DONE | | diff --git a/c64/kernal/assets/kernal_messages.s b/c64/kernal/assets/kernal_messages.s index ed113935..a14954c1 100644 --- a/c64/kernal/assets/kernal_messages.s +++ b/c64/kernal/assets/kernal_messages.s @@ -53,8 +53,8 @@ __msg_kernalverifying: __msg_kernalsaving: .byte $0D - .text "SAVIN" - .byte $80 + $47 // end of string mark + 'G' + .text "SAVING" + .byte $80 + $20 // end of string mark + space __msg_kernalfrom_hex: .text " FROM " diff --git a/c64/kernal/iec/iec_close_load.s b/c64/kernal/iec/iec_close_load.s deleted file mode 100644 index 180d6c6f..00000000 --- a/c64/kernal/iec/iec_close_load.s +++ /dev/null @@ -1,29 +0,0 @@ - -// -// Common part of CLOSE and LOAD routines for IEC -// - - -#if CONFIG_IEC - -iec_close_load: - - tax - - // Command drive to stop talking and to close the file - jsr UNTLK - - txa - jsr LISTEN - - lda #$E0 // CLOSE command - sta TBTCNT - jsr iec_tx_command - jsr iec_tx_command_finalize - - // Tell drive to unlisten - jsr UNLSN - - rts - -#endif // CONFIG_IEC diff --git a/c64/kernal/iec/iec_close_load_save.s b/c64/kernal/iec/iec_close_load_save.s new file mode 100644 index 00000000..445379e0 --- /dev/null +++ b/c64/kernal/iec/iec_close_load_save.s @@ -0,0 +1,41 @@ + +// +// Common part of CLOSE and LOAD/SAVE routines for IEC +// + + +#if CONFIG_IEC + + +iec_close_load: + + tax + + // Command drive to stop talking before closing the file + jsr UNTLK +!: + txa + jsr LISTEN + + lda #$E0 // CLOSE command + sta TBTCNT + jsr iec_tx_command + jsr iec_tx_command_finalize + + // Tell drive to unlisten + jsr UNLSN + + rts + + +iec_close_save: + + tax + + // Command drive to stop listening before closing the file + jsr UNLSN + + bne !- // branch alwayys + + +#endif // CONFIG_IEC diff --git a/c64/kernal/iec/save_iec.s b/c64/kernal/iec/save_iec.s index 0f846c9d..e565f713 100644 --- a/c64/kernal/iec/save_iec.s +++ b/c64/kernal/iec/save_iec.s @@ -4,34 +4,89 @@ // +// XXX this is untested! + + #if CONFIG_IEC -save_iec: +save_iec_dev_not_found: + jmp lvs_device_not_found_error + +save_iec_error: + jmp lvs_device_not_found_error // XXX find a better error + + +save_iec: // XXX finish the implementation -/* // Display SAVING - // XXX jsr lvs_display_saving + jsr lvs_display_saving // Call device to LISTEN lda FA jsr LISTEN - bcs save_iec_dev_not_found // XXX redirecto to load + bcs save_iec_dev_not_found - // Open channel XXX (reserved for file writing) - lda #XXX + // Open channel 1 (reserved for file writing) + lda #$01 jsr iec_cmd_open - bcs // XXX error + bcs save_iec_dev_not_found // Send file name jsr iec_send_file_name - bcs load_iec_error + bcs save_iec_error - // XXX finish the implementation - + // Call device to LISTEN once again + lda FA + jsr LISTEN + bcs save_iec_dev_not_found + + lda #$60 // open channel / data (p3) , required according to p13 + sta TBTCNT + jsr iec_tx_command + bcs save_iec_error + + ldy #$00 +iec_save_loop: + + // Retrieve byte to send +#if CONFIG_MEMORY_MODEL_60K + ldx #