pi1541 / Pi1541

Commodore 1541 emulator for the Raspberry Pi
GNU General Public License v3.0
376 stars 81 forks source link

Browse Mode Hangs When C64 Off ( Likely Related to ATN 1 or DAT 1 ) #89

Open iNamik opened 6 years ago

iNamik commented 6 years ago

This is probably a known bug (feature!), but browse mode hangs when the IEC cable is plugged into a turned-off C64 -- More specifically, I think it hangs whenever the ATN or DAT lines are 1

Devices / Kernel

Hardware Tested:

PI-1541 HATS Tested:

PI-1541 Kernel Versions Tested

Test # 1

Auto mount disabled (//AutoMountImage)

With both C64 and RPI turned off, connect IEC cable between both devices.

Turn RPi On - Leave C64 Off

RPi boots to Browse Mode root screen (/1541)

Issue Once In Browse Mode

No GPIO buttons work No Keyboard Keys work

Turn C64 On

After the C64 turns on, browse mode functions as expected. Both GIO buttons and Keyboard keys work.

Turn C64 Off Again

After turning C64 off, Browse mode again hangs.

Unplug IEC Cable Works (Sometimes)

If you unplug the IEC cable, Browse Mode might work again (sometimes yes, sometimes no)

If you keep plugging/unplugging, it will eventually work.

Seems to Be Based On ATN and DAT Status

Having the graph mode enabled, I noticed that Browse Mode appears to hang with either ATN 1 or DAT 1 is set.

Test # 2

Auto mount enabled (AutoMountImage = fb.d64)

With both C64 and RPI turned off, connect IEC cable between both devices.

Turn RPi On - Leave C64 Off

RPi boots to Emulation Mode with fb.d64 image

Leave Emulation Mode Works

You can exit emulation mode using either GPIO or Keyboard

This will take you back into Browse Mode

Issue Once In Browse Mode

No GPIO buttons work No Keyboard Keys work


I admit it seems like an edge case that you would want to browse the PI-1541 while being connected to an computer that is turned off.

I'm guessing that the IO from the ATN/DAT 1 signal is causing a loop that prevents browse mode from working?

Weather it is something we can't fix, or aren't worried about, the behavior should probably be documented somewhere

Additionally:

By fidgeting with the IEC Cable, you can lock the ATN or DAT lines on the HAT/Kernel to stay 1 (even if you unplug the cable from the HAT) -- This feels like a bug in the HAT, but I tested it on two HATS and it behaved the same, so maybe it something within the standard assembly configuration?

Thank you for your consideration. Please let me know if you have any questions.

-David Farrell

penfold42 commented 6 years ago

The iec code for browse mode is a bit brittle. It was never designed for long term use but with a design goal of “barely sufficient to get fb64 working”

If we could change this to from GPL3 to “GPL2 or later” or if the the sd2iec guys would move from “GPL 2 only” my vote would be to incorporate their code.

There’s lots of while(line state) and while(!line state) spin loops causing this