supermario/base/SuperMarioProj.1994-02-09/OS/HFS/TFSRFN3.a

96 lines
3.9 KiB
Plaintext
Raw Normal View History

2019-06-29 15:17:50 +00:00
;
; File: TFSRFN3.a
;
; Contains: This file contains file system utility routines which
; use the volume block map.
;
; Copyright: © 1982-1991 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <2> 9/12/91 JSM Add a header.
; <1.1> 11/10/88 CCH Fixed Header.
; <1.0> 11/9/88 CCH Adding to EASE.
; <1.0> 2/11/88 BBM Adding file for the first time into EASE…
; 1/14/86 LAK Changed interface (FileAlloc sets up D0 option first so
; AllocContig entrypoint is no longer needed).
; 1/14/86 LAK Changed interface (FileAlloc sets up D0 option first so
; AllocContig entrypoint is no longer needed).
; 10/1/85 LAK Minor cleanup. Removed Lg2Phys (only called by Cache).
; 8/29/85 BB Added support for contiguous allocation (AllocContig)
; 6/19/85 PWD Changed non-hardware internal errors to FSDSIntErr instead of
; IOErr.
; 4/25/85 PWD Changed to convert all internal errors to IOErr.
; 3/10/85 GJC All new for TFS - old is now part of MFS compatibility routines
; 3/10/85 GJC Added TFS functionality.
; 8/18/83 LAK Fixed same bug again (3 more to go).
; 8/15/83 LAK Fixed bug in block allocation (last free block bug).
; 1/17/83 LAK Changes for alloc blks offset from diskette start.
; 1/17/83 LAK Changed for final volume format (alloc blks offset)
; 12/23/82 LAK Added incr, decr of volume free block count in DAlBlks, Alloc;
; mark volume dirty in these routines instead of SubMrk.
; 12/22/82 LAK Rewrote to reflect new file system data structures; No
; reclamation of space is now needed from undeleted files; always
; checks number of free bytes available on the volume before
; proceeding; now has 2 entry points.
;
;_______________________________________________________________________
;
; External Routines:
;
;
; Internal Routines: GtNxBlk,Alloc,DAlBlks,SubMrk
;
;_______________________________________________________________________
;_______________________________________________________________________
;
; Routine: Alloc,AllocContig
; (c) 1983 Apple Computer Inc.
;
; Arguments: A2.L (input) -- VCB ptr
; (A1,D1.W) (input) -- FCB pointer
; D4.L (input) -- number of bytes extra to allocate
; D0.W (output) -- Error code, 0 if no error.
; (only FXM error: dskfull - other errors can
; be passed up by VSM or BT)
; D6.L (output) -- number of bytes actually allocated (always
; a multiple of 512-bytes).
; All other registers are preserved
; Called By: FileWrite,SetEOF,FileAlloc
; Calls: GtNxBlk,SubMrk
; Function: Allocate new blocks to a file. (Does not check lock bits!)
; Alloc entry point does nothing if it can't get all the bytes
; requested.
;
; Modification History:
; 22 Dec 82 LAK Rewrote to reflect new file system data structures;
; No reclamation of space is now needed from undeleted
; files; always checks number of free bytes available
; on the volume before proceeding; now has 2 entry points.
; 17 Jan 83 LAK Changes for alloc blks offset from diskette start.
; 10 Mar 85 GJC Added TFS functionality.
; <14Jan86> LAK Changed interface (FileAlloc sets up D0 option first so
; AllocContig entrypoint is no longer needed).
;_______________________________________________________________________
BLANKS ON
STRING ASIS
Alloc BSR TFSVolTst ; is it TFS or is it MFS
BNE MFSAlloc ; MFS - then go handle it
MOVEQ #kEFAll,D0 ; get it all or give up (doesn't <14Jan86>
; to be contiguous)
AllocTFS MOVE.L (SP)+,-(A6) ; save return address <14Jan86>
MOVE.L D3,-(A6) ; save D3 <14Jan86>
MOVE.W D0,D3 ; pass options in D3 <14Jan86>
JSR Extendfile ; get the space
MOVE.L (A6)+,D3 ; restore D3 <29Aug85>
MOVE.L (A6)+,-(SP) ; Restore return address
TST.W D0 ; Set condition codes
RTS