mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2024-11-03 05:04:29 +00:00
894 lines
25 KiB
Plaintext
894 lines
25 KiB
Plaintext
|
include 'macintosh.a'
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; Files.a
|
||
|
;
|
||
|
; Implements the C interface for file manager register based traps.
|
||
|
; Note: routines appear in same order as "Inside Macintosh"
|
||
|
;
|
||
|
; Copyright Apple Computer, Inc. 1984 - 1989
|
||
|
; All rights reserved.
|
||
|
; Written by Dan Smith 15-Nov-84 (converted version of the pascal interface)
|
||
|
;
|
||
|
; Modifications:
|
||
|
; June 19,1986: MikeS: changed pbhsetvinfo to pbsetvinfo
|
||
|
; Feb 20,1986 Dan Smith & Mike Shannon changed GetWDInfo to get around rom bug
|
||
|
; May 2, 1986 Mike Shannon changed PBGetCatInfo to get around rom bug
|
||
|
; May 12,1986 Mike Shannon: save & restore d2 in FInitQueue
|
||
|
; *** MPW 2.0 ***
|
||
|
; 11 Feb 88 KLH Changed C headers to work with new C compiler:
|
||
|
; Changed to using standard glue in Interface.o, so
|
||
|
; much glue removed from CInterface.o.
|
||
|
; *** MPW 3.0d4 ***
|
||
|
; 8 Mar 88 KLH rename changed to fsrename to avoid ANSI conflict
|
||
|
; *** MPW 3.0a2 ***
|
||
|
; 4 Dec 89 JAL moved fsrename, fsdelete, StringIn, and StringOut to runtime.o
|
||
|
|
||
|
* ******************************************************************************
|
||
|
;
|
||
|
; High-level Routines
|
||
|
;
|
||
|
; Interface for file system and IO functions which do not require
|
||
|
; a parameter block
|
||
|
;
|
||
|
* ******************************************************************************
|
||
|
|
||
|
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
;
|
||
|
; Accessing Volumes
|
||
|
;
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
|
||
|
;
|
||
|
; short getvinfo(drvNum,volName,vRefNum,freeBytes)
|
||
|
; short drvNum;
|
||
|
; char *volName;
|
||
|
; short *vRefNum;
|
||
|
; int *freeBytes;
|
||
|
|
||
|
BLANKS ON
|
||
|
STRING ASIS
|
||
|
|
||
|
getvinfo func EXPORT
|
||
|
import StringOut
|
||
|
|
||
|
link a6,#-IOVQElSize ; get space for Control p-block
|
||
|
lea -IOVQElSize(a6),a0 ; Point a0 at the block
|
||
|
move.l 12(a6),IOVNPtr(a0) ; volume name pointer
|
||
|
move.w 10(a6),IOVDrvNum(a0) ; drive number
|
||
|
clr.w IOVolIndex(a0) ; no volume queue index
|
||
|
_GetVolInfo ; result in d0
|
||
|
move.l 16(a6),a1 ; pointer to vRefNum
|
||
|
move.w IOVRefNum(a0),(a1) ; return volume ref num
|
||
|
|
||
|
; now calculate the number of free bytes on the volume by multiplying
|
||
|
; allocation block size * free allocation blocks
|
||
|
; would ideally like to multiply long * integer but since mulu only
|
||
|
; multiplies two ints, to allow for a larger than 16 bit allocation
|
||
|
; block size we shift it right by 9 (since we know it to be a multiple
|
||
|
; of 512 and then shift the result back.
|
||
|
|
||
|
move.l IOVAlBlkSiz(a0),d1 ; num bytes in an allocation block
|
||
|
asr.l #8,d1 ; shift over by 8
|
||
|
asr.l #1,d1 ; and one more
|
||
|
mulu IOVFrBlk(a0),d1 ; multiply by number of free blocks
|
||
|
asl.l #1,d1 ; shift back to the left
|
||
|
asl.l #8,d1
|
||
|
move.l 20(a6),a1 ; pointer to free bytes
|
||
|
move.l d1,(a1) ; return the value
|
||
|
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short getvol(volName,vRefNum)
|
||
|
; char *volName;
|
||
|
; short *vRefNum;
|
||
|
;
|
||
|
getvol func EXPORT
|
||
|
import StringOut
|
||
|
|
||
|
link a6,#-IOVQElSize ; get space for Control p-block
|
||
|
lea -IOVQElSize(a6),a0 ; Point a0 at the block
|
||
|
move.l 8(a6),IOVNPtr(a0) ; pointer to volume name
|
||
|
_GetVol
|
||
|
move.l 12(a6),a1 ; pointer to drive number
|
||
|
move.w IOVRefNum(a0),(a1) ; return drive number
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short setvol(volName,vRefNum)
|
||
|
; char *volName;
|
||
|
; short *vRefNum;
|
||
|
|
||
|
setvol func EXPORT
|
||
|
import StringIn
|
||
|
import StringOut
|
||
|
|
||
|
jsr StringIn ; convert name to pascal string
|
||
|
link a6,#-IOVQElSize ; get space for Control p-block
|
||
|
lea -IOVQElSize(a6),a0 ; Point a0 at the block
|
||
|
move.l 8(a6),IOVNPtr(a0) ; Ptr to desired volume name
|
||
|
move.w 14(a6),IOVRefNum(a0) ; desired default drive number
|
||
|
_SetVol
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short flushvol(volName,vRefNum)
|
||
|
; char *volName;
|
||
|
; short *vRefNum;
|
||
|
;
|
||
|
|
||
|
flushvol func EXPORT
|
||
|
import StringIn
|
||
|
import StringOut
|
||
|
|
||
|
jsr StringIn ; convert name to pascal string
|
||
|
link a6,#-IOVQElSize ; get space for Control p-block
|
||
|
lea -IOVQElSize(a6),a0 ; Point a0 at the block
|
||
|
move.w 14(a6),IOVRefNum(a0) ; drive to be unmounted
|
||
|
move.l 8(a6),IOVNPtr(a0) ; volume name pointer
|
||
|
_FlushVol
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short unmountvol(volName,vRefNum)
|
||
|
; char *volName;
|
||
|
; short *vRefNum;
|
||
|
;
|
||
|
|
||
|
unmountvol func EXPORT
|
||
|
import StringIn
|
||
|
import StringOut
|
||
|
|
||
|
jsr StringIn ; convert name to pascal string
|
||
|
link a6,#-IOVQElSize ; get space for Control p-block
|
||
|
lea -IOVQElSize(a6),a0 ; Point a0 at the block
|
||
|
move.w 14(a6),IOVRefNum(a0) ; drive to be unmounted
|
||
|
move.l 8(a6),IOVNPtr(a0) ; volume name pointer
|
||
|
_UnmountVol
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short eject(volName,vRefNum)
|
||
|
; char *volName;
|
||
|
; short *vRefNum;
|
||
|
;
|
||
|
|
||
|
eject func EXPORT
|
||
|
import StringIn
|
||
|
import StringOut
|
||
|
|
||
|
jsr StringIn ; convert name to pascal string
|
||
|
link a6,#-IOVQElSize ; get space for Control p-block
|
||
|
lea -IOVQElSize(a6),a0 ; Point a0 at the block
|
||
|
move.w 14(a6),IOVRefNum(a0) ; drive to be unmounted
|
||
|
move.l 8(a6),IOVNPtr(a0) ; volume name pointer
|
||
|
_Eject
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
|
||
|
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
;
|
||
|
; Changing File Contents
|
||
|
;
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
|
||
|
;
|
||
|
; short create(fileName,vRefNum,creator,fileType)
|
||
|
; char *fileName;
|
||
|
; short vRefNum;
|
||
|
; int creator,fileType;
|
||
|
;
|
||
|
|
||
|
create func EXPORT
|
||
|
import StringIn
|
||
|
import StringOut
|
||
|
|
||
|
jsr StringIn ; convert name to pascal string
|
||
|
link a6,#-IOFQELSIZE ; make room on stack for cmd block
|
||
|
lea -IOFQELSIZE(a6),a0 ; address of cmd block
|
||
|
|
||
|
move.l 8(a6),IOFileName(a0) ; set Ptr to filename
|
||
|
move.w 14(a6),IOVRefNum(a0) ; set volume ref num
|
||
|
clr.b IOFileType(a0) ; clear type, permissions (version field)
|
||
|
|
||
|
_Create
|
||
|
tst.w d0 ; error?
|
||
|
bne.s crDone ; yes, don't bother setting type
|
||
|
|
||
|
clr.w IOFDirIndex(a0) ; clear directory index
|
||
|
_GetFileInfo ; get the previous info
|
||
|
|
||
|
; transfer the user defined finder info words (16 bytes)
|
||
|
|
||
|
move.l a0,d0 ; save Ptr to param block
|
||
|
lea IOFlUsrWds(a0),a1 ; where to copy user words
|
||
|
move.l 20(a6),(a1)+ ; enter in the new file type
|
||
|
move.l 16(a6),(a1) ; enter in the new file creator
|
||
|
_SetFileInfo
|
||
|
|
||
|
crDone
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short fsopen(fileName,vRefNum,refNum)
|
||
|
; char *fileName;
|
||
|
; short vRefNum,*refNum;
|
||
|
;
|
||
|
fsopen func EXPORT
|
||
|
import StringIn
|
||
|
import StringOut
|
||
|
|
||
|
jsr StringIn ; convert name to pascal string
|
||
|
link a6,#-IOQELSIZE ; make room on stack for cmd block
|
||
|
lea -IOQELSIZE(a6),a0 ; address of cmd block
|
||
|
move.l 8(a6),IOFileName(a0) ; set Ptr to filename
|
||
|
move.w 14(a6),IODrvNum(a0) ; drive number
|
||
|
clr.b IOFileType(a0) ; file type
|
||
|
clr.b IOPermssn(a0) ; open for read/write
|
||
|
clr.l IOOwnBuf(a0) ; use system buffer
|
||
|
_Open
|
||
|
move.l 16(a6),a1 ; return the refnum
|
||
|
move.w IORefNum(a0),(a1)
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short openrf(fileName,vRefNum,refNum)
|
||
|
; char *fileName;
|
||
|
; short vRefNum,*refNum;
|
||
|
;
|
||
|
;
|
||
|
|
||
|
openrf func EXPORT
|
||
|
import StringIn
|
||
|
import StringOut
|
||
|
|
||
|
jsr StringIn ; convert name to pascal string
|
||
|
link a6,#-IOQELSIZE ; make room on stack for cmd block
|
||
|
lea -IOQELSIZE(a6),a0 ; address of cmd block
|
||
|
move.l 8(a6),IOFileName(a0) ; set Ptr to filename
|
||
|
move.w 14(a6),IOVRefNum(a0) ; set volume ref num
|
||
|
clr.b IOFileType(a0) ; clear type (version field)
|
||
|
clr.b IOPermssn(a0) ; open for read/write
|
||
|
clr.l IOOwnBuf(a0) ; use system buffer
|
||
|
_OpenRF
|
||
|
move.l 16(a6),a1 ; Ptr to refNum
|
||
|
move.w IORefNum(a0),(a1) ; return the refNum
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short FSRead(refNum,count,buffPtr)
|
||
|
; short refNum;
|
||
|
; int *count;
|
||
|
; Ptr buffPtr;
|
||
|
;
|
||
|
; short FSWrite(refNum,count,buffPtr)
|
||
|
; short refNum;
|
||
|
; int *count;
|
||
|
; Ptr buffPtr;
|
||
|
;
|
||
|
;;
|
||
|
;;FSRead func EXPORT
|
||
|
;; export FSWrite
|
||
|
;;
|
||
|
;; SF d1 ; set up read
|
||
|
;; bra.s DoBlk
|
||
|
;;
|
||
|
;;FSWrite
|
||
|
;; ST d1 ; set up write
|
||
|
;;
|
||
|
;;DoBlk
|
||
|
;; link a6,#-IOQELSIZE ; make room on stack for cmd block
|
||
|
;; lea -IOQELSIZE(a6),a0 ; address of cmd block
|
||
|
;;
|
||
|
;; move.l 16(a6),IOBuffer(a0) ; buffer address
|
||
|
;; move.w 10(a6),IORefNum(a0) ; refnum
|
||
|
;; move.l 12(a6),a1 ; address of the count
|
||
|
;; move.l (a1),IOByteCount(a0) ; read count
|
||
|
;; clr.w IOPosMode(a0) ; no special mode
|
||
|
;; clr.l IOPosOffset(a0) ; clear offset
|
||
|
;;
|
||
|
;; tst.b d1 ; look for read or write
|
||
|
;; bne.s @1
|
||
|
;; _READ
|
||
|
;; bra.s @2
|
||
|
;;@1 _WRITE
|
||
|
;;@2
|
||
|
;;
|
||
|
;; move.l 12(a6),a1 ; address of the count
|
||
|
;; move.l IONumDone(a0),(a1) ; return count read
|
||
|
;;
|
||
|
;; ext.l d0 ; sign extend error code
|
||
|
;; unlk a6
|
||
|
;; rts
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short GetFPos(refNum,filePos)
|
||
|
; short refNum;
|
||
|
; int *filePos;
|
||
|
;
|
||
|
;;GetFPos func EXPORT
|
||
|
;;
|
||
|
;; link a6,#-IOQELSIZE ; make room on stack for cmd block
|
||
|
;; lea -IOQELSIZE(a6),a0 ; address of cmd block
|
||
|
;; move.w 10(a6),IORefNum(a0) ; set refnum
|
||
|
;; _GetFPos
|
||
|
;; move.l 12(a6),a1 ; Ptr to logical length variable
|
||
|
;; move.l IOPosOffset(a0),(a1) ; return logical end of file
|
||
|
;; ext.l d0 ; sign extend error code
|
||
|
;; unlk a6
|
||
|
;; rts
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short SetFPos(refNum,posMode,posOff)
|
||
|
; short refNum,posMode;
|
||
|
; int posOff;
|
||
|
;
|
||
|
;;SetFPos func EXPORT
|
||
|
;;
|
||
|
;; link a6,#-IOQELSIZE ; make room on stack for cmd block
|
||
|
;; lea -IOQELSIZE(a6),a0 ; address of cmd block
|
||
|
;; move.w 10(a6),IORefNum(a0) ; set refnum
|
||
|
;; move.w 14(a6),IOPosMode(a0) ; positioning information
|
||
|
;; move.l 16(a6),IOPosOffset(a0) ; new file position
|
||
|
;; _SetFPos
|
||
|
;; ext.l d0 ; sign extend error code
|
||
|
;; unlk a6
|
||
|
;; rts
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short GetEOF(refNum,logEOF)
|
||
|
; short refNum;
|
||
|
; int *logEOF;
|
||
|
;
|
||
|
;;GetEOF func EXPORT
|
||
|
;;
|
||
|
;; link a6,#-IOQELSIZE ; make room on stack for cmd block
|
||
|
;; lea -IOQELSIZE(a6),a0 ; address of cmd block
|
||
|
;; move.w 10(a6),IORefNum(a0) ; set refnum
|
||
|
;; _GetEOF
|
||
|
;; move.l 12(a6),a1 ; Ptr to logical length variable
|
||
|
;; move.l IOLEOF(a0),(a1) ; return logical end of file
|
||
|
;; ext.l d0 ; sign extend error code
|
||
|
;; unlk a6
|
||
|
;; rts
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short SetEOF(refNum,logEOF)
|
||
|
; short refNum;
|
||
|
; int logEOF;
|
||
|
;
|
||
|
;;SetEOF func EXPORT
|
||
|
;;
|
||
|
;; link a6,#-IOQELSIZE ; make room on stack for cmd block
|
||
|
;; lea -IOQELSIZE(a6),a0 ; address of cmd block
|
||
|
;; move.w 10(a6),IORefNum(a0) ; set refnum
|
||
|
;; move.l 12(a6),IOLEOF(a0) ; the desired end of file
|
||
|
;; _SetEOF
|
||
|
;; ext.l d0 ; sign extend error code
|
||
|
;; unlk a6
|
||
|
;; rts
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short Allocate(refNum,count)
|
||
|
; short refNum;
|
||
|
; int *count;
|
||
|
;
|
||
|
;;Allocate func EXPORT
|
||
|
;;
|
||
|
;; link a6,#-IOQELSIZE ; make room on stack for cmd block
|
||
|
;; lea -IOQELSIZE(a6),a0 ; address of cmd block
|
||
|
;; move.l 12(a6),a1 ; Ptr to requested byte count
|
||
|
;; move.l (a1),IOReqCount(a0) ;
|
||
|
;; move.w 10(a6),IORefNum(a0) ; set refnum
|
||
|
;; _Allocate
|
||
|
;; move.l IOActCount(a0),(a1) ; return actual byte count
|
||
|
;; ext.l d0 ; sign extend error code
|
||
|
;; unlk a6
|
||
|
;; rts
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
;
|
||
|
; OSErr GetVRefNum(pathRefNum,vRefNum)
|
||
|
; short pathRefNum;
|
||
|
; short *vRefNum;
|
||
|
;;
|
||
|
;;GetVRefNum func EXPORT
|
||
|
;; move.l 4(sp),d0 ; get the fileRefNum
|
||
|
;; move.l d0,d1 ; duplicate
|
||
|
;; move.l FCBSPtr,a0 ; ptr to file-control-block buffer
|
||
|
;; cmp.w (a0),d1 ; is refNum too large?
|
||
|
;; bcc.s endError ; br if so
|
||
|
;; move.l FCBVPtr(a0,d1),a0 ; get ptr to volume control block
|
||
|
;; move.w VCBVRefNum(a0),d1 ; return vRefNum
|
||
|
;; moveq #0,d0 ; no err
|
||
|
;; bra.s endG
|
||
|
;;endError moveq #0,d1 ; default refum
|
||
|
;; move.w #rfNumErr,d0 ; ref num error
|
||
|
;;endG move.l 8(sp),a0 ; get vRefNum address
|
||
|
;; move.w d1,(a0) ; put it there
|
||
|
;; rts ; return
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short FSClose(refNum)
|
||
|
; short refNum;
|
||
|
;
|
||
|
;;FSClose func EXPORT
|
||
|
;;
|
||
|
;; link a6,#-IOQELSIZE ; make room on stack for cmd block
|
||
|
;; lea -IOQELSIZE(a6),a0 ; address of cmd block
|
||
|
;; move.w 10(a6),IORefNum(a0) ; get the refnum param
|
||
|
;; _CLOSE ; result returned in d0
|
||
|
;; ext.l d0 ; sign extend error code
|
||
|
;; unlk a6
|
||
|
;; rts
|
||
|
|
||
|
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
;
|
||
|
; Changing Information About Files
|
||
|
;
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
|
||
|
;
|
||
|
; short getfinfo(fileName,vRefNum,fndrInfo)
|
||
|
; char *fileName;
|
||
|
; short vRefNum;
|
||
|
; FInfo *fndrInfo;
|
||
|
;
|
||
|
getfinfo func EXPORT
|
||
|
import StringIn
|
||
|
import StringOut
|
||
|
|
||
|
jsr StringIn ; convert name to pascal string
|
||
|
link a6,#-IOFQELSIZE ; make room on stack for cmd block
|
||
|
lea -IOFQELSIZE(a6),a0 ; address of cmd block
|
||
|
move.l 8(a6),IOFileName(a0) ; set Ptr to filename
|
||
|
move.w 14(a6),IOVRefNum(a0) ; set volume ref num
|
||
|
clr.b IOFileType(a0) ; (version field)
|
||
|
clr.w IOFDirIndex(a0) ; clear directory index
|
||
|
|
||
|
_GetFileInfo
|
||
|
move.w d0,-(sp) ; save result
|
||
|
|
||
|
; transfer the user defined finder info words (16 bytes) into result
|
||
|
lea IOFlUsrWds(a0),a0 ; where to copy from
|
||
|
move.l 16(a6),a1 ; where to copy to
|
||
|
moveq #16,d0 ; 16 bytes of information
|
||
|
_BlockMove
|
||
|
|
||
|
lea -IOFQELSIZE(a6),a0 ; address of cmd block
|
||
|
move.w (sp)+,d0 ; short result in d0
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short setfinfo(fileName,vRefNum,fndrInfo)
|
||
|
; char *fileName;
|
||
|
; short vRefNum;
|
||
|
; FInfo *fndrInfo;
|
||
|
;
|
||
|
setfinfo func EXPORT
|
||
|
import StringIn
|
||
|
import StringOut
|
||
|
|
||
|
jsr StringIn ; convert name to pascal string
|
||
|
link a6,#-IOFQELSIZE ; make room on stack for cmd block
|
||
|
lea -IOFQELSIZE(a6),a0 ; restore a0
|
||
|
move.l 8(a6),IOFileName(a0) ; set Ptr to filename
|
||
|
move.w 14(a6),IOVRefNum(a0) ; set volume ref num
|
||
|
clr.b IOFileType(a0) ; (version field)
|
||
|
clr.w IOFDirIndex(a0) ; clear directory index
|
||
|
|
||
|
_GetFileInfo
|
||
|
|
||
|
; transfer the user defined finder info words (16 bytes)
|
||
|
lea IOFlUsrWds(a0),a1 ; where to copy user words
|
||
|
move.l 16(a6),a0 ; where the user words are now
|
||
|
moveq #16,d0 ; 16 bytes of information
|
||
|
_BlockMove
|
||
|
|
||
|
lea -IOFQELSIZE(a6),a0 ; restore a0
|
||
|
_SetFileInfo
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short setflock(fileName,vRefNum)
|
||
|
; char *fileName;
|
||
|
; short vRefNum;
|
||
|
;
|
||
|
;
|
||
|
setflock func EXPORT
|
||
|
import StringIn
|
||
|
import StringOut
|
||
|
|
||
|
jsr StringIn ; convert name to pascal string
|
||
|
link a6,#-IOQELSIZE ; make room on stack for cmd block
|
||
|
lea -IOQELSIZE(a6),a0 ; address of cmd block
|
||
|
move.l 8(a6),IOFileName(a0) ; set Ptr to filename
|
||
|
move.w 14(a6),IOVRefNum(a0) ; set volume ref num
|
||
|
clr.b IOFileType(a0) ; clear type (version field)
|
||
|
_SetFilLock
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; short rstflock(fileName,vRefNum)
|
||
|
; char *fileName;
|
||
|
; short vRefNum;
|
||
|
;
|
||
|
rstflock func EXPORT
|
||
|
import StringIn
|
||
|
import StringOut
|
||
|
|
||
|
jsr StringIn ; convert name to pascal string
|
||
|
link a6,#-IOQELSIZE ; make room on stack for cmd block
|
||
|
lea -IOQELSIZE(a6),a0 ; address of cmd block
|
||
|
move.l 8(a6),IOFileName(a0) ; set Ptr to filename
|
||
|
move.w 14(a6),IOVRefNum(a0) ; set volume ref num
|
||
|
clr.b IOFileType(a0) ; clear type (version field)
|
||
|
_RstFilLock
|
||
|
jmp StringOut ; convert name to c string
|
||
|
|
||
|
|
||
|
* ******************************************************************************
|
||
|
;
|
||
|
; Low-level Routines
|
||
|
;
|
||
|
* ******************************************************************************
|
||
|
|
||
|
; void FInitQueue()
|
||
|
;;
|
||
|
;;FInitQueue proc EXPORT
|
||
|
;; move.l d2,-(sp) ; Mike Shannon, May 12,1986
|
||
|
;; _FInitQueue
|
||
|
;; move.l (sp)+,d2
|
||
|
;; rts ; return
|
||
|
|
||
|
|
||
|
; void AddDrive(drvrRefNum,drvNum,QEl);
|
||
|
; short drvrRefNum,drvNum;
|
||
|
; drvQElPtr qEL;
|
||
|
;;
|
||
|
;;AddDrive proc EXPORT
|
||
|
;; move.l 12(sp),a0 ; Ptr to memory for queue element
|
||
|
;; move.w 10(sp),d0 ; drive number
|
||
|
;; swap d0 ; put it in high word
|
||
|
;; move.w 6(sp),d0 ; driver ref num
|
||
|
;; _AddDrive
|
||
|
;; rts
|
||
|
|
||
|
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
;
|
||
|
; Accessing Volumes
|
||
|
;
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
|
||
|
; short PBMountVol (paramBlock)
|
||
|
; short PBGetVInfo (paramBlock,async)
|
||
|
; short PBGetVol (paramBlock,async)
|
||
|
; short PBSetVol (paramBlock,async)
|
||
|
; short PBFlushVol (paramBlock,async)
|
||
|
; short PBUnmountVol(paramBlock)
|
||
|
; short PBOffLine (paramBlock)
|
||
|
; short PBEject (paramBlock)
|
||
|
|
||
|
;
|
||
|
; PBMountVol calls can only be made synchronously
|
||
|
;
|
||
|
;;PBMountVol proc EXPORT
|
||
|
;; move.l 4(sp),a0 ; get param pointer.
|
||
|
;; _MountVol ; tell OS to do it synchronously
|
||
|
;; ext.l d0 ; sign extend error code
|
||
|
;; rts ; return to caller
|
||
|
|
||
|
;;PBGetVInfo proc EXPORT
|
||
|
;; OsCall _GetVolInfo
|
||
|
|
||
|
;;PBGetVol proc EXPORT
|
||
|
;; OsCall _GetVol
|
||
|
|
||
|
;;PBSetVol proc EXPORT
|
||
|
;; OsCall _SetVol
|
||
|
|
||
|
;;PBFlushVol proc EXPORT
|
||
|
;; OsCall _FlushVol
|
||
|
|
||
|
;
|
||
|
; PBUnmountVol calls can only be made synchronously
|
||
|
;
|
||
|
;;PBUnmountVol proc EXPORT
|
||
|
;; move.l 4(sp),a0 ; get param pointer.
|
||
|
;; _UnmountVol ; tell OS to do it synchronously
|
||
|
;; ext.l d0 ; sign extend error code
|
||
|
;; rts ; return to caller
|
||
|
|
||
|
;
|
||
|
; PBOffLine calls can only be made synchronously
|
||
|
;
|
||
|
;;PBOffLine proc EXPORT
|
||
|
;; move.l 4(sp),a0 ; get param pointer.
|
||
|
;; _OffLine ; tell OS to do it synchronously
|
||
|
;; ext.l d0 ; sign extend error code
|
||
|
;; rts ; return to caller
|
||
|
|
||
|
;
|
||
|
; PBEject calls can only be made synchronously
|
||
|
;
|
||
|
;;PBEject proc EXPORT
|
||
|
;; move.l 4(sp),a0 ; get param pointer.
|
||
|
;; _Eject ; tell OS to do it synchronously
|
||
|
;; ext.l d0 ; sign extend error code
|
||
|
;; rts ; return to caller
|
||
|
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
;
|
||
|
; Changing File Contents
|
||
|
;
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
|
||
|
; short PBCreate (paramBlock,async)
|
||
|
; short PBOpen (paramBlock,async)
|
||
|
; short PBOpenRF (paramBlock,async)
|
||
|
; short PBRead (paramBlock,async)
|
||
|
; short PBWrite (paramBlock,async)
|
||
|
; short PBGetFPos (paramBlock,async)
|
||
|
; short PBSetFPos (paramBlock,async)
|
||
|
; short PBGetEOF (paramBlock,async)
|
||
|
; short PBSetEOF (paramBlock,async)
|
||
|
; short PBAllocate (paramBlock,async)
|
||
|
; short PBFlushFile (paramBlock,async)
|
||
|
; short PBClose (paramBlock,async)
|
||
|
|
||
|
;;PBCreate proc EXPORT
|
||
|
;; OsCall _Create
|
||
|
|
||
|
;;PBOpen proc EXPORT
|
||
|
;; OsCall _Open
|
||
|
|
||
|
;;PBOpenRF proc EXPORT
|
||
|
;; OsCall _OpenRF
|
||
|
|
||
|
;;PBRead proc EXPORT
|
||
|
;; OsCall _Read
|
||
|
|
||
|
;;PBWrite proc EXPORT
|
||
|
;; OsCall _Write
|
||
|
|
||
|
;;PBGetFPos proc EXPORT
|
||
|
;; OsCall _GetFPos
|
||
|
|
||
|
;;PBSetFPos proc EXPORT
|
||
|
;; OsCall _SetFPos
|
||
|
|
||
|
;;PBGetEOF proc EXPORT
|
||
|
;; OsCall _GetEOF
|
||
|
|
||
|
;;PBSetEOF proc EXPORT
|
||
|
;; OsCall _SetEOF
|
||
|
|
||
|
;;PBAllocate proc EXPORT
|
||
|
;; OsCall _Allocate
|
||
|
|
||
|
;;PBFlushFile proc EXPORT
|
||
|
;; OsCall _FlushFile
|
||
|
|
||
|
;;PBClose proc EXPORT
|
||
|
;; OsCall _Close
|
||
|
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
;
|
||
|
; Changing Information About Files
|
||
|
;
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
|
||
|
; short PBGetFInfo (paramBlock,async)
|
||
|
; short PBSetFInfo (paramBlock,async)
|
||
|
; short PBSetFLock (paramBlock,async)
|
||
|
; short PBRstFLock (paramBlock,async)
|
||
|
; short PBSetFVers (paramBlock,async)
|
||
|
; short PBRename (paramBlock,async)
|
||
|
; short PBDelete (paramBlock,async)
|
||
|
;
|
||
|
|
||
|
;;PBGetFInfo proc EXPORT
|
||
|
;; OsCall _GetFileInfo
|
||
|
|
||
|
;;PBSetFInfo proc EXPORT
|
||
|
;; OsCall _SetFileInfo
|
||
|
|
||
|
;;PBSetFLock proc EXPORT
|
||
|
;; OsCall _SetFilLock
|
||
|
|
||
|
;;PBRstFLock proc EXPORT
|
||
|
;; OsCall _RstFilLock
|
||
|
|
||
|
;;PBSetFVers proc EXPORT
|
||
|
;; OsCall _SetFilType
|
||
|
|
||
|
;;PBRename proc EXPORT
|
||
|
;; OsCall _Rename
|
||
|
|
||
|
;;PBDelete proc EXPORT
|
||
|
;; OsCall _Delete
|
||
|
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
;
|
||
|
; Hierarchical File System Calls
|
||
|
;
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
|
||
|
; OSErr PBOpenWD (paramBlock,aSync)
|
||
|
; OSErr PBCloseWD (paramBlock,aSync)
|
||
|
; OSErr PBHSetVol (paramBlock,aSync)
|
||
|
; OSErr PBHGetVol (paramBlock,aSync)
|
||
|
; OSErr PBCatMove (paramBlock,aSync)
|
||
|
; OSErr PBDirCreate (paramBlock,aSync)
|
||
|
; OSErr PBGetWDInfo (paramBlock,aSync)
|
||
|
; OSErr PBGetFCBInfo (paramBlock,aSync)
|
||
|
; OSErr PBGetCatInfo (paramBlock,aSync)
|
||
|
; OSErr PBSetCatInfo (paramBlock,aSync)
|
||
|
; OSErr PBAllocContig (paramBlock,aSync)
|
||
|
|
||
|
;;PBOpenWD proc EXPORT
|
||
|
;; OSCall _OpenWD
|
||
|
|
||
|
;;PBCloseWD proc EXPORT
|
||
|
;; OSCall _CloseWD
|
||
|
|
||
|
;;PBHSetVol proc EXPORT
|
||
|
;; OSCall _HSetVol
|
||
|
|
||
|
;;PBHGetVol proc EXPORT
|
||
|
;; OSCall _HGetVol
|
||
|
|
||
|
;;PBCatMove proc EXPORT
|
||
|
;; OSCall _CatMove
|
||
|
|
||
|
;;PBDirCreate proc EXPORT
|
||
|
;; OSCall _DirCreate
|
||
|
|
||
|
;;PBGetWDInfo proc EXPORT
|
||
|
;; clr.l d1 ; *** ROM bug fix ***
|
||
|
;; move.l 4(sp),a0 ; get param pointer.
|
||
|
;; move.l 8(sp),d0 ; Get ASync flag.
|
||
|
;; bne.s @1
|
||
|
;; _GetWDInfo ; tell OS to do it Synchronously
|
||
|
;; bra.s @2
|
||
|
;;@1 _GetWDInfo ,ASYNC ; Tell OS to do it Asynchronously
|
||
|
;;@2 ext.l d0 ; sign extend error code
|
||
|
;; rts ; return to caller
|
||
|
|
||
|
;;PBGetFCBInfo proc EXPORT
|
||
|
;; OSCall _GetFCBInfo
|
||
|
|
||
|
;;PBGetCatInfo proc EXPORT
|
||
|
;; MOVE.L 4(sp), A0
|
||
|
;; CLR.B ioFileType(A0)
|
||
|
;; Oscall _GetCatInfo
|
||
|
|
||
|
;;PBSetCatInfo proc EXPORT
|
||
|
;; OSCall _SetCatInfo
|
||
|
|
||
|
;;PBAllocContig proc EXPORT
|
||
|
;; OSCall _AllocContig
|
||
|
|
||
|
;;PBLockRange proc EXPORT
|
||
|
;; OSCall _LockRng
|
||
|
|
||
|
;;PBUnLockRange proc EXPORT
|
||
|
;; OSCall _UnLockRng
|
||
|
|
||
|
|
||
|
; OSErr PBSetVInfo (paramBlock,aSync)
|
||
|
; OSErr PBHGetVInfo (paramBlock,aSync)
|
||
|
; OSErr PBHOpen (paramBlock,aSync)
|
||
|
; OSErr PBHOpenRF (paramBlock,aSync)
|
||
|
; OSErr PBHCreate (paramBlock,aSync)
|
||
|
; OSErr PBHDelete (paramBlock,aSync)
|
||
|
; OSErr PBHRename (paramBlock,aSync)
|
||
|
; OSErr PBHRstFLock (paramBlock,aSync)
|
||
|
; OSErr PBHSetFLock (paramBlock,aSync)
|
||
|
; OSErr PBHGetFInfo (paramBlock,aSync)
|
||
|
; OSErr PBHSetFInfo (paramBlock,aSync)
|
||
|
|
||
|
;;PBSetVInfo proc EXPORT
|
||
|
;; OSCall _SetVolInfo
|
||
|
|
||
|
;;PBHGetVInfo proc EXPORT
|
||
|
;; OSCall _HGETVINFO
|
||
|
|
||
|
;;PBHOpen proc EXPORT
|
||
|
;; OSCall _HOpen
|
||
|
|
||
|
;;PBHOpenRF proc EXPORT
|
||
|
;; OSCall _HOpenRF
|
||
|
|
||
|
;;PBHCreate proc EXPORT
|
||
|
;; OSCall _HCreate
|
||
|
|
||
|
;;PBHDelete proc EXPORT
|
||
|
;; OSCall _HDelete
|
||
|
|
||
|
;;PBHRename proc EXPORT
|
||
|
;; OSCall _HRename
|
||
|
|
||
|
;;PBHRstFLock proc EXPORT
|
||
|
;; OSCall _HRstFLock
|
||
|
|
||
|
;;PBHSetFLock proc EXPORT
|
||
|
;; OSCall _HSetFLock
|
||
|
|
||
|
;;PBHGetFInfo proc EXPORT
|
||
|
;; OSCall _HGetFileInfo
|
||
|
|
||
|
;;PBHSetFInfo proc EXPORT
|
||
|
;; OSCall _HSetFileInfo
|
||
|
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
;
|
||
|
; Accessing Queues
|
||
|
;
|
||
|
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
|
||
|
|
||
|
;
|
||
|
; QHdrPtr GetFSQHdr()
|
||
|
;
|
||
|
;;GetFSQHdr proc EXPORT
|
||
|
;;
|
||
|
;; move.l #FSQHdr,d0
|
||
|
;; rts
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; QHdrPtr GetDrvQHdr()
|
||
|
;
|
||
|
;;GetDrvQHdr proc EXPORT
|
||
|
;;
|
||
|
;; move.l #DrvQHdr,d0
|
||
|
;; rts
|
||
|
|
||
|
;-------------------------------------------------------------------------------
|
||
|
;
|
||
|
; QHdrPtr GetVCBQHdr()
|
||
|
;
|
||
|
;;GetVCBQHdr proc EXPORT
|
||
|
;;
|
||
|
;; move.l #VCBQHdr,d0
|
||
|
;; rts
|
||
|
|
||
|
|
||
|
END
|