mirror of
https://github.com/SEPPDROID/DR-DOS-OpenDOS.git
synced 2025-10-22 07:54:28 +00:00
228 lines
8.5 KiB
Plaintext
228 lines
8.5 KiB
Plaintext
; File : $FDOS.EQU$
|
|
;
|
|
; Description :
|
|
;
|
|
; Original Author : DIGITAL RESEARCH
|
|
;
|
|
; Last Edited By : $CALDERA$
|
|
;
|
|
;-----------------------------------------------------------------------;
|
|
; Copyright Work of Caldera, Inc. All Rights Reserved.
|
|
;
|
|
; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL,
|
|
; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC.
|
|
; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES
|
|
; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF
|
|
; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO
|
|
; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE
|
|
; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE
|
|
; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED,
|
|
; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED,
|
|
; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST,
|
|
; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF
|
|
; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT
|
|
; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND
|
|
; CIVIL LIABILITY.
|
|
;-----------------------------------------------------------------------;
|
|
;
|
|
; *** Current Edit History ***
|
|
; *** End of Current Edit History ***
|
|
;
|
|
; $Log$
|
|
;
|
|
; ENDLOG
|
|
;
|
|
; Structure of Buffer Control Blocks
|
|
; ----------------------------------
|
|
; These BCBs immediately preceed the data buffers. BCBs are
|
|
; always shared for all drives and therefore must be big
|
|
; enough for the largest drive.
|
|
;
|
|
|
|
BCB_NEXT equ word ptr 00h ; link to next buffer
|
|
BCB_PREV equ word ptr 02h ; link to previous buffer
|
|
BCB_DRV equ byte ptr 04h ; drive of this buffer or 0FFh
|
|
BCB_FLAGS equ byte ptr 05h ; buffer flags
|
|
BCB_REC equ word ptr 06h ; low 16 bits of sector address
|
|
BCB_REC2 equ byte ptr 08h ; top 8 bits of record address
|
|
BCB_COPIES equ byte ptr 0Ah ; number of copies to write
|
|
BCB_SEPARATION equ word ptr 0Bh ; # sectors copies are apart
|
|
BCB_DDSC equ dword ptr 0Dh ; DWORD ptr to DDSC_
|
|
BCB_REMOTE equ word ptr 11h ; remote in-use count
|
|
BCB_DATA equ byte ptr 14h ; buffer data
|
|
|
|
BF_ISFAT equ 0002h ; buffer marked as FAT sector
|
|
BF_ISDIR equ 0004h ; buffer marked as Directory sector
|
|
BF_ISDAT equ 0008h ; buffer marked as Data sector
|
|
BF_DIRTY equ 0040h ; buffer marked as modified
|
|
BF_REMOTE equ 0080h ; buffer is remote
|
|
|
|
MAX12 equ 0FF6h ; max. disk size w/ 12-bit media
|
|
|
|
; Structure of Hash Control Block
|
|
; -------------------------------
|
|
; Each hash control block refers to the hash codes of one
|
|
; disrectory cluster or a root directory.
|
|
|
|
HCB_LINK equ word ptr 0 ; link to next control block
|
|
HCB_DRV equ byte ptr 2 ; drive for this entry or 0FFh
|
|
HCB_CLU equ word ptr 4 ; cluster number or 0000 if root
|
|
HCB_CNT equ word ptr 6 ; number of hashed entries
|
|
HCB_DATA equ word ptr 8 ; hash buffer data
|
|
|
|
|
|
; Structure of DOS FCB
|
|
; --------------------
|
|
; This is hopefully consistent with what DOS stores in an
|
|
; open file control block for DOS 1.x functions
|
|
|
|
MSF_EXTFLG equ byte ptr 0 ; if this is 0xFF, skip 1st 7 byte
|
|
MSF_ATTRIB equ byte ptr 6 ; file attributes if MSF_EXTFLG
|
|
MSF_DRIVE equ byte ptr 0 ; 1st byte normally drive code
|
|
MSF_NAME equ byte ptr 1 ; 8-bit ASCII file name, 11 characters
|
|
MSF_BLOCK equ word ptr 12 ; current block number
|
|
MSF_RECSIZE equ word ptr 14 ; current logical record size
|
|
MSF_SIZE equ word ptr 16 ; 32-bit file size
|
|
MSF_DATE equ word ptr 20 ; last date stamp
|
|
MSF_TIME equ word ptr 22 ; last time stamp
|
|
MSF_IFN equ byte ptr 24 ;; internal file number
|
|
MSF_IOCTL equ byte ptr 25 ;; file status
|
|
MSF_BLOCK1 equ word ptr 26 ;; 1st block of file
|
|
MSF_DBLK equ word ptr 28 ;; directory block
|
|
MSF_DEVPTR equ dword ptr 28 ;; address of device driver
|
|
MSF_DCNT equ word ptr 30 ;; directory count
|
|
MSF_CR equ byte ptr 32 ; current sequential record
|
|
MSF_RR equ word ptr 33 ; random record address (3 or 4 byte)
|
|
MSF_RR2 equ byte ptr 35 ; random record overflow
|
|
|
|
|
|
; Structure of DOS DPB
|
|
; --------------------
|
|
; The layout of this structure is a guess based on
|
|
; examples. It is returned by PC MODE on functions 1Fh and
|
|
; 32h and is required by various disk-related utilities
|
|
; like disk editors and CHKDSK.
|
|
|
|
DDSC_UNIT equ byte ptr 0 ; absolute drive number
|
|
DDSC_RUNIT equ byte ptr 1 ; relative unit number
|
|
DDSC_SECSIZE equ word ptr 2 ; sector size in bytes
|
|
DDSC_CLMSK equ byte ptr 4 ; sectors/cluster - 1
|
|
DDSC_CLSHF equ byte ptr 5 ; log2 (sectors/cluster)
|
|
DDSC_FATADDR equ word ptr 6 ; sector address of FAT
|
|
DDSC_NFATS equ byte ptr 8 ; # of FAT copies
|
|
DDSC_DIRENT equ word ptr 9 ; size of root directory
|
|
DDSC_DATADDR equ word ptr 11 ; sector address of cluster #2
|
|
DDSC_NCLSTRS equ word ptr 13 ; # of clusters on disk
|
|
DDSC_NFATRECS equ word ptr 15 ; # of sectors per FAT
|
|
DDSC_DIRADDR equ word ptr 17 ; sector address of root dir
|
|
DDSC_DEVHEAD equ dword ptr 19 ; device driver header
|
|
DDSC_DEVOFF equ word ptr 19
|
|
DDSC_DEVSEG equ word ptr 21
|
|
DDSC_MEDIA equ byte ptr 23 ; current media byte
|
|
DDSC_FIRST equ byte ptr 24 ; "drive never accessed" flag
|
|
DDSC_LINK equ dword ptr 25 ; next drive's DDSC
|
|
DDSC_BLOCK equ word ptr 29 ; next block to allocate
|
|
DDSC_FREE equ word ptr 31 ; total free clusters on drive
|
|
DDSC_LEN equ 33
|
|
|
|
|
|
|
|
; DELWATCH hooks called by OS
|
|
|
|
DELW_RDMASK equ 0 ; delete dir search mask
|
|
DELW_DELETE equ 2 ; delete this dir entry
|
|
DELW_FREECLU equ 3 ; free some clusters
|
|
DELW_FREERD equ 4 ; free root dir entry
|
|
DELW_SPACE equ 5 ; add "deletes" to free space
|
|
DELW_NEWDISK equ 7 ; new disk logged in
|
|
DELW_PURGE equ 14 ; perge pd file
|
|
DELW_UNDEL equ 15 ; undelete pd file
|
|
|
|
; SuperStore hook called by OS
|
|
|
|
SSTOR_SPACE equ 10h ; enquire # physical free space
|
|
|
|
; Password hooks called by OS
|
|
|
|
PASSWD_CREAT equ 20h ; initialise an entry
|
|
PASSWD_CHMOD equ 21h ; change an entry
|
|
PASSWD_CHECK equ 22h ; check an entry
|
|
|
|
; Share hooks in PCMODE data segment
|
|
;
|
|
; These point to a stub which does a "STC, RETF"
|
|
;
|
|
|
|
NUM_SHARE_STUB_ENTRIES equ 15
|
|
|
|
S_LOCKS equ DWORD*0 ; share lock/unlock region
|
|
S_UPDATE equ DWORD*1 ; update DHNDL from share
|
|
S_RECORD equ DWORD*2 ; update share from DHNDL
|
|
S_FDOSRW equ DWORD*3 ; validate proposed operation
|
|
S_DISCARD equ DWORD*4 ; discard all files on drive
|
|
S_OPEN equ DWORD*5 ; files is opening, remember it
|
|
S_CLOSE equ DWORD*6 ; files is closing, forget it
|
|
S_OM_COMPAT equ DWORD*7 ; check open mode compatible
|
|
S_CLOSE_IF_OPEN equ DWORD*8 ; close if compat open, else deny
|
|
S_DENY_IF_OPEN equ DWORD*9 ; deny if open shared/by others
|
|
S_GET_LIST_ENTRY equ DWORD*10 ; get open file list entry
|
|
S_CLOSE_FILES equ DWORD*11 ; close all files for given PSP/UID
|
|
|
|
; struct dirfcb
|
|
|
|
DNAME equ byte ptr 0 ;file name & type
|
|
DATTS equ byte ptr 11
|
|
DA_RO equ 01h ; 0x01 - read/only
|
|
DA_HIDDEN equ 02h ; 0x02 - hidden
|
|
DA_SYSTEM equ 04h ; 0x04 - system
|
|
DA_VOLUME equ 08h ; 0x08 - volume label
|
|
DA_DIR equ 10h ; 0x10 - sub-directory
|
|
DA_ARCHIVE equ 20h ; 0x20 - archive
|
|
DA_CLUSTER equ 80h ; 0x80 - return starting cluster from search (API extention)
|
|
DA_DELWATCH equ 80h ; 0x88 - return pending delete files
|
|
DA_FIXED equ 11011000b ; can't CHMOD label, dir, unused bits
|
|
DA_CHANGE equ not DA_FIXED ; all others are changeable
|
|
|
|
;DATTS2 equ 12 ;CP/M attributes
|
|
; ; 0x80 - f1' modify default open rules
|
|
; ; 0x40 - f2' partial close default
|
|
; ; 0x20 - f3' ignore close checksum errors
|
|
; ; 0x10 - f4' disable checksums
|
|
; ; 0x08 - (reserved)
|
|
; ; 0x04 - DELETE password
|
|
; ; 0x02 - WRITE password
|
|
; ; 0x01 - READ password
|
|
DUNDEL equ 13 ;1st letter of deleted file
|
|
DPWD equ word ptr 14 ;16-bit password hash code
|
|
DMODTIME equ word ptr 16 ;delwatch time (hhhhhmmmmmmsssss)
|
|
DMODDATE equ word ptr 18 ;delwatch date (yyyyyyymmmmddddd)
|
|
;DRECSIZE equ 16 ;FlexOS record size
|
|
;DUSER equ 18 ;FlexOS user ID of creator
|
|
;DGROUP equ 19 ;FlexOS group ID of creator
|
|
DPWM equ word ptr 20 ;FlexOS access rights
|
|
DTIME equ 22 ;time (hhhhhmmmmmmsssss)
|
|
DDATE equ 24 ;date (yyyyyyymmmmddddd)
|
|
DBLOCK1 equ 26 ;first block in file
|
|
DSIZE equ 28 ;current file size
|
|
|
|
; DOS Media Password Definitions
|
|
; ------------------------------
|
|
|
|
PWM_OWNER equ 000Fh ; PWD Owner mask
|
|
PWM_GROUP equ 00F0h ; PWD Group mask
|
|
PWM_WORLD equ 0F00h ; PWD World mask
|
|
PWM_R equ 0888h ; PWD required for reading
|
|
PWM_W equ 0444h ; PWD required for writing
|
|
PWM_E equ 0222h ; PWD req'd for executing
|
|
PWM_D equ 0111h ; PWD required for deleting
|
|
PWM_ANY equ PWM_R+PWM_W+PWM_D ; PWD required for anything
|
|
|
|
|
|
; literal constants
|
|
|
|
FAT12 equ 00fffh ; 12 bit fat
|
|
FAT16 equ 0ffffh ; 16 bit fat
|
|
|
|
ENDDIR equ 0ffffh ;end of directory
|
|
|