keirf / greaseweazle

Tools for accessing a floppy drive at the raw flux level
The Unlicense
993 stars 100 forks source link

Implement TG43 signal generation on DENSEL (pin 2) during writes #406

Closed carmisergio closed 9 months ago

carmisergio commented 9 months ago

Objective

Many 8-inch floppy drives require a signal called TG43 which informs the drive to use reduced write current. This signal should be Low by the FDC when the head is positioned over a cylinder greater than or equal to 43, and High otherwise.

Pin selection

To allow the Greaseweazle to generate this signal, I propose the use of pin 2, normally utilized as DENSEL, as this signal is not required on 8-inch drives. As a bonus, TG43 is already pin 2 on the Shugart-50 interface (used by 8-inch floppy drives).

Implementation

This patch implements the option --gen-tg43, to be used with the write operation. This option instructs the Greaseweazle to set pin 2 High (inactive) when writing tracks 0-42, and Low (active) when writing tracks greater than or equal to 43.

The state of the pin is saved before writing and restored after.

Additional changes

Added .gitignore to ignore temporary files generated by tests.

Testing

I have run the unit tests provided within the repository, which pass. As I am still waiting for a few parts to build my Greaseweazle, I have not been able to test this functionality physically, but as it is a really simple patch I'm confident in its correctness. If someone with access to a functioning Greaseweazle is able to test this functionality, I would be grateful.

Cheers!

keirf commented 9 months ago

Merged, thanks!

carmisergio commented 9 months ago

It's always a pleasure contributing to good projects. Please do let me know if there's ever anything I can do.