From 05253c3e92f8d398878f3bba0f1d1f3b2b95fc6f Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 27 Oct 2019 18:36:57 +0100 Subject: [PATCH] improved VECTOR/RESTOR compatibility, small DOS wedge improvements --- c64/basic/wedge_dos.s | 6 +++--- c64/kernal/init/fce2.hw_entry_reset.s | 4 ++-- c64/kernal/vector_real.s | 13 ++++++------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/c64/basic/wedge_dos.s b/c64/basic/wedge_dos.s index 930fa36b..b7292c5d 100644 --- a/c64/basic/wedge_dos.s +++ b/c64/basic/wedge_dos.s @@ -66,6 +66,7 @@ wedge_dos_command: !: // Retrieve status, print it if not OK jsr JCLALL + jsr print_return jsr wedge_dos_status_get lda BUF+0 cmp #$30 // '0' @@ -92,6 +93,7 @@ wedge_dos_change_drive: jmp do_ILLEGAL_DEVICE_NUMBER_error !: sta FA + jsr print_return jmp basic_end_of_line wedge_dos_status_get: @@ -134,8 +136,8 @@ wedge_dos_x1: wedge_dos_status: - jsr print_return jsr wedge_dos_status_get + jsr print_return // FALLTROUGH wedge_dos_status_print: @@ -230,8 +232,6 @@ wedge_dos_directory_display: wedge_dos_clean_exit: jsr JCLALL - // Print new line - jsr print_return jmp basic_main_loop wedge_dos_basic_error: diff --git a/c64/kernal/init/fce2.hw_entry_reset.s b/c64/kernal/init/fce2.hw_entry_reset.s index e0a3793e..14014a02 100644 --- a/c64/kernal/init/fce2.hw_entry_reset.s +++ b/c64/kernal/init/fce2.hw_entry_reset.s @@ -30,11 +30,11 @@ hw_entry_reset: !: // Initialising IO is obviously required. Also indicated by c64 prg p269. jsr JIOINIT - + // Setting up the screen and testing ram is obviously required // also affirmed by p269 of c64 prg jsr JRAMTAS // called RANTAM on Codebase64 wiki - + // Resetting IO vectors is obviously required, if we want interrupts to run // also affirmed by c64 prg p269 jsr JRESTOR diff --git a/c64/kernal/vector_real.s b/c64/kernal/vector_real.s index b3540f9c..299d2c8a 100644 --- a/c64/kernal/vector_real.s +++ b/c64/kernal/vector_real.s @@ -1,4 +1,5 @@ + vector_real: // Use MEMUSS as temporary storage location - checked on real C64 that this is the @@ -8,11 +9,11 @@ vector_real: // According to 'Compute's Mapping the Commodore 64' page 237, // the CBM implementation does not disable IRQs - yet, the // 'C64 Programmers Reference Guide' does not contain such - // warning and does not mention any preparations needed, so... - // better safe than sorry, disable the IRQ for the duration - // of vector manipulation - php - cli + // warning and does not mention any preparations needed. + + // Initial idea was to do php, cli, ..., plp to make the routine safer, + // but it seems it might cause problem with initialization sequence, + // as the stack might be uninitialized when this routine is called // Prepare the user data pointer - strange order to reduce risk // of potential similarity to the original routine @@ -38,6 +39,4 @@ vector_end_loop: dey bpl vector_restore - // Restore status register (IRQ) before return - plp rts