1tiEC NEe Microcomputers, Inc. Application Note 8 J.(PD765 SINGLE/DOUBLE DENSITY FLOPPY DISK CONTROLLER· Richard Weiner/Gregory York . 173 Worcester StreetlWeliesley, Massachusetts 02181 Telephone (617) 237-191.0 TWX: 710-383-1745 APPLICATIONS NOTE #8 NEC uPD765C Single/Double Density Floppy Disk Controller Richard Weiner/Gregory York I NTRODUCT ION The Floppy Disk Drive (FDD) has proven to be one of the most popular peripherals on the market today. The development of double density recording and the use of both sides of the diskette, has al lowed a fourfold increase in recording capabil ity. This increased capabil ity has resulted in a large number of new Floppy Disk Controller (FDC) designs to be undertaken. The uPD765 has been developed to al low the designer to take ful I advantage of these new floppy disk capabil ities as wei I as to design a more sophisticated disk system. The 15 instructions which the uPD765 wi I I perform enhance system throughput and minimize support from the processor. There are several signals generated within the uPD765 (such as VCO Sync and MFM Mode) which greatly reduce the amount of supporting hardware required to make a working floppy disk system. This Appl ication Note presents a complete Floppy Disk Controller design, and al lows you to add or subtract the features you feel are important. However, the design shown in this Appl ication Note is not the only configuration which is possible with the uPD765. This design should be used as a building block in satisfying your particular requirements. Whichever FOe design approach is selected, an early decision which_must be made is whether or not Direct Memory Access (DMA) is required. TheuPD765 wil I operate in either a DMA or a Non-DMA configured system. The Non-DMA configuration usually results in a simple interrupt-driven system. An interrupt-driven system yields the minimum amount of hardware and system complexity, but if double density recording (MFM) is to be done, then extremely tight timing constraints result. In single density recording (FM) the processor has 32 us (normally) and 29 us (worst-case) between interrupts, but in double density these numbers reduce to 16 us (normally) and 13 us (worst-case). As a result, in the interrupt-driven system the processor must be capable of servicing interrupts at a very high rate. If this places an undue load on the processor or seriously inhibits system throughput rate, then the DMA approach represents an excel lent solution to the time constraint problem. A complete detailed design as wei I as a detai led software flow chart is given for a DMA-driven system. This approach was not chosen for the design example because it is better, but merely because this example covers more possible user configurations. The flow chart shown at the end of this Appl ication Note is especially useful because it both shows the proper sequence of events and provides detailed information so that software can be written to control the uPD765. SYSTEM BLOCK DIAGRAM Figure 1 shows how the 765 may be configured in a typical system. The uPD765 may be easi Iy interfaced to any of the popular microprocessors such as uPD8080A~ SYSTEM DATA BUS SYSTEM ADDRESS BUS DDII SYSTEM CONTROL BUS I II ..... ~I II) ... 'I ..... t;:; 0 I ~~ 10 - 0'1 2N~ BYTE OF INSTRUCTION WRITTEN INTO _ ~ :@ ;a. r:zG'> roC: _ ::0 765 BY PROCESSOR ~ ~ ~ ~-o"" . . I I , I ~~N I" I clf) I I I I 9 rr1 I ,. I REPEAT STEPS 3 THRU 6 °z ~ UNTIL ALL BYTES I N INSTRUCTION l ,II I I HAVE BEEN WRI HEN INTO 765 I I ~ ~-J-~-~----- .~ ~ LAST BYTE OF INSTRUCTION WRITTEN INTO 7&5 BY PROCESSOR - l~ ~ ~ -I 1""1 .r- ~ (l)l> (J) Q;)-Il> m c:: 0(1) I""1Q;)-I 1""1 z-1.&.1 -~ STATUS REGISTER, IT MAY BE USED INSTEAD Of t- 1.&.1 en a.:: u- THE INTURRUPT SIGNAl. (/) UJC 1.&.1 ::IE a.::::IE UJ UJ UJ UJ t- t- t- a:0 t- t- >- ~ o a.:: >- NOTE: EITHER iID (IF IT IS A READ INSTRUCTION) >- III ~ >- CD 0 Z III :J: t- u.l ~~~~ ent- Z u.. lii C Z N ID :J: t- Z * OR iR (IF IT IS A WRITE INSTRUCTION) BUT NEVER BOTH. N Z :::>0.. UJo to ~ CD ::IE=> ent- a.::~ a.::UJ .,., to ;; ~ en en ~w ~t- en en en en 4 ~ 4 c ffl~~lii 4 4 4 UJ UJ 1.&.1 UJ 1.&.1 UJ UJ ::IE ::IE ::IE 4 gog~ ::IE ::IE « ::IE « ::IE ~ 4 en a::J:a:4 « en 4 ~ o..~o..C ~ ~ ~ STEP NO. (1\ (2) (3) (4) C5) (6) (1) (8) (9) 00) FIGURE 3 EXECUTION PHASE OF ALL READ OR WRITE INSTROCTIONS - EXECUTION PHASE - - - - - ' 1 ....- - . - - - - I RESULT PHASE -------i..,.......--- COMMAND PHASE OF NEXT INSTRUCTION-- I INT I ----------~~~--------------- rr I I ORO _J1 ~------------------~~r------------~- rr: Jl TC ,-----InL..--_ _--1J_ _~ Jl lI)~ * EITHER RD (If IT IS A READ INSTRUCTla..l OR WR !If IT IS A WR ITE INSTRUCTION) BUT ttfY.ER BOTH. A'~/ I ~~I ex> RQM~~~~~~ I ~I I . I DID%W'~~&1~~ I I I I~~nlr ~ - I I I I I.......J J) . uLiJ t t V) LU t t f gzUJ W I- 411- W >- a:~ ~ I- >- CD l- ~~:n CD V) e c( >- - 41 Z ~ en..::U)V) ~ ~"oi UJO C a:: -e UJ a:: I- - CL LU N CL u.a N CL u.a a:: 0 a:: 3 l- en I- V) I- V) S;~ S;~ ~ V) en ~"':Vla:: c( c U"~:::I: UJ UJ UJ o~ 0 0 :::I: :::I: 2 a:: 0 a:: a:: c c cen CLa:: CLlJ.. en VI STEP NQ (1) (21 (3) (4) (5) FIGURE 4 RESULT PHASE Of ALL READ OR WR ITE INSTRUCTIONS COMMAND PHASE ---;.....- - - - COMMAND PHASE FOR NEXT INSTRUCTION I I I I A0~~A:W I I I ~ --U U U I I SPECIFY INSTRUCTION I u U--lI DIO~~ RQM~~L%0 t f t r-COMMAND PHASE --t RESULT PHASE.-,4---- COMMAND PHASE FOR I I I NEXT INSTRUCTION CS I I I : : A0~~~ I I I I I I RD I I I SENSE PRIVE STATUS INSTRUCTION ViR U---U DIO RQM ~~ t ~ f f FIGURE 5 SPECIFY AND SENSE DRIVE STATUS INSTRUCTION 9 SEEK/RECALIBRATE AND SENSE INTERRUPT STATUS INSTRUCTIONS - - - - - - SEEK (OR RECALIBRATEI COMMAND - - - - - - 1 1. . -. - - - SENSE INTERRUPT STATUS COMMAND ., I I - - - - COMMAND PHASE -----1...._- EXECUTION PHASE .,. COMMAND PHASE .,. RESULT PHASE ---i I I I INT I I ,---_r--__ I ROU U U u u..-----u u DIO~ ~ RQM ~~~~&A4 • • • t . + d Z 0 >- O::z Z W o::Z I- alo:: ,Ie 00 I- 00 V') 0:: wt-z Il"l ~- ~i=zlO 00 lD WZIO >w lD !::Il"l Wuw lD a::>-~ Cf(/) wV) og~1"- o:t-I"- O:::>t-I'- (/)~al~ o::W 8~!::~ ot-o ..... -t- 8~!::~ ~!!?oU u z:::? zo &~~a: ::c.- oO::z ~~ &i'~ CLK ,_-,.. QA ~143 ct - ~ 0 S Q1-=--4--I 9 :HK l.?K ___....."......,:----,:-=-:-~&JIv_ PUMP DN=PDN """ ..~-\.~L "1:) ~ ~ ~ os _f_r--l----:l.:.,l>CLK 1-=7.::....2 PU 6 7 i! oeil' U5 4 ~ EN/P I 00 f-oU- I 3 EN :; Q~ L2. RNG 745124 EN/T ~10 ........RIir-... LOAD U3B 13 .. ...------tt---- PU 74L574 11 .. 3.2V I 2 FREQ CaNT CEXT y~ 8 MHz fl NOM NOM ~--+~2 c~: c/o ..Ii ~ Cl ~ ~ .. 5V lCLK .-......4..... r-~ A ~ OA~ 4~rt B en OB~ ----loS oW ~~Lmo 4> R6 : 1K 4~R1 4~ 18K R8 330 41- C2 33pf 4~~ C ;;; QCl-Jlu::..2~f.;;...o--..._~3)CLK •~ ~ 0 '7" 00 .....1Iu------. R5 ll~ ¢ •..-l EN/P-I (AD- N :;:) EN/T ~ .. "" (Q - +5V U3A 02 74LS74 2N2901 8 MHz NOM . .----------.1-----------------_ MFM MODE FROM Al uPD765 (PIN 26) ~ \l4B SEL 4Y ~ P1U ':".2 ~ 4A ,... A,4 i::.. u.:.[ 38 ~ 3Y fi ~ D S Q1-=5~ _ _ _ DATA WINDOW TO o i 3A ~ uPD765 (PIN 26) ~d ~ R131 .5V f 28 3 2A ~ lIB - 2YI-!7-----+----------.....:31:.1)'CLK tY! PU QrL tl lA STROBE 13 R 1K U4C 9,-1.." .......... U7A I ~5 74LSIO ! PU 74LS74 PU 112 r-----e-----......-+-------.-.-- PU 10 ~ 4 ~D S Q1-=-_ 5 _ _+--+....I1~2D S 19c . . . - - - - - - - - - - - - - - - R D DATA TO Qt-a uPD765 (PIN 23) 4 6 3 ~CLK ....Jl )CLK PLAYBACK DATA 5 FRO M FLOPPY U4A O~ DISK DRIVE 74LSIO R R 1 USA USB 74 LS74 74 LS74 SYNC .... FIGURE 13 PHASE LOCKED LOOP FOR FM/MFM ENCODED DATA 18 Figures 14 and 15 show the timing relationship between these signals under both ideal and worst-case bit patterns. Note in Figure 15 how the RD Data pulse moves around within the Data Window under worst-case peak shift conditions. With this circuit, peak-shifts of up to 375 ns (500 ns theoretical maximum) may be tolerated in MFM encoded data before read errors wi I I be encountered. U5-7 VCO OUT (NOMINAL FREQ =8MHz) •• I I t- ~ CELL 2us - - - - - -.. :I U4-5 PLAYBACK DATA ---~----------.I... I, I ____ . I, , , I U8-5 __ ~~ __________ I • I ~n, , I , I --..:....-=----------;. ~-------------- I U8-8 W NOTE: COUNTER Z2 (to COUNTER) MISSES THIS CLOCK EDGE. AND IS JAMMED TO ALL ZEROS. U2-14 4MHz t TIMING AND SYNC TO PLAYBACK DATA OCCURS AT THIS CLOCK EDGE. U2-13 2MHz ,I U2-12 fo= 1MHz 1,'...___.. •, U2-11 500 KHz JI , I U1-12 fr: IMHz 1.....__..... NOTE: fr AND fo ARE PHASE LOCKED AFTER LOOP HAS ACQU 1RED AND LOCKED. FIGURE 14 SYNCRONIZATION OF fo COUNTER WITH FDD DATA 19 U5-7 VCO OUT tttftttffftrttffftffftftttt • CONTINUOUS SQUAREWAVE • fe- I,I---i III '0" N 1" NOH II' '0· '0' CELL CEU CELL CELL CELL CEll CELL CELL I U4-5 DATA ill U , UI U I U , I WORST CASE 81T PATTERN FOR PLl WITH PEAK SHIFT "I, ,I I I I I , ua-s 11, " n, n,, n,, , n,, , " I I , 11I .. U U " U8-8 SYNC U U t.-- 2us I I I 4us .... I I 4us ... I I 3_ I ..t, I I rLOAD U2 rLOAD U2 rLOAD U2 rLOAD U2 rLOAD U2 I , I , I I I I I I 12-14 410 2-13 2fo I I 2-12 to I I , I 2-11 1/2 fo LJ~ I I t I I NOTE: COUNT IS MISSED HERE DUE TO t NOTE: 500 KHz SIGNAL CAN NOT BE PEAK SH 1FT EFFECT ON INCOMING I USED FOR LOCKING UP PLL DATA STREAM. I BECAUSE OF 2,3 a 4 U5 SPl\CI~ I IN MFM DATA. I I I '-5 DATA WINDOW I , I -9 RD DATA JI I n I .. II____________II__________ I n ~n~ I ________n._____ I FIGURE 15 fa COUNTER SYNC WITH PEAK SHIFT 20 U3-5, U3-9 and U4-8 form a digital phase comparator circuit. U3-5 and U3-9 toggle to a high (1) state whenever a positive edge is generated by U2-12 or Ul-12 respectively. When U3-5 and U3-9 are both high (1), U4-8 goes low and resets both fl ip-flops to their low (0) state, and another cycle begins. The amount of time which U3-5 remains high (1) compared to U3-9 determines whether transistor Q2 remains on longer than Ql. Transistor Q2 charges Cl, while Ql discharges it. If Q2 remains on longer than Ql, there wil I be a net increase in the charge on (and hence voltage across) Cl. As the voltage across Cl increases, the frequency out of U5-7 wil I also increase. This increase in the VCO frequency wil I cause Ul-12 to reach a positive transition sooner than U2-12, which wil I decrease the voltage across Cl (negative feedback). R7 and Cl determine the charging timing constant, whi Ie R4 and Cl determine the discharging timing constant. R8 is a damping resistor (an essential component!) which minimizes overshoots and undershoots. Figure 16 shows the operation of the phase comparator under various conditions of fr and fOe fr AND fo ARE fr LEADS fo o COHERENT fr LAGS fo I I I ~ l U3-11 . fr U3-3 fo U3-9 PON .JI ~ ___ __ ______ ____ ____ ______ ____ ________ rl~ ~n ~~ ~ ~ ~ ~ U3-6 pup I u u NOTE: PDN CONTROLS Q1, AND PUP CONTROLS 02, WHICH DISCHARGE AND CHARGE CAPACTOR CI. RESISTOR CAPACTOR NETWORK R4, R1, R8 AND CI CHANGE THE PULSE WIDTH MODULATED SIGNALS PDN AND PUP (WHICH ARE A DIRECT FUNCTION OF PHASE DIFFERENCES BETWEEN fr AND fo), INTO A D.C. LEVEL, AS SEEN AT U5-2. THE LEVEL AT U5-2 IS NORMINALLY +3.25'1. FIGURE 16 PHASE COMPARATOR Careful note should be made of the functions of VCO Sync (output from uPD765~ pin 24). It is connected to U3-10, U3-4 and U4-10, and when VCO Sync is low (0), both transistors Ql and Q2 are held in the ON state. This causes the voltage across Cl to be approximately +3.25V and the VCO output U5-7 to be 8 MHz. R4 and R7 should be adjusted when VCO Sync is low so that the frequency of the signal at U6-7 does in fact equal exactly 8 MHz. This effectively clamps the VCO output to mid-range and inhibits it from being affected by noise (head not lowered) or erroneous signals (write current glitches). When VCO Sync goes high, it can be assumed that val id data is being received from the drive. The 21 result is that the loop's response is very clean, acquisition and lock occur in a very orderly manner, and one does not have to worry about spurious or false lock conditions. Using the MFM mode signal (pin 26), the uPD765 selects either 500 KHz or 1 MHz for input to U7-3. For single-density data 500 KHz is selected, while double-density data requires 1 MHz. U7-5 is simply a flip-flop which toggles at the 1/4 and 3/4 duration points in a data cel I, thereby generating the Data Window signal shown in Figure 12. SYNCHRONOUS COUNTER DATA RECOVERY CIRCUIT Figure 17 shows an alternate solution to the phase locked loop; it is simply a synchronous counter circuit. The synchronous counter circuit consists of a binary counter which is preloaded with a fixed value on each Read pulse from the drive. The counter's output is the Data Window signal to the uPD765. The two fl ip-flops in Z1 merely synchronize the data from the drive to the 8 MHz clock, and set up the Sync pulse which wi I I preload the counter (Z2). Zl-8 controls the width of the Sync pulse so that it overlaps only one positive edge of the 8 MHz clock. The positive edge of the 8 MHz clock which appears in the Sync pulse window is the one which preloads the counter. Note how Z2-11 is fed back to Z2-6 to ensure that, regardless of the pulse spacing (2, 3 or 4 us), the polarity of the Data Window is never reversed during a data stream. The VCO Sync signal from the uPD765 (pin 24) performs the same function as it did for the PLL design. That is, it inhibits the RD Data and Data Window signals from being generated until val id information is detected from the drive. It also masks out write current glitches which would otherwise appear on each side of the data field. In fact, this simple data recovery circuit would not work rei iably if it were not for the veo Sync signal. By switching the 8 MHz clock to 4 MHz, the synchronous counter circuit can be made to operate at single-density rates. Minifloppies can be used with this design if the clock rate is divided in half again (to 2 MHz). The MFM mode signal (pin 26) from the uPD765 should be used to switch the clock rate to the data recovery circuit. The synchronous counter data recovery circuit is a much simpler design than the PLL, and works almost as wei I. Both designs, however, require that the data from the drive be adequately pr-e- or post-compensated so that peak-shifts are kept wei I below 500 ns. The PLL does offer some very distinct advantages over the synchronous counter approach. Because of the PLL's feedback and low-pass filter characteristics, it adapts to the drive's pulse stream; thus the VCO's center frequency is always optimized for the data. As a result, the Data Window is able to handle early or late peak-shifts equally as wei I with no bias. Also speed (rpm of the diskette) variations and track-to-track variations (pulse crowding on inner tracks) can be handled somewhat better with a PLL. The two data recovery circuits discussed above should be used as guides in helping you design your own circuit. These designs were presented merely to help you understand the uPD765, and do not in any sense represent the only approaches possible. 22 CELL -------~., It- I r .l - - - - - Ius ---~1 I I 8MHz , 250n5 ., : I --: I I : ..--375ns PLAYBACK DATA J: ' PEAK SHIFT '--_______________...!-_.......I,;~I : I.....- , _______ I ________ ;-- - I- ! _ _ _.....J: I ~I_ _PEAK _ __ SHIFT :, I, I " I Jl,~~________________________________~n I~ n I I I, I :: I ~ ® ~~I-------- I I ~ ________________________ __________________________ I I , I RD DATA ~ ~rl--- .....Jrl~ ______ I I I I SYNC iJ ~----------------------~LJ : I : LJ~I : ------ COUNTER PRELOADED 1 ® • © N ® ---1 L r LN DATA WINDOW L PU PU ZI PU 74LS74 4 Z3 74LS04 2 0 S Q5 ® RD DATA PLAYBACK DATA 3 CLK (PIN 23 OF 765) 2 SYNC fROM DRIVE Z3 06 +5V R 74LS04 I 3 4 veo SYNC (PIN 24 OF 765) !470n PU PU PU IMHz CLKD--.......- - - - - - - = - t l ' - - - - - e - - - - - - - ' O O A T A WINDOW ®©® (PIN 22 OF 765) FIGURE 17 SYNCRONOUS COUNTER DATA RECOVERY CIRCUIT U,J ~>-~ .!i.~~ I~ ~ z ~ U2 r~o: I lr---CL-f3-~oc::r--------~--------------o~~ ..... ~~ ~ f:i :: 14LS115 1 3 _ tNT iOtOR--otre ~~< 16 ° ~-oo2.'.L".,.....-_+=3"i .-..+-+-++~9"DI4 gg~r.1~0___o~~i6 ~ ~ rAULT RHH.~~~_ 6 ~UI8-7407 4 AB7 A6 ~ ~ m ~~ tb OBI 29 01 AB6 : : 2 <: f2 14 2 <1619-7407 4 <3~~8-:;40( C!( ..2.a USI OB2 ~B 02 A5 ~-----o AB5 t£AtfTOio1 ~!-----oO ,,",0_--£6<3-8- UI9~407 12. 2VO 2A ~ 00B84 • ~4-_ _..._+-+~E~. DQ43 A4 ~~5---<> AB4 3 u .- )~ A3 4----<> AB3 • I <~4B ..A~19-7407 8 /~ Te om: READY rt-pu P2'----''--+--<: IIOR : : B AI4 3 fjACi( 15 25 ~ITf'TTh 3 , ~ I I U2n tC3~ ORQ -14 19 ORQO ~Tw-~ 4 m~ , WR OATA<~~~Z2"*'---------...J2"<-v')(~:t-'l-I--Lf7IY tC2 "4........L""AT.....E-+-*l,!':'f8 0L RESET 13 RESET 'CLK P4- - MEMW : I I·e 1: .5V 1500 7406 .,c---1- IG V ~ ICO 6 NORMAL ICI 5 EARLY Ii 7 Q 8 fl 0~ 0 13 30 WDA iii ~ :~ ~ rom I ~---..... 19 QK ~~ ...2!1'J~3!--_ _ _~ AB0 1 1 I 1 I t t . r . / 4 _ MAlI/Fill ~~ MAlI VCO ~ I 4100 4100 r - wac ROW ~ I "5V~ ~5V~ ....._ - -.... ~~ ~ : '14·· ' U8 U9 ~- I ~2~[) S OK ., 250KHz ~NI I IASEl tV ' • 74LSI57 I. 2 IA r;-;sL 74LSI57 "--14 '''l,(~- j"" UI0-74LS161 ~3 o~C- ~ ~QC~L!4 T~· ~ pa.1C 1 ~ ~~ fU r r - ~~ 2y..,.7_-+--. ...... O§... r-r--_-++_-_-.~~H~~ 3y!LJ'~ ~ 3vfL UI3A R I l L4 ~ 3B 4Y tiL- ~ 38 4A 4Y r1£ __-~..z.Lt~](J·I.... ClR '- bL----, ~ ~~ ~ ~B ~ 0CE CI pU 174LS74 pu TR ~1.;: '" I.;: 15 15 7 Opu 74L~4O ~~~i! i: 17 ~ 3 ~8 -r D C~Y::L 74ts24O d UII-74~~ I 14 15 I_A ;t.10 pU 4 PUIO lo pU i;~' ~ ~ a~ L~ :r 00 ......-'£ OSC U£ro1"'QI-'9'--_ _ 15<----+-1'''1 0 S 0 .. 20 S m LD ClR hPU I +5V..J§.~CC VOD 9 ,..:~" c.-ll~ Q~ UI3B c-lPo,,9'--_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _....J U3 I I 8 .... 74LS240 OPTIONAL CONfiGURATIONS I. IF EITHER MINifLOPPIES OR STANDARD FLOPPIES ARE TO BE USED, BUT NOT BOTH, THEN REMOVE U8 AND REPLACE WITH 4 JUMPERS. 2. If ONLY ONE HEAD LOAD COMMAND IS NEEDED, THEN REPLACE U21-6 WITH A 7406 (U20) AND REMOVE 213 Of UI9 1U19-6,8,10 a 121. 3. IF ONLY SINGLE DENSITY OR DOUBlE DENSITY IS REQUIRED BUT NOT BOTH, THEN REMOVE U9 AND REPLACE WITH 4 JUMPERS. " IF ONLY STANDARD FLOPPIES ARE USED, THEN REMOVE U2, 213 OF UI7 (UI7-2,4,6 8), AND 112 OF UI3 1U13AI. a 5. IF EXTERNAL 8104Hz CLOCK IS AVAILABLE, THEN REMOVE U12. & IF THE 765 IS OPERATED IN AN INTERRUPT DRIVEN MODE (NON DMA), THEN REMOVE UI5 AND U16, 1 IF PRE-COMPENSATION IS NOT REQUIRED, THEN REMOVE U6 ANO U7, fiGURE 18 fLOPPY D15K CONTROLLER SCHEMATIC 24 GENERAL FLOW CHART OF uPD765C Figure 19 shows a very general ized program flow for the uPD765 command phase. It breaks down the fifteen commands into Specify, Sense Drive Status, and twelve others. (The fifteenth, Sense Interrupt Status, is only used in response to an interrupt.) The Specify command sets up three internal timers and establ ishes whether DMA operation is to be performed, and is typically only performed after power on. It has neither an execution phase nor a result phase. The Sense Drive Status command can be performed between data transfer commands to obtain the status of the selected drive. The status of the drive is available immediately and thus there is no execution phase. The twelve other commands: Read Data, Read Deleted Data, Write Data, Write Deleted Data, Read a Track, Read 10, Format a Track, Scan Equal, Scan Low or Equal, Scan High or Equal, Recal ibrate, Seek, al I involve the disk drive and usually take many milliseconds to be performed. Since it is inefficient to tie up the processor for a long time, these data transfer commands may be performed without need of the processor (DMA mode only) until the execution phase is complete. At the end of the execution phase the uPD765 interrupts the processor to signal the completion of the command. NOTE: NO EXECUT ION PHASE NOTE: NO EXECUTION PHASE NOTE: FOC AUTOMATICALLY ENTERS EXECUTION NO RESULT PHASE PHASE UPON COMPLETION OF COMMANO PHASE. RECEIPT OF EITHER OUA REQUESTS OR INTERRUPT SIGNALS INDICATES BEGINING OF EXECUTION PHASE. FIGURE 19 GENERAL IZED COMMAND PHASE FLOW CHART 25 Figure 20 shows the detailed steps of the command phase. The first entry point labeled "Command FOC" checks the status register to see if the uP0765 is busy, or the disk drive is busy. The second entry point "Output Command to FOC" is used when it is known that the uP0765 is ready for a new command. DISABLE IWTERRUPTS fIGURE 20 DETAIL COMMAND PHASE flDW CHART 26 Figure 21 shows how to process interrupts from the uPD765. Note that the data transfer commands (Read, Write, etc.) are treated differently than Seek/Recal ibrate commands. Further note that there are two other interrupts: Attention and Inval id. When the data transfer commands terminate, their result phase has started and it is only necessary to read the results from the uPD765. After the byte is read, in the result phase the interrupt is automatically reset. If the interrupt is from a Seek/Recal ibrate command terminating, then a Sense Interrupt status command must be executed to properly end the Seek/Recal ibrate command. In this sense the Seek/Recal ibrate commands do not really have their own result phase, but rather they rely on the result phase of the Sense Interrupt Status command. The attention interrupt occurs whenever any disk drive goes from not-ready to ready or vice versa. This al lows the processor to detect the removal or insertion of a diskette. The inval id interrupt occurs when an inval id command is issued. YES NO SEEK OR RECALIBRATE DONE FIGURE 21 INTERRUPT PROCESSING 27 Figure 22 shows the detailed steps necessary in the result phase. The flow chart shows that the processor need not count the bytes to be read in the result phase, but may merely watch the FOe busy bit in the Main Status Register. When this bit goes "low", it indicates that al I bits in the result phase have been read, and the uP0765 is now ready for the next command. FIGURE 22 DETAIL RESULT PHASE FLOW CHART 28 APPENDICES J.LPD765 INSTRUCTION SET G) ® DATA BUS DATA BUS PHASE R/W 07 06 Os 04 03 02 01 DO REMARKS PHASE R/W 07 06 Os 04 03 02 01 DO I REMARKS READ DATA READA TRACK Command W MT MF SK 0 0 1 1 0 Command Codes Command W 0 MF SK 0 0 0 1 0 Command Codes W X X X X X HD USl usa w X X X X X HD USl usa w C Sector I D information prior W C Sector ID information prior W H to Command execution W H to Command execution W R W R W N W N W EOT W EOT W GPL W GPL W DTL W DTL Execution Data-transfer between the Execution Data-transfer between t he FDD and main-system FDD and main-system_ FDC reads all of cylinders contents Result R STO Status information after from index hole"to Ear _ R ST 1 Command execution R ST 2 Result R STO Status information after R C Sector ID information after R ST 1 Command execution R H Command execution R ST2 R R R C Sector I D information after R N R H Command execution READ DELETED DATA R R R N Command W MT MF SK 0 1 1 0 0 Command Codes READ 10 W X X X X X HD USl usa Command W 0 MF 0 0 1 0 1 0 Commands W C Sector ID information prior w H to Command execution W X X X X X HD USl usa W R Execution The first correct ID information W N on the Cylinder is stored in W EOT Data Register W GPl.: W DTL Result R STO Status information after R ST 1 Command execution Execution Data-transfer between the R ST 2 FDD and main-system R C Sector ID information during Result R STO Status information after R H Execution Phase R ST 1 Command execution R R R ST 2 R N R C Sector ID information after FORMA T A TRACK R H Command execution Command W 0 MF 0 0 1 1 0 1 Command Codes R R R N W X X X X X HD USl usa WRITE DATA W N Bytes/Sector W SC Sectors/Track Command W MT MF 0 0 0 1 0 1 Command Codes W GPL Gap3 W X X X X X HD USl USO W D Filler Byte W C Sector ID information prior Execution FDC formats an entire cylinder W H to Command execution W R W W N EOT Result R R R STO ST 1 ST2 I Status information after Command execution I W GPL R C In this case, the ID information W DTL R H has no meaning R R Execution Data-transfer between the R N main-system and FDD SCAN EQUAL Result R STO Status information after Command W MT MF SK 1 0 0 0 1 Command Codes R ST 1 Command execution R ST2 W X X X X X HD US1 usa R C Sector ID information after W C Sector ID information prior R H Command execution W H to Command execution R R W R R N W N WRITE DELETED DATA W EOT W GPL Command W MT MF 0 0 1 0 0 1 Command Codes W STP W X X X X X HD USl usa Execution Data-compared between the W C Sector ID information prior FDD and main-system W II to Command execution W R Result R STO Status information after W N R ST1 Command execution W EOT R ST2 W GPL R C Sector ID information after W DTL R H Command execution R R Execution Data-transfer between the R N FDD and main-system Result R STO Status information after R ST 1 Command execution R ST2 R C Sector ID information after R H------- Command execution R R R N Note: FOR 1024 BYTES/ SECTOR 01=Sl~ 1 OR '1-11 2 COVER PR lOR 8 BYTES * 512 BYTES -15 SECTORS - NOT AN IBM STANDARD BUT OfTEN USED rEf I 1 BYTE 1 I 2 I 3 I 4 I 5 16 I 7 ·r Ef I 1 I 2 3 BYTE 2 1 4 51 6 7 lEl '/ 1 I I I I I 2 3 BYTE 3 4 5 6 7 l CELL "/ If! / AM = INDEX ADDRESS MARl( , DATA=C2, CLOCK= 14 I I rf' .~ I OISSI .. CLOCk T1WISISTIONS ii I 1 I CELL NO. FLUX TRANSISTIONS CEll CELL CEll 14 1 5 1 6 1 7 '1112131415/6/7 '1112/3/4/5/6'17 •I I ;~ I i~ I )AM = 10 ADDRESS MARK CELL NO. DATA = AI, ClOCK ='A I I I I (:, I FLUX TRANSISTIONS /l~ MISSIN6 CLOCK TRANSISTIO~IS _ _L - -_ _ _ _ _ _ _ _ _ _ _ _ _ _--J. CEll CEll CEll CEll '111213/4151617 '1112131415/617 '/1/2/31 4 15 / 6 / 7 • DAM = DATA ADDRESS MARK ______--'__--'I_(~/...f.;.;-. .l---.L.-......--------. . .I'--....(~f..,\'...---II____.......___......__......I--\("'=':~\"'"'_ ...1__.......___ ~~i :ANSISTIONS DATA=At, CLOCK=flA '-'- MISSING CLOCK TRANSISTION:5 _ _ ;'- /' ...L.-_ _ _ _ _ _ _ _ _ _ _ _ _ _- - J IBM TRACK FORMAT FOR ,~LL TRACKS EXCEPT TRACK 0 HEAD 0 MFM ENCODED DATA DOUBLE DENSITY FORMAT 173 Worcester Street/Wellesley, Massachusetts 02181 NEe Microcomputers, Inc. ,Telephone 617/237-1910 TWX 710-383-1745 The information presented in this document is believed to be accurate and reliable. The information is subject to change without notice. PR INTED IN U.S.A. APP8-J79-500-WT