Repository navigation
Conversation
At the start of each chunk the JiffyDOS host polls CLK with no timeout and takes DATA from the first read that finds CLK high, expecting DATA low. The microcode released DATA again 50 us after it answered. A host stalled inside that poll when CLK rises (for example by a badline) can come back after the window has closed, read CLK and DATA both high, take it for the end of the file and stop the LOAD with ST=66 while the error channel reads 00,OK. Hold DATA for 100 us. That is at least as generous as a real JiffyDOS 1541 and harmless: after seeing CLK high and DATA low the host waits for DATA high without a timeout. Refs GideonZ#986. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@JC-000 What is outstanding to make this PR merge ready? One thing I would like is if you could formalize the tests you performed (see 'Evidence') as part of a soak test, with consistent invocation syntax and documentation, resembling the already existing soak tests we have. We created these soak tests for exactly such problems. |
|
@chrisgleissner Not merge ready. I formalized the test as you asked, reran it under control, and the result does not support this PR. Setup. U64E, JiffyDOS 6.01 kernal, SoftIEC drive, 16 KiB file loaded from a USB stick. The kernal is patched to wait a set number of extra cycles before it first polls DATA, to imitate a slower host. Two firmware builds from the same commit that differ only in the one microcode word this PR changes (50 us against 100 us), loaded in alternating blocks of 50 loads.
Every failure is a silent short load: ST=66, error channel What this means. The longer hold does not remove the failure, and a 63-cycle delay is shorter than either window, so these are not simple misses of that window. The root cause I gave in the description is not established. The earlier evidence was too few loads to see past the bursts. This PR stays in draft. I do not have a root cause yet and will look for one by instrumenting the firmware and the C64 side of the test. The test itself is a script for Written with Claude Fable 5.2 in Claude Code. |
|
@chrisgleissner A correction to my comment above: the 100 us hold does fix the delayed-host failure, and yesterday's run could not show it. Same setup, host delayed by 63 cycles, with a bus trace added at the start of each chunk:
Root cause. A load fails when the drive already has its answer ready as the host releases DATA. It holds DATA low for 50 us and releases it, and a host that looks later than that reads both lines high as end of data. On master every load with that early answer failed, 95 of 95 with the screen blanked. With the 100 us hold, 64% of loads had the early answer and none failed. Details are in #986. Why yesterday's table showed no difference. How often the drive answers early swings between about 5% and 50% from one block of loads to the next. That is larger than the difference between the builds at 150 loads each. I was also wrong to write that a 63-cycle delay is shorter than either hold: it is about 64 us, longer than the 50 us one. What is still open. With the screen on, the 100 us build still fails a few loads, at raster positions where a badline adds about 40 cycles and puts the host past 100 us. That rests on 7 failures. I have not measured how long a real 1541 with JiffyDOS holds DATA, so 100 us may not be the final value; I asked on #986. This PR stays in draft until the description is rewritten around this and the soak test in #1132 has the screen-blanked rows as its red/green. Written with Claude Fable 5.2 and Claude Sonnet 5.5 in Claude Code. |
Problem
Intermittent
?LOAD ERRORwith JiffyDOS on the Software IEC drive: ST=66, and the error channel stays at00, OK(#986).Cause
At the start of each LOAD chunk the JiffyDOS kernal polls CLK with no timeout and takes DATA from the first read that finds CLK high, expecting DATA low. The microcode releases DATA 50 µs after it answers. A host stalled inside that poll when CLK rises (a VIC badline, for example) can come back after the window has closed. It then reads CLK and DATA both high, which it treats like an end of file: it waits about 1.1 ms for the drive, gives up and sets ST=66. The drive saw no error, so the channel says
00, OK.The badline is the likely trigger, but not a proven one: on a U64E the unchanged code passed about 1,300 loads with the reporter's program and disk image, and the reporter's U2+ on a real PAL C64 is untested.
Change
WAIT FOR 50 usbecomesWAIT FOR 100 usin_jiffy_outer(software/io/iec/iec_code.iec); the assembled microcode differs in one word. The window starts after the drive answers, so 100 µs is at least as generous as a real JiffyDOS 1541, which holds DATA for about 77 cycles counted the same way. A longer window is harmless: after seeing CLK high and DATA low, the host waits for DATA high without a timeout. EOI, the last chunk, SAVE and byte-mode transfers are untouched.Evidence
U64E, JiffyDOS kernal, 16 KiB LOAD loop. In the delay rows the host's poll was slowed on purpose by patching a temporary copy of the kernal.
On this change, a JiffyDOS SAVE, VERIFY, LOAD back and directory listing all completed with ST=64, and the saved file matched memory.
Limits
_jiffy_load_eoi), which this change does not touch. A real C64 is never that late.Refsrather thanFixes.Refs #986
Written with Claude Sonnet 5.5 and Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code