From 1480350bfb133d3d4d84e2dd2d932907323a7392 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 6 Oct 2019 13:02:14 +0200 Subject: [PATCH] IEC code compatibility improvements --- c64/kernal/iec/iec_rx_byte.s | 12 ++++++------ c64/kernal/iec/iec_tx_byte.s | 6 ++++-- c64/kernal/lvs_helpers.s | 6 ++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/c64/kernal/iec/iec_rx_byte.s b/c64/kernal/iec/iec_rx_byte.s index bb9328ef..01f34846 100644 --- a/c64/kernal/iec/iec_rx_byte.s +++ b/c64/kernal/iec/iec_rx_byte.s @@ -13,7 +13,9 @@ iec_rx_byte: pha // Timing is critical here - execute on disabled IRQs - php + // The best practice would be to do PHP first, but it seems this is not + // what the original ROM does; furthermore, pushing additional bytes to + // stack can wreck autostart softwaree loading at $0100 sei // First, we wait for the talker to release the CLK line @@ -107,8 +109,7 @@ iec_rx_clk_wait2: // Timeout jsr kernalstatus_EOI pla - plp - + // Restore registers pla tay @@ -116,6 +117,7 @@ iec_rx_clk_wait2: tax sec // XXX confirm that sec is really a way to report timeout here + cli rts !: // More bits? @@ -130,9 +132,6 @@ iec_rx_clk_wait2: // Retreive the received byte pla - - // Return no-error - plp // Restore registers sta TBTCNT // $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html @@ -143,5 +142,6 @@ iec_rx_clk_wait2: lda TBTCNT clc + cli rts diff --git a/c64/kernal/iec/iec_tx_byte.s b/c64/kernal/iec/iec_tx_byte.s index 69e71f52..7721cc0e 100644 --- a/c64/kernal/iec/iec_tx_byte.s +++ b/c64/kernal/iec/iec_tx_byte.s @@ -26,7 +26,9 @@ iec_tx_byte: iec_tx_common: // Timing is critical here - execute on disabled IRQs - php + // The best practice would be to do PHP first, but it seems this is not + // what the original ROM does; furthermore, pushing additional bytes to + // stack can wreck autostart softwaree loading at $0100 sei // Wait till all receivers are ready, they should all release DATA @@ -79,7 +81,7 @@ iec_tx_common_bit_is_sent: dex bpl iec_tx_common_sendbit - plp + cli // Give device time to tell if they are busy by pulling DATA // They should do it within 1ms diff --git a/c64/kernal/lvs_helpers.s b/c64/kernal/lvs_helpers.s index 4548f58e..948de153 100644 --- a/c64/kernal/lvs_helpers.s +++ b/c64/kernal/lvs_helpers.s @@ -41,6 +41,7 @@ lvs_handle_byte_load_verify: // Thus we have to use a helper routine in low memory // to do the memory access +#if CONFIG_MEMORY_MODEL_60K // Save byte under ROMs and IO if required php sei @@ -52,6 +53,11 @@ lvs_handle_byte_load_verify: ldx #$37 stx $01 plp +#else + ldy #0 + sta (STAL),y +#endif + rts lvs_advance_pointer: