Changes

765 FDC

478 bytes added, 7 June
* SED9420C
Note: The CPC464, CPC472, 464 Plus and GX4000 are not equipped with a FDC chip.
== Accessing the FDC 765 ==
The Data Register (Port FB7Fh) is used to write Commands and Parameters, to read/write data bytes, and to receive result bytes. These three operations are called Command-, Execution-, and Result-Phase. The Main Status Register signalizes when the FDC is ready to send/receive the next byte through the Data Register.
aThe Data Register (Port FB7Fh) is used to write Commands and Parameters, to read/write data bytes, and to receive result bytes. These three operations are called Command -, Execution-, and Result-Phase:* Command Phase :A command consists of a command byte (eventually including the MF, MK, SK bits), and up to 8 parameter bytes.
A command consists of a command byte * Execution Phase : During this phase, the actual data is transferred (eventually including if any). Usually that are the MF, MK, SK bitsdata bytes for the read/written sector(s), and up to eight parameter except for the Format Track Command, in that case 4 bytesfor each sector are transferred.
b. Execution * Result Phase: Returns up to 7 result bytes (depending on the command) that are containing status information. The Recalibrate and Seek Track commands do not return result bytes directly, instead the program must wait until the Main Status Register signalizes that the command has been completed, and then it must (!) send a Sense Interrupt State command to 'terminate' the Seek/Recalibrate command.
During this phase, the actual data is transferred (if any). Usually that are the data bytes for the read/written sector(s), except for the Format Track Command, in that case four bytes for each sector are transferred. c. Result Phase Returns up to seven result bytes (depending on the command) that are containing status information. The Recalibrate and Seek Track commands do not return result bytes directly, instead the program must wait until the Main Status Register signalizes that when the command has been completed, and then it must (!) FDC is ready to send a Sense Interrupt State command to 'terminate' /receive the next byte through the Seek/Recalibrate commandData Register.
== FDC Command Table ==
Command Parameters Exm Result Description 02+MF+SK HU TR HD ?? SZ NM GP SL <R> S0 S1 S2 TR HD NM SZ read track 03 XX YY - specify spd/dma 04 HU - S3 sense drive state 05+MT+MF HU TR HD SC SZ LS GP SL <W> S0 S1 S2 TR HD LS SZ write sector(s) 06+MT+MF+SK HU TR HD SC SZ LS GP SL <R> S0 S1 S2 TR HD LS SZ read sector(s) 07 HU - recalib.seek TP=0 08 - - S0 TP sense int.state 09+MT+MF HU TR HD SC SZ LS GP SL <W> S0 S1 S2 TR HD LS SZ wr deleted sec(s) 0A+MF HU - S0 S1 S2 TR HD LS SZ read ID 0C+MT+MF+SK HU TR HD SC SZ LS GP SL <R> S0 S1 S2 TR HD LS SZ rd deleted sec(s) 0D+MF HU SZ NM GP FB <W> S0 S1 S2 TR HD LS SZ format track 0F HU TP - seek track n 11+MT+MF+SK HU TR HD SC SZ LS GP SL <W> S0 S1 S2 TR HD LS SZ scan equal 19+MT+MF+SK HU TR HD SC SZ LS GP SL <W> S0 S1 S2 TR HD LS SZ scan low or equal 1D+MT+MF+SK HU TR HD SC SZ LS GP SL <W> S0 S1 S2 TR HD LS SZ scan high or eq.
Parameter bits that can be specified in some Command Bytes are:
Main Status Register (Port FB7E)
b0..3 DB FDD0..3 Busy (seek/recalib active, until succesful sense intstat) b4 CB FDC Busy (still in command-, execution- or result-phase) b5 EXM Execution Mode (still in execution-phase, non_DMA_only) b6 DIO Data Input/Output (0=CPU->FDC, 1=FDC->CPU) (see b7) b7 RQM Request For Master (1=ready for next byte) (see b6 for direction)
Status Register 0
b0,1 US Unit Select (driveno during interrupt) b2 HD Head Address (head during interrupt) b3 NR Not Ready (drive not ready or non-existing 2nd head selected) b4 EC Equipment Check (drive failure or recalibrate failed (retry)) b5 SE Seek End (Set if seek-command completed) b6,7 IC Interrupt Code (0=OK, 1=aborted:readfail/OK if EN, 2=unknown cmd or senseint with no int occured, 3=aborted:disc removed etc.)
Status Register 1
b0 MA Missing Address Mark (Sector_ID or DAM not found) b1 NW Not Writeable (tried to write/format disc with wprot_tab=on) b2 ND No Data (Sector_ID not found, CRC fail in ID_field) b3,6 0 Not used b4 OR Over Run (CPU too slow in execution-phase (ca. 26us/Byte)) b5 DE Data Error (CRC-fail in ID- or Data-Field) b7 EN End of Track (set past most read/write commands) (see IC)
Status Register 2
b0 MD Missing Address Mark in Data Field (DAM not found) b1 BC Bad Cylinder (read/programmed track-ID different and read-ID = FF) b2 SN Scan Not Satisfied (no fitting sector found) b3 SH Scan Equal Hit (equal) b4 WC Wrong Cylinder (read/programmed track-ID different) (see b1) b5 DD Data Error in Data Field (CRC-fail in data-field) b6 CM Control Mark (read/scan command found sector with deleted DAM) b7 0 Not Used
Status Register 3
b0,1 US Unit Select (pin 28,29 of FDC) b2 HD Head Address (pin 27 of FDC) b3 TS Two Side (0=yes, 1=no (!)) b4 T0 Track 0 (on track 0 we are) b5 RY Ready (drive ready signal) b6 WP Write Protected (write protected) b7 FT Fault (if supported: 1=Drive failure)
== Motor On/Off Flipflop ==
The CPC doesn't support floppy DMA transfers, and the FDC's Interrupt signal isn't used in the CPC.
In the CPC the DS1 US1 signal of the FDC is not connected, making it impossible to select floppy drives 2 and 3. The floppy drives 0 and 1 are selected instead. == Ready / Disk Changed signal == This signal differs between floppy drives model:
== *For 3inch floppy drives (pin26), it is a "Ready " signal. The / Disc Changed RDY signal ==is sent whenever a disk is installed and rotating at correct speed in the drive.
The signal on pin26 differs between *For 3.5inch floppy drives model:(pin34), it is a "Disk Changed" signal. The /DSKCHG signal determines whether the same disk loaded during the previous disk access is still in the drive.
*For 3inch floppy drives, it The simplest solution to this issue is a "to just force the Ready" signalon the cable itself. The RDY signal Note that the CPC will then hang if you type the CAT command when no disk is sent whenever present (inserting a disk is installed and rotating at correct speed in the drivewill unblock it).
*For 3.5inch Other solutions exist to [[Modify PC floppy drives or Gotek, it is ]] to recreate a "Disc Changed" Ready signal. The DC Also, Gotek drives (with a FlashFloppy or HxC firmware) can be configured to simulate the Ready signal determines whether the same disk loaded during the previous disk access is still in the drive.
== Notes ==
[[File:UPD765A System Diagram.png]]
== 3-inch Floppy Drive Interface PC to CPC floppy connector ==[[File:Interface FDC - Floppy driveCpc6128floppytopcfloppy.pnggif]]
== FDD Block Diagram ==
5,219
edits