mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-11-22 19:31:02 +00:00
60 lines
2.1 KiB
Plaintext
60 lines
2.1 KiB
Plaintext
;
|
|
; File: MFSRFN2.a
|
|
;
|
|
; Copyright: © 1985-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…
|
|
; 10/1/85 LAK Added changed for use of TFS cache routines. Removed MFSFAlloc
|
|
; (this code was mostly duplicate of TFS code). Removed MFSClose
|
|
; (mostly duplicate of TFS code).
|
|
;
|
|
;
|
|
|
|
;________________________________________________________________________________
|
|
; the following is part of the low level routines used by SETEOF to shorten
|
|
; or lengthen a file. These routines are written to handle MFS compatible
|
|
; volumes when branched to from TFS code.
|
|
;________________________________________________________________________________
|
|
|
|
; Shorten the file. If setting length to zero, zero start block, phys EOF fields
|
|
; Else mark last block with 001, and dealloc the following blks
|
|
|
|
|
|
BLANKS ON
|
|
STRING ASIS
|
|
|
|
MFSShrtnF MOVEQ #0,D6 ; used to figure new physical length
|
|
MOVE.W FCBSBlk(A1,D1),D3 ; start block for file
|
|
MOVE.L VCBAlBlkSiz(A2),D2 ; get alloc blk size in bytes
|
|
|
|
MOVE.L D7,D4 ; new logical end-of-file
|
|
BNE.S @2 ; br if not setting the file to zero
|
|
CLR.W FCBSBlk(A1,D1) ; zero start block for file
|
|
BRA.S @3
|
|
|
|
@1 MOVE.W D5,D3 ; follow block chain to last block
|
|
@2 ADD.L D2,D6 ; increase our physical length
|
|
BSR GtNxBlk ; get block following D3 blk
|
|
SUB.L D2,D4 ; file log byte cnt - alloc blk size
|
|
BHI.S @1 ; loop until at the new last file block
|
|
|
|
CMP.L FCBPLen(A1,D1.W),D6 ; did it actually decrease?
|
|
BCC SEOFOK ; exit if not
|
|
|
|
MOVE.W D5,-(SP) ; save start block of chain to dealloc
|
|
MOVEQ #1,D5 ; mark new last block
|
|
BSR SubMrk
|
|
MOVE.W (SP)+,D3
|
|
|
|
@3 BSR DAlBlks ; deallocate from block D3 onwards.
|
|
MOVE.L D6,FCBPLen(A1,D1.W) ; set new physical length
|
|
MOVE.L D6,D4 ; pass new PEOF in D4
|
|
BRA ShrtnTrash ; rejoin TFS code to trash any orphaned blocks <01Oct85>
|
|
|
|
|