GideonZ / 1541ultimate

Official GIT archive of 1541 ultimate II sources
GNU General Public License v3.0
181 stars 46 forks source link

.D71/.G71 disk image with 1541 #324

Open Jusalak opened 1 year ago

Jusalak commented 1 year ago

I noticed that when a .D71 image is inserted into 1571 and then drive type is changed to 1541, the .D71 image remains inserted. A real physical 1541 drive can access the first side of 1571 double sided floppies.

But when one tries to insert a .D71 disk image into a 1541 but the drive type is not changed to 1571, then the insertion is cancelled.

That is, in one way .D71 can be inserted into a 1541, but in other, not.

The 1570/1571 test/demo disk has a program "DISPLAY BAM". Commodore's own test program also recognizes that the one side of 1571 disk can be accessed with 1541.

This is what happens with 1571 double-sided disk in 1541 drive and the test program. 1571diskon1541

marty41 commented 1 year ago

Why one would tinker around with a .d71 in an 1541 drive, when a 1571 drive is available on the fly? Just use the 1571 instead of trying to get one side of a .d71 running in an emulated 1541 drive. I can't see any significant benefit here for the Ultimate products to put a lot of work into expansion and troubleshooting.

Jusalak commented 1 year ago

I don't know whether it requires so much work, as I wrote, inserting .D71 and changing the drive type to 1541 the one side of .D71 seems already to work with 1541. I tested it a bit and it seems to work.

I is just inconsistent if it can be done in one way but not the other.

marty41 commented 1 year ago

This behaviour I would count as a bug and fix. ;)

Grrrolf commented 1 year ago

Wouldn't this also happen when you would change a physical drive and leave the 1571 formatted disk in? Try visualising it like that. Remove the disk and replace it with a 1541 formatted disk and you're done.

The ultimate device is already smart enough to change disk drive type upon inserting any disk image format. So, there's no real reason anymore to change disk drive types manually.

radius75 commented 1 year ago

In Vice emulator this is implemented to some extent. But what are the benefits of using half a floppy disk formatted in 1571 to 1541, and what in the opposite case, I have no idea. Having the ability to use 1541 and 1571 simultaneously in the Ultimate emulation. I don't have a real 1571 to verify. In the case of emulation, improper use of this can lead to data loss on the d64/d71. If it is possible to implement such an emulation, it is best to leave the choice to the user via the enable/disable option.

Jusalak commented 1 year ago

Wouldn't this also happen when you would change a physical drive and leave the 1571 formatted disk in? Try visualising it like that. Remove the disk and replace it with a 1541 formatted disk and you're done.

I am not sure whether I got your point, but on real hardware it can be done. File access seems normal if the files are entirely on the first side. I noticed this back in the old days and recently tested it again.

Jusalak commented 1 year ago

In Vice emulator this is implemented to some extent. But what are the benefits of using half a floppy disk formatted in 1571 to 1541, and what in the opposite case, I have no idea. Having the ability to use 1541 and 1571 simultaneously in the Ultimate emulation. I don't have a real 1571 to verify. In the case of emulation, improper use of this can lead to data loss on the d64/d71. If it is possible to implement such an emulation, it is best to leave the choice to the user via the enable/disable option.

Obviously not hugely important issue. The question is what U2/U64 does after this, is there corruption or data loss when .D71 is removed from 1541 - that I have not tested yet.

radius75 commented 1 year ago

@Jusalak Try formatting d71 as 2x 170KB Save some files to the second side of the floppy disk. "Insert" d71 into 1541 and format first side, save some files.

And then check in 1571 whether the data on the second side has not been damaged, whether the first siede can be read.

I cannot think of any other test.

Jusalak commented 1 year ago

Interesting test. I try that also. I tested normal 340 kb .D71 and it does not seem to have issues. After being accessed by 1541, U64 writes the .D71 back and it can then be accessed normally by 1571 (displays full capacity and files can be accessed).

markusC64 commented 1 year ago

Of cause. For a disk with both sides formatted single sided (U0>H0 resp. U0>H1), d71 is not suitable because it can not store the difference in sector headers.

g71 would be suitable for that.

radius75 commented 1 year ago

1571 drive is very interesting. The goal of the manufacturer of this device was probably to ensure backward compatibility with the popular 1541 drive. Data portability made easy. In the present day and with such possibilities of emulation, this is a forgotten functionality. Compatibility with games and programs released on single-sided 5.25 floppy disks had to be guaranteed.

Jusalak commented 1 year ago

Yes, I noticed that I coudn't create a double-sided .d71 (I had issues of U64 drive locking up), but double-sided .g71 created with Z64K is ok: the first side accessed with U64 1541, disk ejected, then inserted into 1571 and the second side is intact (confirmed on both U64 and Z64K). 1541d71test.zip

Jusalak commented 1 year ago

There is a flag byte at track 18 sector 0 byte 3 to signal the single/double sided status: If the byte contains $80, that signals a double-sided disk, and $00 a single-sided disk. If a double-sided .d71 image has that byte changed to $00, then the disk becomes single-sided, and then that .d71 image becomes completely relevant to a 1541 drive. And that obviously works with real hw. Later that byte can be changed back to $80 again to re-enable the second side.

(Commodore 128 Programming Secrets p. 13-14 has a bit to say of this flag byte and validation of a double-sided disk in 1541.)

Now when insertion of .d71/.g71 to 1541 is attempted, user is asked whether to change the drive type to 1571; when the user gives a negative answer, then the insertion is cancelled. I propose that insertion of .d71/.g71 to 1541 is to proceed (the user answers "N" to drive type change prompt), but perhaps with a warning message displayed.