Path: vanilla!asbach!noris.net!blackbush.xlink.net!sol.ctr.columbia.edu!news.uoregon.edu!news.dacom.co.kr!usenet.seri.re.kr!news.cais.net!primus.ac.net!news.serv.net!solaris.cc.vt.edu!news.mathworks.com!news.kei.com!nntp.coast.net!oleane!plug.news.pipex.net!pipex!nielsen.co.uk!peer-news.britain.eu.net!yama.mcc.ac.uk!jumper!simonc From: simonc@jumper.mcc.ac.uk (Simon Cooke) Newsgroups: comp.sys.sinclair Subject: Re: MGT Plus-D Disk logical format info wanted! Date: 31 Jan 1996 14:58:22 GMT Organization: Manchester Computing Centre Lines: 53 Message-ID: <4eo02e$7mh@yama.mcc.ac.uk> References: <4ekucp$isb@acebo.sdi.uam.es> NNTP-Posting-Host: jumper.mcc.ac.uk X-Newsreader: TIN [version 1.2 PL2] La Bestia Parda (Ignacio.Garcia@ii.uam.es) wrote: : I have a MGT Plus-D disk interface attached to a 128k Spectrum, : and I need information about this interface and the physical : and logical formats of a MGT formated disk (sectors per track, : directory format, etc...) Here's some of it; I'll leave it to others to fill in the rest. Standard MGT format: 10 sectors per track, 2 sides, 80 cylinders. 512 bytes per sector. Tracks are used linearly; track 0 on side 0 is followed by track 1, on side 0. Track 79 on side 0 is followed by track 0 on side 1. Directory format: First 4 tracks (0-3) contain directory info. 2 entries per sector (each entry is 256 bytes long). This allows 80 files per disk, or more if proprietary alterations to the format are used. First 11 bytes: (1) Attributes. bits 0-4 File type, or zero if erased 6 Protected (read only) 7 Hidden (not shown) [I may have the functions of bits 6 & 7 mixed up). (10) File name. If first byte of name is zero, and attributes byte is zero, the directory after this point is unused, and does not/should not be checked for more entries. The rest of the entry contains the bit mapped sector allocation for the file (195 bytes) and file-specific information, including the length of the file in sectors, and the start track and sector for the file. Tracks on side 0 have bit 7 of the track number reset; tracks on side 1 have bit 7 set. This convention is used throughout the system. The data area (tracks 4-79, 128-...) contains sectors of data. The sector pointed to by the directory area contains 510 bytes of data, plus a pointer to the next sector in the last two bytes of the sector (510, 511). If this pointer is null (ie both track and sector are zero), then this is the last sector of the file. Someone else can fill in the rest of the gaps; I don't have my reference manual with me. Simon -- +- Email:Simon.Cooke@umist.ac.uk ---- Fidonet: 2:250/124.2 (Simon Cooke) ----+ | Snail:1 Dovey Close, Astley, Tyldesley, Manchester, M29 7NP, UK | | Tel: +44 1942 886084 Fax: +44 1942 886084 (ring voice first to confirm!) | +- WWW: http://jumper.mcc.ac.uk/~simonc -------------------------------------+ ---- Path: vanilla!asbach!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!news.mathworks.com!newsfeed.internetmci.com!news.dacom.co.kr!usenet.seri.re.kr!news.cais.net!xara.net!peer-news.britain.eu.net!ukc!falcon.ukc.ac.uk!jmg7 From: jmg7@ukc.ac.uk (J.M.Garner) Newsgroups: comp.sys.sinclair Subject: Re: MGT Plus-D Disk logical format info wanted! Date: Mon, 05 Feb 96 10:59:15 GMT Organization: University of Kent at Canterbury, UK. Lines: 109 Distribution: world Message-ID: <12480@falcon.ukc.ac.uk> References: <4ekucp$isb@acebo.sdi.uam.es> <4eo02e$7mh@yama.mcc.ac.uk> NNTP-Posting-Host: falcon.ukc.ac.uk Simon Cooke (simonc@jumper.mcc.ac.uk) wrote: : La Bestia Parda (Ignacio.Garcia@ii.uam.es) wrote: : : I have a MGT Plus-D disk interface attached to a 128k Spectrum, : : and I need information about this interface and the physical : : and logical formats of a MGT formated disk (sectors per track, : : directory format, etc...) : Here's some of it; I'll leave it to others to fill in the rest. : Standard MGT format: : 10 sectors per track, 2 sides, 80 cylinders. 512 bytes per sector. : Tracks are used linearly; track 0 on side 0 is followed by track 1, on : side 0. Track 79 on side 0 is followed by track 0 on side 1. : Directory format: : First 4 tracks (0-3) contain directory info. 2 entries per sector (each : entry is 256 bytes long). This allows 80 files per disk, or more if : proprietary alterations to the format are used. : First 11 bytes: : (1) Attributes. bits 0-4 File type, or zero if erased ^^^^^^^^^^ I usually call this a directory byte - describes entry as shown in directory listing. Not to be confused with file byte (see below). Not that it matters much. : 6 Protected (read only) : 7 Hidden (not shown) [I may have the functions : of bits 6 & 7 mixed up). : (10) File name. If first byte of name is zero, and attributes byte is : zero, the directory after this point is unused, and does not/should not : be checked for more entries. Not always... Some versions of G+DOS seem to continue checking, and when, say you have a file containing all bad sectors at last directory entry (no.80), it gets printed. : The rest of the entry contains the bit mapped sector allocation for the : file (195 bytes) and file-specific information, including the length of : the file in sectors, and the start track and sector for the file. Tracks : on side 0 have bit 7 of the track number reset; tracks on side 1 have bit : 7 set. This convention is used throughout the system. More info on this: Considering offset 0 is first byte in 256 byte header, Offsets 0-10 as above (file type, name) followed by the following. All 2byte words are in low,high byte significance order.(lsb first) offset 11/12=Number of data sectors in file (not including header) offset 13=Track number of first data sector offset 14=Sector number of first data sector offset 15-210=Sector bitmap(1 bit for each sector, a 1 if used, 0 if not) offset 211=file byte - same as tape format 0=basic 1=numerical array 2=string array 3=code (All attributes/directory byte types fit into one of these, usually code if nothing else) offset 212/213=file length in bytes offset 214/215=file start address (only if code file or basic) offset 216/217=autorun linenumber/number > 32767 for basic, or 65535 anyway for other file types???? Not too sure. offset 218/219=0 (not sure what it's used for - maybe some BASIC parameter) ... ????? If a byte(s) is not used, it is either 255/0 (can't remember) : The data area (tracks 4-79, 128-...) contains sectors of data. The sector : pointed to by the directory area contains 510 bytes of data, plus a : pointer to the next sector in the last two bytes of the sector (510, : 511). If this pointer is null (ie both track and sector are zero), then : this is the last sector of the file. The first data sector of a file if it's one of the types used in tape also (eg basic/array/code) has 10 bytes as a consistency check, containing offset 0=file byte (as above) offset 1/2=file length offset 3/4=start address offset 5/6=autorun/>32767 or 65535 ???? (as above) offset 7/8=not sure (same as offset 218/219 above) offset 9 (byte 10 in file)=first byte of data. : Simon That should be everything. All filled in from my own experiments, and should be correct but don't go suing me if it's wrong cos I aint 100% sure. I'll type up the ROM info (eg calls to load/save etc) sometime soon too... Be patient. John Garner / aka Datasoft. -- This could be c.s.s, it could be a.f.m. It could also be a total load of balls from a madman with no idea of reality. Take your pick, shovel or, indeed, bulldozer. Whatever, just don't try: http://www.nvg.unit.no/spectrum/jmg7 "Gave me back the paradise, that I thought, that I lost for good." -- This could be c.s.s, it could be a.f.m. It could also be a total load of balls from a madman with no idea of reality. Take your pick, shovel or, indeed, bulldozer. Whatever, just don't try: http://www.nvg.unit.no/spectrum/jmg7 "Gave me back the paradise, that I thought, that I lost for good." ---- Path: vanilla!asbach!noris.net!blackbush.xlink.net!tank.news.pipex.net!pipex!howland.reston.ans.net!gatech!newsfeed.internetmci.com!primus.ac.net!news.cais.net!xara.net!peer-news.britain.eu.net!ukc!falcon.ukc.ac.uk!jmg7 From: jmg7@ukc.ac.uk (J.M.Garner) Newsgroups: comp.sys.sinclair Subject: Re: MGT Plus-D Disk logical format info wanted! Date: Wed, 07 Feb 96 14:12:45 GMT Organization: University of Kent at Canterbury, UK. Lines: 128 Distribution: world Message-ID: <12493@falcon.ukc.ac.uk> References: <4ekucp$isb@acebo.sdi.uam.es> <4eo02e$7mh@yama.mcc.ac.uk> <12480@falcon.ukc.ac.uk> NNTP-Posting-Host: falcon.ukc.ac.uk J.M.Garner (jmg7@ukc.ac.uk) wrote: : Simon Cooke (simonc@jumper.mcc.ac.uk) wrote: : : La Bestia Parda (Ignacio.Garcia@ii.uam.es) wrote: : : : I have a MGT Plus-D disk interface attached to a 128k Spectrum, : : : and I need information about this interface and the physical : : : and logical formats of a MGT formated disk (sectors per track, : : : directory format, etc...) : : Here's some of it; I'll leave it to others to fill in the rest. [snip snip snip] See previous articles for rest of details. Or mail me if you haven't seen them. [loadsa snips] : : Simon Here's some more of that info on +D/Disciple techy details: Directory Byte: (1st byte in a directory entry of 256 bytes in tracks 0-3) No. Type Appears As (in disk CATalogue) 0 = Erased N/A 1 = Basic BASIC 2 = Numeric Array ARRAY 3 = Character Array $ ARRAY 4 = Code CODE 5 = 48k snap SNP 48k 6 = Microdrive MDRV 7 = Screen$ SCREEN$ 8 = Special SPECIAL 9 = 128k snap SNP 128k 10 = Opentype OPENTYPE 11 = Execute EXECUTE The following are only used wih "Uni-Dos", which uses a different ROM to standard +D/disciple and allows random access, directories and some new file types: 12 = Subdirectory DIR 13 = Create CREATE (directories are.. well.. subdirectories (what else) and create files are executables which allow extensions to Spectrum BASIC and are loaded into low memory (below BASIC programs I think). If the disk has an extended catalogue (used by Betados), then offset 255 (the last byte of the first header) in the first sector of the directory (track 0, sector 1) will contain the number of extra tracks used for the directory. So a 2 (decimal) would mean the usual 4 tracks(=80 files) + 2 tracks (10sectors*2per sector=20per track * 2=40) = 120 directory entries in total (if you understood that). Basically no. directory entries allowed is: 80 + 20 * , where n is the number in offset 255. As said before, if bit 7 (value=128) is set then it's a hidden file, and if bit 6 (value=64) then it's a protected and cannot be saved over / erased. Now for some useful calls. Not all are here, but that's cos I don't know them all. Try looking in "AlchNews" (disk/tapezine produced by Alchemist Research) issues around 14 for the info on direct ROM calls. AlchNews available at ftp.nvg.unit.no/pub/sinclair/ .../mags/... or something (as .TAP files I think). Most disk operations can use the RST 8 : DEFB , although using ROM calls directly with +D/Disciple ROM switched in is quicker. Here's a list of the hookcodes. UFIA is User File Information Area, an area in the +D RAM used for information about open files, and to open a file you should make up a UFIA somewhere in conventional memory and call the relevant routines with IX pointing to it. I don't have the UFIA strucuture to hand, but I will type it up sometime and post it. These +D info files may also be an addition to my web pages someday. (see signature) Hook Command 51 Transfer UFIA (in IX register) to disk file channel area 52 Open file (use info in file channel area to determine which file) 53 Do both 51 and 52 above - open file ready to write data 54 Save character to currently open file (in A, I believe??) 55 Save block to open file DE=address,BC=length 56 Close file (use file channel area) 57 RST 16 to +D/disciple printer port (A=char to print) 58 SAVE SCREEN$ 1 (see manual) a 32 column screen dump 59 Prepare file for loading - IX=UFIA address on entry, 1st 9 bytes of the file are the last 9 of UFIA 60 Load character (in A register??) 61 Load block - DE=address, BC=length 62 Save sector: 63 Load sector: 64 Reset current drive to track 0, returns Carry flag set if drive empty. If bit 6 of A register is 1,disk is read-only 65 Erase file on disk,IX=UFIA address 66 SAVE SCREEN$ 2 (see manual) a large screen dump 67 Disc CATalogue (don't know details, probably IX=UFIA for filename etc) 68 Load any sector to address in IX: A=drive,D=track,E=sector 69 Save any sector from address in IX: same as above 70 Open/Close stream - A=0,open file using UFIA,A= then close the file associated with that stream (A=0-15 although BASIC uses 0-3 remember) 71 Page in +D/disciple ROM and RAM (eg for calling routines) Yet more hookcodes exist for Uni-Dos, but seeing as how I only know of a very few people with this DOS, I don't think it's worth me typing in. Unless you REALLY want me to (email me if so...) There are also those from 27 to 50, used for Microdrive. I could type those too... When the drive is mentioned (eg sector routines), the value can be 1 or 2 or (I think) "*" ie 42 decimal for the last drive used. There are also some variables in the +D/disciple RAM, at 8192 decimal onwards. RTFM (if you have one). Well thats all I can be bothered to type, as I've said, there are some sections in AlchNews on it (issues 13/14/..??). DISCLAIMER: If you do any experimenting, I *definitely* advise using a blank disk, or one with files you don't mind losing in case. And it might be a good idea to reboot the +D after testing things. John Garner -- This could be c.s.s, it could be a.f.m. It could also be a total load of balls from a madman with no idea of reality. Take your pick, shovel or, indeed, bulldozer. Whatever, just don't try: http://www.nvg.unit.no/spectrum/jmg7 "Gave me back the paradise, that I thought, that I lost for good."