Files
open-roms/src/kernal/iec/ckout_iec.s
T
chris 340bbefd06 CHKIN, CHKOUT: address the channel by the file's secondary address
chkin_iec and ckout_iec read the secondary address from LAT, the table
of logical file numbers, instead of SAT, the table of secondary
addresses. A file whose number differed from its secondary address,
such as OPEN 3,8,2, was read from or written to the wrong channel, and
the read-only and write-only checks tested the file number.

The contract (Michael Steil, "Commodore Peripheral Bus: Part 2",
https://www.pagetable.com/?p=1031): CHKIN sends TALK and CHKOUT sends
LISTEN, each followed by the secondary address OPEN was given; Compute!'s
Mapping the Commodore 64 (p. 52) keeps the logical file numbers at
$0259 (LAT) and the secondary addresses at $026D (SAT). Both routines
now read SAT.

Not reported upstream (https://github.com/MEGA65/open-roms); it may be
what upstream issue #117's OPEN 1,8,0,"$" test met:
https://github.com/MEGA65/open-roms/issues/117
2026-10-15 02:17:03 +02:00

35 lines
470 B
ArmAsm

;; #LAYOUT# STD * #TAKE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
;
; IEC part of the CKOUT routine
;
!ifdef CONFIG_IEC {
ckout_iec:
; Fail if the file is open for reading (secondary address 0)
lda SAT, Y
+beq ckout_file_not_output
; Send LISTEN + SECOND first
lda FAT,Y
jsr LISTEN
+bcs chkinout_device_not_present
lda SAT, Y
ora #$60
jsr SECOND
+bcs chkinout_device_not_present
jmp ckout_set_device
} ; CONFIG_IEC