MEGA65 / mega65-core

MEGA65 FPGA core
Other
241 stars 88 forks source link

Floppy not working depending on uninitialised config sector data #687

Closed ki-bo closed 1 year ago

ki-bo commented 1 year ago

Test Environment (required) You can use MEGA65INFO to retrieve this.

Describe the bug I used an SD card for my MEGA65 that I already had available (to put the original factory SD as a backup). I used fdisk to format the SD and wasn't able to get the floppy drive working. I could format disks, but always had read issues. Just issuing a DIR command showed broken data.

After some debugging it turned out it was the config sector (sector #1 on the SD = the second one on the block device). This one is not erased during fdisk format and still contained invalid data. The unit went through onboarding and I used configure to set everything up. Still, you can see that many bytes in that sector still contain the original data from when I had used that card for something else. Although one might assume that bytes not written by config or onboarding should have no influence on the behaviour of the machine, it certainly does. We should try to understand what bytes in that config sector make the floppy drive stop working.

To Reproduce Steps to reproduce the behaviour:

  1. gunzip attached config file
  2. Use mega65_ftp to put the attached config sector on your SD: secrestore config.broken 1
  3. Power cycle the M65
  4. Put into a physical floppy disk you know is working fine
  5. Issue DIRand see it fail

Expected behavior Floppy behaviour should work as expected. Config should initialise all bytes relevant with meaningful default values. config.broken.gz

lydon42 commented 1 year ago

https://github.com/MEGA65/mega65-fdisk/issues/19