CONTENTS 1 Introduction 2 Fitting ADI 3 Using ADI Copy a Disc Verify two discs Edit a sector Scan a disc Format tracks Unformat tracks Modify format parameters Get sectors from disc Put sectors to disc Read track data Write track data Examine & edit buffer Zero buffer Turn printer on/off Initialize status *Command *Osword7F 4 Drive types and disc formats. 1. INTRODUCTION ADI(The Advanced Disc Investigator) is a very useful tool for use with standard and non-standard discs.ADI is operated from a single menu with a permanent status window which is continually updated by the commands.Besides the obvious use for backing up non-standard discs ADI can be used to check and repair faulty tracks, recover data from a disc, create specially designed disc formats,operate in single and double density modes and examine the parts of discs that other editors cannot reach.Chapter 2. describes how to fit ADI into a BBC or ELECTRON computer.Chapter 3. describes how to use ADI and gives a description of the commands and the parameters used with the commands.Chapter 4. gives a description of the various types of disc drives and explains in detail the format of a track.In this manual FDC stands for Floppy Disc Controller.Early BBC computers used the Intel 8271 FDC; later machines like the B+ and the Electron use Western Digital's 1770 FDC.They are both similar, but the 1770 is capable of operating in double density mode.ADI can operate in double density, only if the Acorn 1770 disc interface is fitted to the computer. 2. FITTING ADI For the BBC computerAfter turning off the power, take off the top cover by removing the 4 fixing screws located 2 at the rear and 2 underneath near the front.Now locate the ROM sockets.In the B+ they are located to the right of the power supply.The 2 sockets nearest the front of the computer are used by the speech synthesizer and should not be used.In the BBC model B the ROM sockets are situated beneath the keyboard, so remove the screws securing the keyboard to the computer and move the keyboard carefully to one side, just enough to expose the ROM sockets located to the right of the motherboard.Insert the ADI ROM into one of the empty sockets, with the little notch in the chip facing toward the back of the computer.Take care not to bend any of the legs on the chip.Replace the keyboard & top cover.Turn on the computer and type *HELP. A list of ROM titles should appear on the screen.If 'Advanced Disc Investigator' does not appear in the list, it is likely that the ROM is not positioned correctly in its socket.For the ELECTRONChecking LK1 The link in the Plus3 may already be joined.This can be checked by performing the following task.First fit the ROM cartridge into the Plus1 as described below.Turn on the computer and type *ADI.Insert a formatted disc into the drive and select the command 'Edit a Sector', by pressing 'E'.At this point, if a 'snowstrom' effect appears on the screen then the link HAS been joined and nothing further need be done.If the 'snowstorm' effect does not appear then the link HAS NOT been joined.The 'snowstorm' effect is the result of temporarily turning off the screen display to provide the extra processing time while accessing the disc.Joining LK1 After turning off the power, isolate the Plus3 by disconnecting the Plus1 & Electron.Remove the top cover of the Plus3 by unscrewing the 9 fixing screws on the bottom of the Plus3. Locate LK1 situated to the top left of the disc drive between IC6 and IC10.If the link is not joined, make the connection with a small piece of wire, ideally soldering it to the board.Replace the cover and reconnect the Electron and Plus1.Fit the ROM cartridge to the Plus1 as described below.To check that the link has been properly joined, follow the procedure shown above (Checking LK1)Fitting the ROM cartridge Turn off the power and insert the ROM cartridge into one of the slots in the top of the Plus1.Ensure that the label on the cartridge faces the keyboard.If in doubt, refer to 'Using Cartridges' on page 16 of the Plus1 User Guide.To check that the cartridge has been properly inserted, turn on the power and type *HELP.A list of ROM titles should appear on the acreen.If 'The Advanced Disc Investigator' is not in the list, it is likely that the ROM cartridge is not correctly positioned in the Plus1. 3. USING ADI ADI is a utility ROM and is called from a single '*' command.It is advisable save to any program in memory before using this command on a computer without a second processor, since the IO memory is used.ADI can be used with a second processor turned on but will not use the memory in the second processor.To use the COPY, FORMAT, UNFORMAT, READ and WRITE track commands in ADI in double density mode on a computer which does not have SHADOW RAM, as used on the BBC B+, it is necessary to 'Unplug' the ADFS ROM, and if present, the 1770 DFS ROM.When this is done PAGE should be &E00. To enter ADI type *ADIThe screen will clear, and after a short delay (about 5 seconds on the Electron), the ADI screen is displayed.The rectangle in the top lefthand side of the screen is the Menu window from which various commands can be selected.The rectangle at the bottom of the screen is the STATUS window showing all the current disc and drive parameters.The rectangle at the top righthand of the screen shows a serial number that is unique to your copy of ADI.The MENU window To select a command from the menu, use the left and right cursor keys to move the inverse cursor over the letter corresponding to the command and press RETURN.The full name of the command is shown on the line below.Alternatively, just press the key which matches the command on the menu.A description of the commands follows later.To change the foreground display colour press the COPY key.To change the background display colourpress the DELETE key. To leave ADI press ESCAPE.The STATUS window To move the STATUS cursor backwards or forwards, use the left & right SHIFT cursor keys.To change the value of the parameter under the cursor use the up & down SHIFT cursor keys.Press SHIFT/down to add one to the parameter and SHIFT/up to subtract one from the parameter.Alternatively, just type in the number in decimal. S/.DRIVE This parameter is the 'source drive' number.It is the source drive from which data is read when using a command which requires a source and destination drive, i.e. the COPY A DISC and VERIFY TWO DISCS commands.It is also used by commands which only require a single drive, such as EDIT A SECTOR and SCAN A DISC commands. This parameter consists of three parts. The drive number 0-3 The stepping size of the drive head The density of the disc in the drive The stepping size is only of use in 80track drives.It controls whether the drive head is moved in single steps 48 tpi (tracks per inch) or double steps 96 tpi.Setting this to 48 will double step the drive head and setting to 96 will step the head normally in single steps.When copying a 40 track disc in and 80 track drive set this parameter to 48. 40track drives should leave this parameter set at 96. The last part of S/DRIVE controls the density.If the disc in the drive is single density, set this parameter to FM (frequency modulation) and if it is double density set it to MFM (modified frequency modulation).The 8271 FDC can only operate in single density. To change the drive stepping size & density use the SHIFT/up & SHIFT/down cursor keys.Pressing a number 0-9 has the following effect:- 0 -Drive 0, 96 tpi FM 1 -Drive 1, 96 tpi FM 2 -Drive 2, 96 tpi FM 3 -Drive 3, 96 tpi FM 4 -Drive 0, 48 tpi FM 5 -Drive 1, 48 tpi FM 6 -Drive 2, 48 tpi FM 7 -Drive 3, 48 tpi FM 8 -Drive 0, 96 tpi MFM 9 -Drive 1, 96 tpi MFM WARNING To avoid damage to a 40 track drive, do not use 48tpi. TRACK This parameter is the physical track number (0-79) of the disc.Set this parameter to the track number of the first track to be used by a command.For example; to edit a sector of a disc on track 20,set this parameter to 20. WARNING To avoid damage to a 40 track drive only use sectors 0-39 SECTOR This parameter is the physical sector number (0-30) of a track.Set this parameter to the sector number of the first sector to be used by a command.For example; to edit the first sector of a track, set this parameter to 0, to edit the second sector set it to 1, to edit the third sector set it to 2 etc. BYTES This parameter is the actual length of a sector in bytes.It is used by the FORMAT command to create sectors of this length. D/DRIVE This parameter is the destination drive number.It is used by commands which require a source and destination disc, ie. the COPY A DISC and VERIFY TWO DISCS commands.If only a single drive is connected, the destination drive should be the same as the source drive.Messages will be printed when to swap the source and destination discs. See:-S/DRIVE for explanation the 48/96 nd FM/MFM parameters. TRACKS This parameter is the numbers of tracks (0-80) to be operated on by a MENU command.For example; to scan 20 tracks starting from track 10 set TRACK to 10 and TRACKS to 20 WARNING To avoid damage to a 40 track drive do not exceed track 39 ie. TRACK+TRACKS must not exceed 40 T/ID This parameter is the track ID (0-255).A track ID is a number given to each sector when a disc is formatted.It is normally the same as the track number on which the track is formatted.This parameter is only used by the FORMAT command.It should normally be set to the same value as TRACK.A protected disc will often use a track ID different to its physical track number. H/ID This parameter is the head ID (0-255).A head ID is a number given each sector when a disc is formatted.A head number could be used to match up a disc with a particular drive number.The head number is redundant on the BBC and Electron disc systems.This parameter is only used by the FORMAT command.It should normally be set to zero.Protected discs sometimes use a head number other than zero. S/ID This parameter is the sector ID (0-255, 0-239 on 1770).A sector ID is a number given to each sector of a track when it is formatted.Sector ID's in DFS are 0-9 and in ADFS 0-15.This parameter is only used by the FORMAT command.It should normally be set to zero.Protected discs often use a sector ID starting from a number other than zero. L/ID This parameter is the length ID (0-255).A length ID is a number given to each sector when a disc is formatted, and used to indicate the length of the sector.The FDC recognizes the length as follows:- L/ID SECTOR length in bytes 0 - 128 1 - 256 2 - 512 3 - 1024 4 - 2048 (8271 only) This parameter is only used by the FORMAT command.It should normally be set to the value corresponding to the sector length as shown above.Some protected discs use a length ID which does not match the physical sector length.See 'Protected Disc Formats' later. SECTORS This parameter is the number of sectors on a track (0-99).It is used by the FORMAT command as the number of sectors to be formatted on each track.It is also used by the GET SECTORS FROM DISC and PUT SECTORS TO DISC command.This parameter should be set to the number of sectors to read or write.Protected disc can sometime use less or more than the normal 10 or 16 sectors per track. OPERATION This parameter shows the current command in operation by the FDC.This parameter will be blank when there is no command in operation. OPERATION MEANING SEEK Seek drive head to a track READ DD Read a deleted data sector WRITE Write a normal sector WRITE DD Write a deleted data sector FORMAT Format a track READ ID Read a track's sector ID WRITE SR Write to an FDC special register READ T Read track data (1770 FDC only) WRITE T Write track data (1770 FDC only) RESULT This parameter shows the result of the last FDC command.Every command issued by the FDC returns a result (0-255).A successful completion of a command returns 0.The number and meaning of the result is shown by this parameter.This parameter is only used by the PUT SECTORS TO DISC, to write deleted sectors to a disc.For a list of the 8271 FDC results type *HELP RESULT. COPY A DISC Purpose To copy tracks from the source disc to the destination disc.The destinatipn disc need not be formatted since the format of the source disc is copied on to the destination disc.A Y/N message is displayed before the tracks are copied.Press Y to continue or any other key to cancel the command. This command uses the buffer to copy tracks from source to destination disc.Sectors are read into the buffer one at a time and the result is displayed on the screen.A result of 0 or 32 means the sector has been read successfully.The result is displayed when writing the sectors to the destination disc.A result of 0 means the sector has been written successfully. Press any key to Pause the command and again to continue. Parameters S/DRIVE - Source drive No.,stepping size and density of disc. D/DRIVE - Destination drive No.,stepping size and density of disc TRACK - First track to copy TRACKS - Number of tracks to copy Examples To back up a 40 track disc so that it can be used in an 80 track drive, using a dual 80 track for backup, set the parameters to:- S/DRIVE: 0 48 D/DRIVE: 1 96 TRACK: 00 TRACKS 40 this would also backup a non-standard 40 track disc.Some software publishers use a 40/80 disc format,which has a copy of the program in 40 track on side 0 and another copy in 80 track on side 2.Using this example it is possible to make a copy of side 0 in 80 track.This is useful for single sided drives which cannot read side 2. Notes Using the 1770 FDC to copy early forms of non-standard discs may produce a result of 14, Data Field CRC Error when reading sectors.This means that the sector cannot be read, and is due to a protective feature of the disc, which can only be used on the older 8271 FDC.Only the READ TRACK DATA command can be used to read the sectors from the disc.See Protected Disc formats and the 1770 FDC for more information. VERIFY TWO DISCS Purpose To verify tracks on the source disc with the destination disc.This should be used after using the COPY command, to ensure a successful copy.A result is displayed after verifying each track. 'CORRECT' means the tracks are the same.Other possible results and their meanings are given below. Press a key to Pause the command and again to continue. Result Meaning No sectors found - both S/DRIVE and D/DRIVE have no sectors ID Field Incorrect - a sector's ID field does not match S/DRIVE read error - cannot read sector from S/DRIVE D/DRIVE read error - cannot read sector from D/DRIVE Length error - a sector's length does not match Data address mark error - data type (normal/deleted) does not match Data error - a sector's data does not match Parameters S/DRIVE - source drive No.,stepping size and density of disc D/DRIVE - destination drive No.,stepping size and density of disc. TRACK - First track to verify TRACKS - Number of tracks to verify. EDIT A SECTOR Purpose To examine and edit disc sectors.The sectors will be read from SECTOR, the track from TRACK and the drive from S/DRIVE.The size of the sector in bytes ,the sector's field ID's and number of sectors on the track will be shown in the status window. The sector is displayed in the centre of the screen as HEX data and ASCII characters.A cursor will appear on the first byte of the sector.Moving the cursor is done by moving the 4 cursor keys.If the sector occupies more than one screen (256 bytes), the cursor can be moved forward and back a page using the SHIFT/up and SHIFT/down keys.Press SHIFT/left cursor to move to the left margin and SHIFT/right cursor to move to the right margin.Editing an ASCII byte is done by overtyping from the keyboard.The new byte will appear as hex inside the round brackets and as a ASCII character above the flashing cursor.To enter numbers as hex bytes press the COPY key.The round brackets will change to square brackets.Now only hex numbers will be accepted ie. 0-9 and A-F.Press copy again to enter ASCII characters.Moving forward or back a track or sector is done using the 4 CTRL/cursor keys. CTRL/right Forward 1 sector CTRL/left Back a sector CTRL/up Back a track CTRL/down Forward a track If a sector has been edited, a message is displayed for saving the altered sector back onto disc.Press Y to save the sector, or any other key not to save it.The sector can be displayed as 65C02 disassembler by pressing the TAB key (CTRL/I on the Electron). Press ESCAPE to leave this command. Parameters S/DRIVE - Drive number,stepping size and density of disc to edit. TRACK - Track number to edit SECTOR - Sector number to edit TRACKS - Number of tracks on disc Editing Keys Cursor Keys - cursor movement SHIFT/left - Move to LEFT margin SHIFT/right - Move to RIGHT margin SHIFT/down - Move forward 1 PAGE SHIFT/up - Move back 1 PAGE CTRL/left - Move back 1 SECTOR CTRL/right - Move forward 1 SECTOR CTRL/down - Move forward 1 TRACK CTRL/up - Move back 1 TRACK COPY - Toggle HEX/ASCII TAB (CTRL/I on Electron) - Swap display type CTRL/P - Print screen ESCAPE - Leave command SCAN A DISC Purpose To display the format of a disc.The information regarding the format of a track is the TRACK, HEAD, SECTOR and LENGTH ID's of each sector,the sector's length in bytes and also the result from reading each sector.A result of 0 or 32 means the sector has been read successfully.The SCAN command is a very important command, since without it, it would be virtually impossible to copy a disc with a non-standard format.A protected disc can quickly be identified by its unusual format, by using this command.See page (missing) for more information on disc formats. Press any key to Pause the command and again to continue. Parameters S/DRIVE - Drive No.,stepping size and density of disc to scan. TRACK - First track to scan. TRACKS - Number of tracks to scan. FORMAT TRACKS Purpose To format or re-format tracks to a specified format.This command can be used to re-format just 1 track, instead of the whole disc.This is useful when the rest of the disc contains important information which could not be formatted over.A YES/NO is displayed before the tracks are formatted.Press Y to continue or any other key to cancel the command Parameters S/DRIVE - Drive No.,stepping size and density of disc to format. TRACK - First track to format BYTES - Length of each sector in bytes TRACKS - Number of tracks to format T/ID - Track ID of first track H/ID - Head ID for each sector S/ID - Sector ID for first sector on each track L/ID - Length ID of each sector. SECTORS - Number of sectors on each track Examples To format an 80 track disc in DFS format in drive 0 use:- S/DRIVE=0 96 FM TRACK=0 TRACKS=80 BYTES=256 T/ID=0 H/ID=0 S/ID=0 L/ID=1 SECTORS=10 To format track 20 only in DFS format in drive 0 use:- S/DRIVE=0 96 FM TRACK=20 TRACKS=1 BYTES=256 T/ID=20 H/ID=0 S/ID=0 L/ID-1 SECTORS=10 To format an 80 track disc in ADFS format in drive 0 use:- S/DRIVE=0 96 MFM TRACK=0 TRACKS=80 BYTES=256 T/ID=0 H/ID=0 S/ID=0 L/ID=1 SECTORS=16 To format track 20 only in ADFS format in drive 0 use:- S/DRIVE=0 96 MFM TRACK=20 TRACKS=1 BYTES=256 T/ID=20 H/ID=0 S/ID=0 L/ID=1 SECTORS=16 Obviously by changing these parameters it is possible to create an almost infinite number of formats, even the IBM mini-floppy format with:- S/DRIVE=0 96 MFM TRACK=0 TRACKS=40 BYTES=512 T/ID=0 H/ID=0 S/ID=1 L/ID=2 SECTORS=9 Notes Formatting a DFS or ADFS disc with this command does not write the catalogue information onto the disc. UNFORMAT TRACKS Purpose To 'unformat' tracks on a disc.This formats the track in such a way that the FDC is unable to distinguish any sector on the track, just like a blank track This is useful for creating a disc which must be completely blank.A method of protection employed by some protected discs is to check for 'blank tracks'.A YES/NO message is displayed before the tracks are 'unformatted'.Press Y to continue or any other key to cancel the command. Parameters S/DRIVE - Drive No.,stepping size and density of the disc TRACK - First track to be 'unformatted' TRACKS - Number of tracks to be 'unformatted' MODIFY FORMAT PARMS Purpose To change the default 'skew' and 'field gaps' used when formatting a track.A table of skew and gaps 1 and 3 is printed in the centre of the screen. There is a value for each sector length in single (FM) and double (MFM) density. To modify a value, respond to the prompts that follow. To leave this command without modifying the table just press RETURN at the prompt. Skew values can be both positive and negative. To enter a negative value use the following formula:- value=256-x Where x=the value to be made negative. A skew value should be chosen carefully. A disc with 10 sectors could have skew values of 0 to 9 or -1 to -9, any other values are meaningless. A value of 0 means no skew at all.See page 18 for more information on skew. GET SECTORS FROM DISC Purpose To read the sectors (0-99) from the source disc into the buffer.After the prompt 'Use STATUS ID's Y/N' is displayed, press 'N' or RETURN to read the sectors normally from the disc into the buffer.The maximum number of sectors able to be read into the buffer will depend upon the size of the buffer. The message 'No Room' is displayed if the buffer is not large enough to hold all the sectors. If 'Y' is pressed after the prompt then the ID parameters in the status window are used to read the sectors from the disc. Only the sectors on the track TRACK can be read into the buffer. The usefulness of this is limited. It is of most use on the 8271 FDC when it is required to issue a read sector command of a particular sector length on any sector. By setting L/ID to a length greater than the physical sector length, the sector can be read as well as the CRC's, gaps and sync bytes that follow the sector. This feature is not available on the 1770 FDC Some protected discs make use of this feature to read the size of gap 3. Use MODIFY FORMAT PARMS command to change the size of this gap. Parameters S/DRIVE - Drive No.,stepping size and density of the disc TRACK - First track to start reading from SECTOR - First sector to start reading from SECTORS - Number of sectors to read. Parameters using STATUS ID's S/DRIVE - Drive No.,stepping size & density of disc TRACK - Track to read T/ID - Logical track number S/ID - First logical sector to read L/ID - Length of sector to read SECTORS - Number of sectors to read. PUT SECTORS TO DISC Purpose To write sectors (0-99) from the buffer onto the source disc.A YES/NO message is displayed before the sectors are written.Press 'Y'to continue and any other key to cancel the command.After the prompt 'STATUS ID's Y/N ?' is displayed press 'N' or RETURN to write the sectors normally from buffer to disc. The message 'No Room' is displayed if the number of sectors exceeds the size of the buffer. If 'Y' is pressed after the prompt then the ID parameters in the status window are used to write the sectors from the buffer.Only the sectors on track TRACK can be written from the buffer.The usefulness of this is limited.It is of most use on the 8271 FDC when it is required to issue a write sector command of a particular sector length on any sector.By setting L/ID to a length greater than the physical length, it is possible to mix physical sector lengths on one track.This feature is not available on the 1770 FDC. It is possible to write deleted sectors to a disc by changing the result parameter before using this command, so it displays DELETED DATA. Normal sectors will be written if the result displays NORMAL DATA. Parameters S/DRIVE - Drive No.,stepping size and density of disc TRACK - First track to start writing to SECTOR - First sector to start writing to SECTORS - Number of sectors to write Parameters using STATUS ID/'s S/DRIVE - Drive No.,stepping size and density of disc TRACK - Track to write T/ID - Logical track No. S/ID - First logical sector to write L/ID - Length of sector to write SECTORS - Number of sectors to write READ TRACK DATA Purpose To read all the bytes on a track into the buffer, which includes the sector ID's, CRC bytes and field gaps. The number of bytes read from the track is shown in the status window by the BYTES parameter. See 'What's on a track? on page (missing) for more information. A double density (MFM) track can only be read using the 1770 FDC. An MFM track uses about 6300 bytes. If the buffer is not large enough the message 'No Room' is displayed. Type *HELP TRACK for a table of the format of a track. Parameters S/DRIVE - Drive No.,stepping size and density of disc TRACK - Track No. from which the data is read Notes Although the 8271 FDC does not have a read track command, it is possible to read almost all of the track. This is done by reading the first sector on the track as a very large sector (4096 bytes) which reads everything after the first sector, including the other sectors and their gaps & CRC's etc. The sector ID field, post ID field gap and data address mark of the first sector, and the post index field gap (1) are not read into the buffer. The RESULT parameter will return error 14, Data Field CRC Error. The BYTES parameter will return a track length of 4096 bytes. When this command is used to read an MFM track on the 1770 FDC or an FM track on the 8271 FDC, certain data patterns in the track's data field causes read errors to occur, making the contents of the buffer to be an inaccurate dump of the track. A formatted track which has not had sectors written to it can be read without errors. WRITE TRACK DATA Purpose To format a disc with the data in the buffer. The data must include the field addresses and field gaps. The correct format of the data for a track must be observed otherwise the track will be unreadable. See 'What's on a track ?' on page (missing) for more information. A YES/NO message is displayed before the track is formatted. Press 'Y' to continue or any other key to cancel the command. This command can only be used if the Acorn 1770 disc interface is fitted in the computer. A double density (MFM) track uses about 6300 bytes. If the buffer is not large enough, the message 'No Room' is displayed. Type *HELP TRACK for a table of the format of a track Prameters S/DRIVE - Drive No.,stepping size and density of disc TRACK - Track No. of the track to be formatted BUFFER EXAMINE Purpose To examine and edit the contents of the buffer. Data from the buffer is displayed in the centre of the screen as Hex bytes and ASCII characters. A cursor will appear over the first byte in the buffer and can be moved with the 4 cursor keys.Moving forwards or backwards a page at a time is done using the SHIFT/up and SHIFT/down cursor keys. Moving to the left or right margin is done by using SHIFT/left and SHIFT/right. Editing is done by typing the characters from the keyboard. To enter numbers as hex bytes press COPY. The round brackets will change to square brackets. Now only Hex numbers can be typed, ie 0-9 and A-F. Press COPY again to enter ASCII characters. To display the contents or the buffer in 65C02 disassembler, press the TAB key (CTRL/I on the Electron) Press ESCAPE to leave this command Editing Keys Cursor Keys - Cursor movement SHIFT/left - Move to left margin SHIFT/right - Move to right margin SHIFT/down - Move forward 1 page SHIFT/up - Move back 1 page COPY - Toggle HEX/ASCII TAB (CTRL/I on Electron) - Swap display type CTRL/P - Print the screen ESCAPE - Leave command EXAMINE BUFFER Purpose To fill the contents of the buffer with zeros. A YES/NO message is displayed before the buffer is cleared. Press 'Y' to clear or any other key to cancel the command TURN PRINTER ON/OFFPurpose To turn the printer on or off. If the printer is turned on, output from the COPY, SCAN an VERIFY commands will be sent to the printer as well as the screen. If the printer is off, output is sent to the screen only.To turn the printer ON if it is OFF or OFF if it is ON pres 'Y' at the YES/NO prompt or any other key to cancel the command. INITIALIZE STATUS Purpose To return the status parameters in the status window to their default values. The density of the S/DRIVE and D/DRIVE parameters is set according to the density of the current disc filing system, ie FM (single density) for DFS, and MFM (double density) for ADFS. TRACKS is set to 80, BYTES to 256 and SECTORS to 10 in DFS and 16 in ADFS. The other parameters are set to zero. *COMMAND Purpose To send a command to the MOS. Type in the command after the '*' prompt. Any output from the command will appear in the centre of the screen. It would be possible to return to BASIC by typing *BASIC, but this is not recommended. To leave ADI properly press ESCAPE from the menu. *OSWORD7F Purpose To send a command to the FDC. The parameters which follow the command are assembled in memory and passed to OSWORD &7F, is the drive number, is the start address for reading or writing, is the 8271 FDC command, can be repeated for commands which use more than one parameter. The parameters for OSWORD7F should be in hexadecimal. If this command is used with no parameters, then the result from the last OSWORD7F command is printed. Results and their meanings can be found on page 7. If the 1770 interface is fitted, this command can be used on double density discs by setting bit 3 of the parameter, ie add 8 to the drive number. For a list of the 8271 FDC commands type *HELP FDC. Note:- The READ & WRITE TRACK commands can only be used on the 1770 FDC. Examples *OSWORD7F 0 1900 53 A 0 21 Reads one sector from an FM disc in drive 0, track 10, sector 0 to memory address &1900 *OSWORD7F 8 1900 A 0 21 Reads 1 sector from an MFM disc in drive 0, track 10, sector 0 to memory address &1900 Notes For the precise meaning of all 8271 FDC commands and their parameters, refer to the document on the 8271 FDC by INTEL. 4 DRIVE TYPES AND DISC FORMATS 40 and 80 Track Drives A 40 track drive is capable of moving it's head over 40 track positions, so a maximun of 40 tracks can be written to the disc. 40 track drives can pack 48 tracks into 1 inch across the surface of the disc, or 48 tracks per inch (48tpi). This means that 40 tracks occupy less than 1 inch across the surface of a disc. An 80 track disc drive is capable of moving it's head over 80 positions, so a maximum of 80 tracks can be written to the disc. 80 track drives can pack 96 tracks into 1 inch across the surface of the disc or 96 tracks per inch (96tpi). This means that 80 tracks occupy less than 1 inch across the surface of the disc. Because 80 track drives have twice as many tracks per inch, the hardware of the drive must be more precise. Consequently, 80 track drives are usually more expensive than 40 track drives. Single and Dual Drives A single drive means just 1 drive unit and a dual drive means 2 drive units. Both Single and Dual units can be single or double sided. Single sided and Double sided Drives A single sided drive means that only one side of the disc can be used, whereas a double sided drive means both sides can be used (provided the disc is double sided) Single Density and Double Density Single and double density is the ability of the FDC, not the drive or the disc, to write data on to the disc in FM (frequency modulation), or in MFM (modified frequency modulation). MFM can pack twice as many bytes on to a track as FM, but because of the overhead in gaps and CRC &c., the number of bytes used as data is not quite double. DFS uses 10 sectors per track, and ADFS (the double density system) uses 16. Double density discs should be used in a double density system. Quite often single density discs will work too, but these are less reliable than double double density discs. What's on a track? Each track is divided into equal sized sectors, where the program data is stored. Each sector can store the same number of bytes, and will hold some, or all of the program, depending on its size. DFS uses 10 sectors per track and ADFS uses 16. Each sector on DFS and ADFS can store up to 256 bytes. A track contains not just the program data but lots of other information, which is not normally seen, although it is used every time the track is accessed. About 75% of the track contains program data, the rest contains information about the track, gaps and CRC bytes. Post Index Gap Usually called Gap 1., it is written starting from the index mark and consists of a specified number of &FF bytes followed by 6 bytes of 00's. The 00's are used during read and write operations to synchronize the data separation logic, with the data to be read from the ID field. The post index gap is written only when the track is formatted. Sector ID Field This consists of 7 bytes and is written only when the track is formatted. The first byte is the ID address mark consisting of the data byte &FE. The next 4 bytes are the, track, head, sector, and length ID's respectively. These are used to indentiy a particular sector on subsequent read or write operations, the last 2 bytes are a 16bit CRC (cyclic redundancy check) od the first 5 bytes of this feild. The FDC can detect an ID CRC Field error from this CRC. Post ID Field Gap Usually called Gap 2. this, in FM, consists of 11 bytes of &FF and 6 bytes of &00. In MFM it consists of 22 bytes of &FF, 6 bytes of &00 and 3 bytes oif &a1. Gap 2 is written initially when the track is formatted. During subsequent write operations, the drive's write circuitry is enabled at byte 12 in FM and byte 23 in MFM and the six &00's are rewritten each time the sector is updated. During subsequent read operations, the last 6 bytes are used to synchronize the data separation logic with the incoming data field. Data Field The length of the data field is determined when the track is formatted. DFS and ADFS use 256 bytes. The first byte of the data field is the data address mark which consists of byte &FB. When a deleted sector is to be written a deleted sector address mark is written which consists of the data byte &F8. The last two bytes of the data field are a 16 bit CRC. The FDC can detect a DATA Field CRC error from this CRC. Post Data Field Gap Usually called Gap 3., this is written when the track is formatted, and in FM consists of a selectable number of &FF bytes followed by 6 &00 bytes. In MFM it consists of a selectable number of &4E bytes. Gap 3 separates the precedingdata field from the next physical ID field on the track. Following a sector update operation, the drive's write logic is disabled during the first &FF bytes (&4E for MFM). Gap 3 is not written following the last physical sector on the track. Final Gap Called Gap 4, is written when the track is formatted and consists of &FF's in FM and &4E's in MFM, extending from the last physical data field on the track to the end of the track. The sector ID Field, Post ID Field Gap, Data Field and Post Data Field Gap are repeated for each sector on the track. The Post Data Field is not written after the last physical sector. FIELD FM VALUE LENGTH MFM - VALUE LENGTH ============================================================ Post Index Field Gap (1) - &FF P - &4E P &00 6 ------------------------------------------------------------ ------------------------------------------------------------ Sector ID Field &00 12 &A1 3 ID Address Mark - &FE 1 - &FE 1 T/ID - Track 1 - Track 1 H/ID - Head 1 - Head 1 S/ID - Sector 1 - Sector 1 L/ID - Length 1 - Length 1 CRC - CRC 2 - CRC 2 ------------------------------------------------------------ Post ID Field Gap (2) - &FF 11 - &4E 22 - &00 6 - &00 12 - - &A1 3 ----------------------------------------------------------- Data Field Data Address Mark - &FB 1 - &FB 1 Data Bytes - Data Sector - Data Sector CRC - CRC 2 - CRC 2 ----------------------------------------------------------- Post Data Field Gap (3) - &FF P - &4E P - &00 6 ---------------------------------------------------------- Final Gap (4) - &FF - - &4E - (The length of the final field gap will depend upon the number of bytes per sector and the length of the program selectable gaps.) The number of bytes appearing as 'P' under the heading LENGTH are program selectable. The lengths are specified in the format command.The table shown above can be produced by typing *HELP TRACK. This is best done in mode 0 or 3. Using the READ TRACK DATA command it is possible to read all the bytes from a track and identify the different fields described above. Alternatively, examining the buffer after using the FORMAT command on a 1770 FDC system will reveal the exact format of the last track formatted. Deleted Data Deleted Data or Deleted Sectors are sectors which have been marked as deleted so that they cannot be accessed by normal read and write sector commands. Physically the only difference between a deleted sector and a normal sector is the Data address Mark in the Data Field. Skew <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Skew is a physical offset of a sector on a track with the same logical sector on the next track. For example if a disc has sectors numbered 0-9 on track 0 with sector 0 as the first physical sector on the track, and track 1 has sectors 0-9, and the first physical sector is 1, then the disc has a skew of 1. The reason for offsetting the sectors like this is to minimize the access time due to the head stepping delay. In other words, by the time the drive head has stepped to the next track, the next sector to come under the drive head is the first logical sector to access next, in this example 0. DFS discs use a skew factor of 7, while ADFS discs use a skew factor of 0. Sector Interleaving Sector interleaving is not necessary on the BBC or Electron systems. It is a similar technique to skew but for a different reason. Sector interleaving is the practice of selecting the order of sectors on a track to minimize the access time due to rotational delay. For example, instead of formating sectors 0-9 they could be formatted 0,3,6,9,2,5,8,1,4,7, Protected Disc Formats There is nothing strange about the format of a protected disc, it is just different, like the format of an ADFS disc is different to the format of a DFS disc. Any format which is different to a normally formatted disc is classed as 'protected' and is unreadable by the normal disc filing system software. The FORMAT command and its parameters give a good indication as to how varied the formats can get. A protected disc will usually have a program on it which can read this different format. This is usually written in machine code to make it harder to read. All DFS protected discs must have at least 3 sectors which are normally formatted, since the disc must be BOOTable, ie run from SHIFT/BREAK. Protected Disc Formats and the 1770 FDC Although the 1770 FDC is very similar to the 8271 FDC it does not operate in exactly the same way and some discs which work with the 8271 won't work with the 1770. Software which addresses the 8271 directly will obvoiusly not work. Disc formats which use an incorrect Length ID in the sector ID field will also create problems. This is because the 1770 FDC reads the length of the sector from the Length ID, whereas the 8271 is supplied with the length by the read or write sector command, which may or may not be the same as the Length ID. Consequently if the 1770 thinks the size of the sector is 128 bytes, whereas it is really 256 bytes long, then only half the sector is read, and the FDC produces a Data Field CRC error.