Commit Graph
245 Commits
Author SHA1 Message Date
chris 729a410079 Serial bus: UNLSN, UNTLK, and a missing device leave the bus released
UNLSN ended through iec_set_idle, which pulls CLK, so the C64 kept
holding CLK after UNLISTEN. UNTLK waited for the talker to pull CLK,
which no device does after UNTALK, timed out, and left CLK pulled with
carry set. And a serial routine that found no device also left CLK
pulled. A fastloader that waits for the drive to pull CLK after the
KERNAL's UNLSN (Turrican's) then went on too early.

The contract (Michael Steil, "Commodore Peripheral Bus: Part 4",
https://www.pagetable.com/?p=1135): at the end of a transmission the
sender releases CLK and the receivers release DATA, so the bus is idle
again, and the controller releases ATN after each command; after
UNTALK "the current talker will then release the bus" (Part 2,
https://www.pagetable.com/?p=1031). UNLSN and UNTLK now share their end
and release CLK and DATA; the device-not-present exit releases ATN, CLK,
and DATA. Commodore's ROMs leave the same lines in the same scenarios,
as differential tests in arnitech show.

Not reported upstream (https://github.com/MEGA65/open-roms).
2026-10-15 14:21:36 +02:00
chris 51a2a43520 CLOSE: a device that does not answer sets ST to device not present
When LISTEN or the CLOSE command found no device on the serial bus,
close_iec freed the file number but left ST as it was, so READST after
the CLOSE said 0.

The contract: every device on the bus must answer ATN by pulling DATA,
and when none does the result is DEVICE NOT PRESENT (Michael Steil,
"Commodore Peripheral Bus: Part 2", https://www.pagetable.com/?p=1031);
the C64 Programmer's Reference Guide's READST reports that as ST bit 7
($80). close_iec now sets that bit when LISTEN or the CLOSE command
fails, and still frees the file number. Commodore's ROMs give the same
ST in the same scenario, as a differential test in arnitech shows.

Not reported upstream (https://github.com/MEGA65/open-roms).
2026-10-15 02:50:48 +02:00
chris 74ef17d292 Serial bus: a data byte with no listener says DEVICE NOT PRESENT
iec_tx_byte never checked that anyone was listening. With no listener,
DATA stays released, so the wait for listeners to be ready returned at
once, and a byte sent with EOI then waited forever for an EOI
acknowledgement that never came. UNLSN, which sends the byte CIOUT holds
back with EOI, hung the C64 after CHKOUT to a channel the drive refuses
(DOS 2.6 leaves the bus when no write channel is open), or to a channel
a CLOSE 15 has closed.

The contract (Michael Steil, "Commodore Peripheral Bus: Part 4",
https://www.pagetable.com/?p=1135): a listener holds DATA until the
talker releases CLK; if at the beginning of a byte no receiver pulls
DATA within 256 us, that is a DEVICE NOT PRESENT error. The C64
Programmer's Reference Guide's READST gives it as ST bit 7 ($80).
iec_tx_byte now waits up to about 256 us for DATA to be pulled, and
without it sets ST $80 and returns with DEVICE NOT PRESENT. Commodore's
ROMs give the same ST in the same scenarios, as a differential test in
arnitech shows.

Not reported upstream (https://github.com/MEGA65/open-roms).
2026-10-15 02:31:56 +02:00
chris f1df180bf8 TKSA: send the secondary address the caller gives
TKSA ORed the accumulator with $90 before sending it. Its callers pass
the secondary address plus $60, as the routine's own comment asks, so
TKSA turned a TALK secondary address $60-$6F into $F0-$FF, the OPEN
command, on the bus.

The contract (C64 Programmer's Reference Guide, TKSA; Michael Steil,
"Commodore Peripheral Bus: Part 2", https://www.pagetable.com/?p=1031,
which gives TKSA's argument as A = $60 + secondary address): TKSA sends
the byte in A as the secondary address to the device told to TALK.
TKSA now sends A as it is.

Upstream: https://github.com/MEGA65/open-roms/issues/116 (bug 1)
2026-10-15 02:18:55 +02:00
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
chris 29124377fc CLOSE: send LISTEN, CLOSE, UNLISTEN to a serial device
close_iec sent its CLOSE command under ATN without first addressing the
device with LISTEN and without UNLISTEN after it, and built the command
with ORA $E0 (zero page) instead of ORA #$E0, so the byte it sent was
the secondary address ORed with whatever $E0 held. The drive never
learned of the CLOSE, so a file written on a channel was never written
to the disk.

The contract (Michael Steil, "Commodore Peripheral Bus: Part 2",
https://www.pagetable.com/?p=1031): CLOSE of a file on a serial device
sends LISTEN, then $E0 plus the secondary address, then UNLISTEN.
close_iec now does that, as iec_close_load already does for LOAD.

Not reported upstream (https://github.com/MEGA65/open-roms).
2026-10-15 02:15:38 +02:00
chris 264e9792a5 CIOUT: buffer the byte where iec_tx_byte sends it from
CIOUT kept the byte to send next in BSOUR ($95), but iec_tx_byte, which
CIOUT and iec_tx_flush (called by UNLSN, UNTLK, LISTEN, TALK) use to
send it, transmits TBTCNT ($A4). So every byte CHROUT sent to a serial
device was whatever TBTCNT held, and a file written with CHKOUT and
CHROUT held the wrong bytes.

The contract (C64 Programmer's Reference Guide, CIOUT): CIOUT sends a
byte to the listening device, always holding one back so that the last
byte goes with EOI when UNLSN ends the transfer. CIOUT now buffers the
byte in TBTCNT, the one-line fix of upstream PR #113; changing the send
path to read BSOUR would also move LOAD's and SAVE's bytes.

Upstream: https://github.com/MEGA65/open-roms/pull/113
2026-10-15 02:15:38 +02:00
Rikard Nordgren 535917a0f4 Add init screen code at E536 2025-02-05 18:40:56 +01:00
FeralChild64 f9a1bab1fd fixed mistake in the hypervisor init 2021-08-24 22:03:05 +02:00
FeralChild64 a12eaff249 attempt tro fix https://github.com/MEGA65/open-roms/issues/68 2021-08-08 20:54:29 +02:00
FeralChild64 f7ff71f6cd added ram disk status message on startup screen 2021-05-19 22:59:35 +02:00
FeralChild64 f6abf8e4cd some work towards 2nd floppy 2021-05-16 17:58:22 +02:00
FeralChild64 d68583d1b3 improved support for different RAM configurations 2021-03-30 20:34:01 +02:00
FeralChild64 7510d4a83f fixed problem in LOAD, wrong register was used 2021-03-27 22:12:06 +01:00
FeralChild64 0e34cd8d68 more work on RAM disk support, added ATTIC/CELLAR RAM test 2021-03-26 21:43:24 +01:00
FeralChild64 0618d38cdd 65C02 code size optimization (22 bytes saved) in IEC code 2021-03-26 16:45:06 +01:00
FeralChild64 2110abf932 fixed JiffyDOS broken on some configuurations 2021-02-28 22:02:13 +01:00
FeralChild64 50da880ffc code size optimization 2021-02-24 21:11:41 +01:00
FeralChild64 b21ba971f9 CBDOS now works in compatibility mode too 2021-02-24 19:08:51 +01:00
FeralChild64 cb16d5d15c started MEGA65 speed handling rework, always run IEC code with disabled badlines 2021-02-24 18:44:18 +01:00
FeralChild64 67e9be4372 fixed LOAD command for CBDOS 2021-02-14 16:19:00 +01:00
FeralChild64 eec5a0680b small CBDOS tweaks 2021-02-14 15:23:12 +01:00
FeralChild64 3e9581cb89 fixed sending file name to CBDOS 2021-02-12 21:25:06 +01:00
FeralChild64 beefa98acc some work towards SECOND in the internal DOS 2021-02-12 18:53:38 +01:00
FeralChild64 04be4bf1d1 work towards SECOND/TKSA in CBDOS 2021-02-07 12:39:18 +01:00
FeralChild64 5f6a8eb7bf MEGA65 banner now displays internal device numbers 2021-02-03 20:20:10 +01:00
FeralChild64 92d1ad0177 rework for the initial CBDOS 2021-02-03 16:05:07 +01:00
FeralChild64 7d7b3c8419 improved IEC error handling 2021-01-25 22:41:18 +01:00
FeralChild64 38bf468653 fixed infinite loop in IEC code 2021-01-25 22:37:55 +01:00
FeralChild64 6193fdcf7b disabled function keys for non-direct mode and for MONITOR 2021-01-25 21:21:01 +01:00
FeralChild64 f218a3ca84 fixed another CHRIN problem, with empty lines 2021-01-25 21:02:16 +01:00
FeralChild64 737fa3c443 CHRIN fix, C64 part 2021-01-24 22:18:07 +01:00
FeralChild64 a9c999c189 CHRIN fix, M65 part 2021-01-24 22:10:02 +01:00
FeralChild64 dc5cc32e7b minor CHRIN code size optimization 2021-01-24 20:22:38 +01:00
FeralChild64 7cabe62cc5 more monitor bugfixes 2021-01-22 23:52:07 +01:00
FeralChild64 1bc7bf7e40 more work towards disk operations in monitor 2021-01-20 18:00:09 +01:00
FeralChild64 09cd066256 started work on monitor GO/JSR commands 2021-01-18 22:06:22 +01:00
FeralChild64 68a784d563 monitor command 'F' adaptation, not tested yet 2021-01-14 18:08:03 +01:00
FeralChild64 409b01aec4 adapter converters, preparations for DOS Wedge from within the monitor 2021-01-11 06:54:33 +01:00
FeralChild64 64a22abf50 fixed another memory-related problem in monitor 2021-01-09 23:45:22 +01:00
FeralChild64 018ae9725b small code size optimization 2020-12-30 22:16:08 +01:00
FeralChild64 cded5a0264 implemented solid cursor 2020-12-30 21:14:51 +01:00
FeralChild64 3054a44e7c screen editor color handling fix 2020-12-29 23:32:39 +01:00
FeralChild64 eab6efbe07 jingle sound is sane now 2020-12-29 15:16:51 +01:00
FeralChild64 b1131e219f jingle changes 2020-12-29 00:20:27 +01:00
FeralChild64 f5641953ab screen editor cleanup 2020-12-28 22:41:59 +01:00
FeralChild64 f3fa863985 small editor improvement 2020-12-28 22:23:40 +01:00
FeralChild64 0d05ac1f44 more MEGA65 screen editor work, bell works now 2020-12-28 21:38:36 +01:00
FeralChild64 1913697cd3 more MEGA65 screen editor features 2020-12-28 18:27:18 +01:00
FeralChild64 beeb228cd4 color usage tweaks 2020-12-28 17:29:11 +01:00