!**************************************************************************
!*
!* Network driver interface for netboot bootrom
!*
!* Module: dospriv.inc
!* Purpose: Include file to define DOS and BIOS data structures
!* Entries: None
!*
!**************************************************************************
!*
!* Copyright (C) 1995-2003 Gero Kuhlmann <gero@gkminix.han.de>
!*
!* This program is free software; you can redistribute it and/or modify
!* it under the terms of the GNU General Public License as published by
!* the Free Software Foundation; either version 2 of the License, or
!* any later version.
!*
!* This program is distributed in the hope that it will be useful,
!* but WITHOUT ANY WARRANTY; without even the implied warranty of
!* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!* GNU General Public License for more details.
!*
!* You should have received a copy of the GNU General Public License
!* along with this program; if not, write to the Free Software
!* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!*
!* $Id: dospriv.inc,v 1.5 2003/01/25 23:29:41 gkminix Exp $
!*
#ifndef _NETDRVR_DOSSIM_DOSPRIV_H
#define _NETDRVR_DOSSIM_DOSPRIV_H
!
!**************************************************************************
!
! The DOS dispatcher interrupt 21h has to save some registers before
! calling the handler routine. As DOS is able to use two different
! stacks we also have to save those registers into two different
! locations. The area to hold the values looks like this:
!
old_bp equ 0
old_ds equ 2
old_stack equ 4
old_reg_size equ 8
!
!**************************************************************************
!
! Definitions for memory management:
!
! A memory control block precedes every memory block in the lower ram
! area (e.g. from the end of the boot rom data area to the beginning
! of the operating system loading area). If the owner address is 0,
! the memory block is free.
!
mcb_id equ 0 ! ID of control block (see below)
mcb_owner equ 1 ! pointer to PSP of owner process
mcb_size equ 3 ! size in paragraphs
! MCB id codes:
MCB_MEM_ID equ $4D ! indicates valid memory block
MCB_END_ID equ $5A ! indicates last memory block
!
!**************************************************************************
!
! Definition of device codes:
!
DEV_CON equ 0 ! console
DEV_AUX equ 1 ! serial port
DEV_PRN equ 2 ! printer port
!
!**************************************************************************
!
! Definition of reserved file handles.
!
RES_HANDLES equ 5 ! total number of reserved handles
RES_STDIN equ 0 ! stdin file handle
RES_STDOUT equ 1 ! stdout file handle
RES_STDERR equ 2 ! stderr file handle
RES_AUX equ 3 ! AUX device file handle
RES_PRN equ 4 ! PRN device file handle
!
!**************************************************************************
!
! Definition of Program Segment Prefix (PSP):
!
o_psp_endmem equ 2 ! first allocatable seg after program
o_psp_int22 equ 10 ! saved interrupt 22h vector
o_psp_int23 equ 14 ! saved interrupt 23h vector
o_psp_int24 equ 18 ! saved interrupt 24h vector
o_psp_parent equ 22 ! PSP of parent process
o_psp_handles equ 24 ! process file handles
o_psp_env equ 44 ! segment of program environment
o_psp_oldstack equ 46 ! stack pointer of parent
o_psp_numhndl equ 50 ! number of file handles
o_psp_ofshndl equ 52 ! offset of file handle table
o_psp_seghndl equ 54 ! segment of file handle table
o_psp_fcb1 equ 92 ! first part of FCB 1
o_psp_fcb2 equ 108 ! first part of FCB 2
o_psp_cmdlsize equ 128 ! length of command line
o_psp_cmdl equ 129 ! command line (the first of 127 bytes)
PSP_MAXCMDL equ 125 ! maximum length of command line
PSP_SIZE equ 256 ! size of PSP with full command line
!
!**************************************************************************
!
! Definitions for program management:
!
COM_MAGIC equ $4B47 ! magic cookie for COM program images
COM_MIN_FREE equ $0050 ! minimum number of free paragraphs
EXE_MAGIC equ $5A4D ! magic cookie for EXE program images
EXE_SECTSIZE equ 512 ! size of program sectors in EXE
EXE_SIG equ $0000 ! EXE header signature
EXE_LASTSECT equ $0002 ! number of bytes in last sector
EXE_FSIZE equ $0004 ! number of sectors in program
EXE_RELOCNUM equ $0006 ! number of relocation table entries
EXE_HEADSIZE equ $0008 ! size of header in paragraphs
EXE_MINPARA equ $000A ! min no of paragraphs required
EXE_MAXPARA equ $000C ! max no of paragraphs required
EXE_SS equ $000E ! stack segment (offset to prog start)
EXE_SP equ $0010 ! stack pointer
EXE_IP equ $0014 ! start address of program
EXE_CS equ $0016 ! start segment (offset to prog start)
EXE_RELOCTAB equ $0018 ! offset to relocation table
!
!**************************************************************************
!
! DOS error codes
!
ERR_NOFN equ 1 ! function does not exist
ERR_NOFILE equ 2 ! file not found
ERR_NODIR equ 3 ! directory not found
ERR_TOOMANY equ 4 ! too many open files
ERR_NOACC equ 5 ! access denied
ERR_INVHDL equ 6 ! invalid file handle
ERR_INVMCB equ 7 ! invalid memory control block
ERR_NOMEM equ 8 ! not enough memory
ERR_INVMEM equ 9 ! invalid memory block address
ERR_INVENV equ 10 ! invalid environment
ERR_INVFORM equ 11 ! invalid format
ERR_INVACC equ 12 ! invalid access code
ERR_INVDATA equ 13 ! invalid data
ERR_INVDRV equ 15 ! invalid drive
ERR_DELACT equ 16 ! not allowed to delete active dir
ERR_NODEV equ 17 ! device not available
ERR_NOMORE equ 18 ! no more files
ERR_WRTPROT equ 19 ! disk is write protected
ERR_NODISK equ 20 ! disk device not available
ERR_NOTRDY equ 21 ! drive not ready
ERR_INVCMD equ 22 ! invalid disk command
ERR_CRCERR equ 23 ! CRC error
ERR_TIMOUT equ 24 ! time out of disk operation
ERR_SEARCH equ 25 ! error searching disk block
ERR_NODOS equ 26 ! no DOS diskette
ERR_NOSECT equ 27 ! sector not found
ERR_NOPAPER equ 28 ! no paper in printer
ERR_WRITE equ 29 ! write error
ERR_READ equ 30 ! read error
ERR_GENERAL equ 31 ! general error
!
!**************************************************************************
!
! ASCII character definitions
!
CHR_BS equ $08 ! Backspace character
CHR_TAB equ $09 ! Tab character
CHR_LF equ $0A ! Line-feed character
CHR_FF equ $0C ! Form-feed character
CHR_RET equ $0D ! Return character
CHR_EOF equ $1A ! End-of-file character
CHR_FIRST equ $20 ! first printable character
CHR_DELETE equ $7F ! Delete character
!
!**************************************************************************
!
! With a 386+ processor, the DOS simulator can internally use the FS
! register instead of ES, which saves a couple of push/pop instructions.
!
! Macro to use FS instead of ES in segment prefixes
!
#ifdef IS386
#define segfs seg fs
#else
#define segfs seg es
#endif
!
! Macros to push and pop ES if FS cannot be used
!
#ifdef IS386
#define pushfs
#else
#define pushfs push es
#endif
#ifdef IS386
#define popfs
#else
#define popfs pop es
#endif
!
!**************************************************************************
!
#endif
syntax highlighted by Code2HTML, v. 0.9.1