initial SAVE implementation

This commit is contained in:
FeralChild64 committed 2019-11-05 17:09:57 +01:00
1 parent 6f39064916
commit b860322a09
6 files changed
+135 -45

No files matched your search

+1 -1
View File
@@ -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 | |
+2 -2
View File
@@ -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 "
-29
View File
@@ -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
+41
View File
@@ -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
+67 -12
View File
@@ -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 #<STAL+0
jsr peek_under_roms
#else // CONFIG_MEMORY_MODEL_38K
lda (STAL),y
#endif
// Check if end of saving
ldx STAL+0
cpx EAL+0
bne !+
ldx STAL+1
cpx EAL+1
beq iec_save_loop_end
!:
// Send the byte and do next iteration
sta TBTCNT
clc
jsr iec_tx_byte
jsr lvs_advance_pointer
jmp iec_save_loop
iec_save_loop_end:
// Send last byte
sta TBTCNT
sec // mark end of stream
jsr iec_tx_byte
// Close file on drive
lda FA
jsr iec_close_save
// Return success
clc
rts
*/
STUB_IMPLEMENTATION()
#endif // CONFIG_IEC
@@ -1,6 +1,6 @@
//
// Helper functions for various LOAD/VERIVY/SAVE routine variants (IEC / U64 / etc.)
// Helper functions for various LOAD/VERIFY/SAVE routine variants (IEC / U64 / etc.)
//
@@ -149,6 +149,29 @@ lvs_display_done:
ldx #__MSG_KERNAL_TO_HEX
jmp !-
lvs_display_saving:
// Display SAVING and file name
lda MSGFLG
bpl lvs_display_end
ldx #__MSG_KERNAL_SAVING
jsr print_kernal_message
ldy #$00
!:
cpy FNLEN
beq !+
lda (FNADDR), y
jsr JCHROUT
iny
bne !- // jump alwayys
!:
jsr print_return
rts
lvs_error_end:
sec