Path: utzoo!mnetor!uunet!husc6!bu-cs!spike From: spike@bu-cs.BU.EDU (Spike) Newsgroups: comp.sys.apple Subject: Re: DOS 3.3 File Manager Message-ID: <18472@bu-cs.BU.EDU> Date: 9 Jan 88 22:47:21 GMT References: <1568@mind.UUCP> Reply-To: spike@bu-it.bu.edu (Joe Ilacqua) Followup-To: comp.sys.apple Organization: Boston University Distributed Systems Group Lines: 89 In article <1568@mind.UUCP> romero@mind.UUCP (Antonio Romero) writes: >I'm developing some software for the Apple IIe/c using Manx's C compiler >v1.05. I'm in a bit of a bind at the moment, because Manx's creat() >function from their library is rather buggy. I can't seem to get it to >work for creating text files-- the machine almost invariably crashes. >Since the creat() function is evidently nothing but an interface to the file >manager of DOS 3.3, I'd like to try bypassing the library altogether >and calling the file manager directly, but I can't find a description of >the file manager anywhere in the technical reference manual for DOS 3.3 or >in the Dos Programmer's Toolkit. Does anyone out there know a readily >available reference which describes the use of the file manager? This is cribbed from _Beneath_Apple_Dos_ [Worth, Lechner] get it if you can!! O.K. to use the File Manager you do to things First: You tell the File Manager the location of your parameter list. This is done with a 'JSR $3DC' where the high part of the address is in Y and the low in A. Second: The file manager is call with a 'JSR $3D6'. If a file is not found and the X refister contains 0 then the file is created; if X does not contain 0 an error is returned. For the Open call the parameter list should look like: Byte 00 -> 01 (OPEN) 02/03 -> Fix record length or 0000 if variable 04 -> Volume number or 00 for any 05 -> Drive [01 or 02] 06 -> Slot [01 thur 07] 07 -> File type $00 = TEXT $01 = INTEGER BASIC $02 = APPLESOFT BASIC $04 = BINARY $08 = RELOCATABLE $10 = S TYPE $20 = A TYPE $40 = B TYPE 08/09 -> Low/High address of filename (30 chars) 0C/0D -> Low/High address of workarea buffer (45 bytes) 0E/0F -> Low/High address of Track/Sector list buffer (256 bytes) 10/11 -> Low/High address of data buffer (256 bytes) The three buffers are initialized by the file manager not by the caller The call returns Byte 07 -> File type opened (useful if the file was not just created) 0A -> Return Code $00 = No Error $02 = Bad Call $03 = Bad Sub Call $04 = Write Protected $05 = End Of Data $06 = File Not Found $07 = Volume Mismatch $08 = Disk I/O Error $09 = Disk Full $0A = File Locked OPEN should alway be follow by a POSITION call. For creat you would want to set the position to the start of the file i.e. 02-05 = 00 00 00 00. BYTE 00 -> 0A (Position) 02/03 -> Relative record number (0000 is the first) if fixed record length 0000 if not fix record. 04/05 -> Offset in to record or if not fix record offset in to file 0C/OD -> Low/High address of data buffer (256 bytes) 0A -> Return code CLOSE Cleans up and updates the catalog. It looks like: BYTE 00 -> 02 (Close) 0C/0D -> Low/High address of workarea buffer (45 bytes) 0E/0F -> Low/High address of Track/Sector list buffer (256 bytes) 10/11 -> Low/High address of data buffer (256 bytes) 0A -> Return code "Last night I had that dream again. I dreamt I had to take a test, in a Dairy Queen, on another planet." UUCP: ...!harvard!bu-cs!bu-it!spike ARPANET: spike@bu-it.bu.edu CSNET: spike%bu-it@bu-cs BITNET: engemnc@bostonu "VPS sucks" -- ->Spike