Changes

Jump to: navigation, search

765 FDC

2,667 bytes added, 15 April
/* External links */
µPD765 - Floppy Disc Controller (used in [[DDI-1]] and CPC 664/6128).
 
The ports used by Amstrad and compatible interfaces use:
* Port FA7Eh - Floppy Motor On/Off Flipflop
* Port FB7Eh - FDC 765 Main Status Register (read only)
* Port FB7Fh - FDC 765 Data Register (read/write)
 
The Vortex disc interface uses other ports - exactly how this works has not yet been discovered.
== IC Models used in CPC ==
More than one manufacturer made 765 compatible ICs. These are the ones known to be used in the CPC by looking at pictures of CPC mainboards.
 
All should operate almost identically.
* [[Zilog]] Z0765A08PSC
* [[NEC D765AC-2]]
* NEC D765AC
* UMC UM8272A
* FDC9216
* SED9420C
== 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.
a. Command Phase 
A command consists of a command byte (eventually including the MF, MK, SK bits), and up to eight parameter bytes.
b. Execution Phase 
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 the command has been completed, and then it must (!) send a Sense Interrupt State command to 'terminate' the Seek/Recalibrate command.
b0,1 US Unit Select (driveno during interrupt)
b2 HD Head Adress 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))
Status Register 1
b0 MA Missing Adress 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)
== Motor On/Off Flipflop ==
Writing 00h to Port FA7Eh turns all disk drive motors off, writing 01h turns all motors on. It is not possible to turn on/off the motor of a specific drive separately.
 
An exception are the Vortex F1-S, F1-D, M1-S and M1-D drives. (How are they different?)
== Notes ==
Before accessing a disk you should first Recalibrate the drive, that'll move the head backwards until it reaches Track 0 (that's required to initialize the FDCs track counter). On a 80 track drive you may need to repeat that in case that the first recalibration attempt wasn't successful (that's because the FDC stops searching after 77 steps).
Now if you want to format, read or write a sector on Before accessing a specific track disk you must first Seek that track (command 0Fh). Thatshould issue a 'll 'recalibrate'' command to the drive to move the read/write head to backwards until the physical ''track number. If you donzero't do that, then ' signal from the drive is sensed by the FDC. The FDC will attempt to read/write data to/from the current physical also set its track, independendly of the specified logical Track-IDcounter for that drive to zero.
The TrackOn an 80-, Sector-, and Head-IDs are logical IDs only. These logical IDs are defined when formatting the disk, and aren't required to be identical track drive you may need to repeat that twice because some models of the physical Track, Sector, FDC stop after 77 steps so if recalibrating from track 78 or Head numbers. However, when reading or writing a sector you must specify above the same IDs that have been used during formattingcontroller might not reach track zero.
Despite of the confusing nameIn order to format, read or write a sector with on a "Deleted Data Address Mark" (DAM) is not deletedspecific track you must first ''seek'' that track using command 0Fh. The DAM-flag is just another ID-bit, and (if That'll move the read/write head to the physical track number. If you don't do that ID-bit is specified correctly in then the command) it can be FDC will attempt to read/written like normal write data sectorsfrom/to the current physical track, irrespective of the specified logical ''track ID''.
At the end of a successful read/write commandThe ''track'', the program should send a Terminal Count (TC) signal to the FDC''sector'', and ''head'' IDs are logical IDs only. However, in These logical IDs are defined when formatting the CPC the TC pin isndisk and aren't connected required to reflect the I/O busphysical track, making it impossible for the program to confirm a correct operationsector, or head numbers. For that reasonHowever, when reading or writing a sector you must specify the FDC will assume same IDs that the command has failed, and it'll return both Bit 6 in Status Register 0 and Bit 7 in Status Register 1 set. The program should ignore this errormessagehave been used during formatting.
The CPC doesn't support floppy DMA transfersDespite the name, and a sector with a ''Deleted data Address Mark'' (DAM) is not deleted; the FDCs Interrupt signal isnDAM-flag is just another ID bit. 't used Deleted' sectors can be read/written just like normal data sectors and if that ID bit is specified correctly in the CPC alsocommand.
At the end of a successful read or write command, the program should send a ''Terminal Count'' (TC) signal to the FDC. However, in the CPC the TC pin isn't connected to the I/O bus, making it impossible for the program to confirm a correct operation. For that reason, the FDC will assume that the command has failed, and it'll return both Bit 6 in Status Register 0 and Bit 7 in Status Register 1 set. The program should ignore this error message. The CPC doesn't support floppy DMA transfers, and the FDCs Interrupt signal isn't used in the CPC. Usually single sided 40 Track -track 3" disk drives are used in CPCs. For practical purposes, whereas 40 tracks is the official specification, practically 42 tracks could be used— the limit is specific to the drive and some support more tracks but 42 is a good maximum. The FDC controller can be used to control 80 -tracks, and/or double sided drives also, even though AMSDOS isndoesn't supporting support such formats. AMSDOS is supporting supports a maximum of two disk drives only. == FDC Track Format ==[[File:FDC765 Track Format.png]] == Internal details of the chip == * [https://scarybeastsecurity.blogspot.com/2020/11/reverse-engineering-forgotten-1970s.html The decapped photos of Intel 8271, NEC D765 and Intel 8272 chips] prove that NEC D765 and Intel 8272 chips are identical. * From [https://hackaday.com/2012/08/13/taking-a-look-at-decapped-ics/#comment-734991 a comment in the hackaday website]: "Internally this is a microcoded part with a primative controller of NEC’s own design. Testing microcode embedded in a part can be troublesome. The uPD765 had a few extra gates associated with the DMA Request and DMA Ack pins. Presenting a certain illegal combination here places the part into a “test” mode and allows the sequencer microcode to be output on the normal Data pins. The sequencer microcode is responsible for high level commands such as Read Track, Recalibrate, Format Track, or Write Data. There is a similar test mode for the nano-code array which serializes data at the floppy disk head." == FDC Block Diagram ==[[File:FDC Intel 8272A block diagram.gif]] == Generic System Diagram ==The Amstrad CPC and Amstrad Plus do not have a DMA controller associated with the FDC. The INT pin of the FDC is not connected either. [[File:UPD765A System Diagram.png]] == 3-inch Floppy Drive Interface ==[[File:Interface FDC - Floppy drive.png]] == FDD Block Diagram ==[[File:Floppy Disk Drive - Block Diagram.png]]
== Datasheets ==
* [[Media:UPD765 UPD765_App_Note_Mar79.pdf| NEC uPD765 Datasheet OCRedpreliminary (1979)]] [[Media:D765 NEC.pdf]] [[Media:UPD765-NEC.pdf]] [[Media:Z765A datasheet.pdf]] - uPD765 disc controller* [[Media:Intel 8272A Datasheet preliminary (1982).pdf]] [[Media:Datasheet.hk_d8272a_2873060.pdf|Intel 8272A Datasheet (1986)]] - Licensed clone of the uPD765* [[Media:FDC9229BT Datasheet.pdf]] - FDC9229BT data separator (that usually assists the uPD765 chip)* [[Media:SED9420.pdf]] - SED9420C data separator
* [[Media:DDI Schematic.png]] - DDI-1 Schematic (disc interface for CPC464)
* [[Media:Panasonic-3 inch Floppy Drive EME-150.pdf]] Panasonic EME-150M 3inch Floppy Disk Drive Datasheet
* [[Media:NEC_FD1035_Floppy.pdf]] - NEC FD1035 3.5inch Floppy Disk Drive Datasheet (1984)
 
== External links ==
*[http://quasar.cpcscene.net/doku.php?id=assem:fdc Quasar FDC documentation (in french)]
*[https://64nops.wordpress.com/2021/07/04/a-la-decouverte-du-fdc/ FDC blog articles (in french)]
*[https://info-coach.fr/atari/hardware/FD-Hard.php Atari ST Floppy Disk hardware analysis]
[[Category:CPC Internal Components]][[Category:Programming]][[Category:DATA Storage]][[Category:Electronic Component]]
5,103
edits