home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpm
/
filutl
/
decuf13.ark
/
EXTFN.MAC
< prev
next >
Wrap
Text File
|
1989-09-27
|
4KB
|
112 lines
.Z80
;
; Extend_BDos_Disk_Functions, ExtBDF.
;
; To support extended filenames, that is unambigious file names including
; a user number, the BDos functions need to be extended. As a part of the
; normal file operations, the user number of the file must be selected
; prior to the file operation. After the file operation, the original
; user number must be restored.
;
; The FCB's of the files using the extended file names must be registered
; in a special list. Each entry in the list specifies the address of the
; FCB together with the user number of the file.
;
; If a file operation is requested from BDos AND the supplied FCB address
; is registred, the user number swapping is performed. In all other
; cases, no special action is taken other than invoking BDos.
;
BDOS EQU 0001H ;Address of real BDos
EXALRB EQU 0002H ;List of registered FCB's
EXANRB EQU 0003H ;Number of registered FCB's
CURUSR EQU 0004H ;Save area current user number
;
XFR: LD A,(EXANRB) ;Number of registred FCB's
JR Z,EXA010 ;Exit if none registred
;
; The following BDos function codes must be handled especially:
; 15 - Open File
; 16 - Close File
; 19 - Delete File
; 20 - Read Sequential
; 21 - Write Sequential
; 22 - Make File
; ( 30 - Set File Attributes )
; 33 - Read Random
; 34 - Write Random
; 35 - Compute File Size
; 40 - Write Random with Zero Fill
;
LD A,C ;Function code
;
SUB 15 ;Compare with lower bound, 15
JR C,EXA010 ;Exit if non-disk function
SUB 16+1-15 ;Compare with upper bound, 16
JR C,EXA020 ;Brif a disk function
;
SUB 19-16-1 ;Compare with lower bound, 19
JR C,EXA010 ;Exit if non-disk function
SUB 22+1-19 ;Compare with upper bound, 22
JR C,EXA020 ;Brif a disk function
;
SUB 33-22-1 ;Compare with lower bound, 33
JR C,EXA010 ;Exit if non-disk function
SUB 35+1-33 ;Compare with upper bound, 35
JR C,EXA020 ;Brif a disk function
;
; The BDos function is not one of the disk function to be intercepted.
; Invoke BDos to handle the function request.
;
EXA010: JP BDOS ;Enter BDOS
;
; The BDos function is one of the disk functions which might need
; modification of the user area. Check the address of the FCB to
; be one of the registered FCB's.
;
EXA020: LD IY,EXALRB ;List of registered FCB's
LD A,(EXANRB) ;Number of registered FCB's
LD B,A ;Move number
;
EXA025: LD L,(IY+0) ;LSB of registered FCB address
LD H,(IY+1) ;MSB of registered FCB address
OR A ;Clear carry flag
SBC HL,DE ;Compare with supplied FCB address
JR Z,EXA030 ;Brif FCB found in list
INC IY ;Move pointer to next entry
INC IY
INC IY
DJNZ EXA025 ;Brif not at end of list
JR EXA010 ;FCB is not registered
;
; A registered FCB is supplied in this BDos call. Fetch the current
; user number, select the user area needed for this function, perform
; the requested BDos function and restore the original user number.
;
EXA030: PUSH BC ;Save BDos function code
PUSH DE ;Save FCB address
;
LD C,020H ;Function= Get/Set_User_Number
LD E,0FFH ;Select Get_User_Number function
CALL BDOS ;Invoke BDos
LD (CURUSR),A ;Save current user number
;
LD C,020H ;Function= Get/Set_User_Number
LD E,(IY+2) ;Load requested user number
CALL BDOS ;Invoke BDos
;
POP DE ;Restore address of FCB
POP BC ;Restore BDos function code
CALL BDOS ;Invoke BDos
PUSH AF ;Save return code
;
LD C,020H ;Function=Get/Set_User_Number
LD A,(CURUSR) ;Original user number
LD E,A ;
CALL BDOS ;Invoke BDos
;
POP AF ;Restore return code from disk
RET ;Return to calling procedure
;
END