LIBRARY :
FILE.ZIP
; /// MACRO AND PROCEDURE DEFINITIONS USED IN THE FILE.RTF FILE ////
;;///////////////////////////////////////////////////////////////////////////////////////////////////////
; eax = start sector
; ebx = segment
; ecx = number of sectors to read
; edi = offset
; drive parameters should be loaded
; before this procedure or at least
; currentdisk,sectorperhead and and headspercylinder
; should be determined explicitly
; call readsector esi,eax,ecx,ebx,edi
; this routine reads a disk head by head which is the most proper
; way of reading and writing a disk
; for example if you will read 60 sectors starting from sector 4
; in a floppy disk
; this routine automatically reads sectors that way (4-17) (18-35) (36-53) (54-63)
; thus eliminates cross-boundry problems
READSECTOR PROC
; eax = start sector
; ebx = segment
; ecx = number of sectors to read
; edi = offset
; drive parameters should be loaded
; before this procedure or at least
; currentdisk,sectorperhead and and headspercylinder
; should be determined explicitly
; call writesector eax,ecx,ebx,edi
; this routine writes a disk head by head which is the most proper way
; of reading and writing a disk
; for example if you will write 60 sectors starting from sector 4
; in afloppy disk
; this routine automatically writes sectors that way (4-17) (18-35) (36-53) (54-63)
; thus eliminates cross-boundry problems
WRITESECTOR PROC
; searches for a blank entry in a sub dir
; searches only one sector at a time
; enty : ebx = sector to search
; dx=0 if there is no blank entry
; dx=1 if there is a blank entry
; di = offset of first blank entry
SEARCHBLANK1DIR PROC
; searches for a blank entry in a sub dir
; scans all sectors of subdir
; entry ebx = fat cluster
; dx=0 if there is no blank entry
; dx=1 if there is a blank entry
; clust is the fat no of start cluster of sub dir
; output eax = sector number of last sector of sub dir
; di = dir entry index in eax
; modifies eax and dx and di
SEARCHBLANKINSUBDIR PROC
; findblankname
; finds a blank entry in es:[bx]
; output : dx= 1 edi=offset of direntry
; dx=0 if error
; searches 1 cluster at a time
FINDBLANKNAME PROC
; searches for a blank entry between specified sectors
; eax = start sector,ebx = end sector
; dx=1 if one
; dx=0 if no blank entry
SEARCHBLANKDIR PROC
SEARCHBLANKDIR ENDP
; searches for a blank entry between specified sectors
; ebx = startcluster no
; dx=1 if one
; dx=0 if no blank entry
FINDBLANKDIR PROC
; esi = offset name to find filename should be padded
; di = dir entry index of filename
; dx=1 if found
FINDNAME PROC
; search1dir
; searches a name in a sector
; esi = offset fname
; ebx = clust
; output : dx= 1 ; eax=sector number if file found ; di=offset of direntry
; dx=0 if error
; preserves cx and si registers
SEARCH1DIR PROC
; searchdir
; searches a name in sectors between fromclust and toclust
; esi = offset fname
; eax = fromsector
; ebx = tosector
; output : dx= 1
; eax=sector number if file found ; di=offset of direntry
; dx=0 if file not found
SEARCHDIR PROC
; searches for a name in a sub dir
; scans all sectors of subdir
; esi = offset dirname
; ebx = cluster
; dx=0 if not found
; dx=1 if found
; clust is the fat no of start cluster of sub dir
; output eax = sector number where name found di = dir entry index
SEARCHSUBDIR PROC
; searches for a name in any dir
; scans all sectors of subdir
; esi = offset dirname
; ebx = cluster
; dx=0 if not found
; dx=1 if found
; clust is the fat no of start cluster of sub dir
; output eax = sector number where name found di = dir entry index
FINDDIRNAME PROC
LOADDIR PROC
; ebx = start cluster of directory
LOADFILE PROC
; this saves a file wholly
; esi = offset filename
; ebx = datasegment
; ecx = start cluster
; output : eax = sector of dir entry of filename
SAVEFILENAME PROC
; overwrites a file wholly
; esi = offset filename
; ebx = datasegment
; ecx = start cluster
; output : eax = sector of dir entry of filename
OVERWRITEFILENAME PROC
; esi = offset filename
WRITEFILEDATA PROC
; writes directory name to a blank root entry and writes the fat entries only
; ebx= start sector of sub dir ,eax= sector of root dir, di = dir entry index in this sector
; startrootsect is the fat entry of parent dir of subdir
; esi = offset dirname
CREATEDIRNAME PROC
; ebx = start cluster
DELETEFILENAME PROC
; addchain2subdir
; extends root sectors of a sub directory
; clust no is the sector where filename is in
; first we start by searching dir name in the current sector
; if there is not then we exit
; then we search for the end of sub dir
; sub dir may have more than one sector
; when found then we search for a blank fat and write this value
; to the previous fat and we write 0fffh to the last fat we found
; ebx = cluster no of dir
ADDCHAINTODIR PROC
; pads a given file or directoryname
; preserves all registers
PADFILENAME PROC