IDEPatch 1.18 ============= J.G.Harston 70 Camm Street, Walkley, Sheffield S6 3TR jgh@arcade.demon.co.uk By default ADFS accesses SCSI hard drives. It can be difficult to get the SCSI host adaptor for the Master, but IDE hard drives are cheap and easily available. An IDE interface can be built with two ICs to allow IDE drives to be used. This program patches ADFS 1.50 for the Master to access IDE drives instead of SCSI drives. Additionally, ADFS is patched to preseve context on Ctrl-Break. Normally, when pressing Ctrl-Break ADFS forgets the current directory and library and the previous directory. This can be very inconvenient, as well as annoying. Also, if a hard drive is present, after *MOUNT or the first time ADFS is selected, a Library directory is looked for, regardless of the setting of *Configure Dir/NoDir. To use, you need a ROM image of ADFS 1.50. You can do this using the supplied *SrSave command, as the built-in command on the Master does not allow you to save a sideways ROM. ADFS is in bank 13, so save the ROM image as follows: */SrSave ADFS150 8000+4000 D Once you have a ROM image, run IDEPatch. You will be asked for the name of the ROM image to load. Once entered, it will patch the image, and ask for a filename to save the new image. If is pressed the default filename displayed is used. You can load the new image into sideways RAM or blow it into an EPROM and plug it into a spare ROM socket. If socket 8 on the motherboard is free, you can use that, otherwise you could plug it into an external cartridge. Disable the onboard ADFS with *Unplug 13. If ADFS is your default filing system, change it to select the new ROM with *Configure FILE where is the bank your new ADFS ROM is in. If loading the new image to RAM, you will need to simulate a power-on reset to clear the workspace with: *FX151,78,127 ADFS will report itself as version 1.53. Pressing Ctrl-Break or Ctrl-A- Break will remember the directory context. Pressing Ctrl-F-Break resets ADFS as before. Hard Drive Initialisation ========================= The program HDInit will install a blank ADFS filesystem on a hard drive. You are given a short menu of options: D: Select Drive I: Investigate Drive F: Format Drive X: Exit You can also press '*' and enter *commands. Option D lets you select a drive to use. You can also select a floppy drive with 4-7 to quickly blank a disk. Option I will investigate the current drive and find out various information about it. Option F will place a blank filesystem on the selected drive. If the drive hasn't been investigated to find its size, then the size is found first. You are then asked to confirm that you want to blank the drive by entering YES in capital letters. Once you have initialised the hard drive you should reset to clear the ADFS workspace or the disk map and root directory can be corrupted. Technical Information ===================== IDEPatch changes the code that detects the presence of the SCSI host interface and access SCSI devices. It looks for an IDE interface at &FC40-&FC47. Only 8-bit transfers are performed, the high byte of each word is ignored. Consequently, a 500M drive, for example, will only be able to be initialised as a 250M ADFS drive. To the outside world ADFS acts on SCSI commands. The SCSI system is accessible by the user through OSWORD &72. The only commands that are translated to IDE commands are &08 - Read (translated to IDE command &20) and &0A - Write (translated to IDE command &30). All other actions return a result of &60 indicating Bad SCSI Command. IDE result codes are translated to SCSI result codes as follows: IDE result code SCSI result code &20xx Device Fault &65 Bad drive &x140 Data error &48 CRC error &x120 Media changed &x110 Sector not found &50 Sector not found &x108 Media change request &x104 Bad command &60 Bad command &x102 Drive empty &x0xx OK &00 OK &7F Unknown IDE result The IDE device is accessed using CHS addressing - Cylinder, Head, Sector - with the geometry set to 64 sectors per track and 4 heads. This makes it easier to address the drive as divides and multiplies are avoided. In testing I have found few drives support LBA (Logical Block Address) addressing. IDE drive 0 is accessed by ADFS drive 0 and 1, IDE drive 1 is accessed by ADFS drive 2 and 3. Drive 0 and 2 access the first 512M of the drive, and drive 1 and 3 access the second 512M of each drive, allowing up to 4G of accessible hard drive space. For example, a 1600M hard drive will be seen as a 512M drive followed by a 288M drive. Future ADFS patches may access a RAM card with drive 6 or 7. The highest sector addressable by an IDE device is &FFFFFFF, giving access to 64G using 256-byte sectors. However, the highest sector addressed by ADFS's SCSI subsystem is &1FFFFF, giving 512M per logical drive using 256-byte sectors. ADFS Version Numbers ==================== ADFS 1.50 is the version supplied with MOS 3.50. ADFS 1.51 is ADFS with context preserved over Ctrl-Break. ADFS 1.52 is ADFS with IDE single hard drive access. ADFS 1.53 is ADFS with IDE hard drive access, four drives on two devices. Version History =============== 09-Sep-2002 v1.00 JGH: Ctrl-Break doesn't reset directory context. 03-Jul-2004 v1.10 JGH: Accesses IDE hard drives. 04-Nov-2004 v1.11 JGH: Fuller testing with IDE hardware. 25-Nov-2004 v1.12 JGH: Partially working using multiple sector access. 12-Dec-2004 v1.13 JGH: Accesses one sector at a time. 15-Dec-2004 v1.14 JGH: Each sector accessed twice to avoid DRQ bug. 17-Dec-2004 v1.15 JGH: SetGeometry sets correct drive. 27-Dec-2004 v1.16 JGH: Autofinds Library. 23-Feb-2005 v1.17 JGH: Access four drives on two devices. Doesn't wait for spin-up on power-on. 28-Apr-2005 v1.18 JGH: Removed test offset code.