From c3383b9e8fadee15fcbeae2c9b726ac5ee8fa12d Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 29 Oct 2019 22:31:25 +0100 Subject: [PATCH] RS-232 OPEN/CLOSE connected to I/O stack --- c64/kernal/iec/open_iec.s | 6 ++++++ c64/kernal/iostack/f291.close.s | 17 +++++++++++------ c64/kernal/iostack/f34a.open.s | 17 ++++++++++++----- c64/kernal/rs232/close_rs232.s | 7 ++++--- c64/kernal/rs232/open_rs232.s | 7 ++++--- 5 files changed, 37 insertions(+), 17 deletions(-) diff --git a/c64/kernal/iec/open_iec.s b/c64/kernal/iec/open_iec.s index 33269eb9..f2269c0b 100644 --- a/c64/kernal/iec/open_iec.s +++ b/c64/kernal/iec/open_iec.s @@ -9,6 +9,10 @@ open_iec: + // Check for command to send + ldy FNLEN + beq open_iec_done + // We have a command to send to IEC device jsr LISTEN bcc !+ @@ -28,6 +32,8 @@ open_iec: // Send command ('file name') jsr lvs_send_file_name +open_iec_done: + jmp open_done_success diff --git a/c64/kernal/iostack/f291.close.s b/c64/kernal/iostack/f291.close.s index c2f3c4ae..c4930447 100644 --- a/c64/kernal/iostack/f291.close.s +++ b/c64/kernal/iostack/f291.close.s @@ -11,21 +11,26 @@ CLOSE: - // XXX this needs more testing (opening 10 files at once, closing in various orders, etc) once the code is more mature - // Find the LAT / SAT / FAT entry which LAT corresponds to A jsr find_fls bcs close_end // XXX can we report error in IOSTATUS here? -#if CONFIG_IEC + // We have the entry index in .Y - // We have the entry index in .Y - check whether this is IEC device lda FAT, y + + // Perform device-specific actions + +#if HAS_RS232 + cmp #$02 + beq_far close_rs232 +#endif + +#if CONFIG_IEC jsr iec_check_devnum_oc bcc_far close_iec - -#endif // CONFIG_IEC +#endif // FALLTROUGH diff --git a/c64/kernal/iostack/f34a.open.s b/c64/kernal/iostack/f34a.open.s index ddadebea..3dc0e134 100644 --- a/c64/kernal/iostack/f34a.open.s +++ b/c64/kernal/iostack/f34a.open.s @@ -54,15 +54,22 @@ open_has_space: iny sty LDTND - // Check for command to send - lda FNLEN - beq open_done_success - - // Check for IEC device lda FA + +#if HAS_RS232 + + cmp #$02 + beq_far open_rs232 + +#endif + +#if CONFIG_IEC + jsr iec_check_devnum_oc bcc_far open_iec +#endif + // FALLTROUGH open_done_success: diff --git a/c64/kernal/rs232/close_rs232.s b/c64/kernal/rs232/close_rs232.s index 95e5959e..a2d6457e 100644 --- a/c64/kernal/rs232/close_rs232.s +++ b/c64/kernal/rs232/close_rs232.s @@ -3,14 +3,15 @@ // RS-232 part of the CLOSE routine // -// XXX connect to I/O stack - #if HAS_RS232 close_rs232: - STUB_IMPLEMENTATION() // XXX provide implementation for both UP2400 and UP9600 + + // XXX provide implementation for both UP2400 and UP960 + + jmp close_remove_from_table #endif // HAS_RS232 diff --git a/c64/kernal/rs232/open_rs232.s b/c64/kernal/rs232/open_rs232.s index b864cdc0..82d64230 100644 --- a/c64/kernal/rs232/open_rs232.s +++ b/c64/kernal/rs232/open_rs232.s @@ -3,14 +3,15 @@ // RS-232 part of the OPEN routine // -// XXX connect to I/O stack - #if HAS_RS232 open_rs232: - STUB_IMPLEMENTATION() // XXX provide implementation for both UP2400 and UP9600 + + // XXX provide implementation for both UP2400 and UP9600 + + jmp open_done_success #endif // HAS_RS232