EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

doss.htm
Constants
Structures
DRIVER_REQUEST
DRIVER_HEADER
FCB
MCB
PSP

This file can be included to program for DOS written in EuroAssembler.
It defines structures and constant symbol names used with Disk Operating System (DOS).


doss HEAD  ; Start of interface block includable to other programs.
↑ Constants
Boolean flags used in DRIVER_HEADER.Attribute and DRIVER_REQUEST.Status.
  ; Boolean flags used in DRIVER_HEADER.Attribute.
drvStdIn      = 00000000_00000001b ; Driver is Standard Input device.
drvStdOut     = 00000000_00000010b ; Driver is Standard Output device.
drvNul        = 00000000_00000100b ; Driver is NUL device.
drvClock      = 00000000_00001000b ; Driver is Clock device.
drvCon        = 00000000_00010000b ; Driver is CON device.
drvRemovable  = 00001000_00000000b ; Driver supports removable media.
drvBusy       = 00100000_00000000b ; Driver supports output-until-busy.
drvIoCtl      = 01000000_00000000b ; Driver supports I/O control.
drvCharDevice = 10000000_00000000b ; Driver is character-device. 0 for block-device.

  ; Boolean flags used in DRIVER_REQUEST.Status.
dstDone           = 00000001_00000000b ; Command performed.
dstBusy           = 00000010_00000000b ; Device is busy.
dstError          = 10000000_00000000b ; Error code in LSB, see below.
dstWriteProt      =  0 ; Medium is write-protected.
dstUnknownUnit    =  1 ; Not that much units is supported by the driver.
dstNotReady       =  2 ; Drive is not ready.
dstUnknownCmd     =  3 ; Unsupported function was requested.
dstDataError      =  4 ; Bad data read (CRC check failed).
dstBadRequest     =  5 ; The driver request structure error.
dstSeekError      =  6 ; Seek error on disk.
dstUnknownMedium  =  7 ; Inserted medium of unknown type.
dstBlockNotFound  =  8 ; Requested block was not found.
dstOutOfPaper     =  9 ; Printer run out of paper.
dstWriteError     = 10 ; Error during disk write.
dstReadError      = 11 ; Error during disk read.
dstGeneralFailure = 12 ; General error.
dstMediaChanged   = 15 ; Medium was changed unexpectedly.
↑ DRIVER_HEADER
Structure describes the beginning of DOS device driver file.
DRIVER_HEADER STRUC
.NextHeader D D -1 ; Far pointer to the next driver, or -1 if this is the last one.
.Attributes D W  0 ; Driver properties encoded in Constants.
.Strategy   D W    ; Offset of strategy routine.
.Interrupt  D W    ; Offset of interrupt routine.
.Device     D Q    ; Zero-padded character device name, or number of block devices as 64bit integer.
.Request    D 0*D  ; Far pointer to the request, saved in the strategy routine.
.RequestOfs D W    ; .Request can be aliased as .RequestSeg : .RequestOfs.
.RequestSeg D W    ; Paragraph address of the request.
 ENDSTRUC DRIVER_HEADER
↑ DRIVER_REQUEST
Structure describes the request submitted to DOS device drivers. It has variable size, only its first 13 bytes are fixed.
|[DRIVER_REQUEST]|DRIVER_REQUEST STRUC
|0000:17         |.Size       D B ; Size of the request in bytes.
|0001:00         |.Unit       D B ; Disk number if block-device is requested.
|0002:00         |.Command    D B ; Ordinal of requested function.
|0003:0000       |.Status     D W ; Returned driver status in DriverEncoding.
|0005:0000000000~|.Reserved05 D 8*B
|000D:00         |.Units      D B ; Returned number of initialized units.
|000E:[0000]     |.TermOfs    D W ; Address of the end of driver resident.
|0010:{0000}     |.TermSeg    D W
|0012:[0000]     |.ArgOfs     D W ; Address of the device arguments,
|0014:{0000}     |.ArgSeg     D W ;  as provided in CONFIG.SYS behind DEVICE=.
|0016:00         |.FirstUnit  D B ; Disk number of 1st unit if block-device (0=A:).
|0017:           |ENDSTRUC DRIVER_REQUEST
↑ MCB
16 bytes long Memory Control Block describes allocated memory in DOS. It is immediately followed with the actual reserved memory area.
Documented
[TechHelp]
MCB STRUC
.Type     D B   ; 'M' for the first and middle block in chain, 'Z' for the last one.
.Owner    D W   ; Paragraph address of the block owner. 8=owned by DOS, 0=block is free.
.Size     D W   ; Number of allocated memory paragraphs which follow this MCB.
.Reserved D 3*B ; Not used.
.Name     D 8*B ; Owner's name, visible with MEM /C.
 ENDSTRUC MCB   ; SIZE# MCB = 0x10 = 16.
↑ FCB
16 bytes long File Control Block is constructed by DOS in PSP block in 0..2 instances, if one or two filenames are provided as command-line arguments.
Documented
[TechHelp]
|[FCB]                |FCB STRUC
|0000:00              |.DriveNr     D B 0     ; Disk drive number. 0=current, 1..26=A:..Z:.
|0001:2020202020202020|.FileName    D 8*B " " ; File name, space-padded.
|0009:202020          |.FileExt     D 3*B " " ; File extension, space-padded.
|000C:0000            |.CurentBlock D W 0     ; Block number, set by OS. Starts at 0.
|000E:0000            |.RecSize     D W 0     ; Record size. 128 after Open.
|0010:00000000        |.FileSize    D D 0     ; File size in bytes.
|0014:0000            |.FileDate    D W 0     ; File last modification date.
|0016:0000            |.FileTime    D W 0     ; File last modification time.
|0018:0000000000000000|.Reserved18  D 8*B 0   ; DOS reserved area.
|0020:00              |.CurrentRec  D B 0     ; Block-relative record number (0..7Fh).
|0021:00000000        |.RandomRec   D D 0     ; Block number.
|0025:                | ENDSTRUC FCB          ; SIZE# FCB = 0x25 = 37.
↑ PSP
256 bytes long Program Segment Prefix is constructed by DOS below the executable image. Its address is passed to the COM or MZ program as ES:0 and DS:0.
Documented
[PSP]
|[PSP]              |PSP STRUC
|0000:CD20          |.ExitCode   D I"INT 0x20" ; Instruction which terminates the program.
|0002:FF9F          |.MemTop     D W 0x9FFF    ; Top of allocated memory in paragraphs.
|0004:00            |.Reserved04 D B 0         ; Reserved.
|0005:9A[0000]{0000}|.DosApiCall D I"CALLF 0:0"; Call to DosAPI dispatcher (CP/M heritage).
|000A:00000000      |.OldInt0x22 D D 0         ; Previous termination handler interrupt vector.
|000E:00000000      |.OldInt0x23 D D 0         ; Previous Ctrl-Break handler interrupt vector.
|0012:00000000      |.OldInt0x24 D D 0         ; Previous critical error handler interrupt vector.
|0016:{0000}        |.ParentPsp  D W           ; Parent PSP segment (usually COMMAND.COM)
|0018:000000000000~~|.Jft        D 10*W        ; Job File Table.
|002C:{0000}        |.EnvSeg     D W 0         ; Paragraph address of environment copy for this program.
|002E:00000000      |.StackPtr   D D           ; SS:SP pointer on entry to the last INT 0x21.
|0032:1400          |.JftSize    D W           ; SIZE# JFT.
|0034:[0000]{0000}  |.JftPtr     D D           ; Far pointer to JFT.
|0038:[0000]{0000}  |.PrevPsp    D D           ; Far pointer to previous PSP, used by SHARE.
|003C:00000000      |.Reserved3C D 4*B         ; Reserved.
|0040:0500          |.DosVersion D W 5         ; MSDOS 5.
|0042:000000000000~~|.Reserved42 D 14*B        ; Reserved.
|0050:CD21CB        |.DosApiInt  D I"INT 0x21",I"RETF" ; Instruction which calls DosAPI.
|0053:0000          |.Reserved53 D 2*B         ; Reserved.
|0055:00000000000000|.Fcb1Ext    D 7*B 0       ; FCB1 extension.
|005C:000000000000~~|.Fcb1       D 16*B        ; Part of unopened FCB of file %1.
|006C:000000000000~~|.Fcb2       D 20*B        ; Part of unopened FCB of file %2.
|0080:              |.DTA        D 0*128*B     ; Data Transfer Area is by default placed here.
|0080:00            |.CmdArgSize D B 0         ; Number of bytes in command-line arguments (0..126).
|0081:0D0000000000~~|.CmdArg     D 127*B       ; Command-line arguments, CR-terminated.
|0100:              | ENDSTRUC PSP             ; SIZE# PSP = 256.
 ENDHEAD doss ; End of interface block.

▲Back to the top▲