I/O stack refactoring completed
This commit is contained in:
1 parent
ec98861613
commit
ec3e78de88
13 files changed
+84
-23
No files matched your search
@@ -35,6 +35,8 @@ CHRIN:
|
||||
|
||||
#endif // HAS_RS232
|
||||
|
||||
chrin_getin: // jump entry for GETIN
|
||||
|
||||
#if CONFIG_IEC
|
||||
|
||||
// Try IEC devices
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmer's Reference Guide - page 278/279
|
||||
// - [CM64] Compute's Mapping the Commodore 64 - page 228
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .Y
|
||||
// Additionally we have to preserve .X for out CHRIN and implementation
|
||||
//
|
||||
|
||||
CHROUT:
|
||||
|
||||
sta SCHAR
|
||||
|
||||
// Save X and Y values
|
||||
// (Confirmed by writing a test program that X and Y
|
||||
// don't get modified, in agreement with C64 PRG's
|
||||
// description of CHROUT)
|
||||
|
||||
phx_trash_a
|
||||
phy_trash_a
|
||||
|
||||
php
|
||||
|
||||
// Determine the device number
|
||||
lda DFLTO
|
||||
|
||||
cmp #$03 // screen
|
||||
beq_far chrout_screen
|
||||
|
||||
#if HAS_RS232
|
||||
cmp #$02
|
||||
beq_far chrout_rs232
|
||||
#endif
|
||||
|
||||
#if CONFIG_IEC
|
||||
jsr iec_check_devnum_oc
|
||||
bcc_far chrout_iec
|
||||
#if CONFIG_IEC
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
chrout_done_fail:
|
||||
|
||||
plp
|
||||
|
||||
// Restore X and Y
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
|
||||
sec // indicate failure
|
||||
rts
|
||||
|
||||
chrout_done_unknown_device:
|
||||
|
||||
plp
|
||||
|
||||
// Restore X and Y
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
|
||||
// End wioth error
|
||||
jmp lvs_device_not_found_error
|
||||
|
||||
chrout_done_success:
|
||||
|
||||
plp
|
||||
|
||||
// Restore X and Y
|
||||
ply_trash_a
|
||||
plx_trash_a
|
||||
|
||||
lda SCHAR
|
||||
clc // indicate success
|
||||
rts
|
||||
@@ -0,0 +1,8 @@
|
||||
All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses.
|
||||
|
||||
Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point
|
||||
to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify
|
||||
different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original
|
||||
C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory).
|
||||
|
||||
For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal.
|
||||
@@ -40,9 +40,19 @@ LOAD:
|
||||
// Check whether we support the requested device
|
||||
lda FA
|
||||
|
||||
#if CONFIG_TAPE_NORMAL
|
||||
cmp #$01
|
||||
beq_far load_tape_normal
|
||||
#endif
|
||||
|
||||
#if CONFIG_TAPE_TURBO
|
||||
cmp #$07
|
||||
beq_far load_tape_turbo
|
||||
#endif
|
||||
|
||||
#if CONFIG_IEC
|
||||
jsr iec_check_devnum_lvs
|
||||
bcc_far load_iec
|
||||
#endif // CONFIG_IEC
|
||||
#endif
|
||||
|
||||
jmp lvs_illegal_device_number
|
||||
Reference in new issue
Block a user