mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-27 07:44:09 +02:00
Ran all .c and .h files through "indent"
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@329 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
684a2cb93d
commit
b6d423a1b3
13
hdr/buffer.h
13
hdr/buffer.h
@ -32,13 +32,13 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *buffer_hRcsId = "$Id$";
|
||||
static BYTE *buffer_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BUFFERSIZE 512
|
||||
struct buffer
|
||||
{
|
||||
struct buffer {
|
||||
WORD b_dummy; /* dummy self pointing word to keep MFT from crashing */
|
||||
struct buffer
|
||||
FAR *b_next; /* form linked list for LRU */
|
||||
@ -53,12 +53,10 @@ struct buffer
|
||||
UWORD b_offset; /* span between copies */
|
||||
#endif
|
||||
#if 0 /*TE*/
|
||||
union
|
||||
{
|
||||
union {
|
||||
struct dpb FAR *_b_dpbp; /* pointer to DPB */
|
||||
LONG _b_huge_blkno; /* DOS-C: actual block number if >= 0xffff */
|
||||
}
|
||||
_b;
|
||||
} _b;
|
||||
#endif
|
||||
BYTE b_buffer[BUFFERSIZE]; /* 512 byte sectors for now */
|
||||
};
|
||||
@ -79,4 +77,3 @@ struct buffer
|
||||
* Rev 1.0 20 Apr 2001 17:30:00 Bart Oldeman
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
27
hdr/cds.h
27
hdr/cds.h
@ -28,30 +28,25 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *Cds_hRcsId = "$Id$";
|
||||
static BYTE *Cds_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define MAX_CDSPATH 67
|
||||
|
||||
struct cds
|
||||
{
|
||||
struct cds {
|
||||
BYTE cdsCurrentPath[MAX_CDSPATH];
|
||||
UWORD cdsFlags;
|
||||
struct dpb FAR *cdsDpb;
|
||||
|
||||
union
|
||||
{
|
||||
BYTE FAR *
|
||||
_cdsRedirRec;
|
||||
struct
|
||||
{
|
||||
union {
|
||||
BYTE FAR *_cdsRedirRec;
|
||||
struct {
|
||||
UWORD _cdsStrtClst;
|
||||
UWORD _cdsParam;
|
||||
}
|
||||
_cdsRedir;
|
||||
}
|
||||
_cdsUnion;
|
||||
} _cdsRedir;
|
||||
} _cdsUnion;
|
||||
|
||||
UWORD cdsStoreUData;
|
||||
|
||||
@ -67,11 +62,9 @@ struct cds
|
||||
#define cdsRedirRec _cdsUnion._cdsRedirRec
|
||||
#define cdsParam _cdsUnion._cdsRedir._cdsParam
|
||||
|
||||
typedef struct _cdstbl
|
||||
{
|
||||
typedef struct _cdstbl {
|
||||
struct cds cds_table[26];
|
||||
}
|
||||
cdstbl;
|
||||
} cdstbl;
|
||||
|
||||
/* Bits for cdsFlags */
|
||||
#define CDSNETWDRV 0x8000
|
||||
|
@ -32,13 +32,12 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *clock_hRcsId = "$Id$";
|
||||
static BYTE *clock_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
struct ClockRecord
|
||||
{
|
||||
struct ClockRecord {
|
||||
UWORD clkDays; /* days since Jan 1, 1980. */
|
||||
UBYTE clkMinutes; /* residual minutes. */
|
||||
UBYTE clkHours; /* residual hours. */
|
||||
|
@ -32,7 +32,8 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *date_hRcsId = "$Id$";
|
||||
static BYTE *date_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
12
hdr/dcb.h
12
hdr/dcb.h
@ -30,13 +30,13 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *clock_hRcsId = "$Id$";
|
||||
static BYTE *clock_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Internal drive parameter block */
|
||||
struct dpb
|
||||
{
|
||||
struct dpb {
|
||||
BYTE dpb_unit; /* unit for error reporting */
|
||||
BYTE dpb_subunit; /* the sub-unit for driver */
|
||||
UWORD dpb_secsize; /* sector size */
|
||||
@ -61,10 +61,8 @@ struct dpb
|
||||
UWORD dpb_nfreeclst; /* number of free clusters */
|
||||
/* -1 if not known */
|
||||
#else
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
UWORD dpb_nfreeclst_lo;
|
||||
UWORD dpb_nfreeclst_hi;
|
||||
} dpb_nfreeclst_st;
|
||||
|
98
hdr/device.h
98
hdr/device.h
@ -29,11 +29,11 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *device_hRcsId = "$Id$";
|
||||
static BYTE *device_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Status Word Bits
|
||||
*/
|
||||
@ -122,8 +122,7 @@ static BYTE *device_hRcsId = "$Id$";
|
||||
|
||||
/* Device header */
|
||||
|
||||
struct dhdr
|
||||
{
|
||||
struct dhdr {
|
||||
struct dhdr
|
||||
FAR *dh_next;
|
||||
UWORD dh_attr;
|
||||
@ -155,8 +154,7 @@ struct dhdr
|
||||
|
||||
#define BPB_SIZEOF 31 /* size of the standard BPB */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UWORD bpb_nbyte; /* Bytes per Sector */
|
||||
UBYTE bpb_nsector; /* Sectors per Allocation Unit */
|
||||
UWORD bpb_nreserved; /* # Reserved Sectors */
|
||||
@ -184,8 +182,7 @@ typedef struct
|
||||
UWORD bpb_xbackupsec; /* backup boot sector number */
|
||||
/* 0xFFFF if unknown */
|
||||
#endif
|
||||
}
|
||||
bpb;
|
||||
} bpb;
|
||||
|
||||
#define N_RETRY 5 /* number of retries permitted */
|
||||
#define SEC_SIZE 512 /* size of sector in bytes */
|
||||
@ -193,8 +190,8 @@ bpb;
|
||||
#define LBA_READ 0x4200
|
||||
#define LBA_WRITE 0x4300
|
||||
|
||||
|
||||
struct _bios_LBA_address_packet /* Used to access a hard disk via LBA */
|
||||
struct _bios_LBA_address_packet
|
||||
/* Used to access a hard disk via LBA */
|
||||
/* Added by Brian E. Reifsnyder */
|
||||
{
|
||||
unsigned char packet_size; /* size of this packet...set to 16 */
|
||||
@ -213,8 +210,7 @@ struct CHS {
|
||||
};
|
||||
|
||||
/* DOS 4.0-7.0 drive data table (see RBIL at INT2F,AX=0803) */
|
||||
typedef struct ddtstruct
|
||||
{
|
||||
typedef struct ddtstruct {
|
||||
struct ddtstruct FAR *ddt_next;
|
||||
/* pointer to next table (offset FFFFh if last table) */
|
||||
UBYTE ddt_driveno; /* physical unit number (for INT 13) */
|
||||
@ -231,12 +227,10 @@ typedef struct ddtstruct
|
||||
bpb ddt_defbpb; /* BPB for default (highest) capacity supported */
|
||||
UBYTE ddt_reserved[6]; /* (part of BPB above) */
|
||||
UBYTE ddt_ltrack; /* last track accessed */
|
||||
union
|
||||
{
|
||||
union {
|
||||
ULONG ddt_lasttime; /* removable media: time of last access
|
||||
in clock ticks (FFFFFFFFh if never) */
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
UWORD ddt_part; /* partition (FFFFh = primary, 0001h = extended)
|
||||
always 0001h for DOS 5+ */
|
||||
UWORD ddt_abscyl; /* absolute cylinder number of partition's
|
||||
@ -268,8 +262,7 @@ typedef struct ddtstruct
|
||||
|
||||
/* typedef struct ddtstruct ddt;*/
|
||||
|
||||
struct gblkio
|
||||
{
|
||||
struct gblkio {
|
||||
UBYTE gbio_spcfunbit;
|
||||
UBYTE gbio_devtype;
|
||||
UWORD gbio_devattrib;
|
||||
@ -297,8 +290,7 @@ struct gblkrw /* for read / write track */
|
||||
UBYTE FAR *gbrw_buffer;
|
||||
};
|
||||
|
||||
struct Gioc_media
|
||||
{
|
||||
struct Gioc_media {
|
||||
WORD ioc_level;
|
||||
ULONG ioc_serialno;
|
||||
BYTE ioc_volume[11];
|
||||
@ -315,8 +307,7 @@ struct Gioc_media
|
||||
#define BT_BPB 11
|
||||
#define BT_SIZEOF 36
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BYTE bt_jump[3]; /* Boot Jump opcodes */
|
||||
BYTE bt_oem[8]; /* OEM Name */
|
||||
bpb bt_bpb; /* BPB for this media/device */
|
||||
@ -330,12 +321,10 @@ typedef struct
|
||||
ULONG bt_serialno;
|
||||
BYTE bt_volume[11];
|
||||
BYTE bt_fstype[8];
|
||||
}
|
||||
boot;
|
||||
} boot;
|
||||
|
||||
/* File system information structure */
|
||||
struct fsinfo
|
||||
{
|
||||
struct fsinfo {
|
||||
UDWORD fi_signature; /* must be 0x61417272 */
|
||||
DWORD fi_nfreeclst; /* number of free clusters, -1 if unknown */
|
||||
DWORD fi_cluster; /* most recently allocated cluster, -1 if unknown */
|
||||
@ -344,61 +333,42 @@ struct fsinfo
|
||||
|
||||
typedef boot super; /* Alias for boot structure */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UBYTE r_length; /* Request Header length */
|
||||
UBYTE r_unit; /* Unit Code */
|
||||
UBYTE r_command; /* Command Code */
|
||||
WORD r_status; /* Status */
|
||||
BYTE r_reserved[8]; /* DOS Reserved Area */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
UBYTE _r_nunits; /* number of units */
|
||||
BYTE FAR *_r_endaddr; /* Ending Address */
|
||||
bpb *FAR * _r_bpbptr; /* ptr to BPB array */
|
||||
UBYTE _r_firstunit;
|
||||
}
|
||||
_r_init;
|
||||
struct
|
||||
{
|
||||
} _r_init;
|
||||
struct {
|
||||
BYTE _r_meddesc; /* MEDIA Descriptor */
|
||||
BYTE _r_retcode; /* Return Code */
|
||||
BYTE FAR
|
||||
* _r_vid; /* volume id */
|
||||
}
|
||||
_r_media;
|
||||
struct
|
||||
{
|
||||
BYTE FAR * _r_vid; /* volume id */
|
||||
} _r_media;
|
||||
struct {
|
||||
BYTE _r_meddesc; /* MEDIA Descriptor */
|
||||
boot FAR
|
||||
* _r_fat; /* boot sector pointer */
|
||||
bpb FAR
|
||||
* _r_bpbpt; /* ptr to BPB table */
|
||||
}
|
||||
_r_bpb;
|
||||
struct
|
||||
{
|
||||
boot FAR * _r_fat; /* boot sector pointer */
|
||||
bpb FAR * _r_bpbpt; /* ptr to BPB table */
|
||||
} _r_bpb;
|
||||
struct {
|
||||
BYTE _r_meddesc; /* MEDIA Descriptor */
|
||||
BYTE FAR
|
||||
* _r_trans; /* Transfer Address */
|
||||
BYTE FAR * _r_trans; /* Transfer Address */
|
||||
UWORD _r_count; /* Byte/Sector Count */
|
||||
UWORD _r_start; /* Starting Sector No. */
|
||||
BYTE FAR
|
||||
* _r_vid; /* Pointer to volume id */
|
||||
BYTE FAR * _r_vid; /* Pointer to volume id */
|
||||
LONG _r_huge; /* for > 32Mb drives */
|
||||
}
|
||||
_r_rw;
|
||||
struct
|
||||
{
|
||||
} _r_rw;
|
||||
struct {
|
||||
BYTE _r_ndbyte; /* Byte Read From Device */
|
||||
}
|
||||
_r_nd;
|
||||
}
|
||||
_r_x;
|
||||
}
|
||||
request;
|
||||
} _r_nd;
|
||||
} _r_x;
|
||||
} request;
|
||||
|
||||
#define HUGECOUNT 0xffff
|
||||
#define MAXSHORT 0xffffl
|
||||
|
@ -30,13 +30,12 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *dirmatch_hRcsId = "$Id$";
|
||||
static BYTE *dirmatch_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BYTE dm_drive;
|
||||
BYTE dm_name_pat[FNAME_SIZE + FEXT_SIZE];
|
||||
BYTE dm_attr_srch;
|
||||
@ -48,8 +47,7 @@ typedef struct
|
||||
UWORD reserved;
|
||||
#endif
|
||||
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
BITS /* directory has been modified */
|
||||
f_dmod:1;
|
||||
BITS /* directory is the root */
|
||||
@ -60,16 +58,14 @@ typedef struct
|
||||
f_ddir:1;
|
||||
BITS /* filler to avoid a bad bug (feature?) in */
|
||||
f_filler:12; /* TC 2.01 */
|
||||
}
|
||||
dm_flags; /* file flags */
|
||||
} dm_flags; /* file flags */
|
||||
|
||||
BYTE dm_attr_fnd; /* found file attribute */
|
||||
time dm_time; /* file time */
|
||||
date dm_date; /* file date */
|
||||
LONG dm_size; /* file size */
|
||||
BYTE dm_name[FNAME_SIZE + FEXT_SIZE + 2]; /* file name */
|
||||
}
|
||||
dmatch;
|
||||
} dmatch;
|
||||
|
||||
/*
|
||||
* Log: dirmatch.h,v
|
||||
|
@ -30,15 +30,14 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *dosnames_hRcsId = "$Id$";
|
||||
static BYTE *dosnames_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#define PARSE_MAX 64
|
||||
|
||||
struct dosnames
|
||||
{
|
||||
struct dosnames {
|
||||
UBYTE dn_drive; /* the drive that was parsed */
|
||||
UBYTE dn_network[PARSE_MAX]; /* specified network */
|
||||
UBYTE dn_path[PARSE_MAX]; /* the path */
|
||||
|
@ -30,11 +30,11 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *error_hRcsId = "$Id$";
|
||||
static BYTE *error_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Internal system error returns */
|
||||
#define SUCCESS 0 /* Function was successful */
|
||||
#define DE_INVLDFUNC -1 /* Invalid function number */
|
||||
|
10
hdr/exe.h
10
hdr/exe.h
@ -30,13 +30,12 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *exe_hRcsId = "$Id$";
|
||||
static BYTE *exe_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UWORD exSignature;
|
||||
UWORD exExtraBytes;
|
||||
UWORD exPages;
|
||||
@ -51,8 +50,7 @@ typedef struct
|
||||
UWORD exInitCS;
|
||||
UWORD exRelocTable;
|
||||
UWORD exOverlay;
|
||||
}
|
||||
exe_header;
|
||||
} exe_header;
|
||||
|
||||
#define MAGIC 0x5a4d
|
||||
|
||||
|
13
hdr/fat.h
13
hdr/fat.h
@ -30,11 +30,11 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *fat_hRcsId = "$Id$";
|
||||
static BYTE *fat_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* FAT file system attribute bits */
|
||||
#define D_NORMAL 0 /* normal */
|
||||
#define D_RDONLY 0x01 /* read-only file */
|
||||
@ -79,8 +79,7 @@ static BYTE *fat_hRcsId = "$Id$";
|
||||
/* dpb_size == 0 for FAT32, hence doing -1 here */
|
||||
|
||||
/* FAT file system directory entry */
|
||||
struct dirent
|
||||
{
|
||||
struct dirent {
|
||||
UBYTE dir_name[FNAME_SIZE]; /* Filename */
|
||||
UBYTE dir_ext[FEXT_SIZE]; /* Filename extension */
|
||||
UBYTE dir_attrib; /* File Attribute */
|
||||
@ -97,8 +96,7 @@ struct dirent
|
||||
ULONG dir_size; /* File size in bytes */
|
||||
};
|
||||
|
||||
struct lfn_entry
|
||||
{
|
||||
struct lfn_entry {
|
||||
UBYTE lfn_id;
|
||||
UNICODE lfn_name0_4[5];
|
||||
UBYTE lfn_attrib;
|
||||
@ -142,8 +140,7 @@ struct lfn_entry
|
||||
|
||||
#define DIRENT_SIZE 32
|
||||
|
||||
struct lfn_inode
|
||||
{
|
||||
struct lfn_inode {
|
||||
UNICODE name[256];
|
||||
|
||||
struct dirent l_dir;
|
||||
|
22
hdr/fcb.h
22
hdr/fcb.h
@ -30,11 +30,11 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *fcb_hRcsId = "$Id$";
|
||||
static BYTE *fcb_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* fcb convience defines */
|
||||
/* block device info */
|
||||
#define FID_CHARDEV 0x80 /* 1 defines character device */
|
||||
@ -77,8 +77,7 @@ static BYTE *fcb_hRcsId = "$Id$";
|
||||
#define FCB_WRITE 1
|
||||
|
||||
/* File Control Block (FCB) */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BYTE fcb_drive; /* Drive number 0=default, 1=A, etc */
|
||||
BYTE fcb_fname[FNAME_SIZE]; /* File name */
|
||||
BYTE fcb_fext[FEXT_SIZE]; /* File name Extension */
|
||||
@ -99,21 +98,17 @@ typedef struct
|
||||
/* end reserved */
|
||||
UBYTE fcb_curec; /* Current block number of */
|
||||
ULONG fcb_rndm; /* Current relative record number */
|
||||
}
|
||||
fcb;
|
||||
} fcb;
|
||||
|
||||
/* FAT extended fcb */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UBYTE xfcb_flag; /* 0xff indicates Extended FCB */
|
||||
BYTE xfcb_resvrd[5]; /* Reserved */
|
||||
UBYTE xfcb_attrib; /* Attribute */
|
||||
fcb xfcb_fcb;
|
||||
}
|
||||
xfcb;
|
||||
} xfcb;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UBYTE renDriveID; /* drive no. */
|
||||
BYTE renOldName[8]; /* Old Filename */
|
||||
BYTE renOldExtent[3]; /* Old File Extension */
|
||||
@ -121,8 +116,7 @@ typedef struct
|
||||
BYTE renNewName[8]; /* New Filename */
|
||||
BYTE renNewExtent[3]; /* New FileExtension */
|
||||
BYTE renReserved2[9];
|
||||
}
|
||||
rfcb;
|
||||
} rfcb;
|
||||
|
||||
/*
|
||||
* Log: fcb.h,v
|
||||
|
@ -30,11 +30,11 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *file_hRcsId = "$Id$";
|
||||
static BYTE *file_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* 0 = CON, standard input, can be redirected */
|
||||
/* 1 = CON, standard output, can be redirected */
|
||||
/* 2 = CON, standard error */
|
||||
|
16
hdr/fnode.h
16
hdr/fnode.h
@ -30,25 +30,22 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *fnode_hRcsId = "$Id$";
|
||||
static BYTE *fnode_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
struct f_node
|
||||
{
|
||||
struct f_node {
|
||||
UWORD f_count; /* number of uses of this file */
|
||||
COUNT f_mode; /* read, write, read-write, etc */
|
||||
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
BITS f_dmod:1; /* directory has been modified */
|
||||
BITS f_droot:1; /* directory is the root */
|
||||
BITS f_dnew:1; /* fnode is new and needs fill */
|
||||
BITS f_ddir:1; /* fnode is assigned to dir */
|
||||
BITS f_ddate:1; /* date set using setdate */
|
||||
}
|
||||
f_flags; /* file flags */
|
||||
} f_flags; /* file flags */
|
||||
|
||||
struct dirent f_dir; /* this file's dir entry image */
|
||||
|
||||
@ -67,8 +64,7 @@ struct f_node
|
||||
};
|
||||
|
||||
#if 0
|
||||
struct lfn_inode
|
||||
{
|
||||
struct lfn_inode {
|
||||
UNICODE name[255];
|
||||
|
||||
struct dirent l_dir; /* this file's dir entry image */
|
||||
|
10
hdr/kbd.h
10
hdr/kbd.h
@ -30,21 +30,19 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *kbd_hRcsId = "$Id$";
|
||||
static BYTE *kbd_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#define KBD_MAXLENGTH 256
|
||||
|
||||
/* Keyboard buffer */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UBYTE kb_size; /* size of buffer in bytes */
|
||||
UBYTE kb_count; /* number of bytes returned */
|
||||
BYTE kb_buf[KBD_MAXLENGTH]; /* the buffer itself */
|
||||
}
|
||||
keyboard;
|
||||
} keyboard;
|
||||
|
||||
/*
|
||||
* Log: kbd.h,v
|
||||
|
@ -30,7 +30,8 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *mcb_hRcsId = "$Id$";
|
||||
static BYTE *mcb_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -56,15 +57,13 @@ static BYTE *mcb_hRcsId = "$Id$";
|
||||
typedef UWORD seg;
|
||||
typedef UWORD offset;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
BYTE m_type; /* mcb type - chain or end */
|
||||
UWORD m_psp; /* owner id via psp segment */
|
||||
UWORD m_size; /* size of segment in paragraphs */
|
||||
BYTE m_fill[3];
|
||||
BYTE m_name[8]; /* owner name limited to 8 bytes */
|
||||
}
|
||||
mcb;
|
||||
} mcb;
|
||||
|
||||
/*
|
||||
* Log: mcb.h,v
|
||||
|
@ -59,30 +59,22 @@
|
||||
#define REM_PRINTREDIR 0x1125
|
||||
#define REM_EXTOC 0x112e
|
||||
|
||||
struct rgds
|
||||
{
|
||||
struct rgds {
|
||||
UWORD r_spc;
|
||||
UWORD r_navc;
|
||||
UWORD r_bps;
|
||||
UWORD r_nc;
|
||||
};
|
||||
|
||||
struct remote_fileattrib
|
||||
{
|
||||
struct remote_fileattrib {
|
||||
UWORD rfa_file; /* File Attributes */
|
||||
union
|
||||
{
|
||||
union {
|
||||
ULONG rfa_filesize; /* file size */
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
UWORD rfa_filesize_lo; /* DI Low */
|
||||
UWORD rfa_filesize_hi; /* BX High */
|
||||
}
|
||||
_split_rfa_fz;
|
||||
}
|
||||
rfa_fz_union;
|
||||
} _split_rfa_fz;
|
||||
} rfa_fz_union;
|
||||
UWORD rfa_time;
|
||||
UWORD rfa_date;
|
||||
};
|
||||
|
||||
|
||||
|
12
hdr/nls.h
12
hdr/nls.h
@ -281,7 +281,6 @@
|
||||
access to often used and mandatoryly present tables. */
|
||||
#define NLS_REORDER_POINTERS
|
||||
|
||||
|
||||
/*
|
||||
* How the kernel and NLSFUNC communicate with each other
|
||||
*/
|
||||
@ -336,8 +335,7 @@
|
||||
/*
|
||||
* This is the data in the exact order returned by DOS-65-01
|
||||
*/
|
||||
struct nlsExtCntryInfo
|
||||
{
|
||||
struct nlsExtCntryInfo {
|
||||
UBYTE subfct; /* always 1 */
|
||||
WORD size; /* size of this structure
|
||||
without this WORD itself */
|
||||
@ -393,7 +391,6 @@ struct nlsPointer { /* Information of DOS-65-0X is addressed
|
||||
0xA0, 0xA1,& 0xA2 */
|
||||
};
|
||||
|
||||
|
||||
struct nlsPackage { /* the contents of one chain item of the
|
||||
list of NLS packages */
|
||||
struct nlsPackage FAR *nxt; /* next item in chain */
|
||||
@ -433,11 +430,9 @@ nlsChBuf(256);
|
||||
struct nlsFnamTerm {
|
||||
WORD size; /* size of this structure */
|
||||
BYTE dummy1;
|
||||
char firstCh,
|
||||
lastCh; /* first, last permittable character */
|
||||
char firstCh, lastCh; /* first, last permittable character */
|
||||
BYTE dummy2;
|
||||
char firstExcl,
|
||||
lastExcl; /* first, last excluded character */
|
||||
char firstExcl, lastExcl; /* first, last excluded character */
|
||||
BYTE dummy3;
|
||||
BYTE numSep; /* number of file name separators */
|
||||
char separators[1]; /* grows dynamically */
|
||||
@ -551,6 +546,5 @@ struct nlsCSys_completeFileHeader { /* as S0, but full 128 bytes */
|
||||
unsigned char csys_padbytes[128 - (sizeof(CSYS_FD_IDSTRING) - 1)];
|
||||
};
|
||||
|
||||
|
||||
/* standard alignment */
|
||||
#include <algndflt.h>
|
||||
|
45
hdr/pcb.h
45
hdr/pcb.h
@ -51,27 +51,23 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *pcb_hRcsId = "$Id$";
|
||||
static BYTE *pcb_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Force one-byte alignment for all the internal structures, see above */
|
||||
#include <algnbyte.h>
|
||||
/* */
|
||||
/* interrupt handler structure definition */
|
||||
/* */
|
||||
typedef union
|
||||
{
|
||||
typedef union {
|
||||
UWORD x; /* access mode for ax, bx, etc. */
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
UBYTE l; /* access mode for al, bl, etc. */
|
||||
UBYTE h; /* access mode for ah, bh, etc. */
|
||||
}
|
||||
b;
|
||||
}
|
||||
xreg;
|
||||
} b;
|
||||
} xreg;
|
||||
|
||||
/* The structure assumes that:
|
||||
1) An interrupt was invoked, &
|
||||
@ -79,22 +75,11 @@ xreg;
|
||||
Furthermore, the PUSH$ALL macro must push ES first and AX last.
|
||||
-- 2000/03/22 ska*/
|
||||
/* maps MS-DOS unique stacking order */
|
||||
typedef struct _iregss
|
||||
{
|
||||
xreg a,
|
||||
b,
|
||||
c,
|
||||
d;
|
||||
UWORD si,
|
||||
di,
|
||||
bp,
|
||||
ds,
|
||||
es;
|
||||
UWORD ip,
|
||||
cs,
|
||||
flags;
|
||||
}
|
||||
iregs;
|
||||
typedef struct _iregss {
|
||||
xreg a, b, c, d;
|
||||
UWORD si, di, bp, ds, es;
|
||||
UWORD ip, cs, flags;
|
||||
} iregs;
|
||||
|
||||
/* Registers directly passed to syscall;
|
||||
must be the same order as iregs!
|
||||
@ -104,16 +89,12 @@ iregs;
|
||||
UWORD si, UWORD di, UWORD bp, UWORD ds, UWORD es, \
|
||||
UWORD ip, UWORD cs, UWORD flags
|
||||
|
||||
|
||||
|
||||
/* Process control block for task switching */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UWORD pc_ss;
|
||||
UWORD pc_sp;
|
||||
iregs pc_regs;
|
||||
}
|
||||
pcb;
|
||||
} pcb;
|
||||
|
||||
/* Note: The following figure is not made by myself and I assume that
|
||||
the order of "ES" through "AX" are misinterpreted?! -- 2000/03/22 ska*/
|
||||
|
17
hdr/portab.h
17
hdr/portab.h
@ -30,7 +30,8 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static char *portab_hRcsId = "$Id$";
|
||||
static char *portab_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -57,7 +58,6 @@ static char *portab_hRcsId = "$Id$";
|
||||
/* */
|
||||
/****************************************************************/
|
||||
|
||||
|
||||
/* commandline overflow - removing -DI86 TE */
|
||||
#if defined(__TURBOC__)
|
||||
|
||||
@ -99,42 +99,30 @@ static char *portab_hRcsId = "$Id$";
|
||||
have a certain calling standard. These are declared
|
||||
as 'ASMCFUNC', and is (and will be ?-) cdecl */
|
||||
#define ASMCFUNC cdecl
|
||||
|
||||
#ifdef MC68K
|
||||
|
||||
#define far /* No far type */
|
||||
#define interrupt /* No interrupt type */
|
||||
|
||||
#define VOID void
|
||||
#define FAR /* linear architecture */
|
||||
#define NEAR /* " " */
|
||||
#define INRPT interrupt
|
||||
|
||||
#define CONST
|
||||
#define REG register
|
||||
|
||||
#define API int /* linear architecture */
|
||||
#define NONNATIVE
|
||||
|
||||
#define PARASIZE 4096 /* "paragraph" size */
|
||||
#endif
|
||||
|
||||
#ifdef I86
|
||||
|
||||
#define VOID void
|
||||
#define FAR far /* segment architecture */
|
||||
#define NEAR near /* " " */
|
||||
#define INRPT interrupt
|
||||
|
||||
#define CONST const
|
||||
#define REG register
|
||||
|
||||
#define API int far pascal /* segment architecture */
|
||||
#define NATIVE
|
||||
|
||||
#define PARASIZE 16 /* "paragraph" size */
|
||||
#endif
|
||||
|
||||
/* */
|
||||
/* Boolean type & definitions of TRUE and FALSE boolean values */
|
||||
/* */
|
||||
@ -188,7 +176,6 @@ typedef unsigned short UNICODE;
|
||||
|
||||
#define STATIC /* local calls inside module */
|
||||
|
||||
|
||||
#ifdef UNIX
|
||||
typedef char FAR *ADDRESS;
|
||||
#else
|
||||
|
@ -30,7 +30,8 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *process_hRcsId = "$Id$";
|
||||
static BYTE *process_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -40,36 +41,27 @@ static BYTE *process_hRcsId = "$Id$";
|
||||
#define P_NOWAIT 1 /* both concurrent -- not implemented */
|
||||
#define P_OVERLAY 2 /* child replaces parent, parent no longer exists */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
UWORD load_seg;
|
||||
UWORD reloc;
|
||||
}
|
||||
_load;
|
||||
struct
|
||||
{
|
||||
} _load;
|
||||
struct {
|
||||
UWORD env_seg;
|
||||
CommandTail FAR *cmd_line;
|
||||
fcb FAR *fcb_1;
|
||||
fcb FAR *fcb_2;
|
||||
BYTE FAR *stack;
|
||||
BYTE FAR *start_addr;
|
||||
}
|
||||
_exec;
|
||||
}
|
||||
ldata;
|
||||
}
|
||||
exec_blk;
|
||||
} _exec;
|
||||
} ldata;
|
||||
} exec_blk;
|
||||
|
||||
#define exec ldata._exec
|
||||
#define load ldata._load
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UWORD ps_exit; /* 00 CP/M-like exit poimt */
|
||||
UWORD ps_size; /* 02 memory size in paragraphs */
|
||||
BYTE ps_fill1; /* 04 single char fill */
|
||||
@ -91,37 +83,23 @@ typedef struct
|
||||
BYTE ps_fill2[16];
|
||||
UBYTE ps_unix[3]; /* unix style call - 0xcd 0x21 0xcb */
|
||||
BYTE ps_fill3[9];
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
fcb
|
||||
_ps_fcb1; /* first command line argument */
|
||||
}
|
||||
_u1;
|
||||
struct
|
||||
{
|
||||
BYTE
|
||||
fill4[16];
|
||||
fcb
|
||||
_ps_fcb2; /* second command line argument */
|
||||
}
|
||||
_u2;
|
||||
struct
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
fcb _ps_fcb1; /* first command line argument */
|
||||
} _u1;
|
||||
struct {
|
||||
BYTE fill4[16];
|
||||
fcb _ps_fcb2; /* second command line argument */
|
||||
} _u2;
|
||||
struct {
|
||||
BYTE fill5[36];
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
BYTE _ps_cmd_count;
|
||||
BYTE _ps_cmd[127]; /* command tail */
|
||||
}
|
||||
_u4;
|
||||
}
|
||||
_u3;
|
||||
}
|
||||
_u;
|
||||
}
|
||||
psp;
|
||||
} _u4;
|
||||
} _u3;
|
||||
} _u;
|
||||
} psp;
|
||||
|
||||
#define ps_fcb1 _u._u1._ps_fcb1
|
||||
#define ps_fcb2 _u._u2._ps_fcb2
|
||||
|
45
hdr/sft.h
45
hdr/sft.h
@ -29,16 +29,15 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *sft_hRcsId = "$Id$";
|
||||
static BYTE *sft_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#define SFTMAX 128
|
||||
|
||||
/* Handle Definition entry */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
WORD sft_count; /* 00 - reference count */
|
||||
WORD sft_mode; /* 02 - open mode - see below */
|
||||
BYTE sft_attrib; /* 04 - file attribute - dir style */
|
||||
@ -46,24 +45,17 @@ typedef struct
|
||||
union /* 05 */
|
||||
{
|
||||
WORD _sft_flags;
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
BYTE _sft_flags_lo;
|
||||
BYTE _sft_flags_hi;
|
||||
}
|
||||
_split_sft_flags;
|
||||
}
|
||||
sft_flags_union;
|
||||
} _split_sft_flags;
|
||||
} sft_flags_union;
|
||||
|
||||
union /* 07 */
|
||||
{
|
||||
struct dpb FAR *
|
||||
_sft_dcb; /* The device control block */
|
||||
struct dhdr FAR *
|
||||
_sft_dev; /* device driver for char dev */
|
||||
}
|
||||
|
||||
sft_dcb_or_dev;
|
||||
struct dpb FAR *_sft_dcb; /* The device control block */
|
||||
struct dhdr FAR *_sft_dev; /* device driver for char dev */
|
||||
} sft_dcb_or_dev;
|
||||
WORD sft_stclust; /* 0b - Starting cluster */
|
||||
time sft_time; /* 0d - File time */
|
||||
date sft_date; /* 0f - File date */
|
||||
@ -74,36 +66,30 @@ typedef struct
|
||||
WORD sft_dirdlust; /* 1d - Sector containing cluster */
|
||||
BYTE sft_diridx; /* 1f - directory index */
|
||||
BYTE sft_name[11]; /* 20 - dir style file name */
|
||||
BYTE FAR *
|
||||
sft_bshare; /* 2b - backward link of file sharing sft */
|
||||
BYTE FAR *sft_bshare; /* 2b - backward link of file sharing sft */
|
||||
WORD sft_mach; /* 2f - machine number - network apps */
|
||||
WORD sft_psp; /* 31 - owner psp */
|
||||
WORD sft_shroff; /* 33 - Sharing offset */
|
||||
WORD sft_status; /* 35 - this sft status */
|
||||
BYTE FAR *sft_ifsptr; /* 37 - pointer to IFS driver for file, 0000000h if native DOS */
|
||||
}
|
||||
sft;
|
||||
} sft;
|
||||
|
||||
/* SFT Table header definition */
|
||||
typedef struct _sftheader
|
||||
{
|
||||
typedef struct _sftheader {
|
||||
struct _sfttbl FAR * /* link to next table in list */
|
||||
sftt_next;
|
||||
WORD sftt_count; /* # of handle definition */
|
||||
/* entries, this table */
|
||||
}
|
||||
sftheader;
|
||||
} sftheader;
|
||||
|
||||
/* System File Definition List */
|
||||
typedef struct _sfttbl
|
||||
{
|
||||
typedef struct _sfttbl {
|
||||
struct _sfttbl FAR * /* link to next table in list */
|
||||
sftt_next;
|
||||
WORD sftt_count; /* # of handle definition */
|
||||
/* entries, this table */
|
||||
sft sftt_table[SFTMAX]; /* The array of sft for block */
|
||||
}
|
||||
sfttbl;
|
||||
} sfttbl;
|
||||
|
||||
/* defines for sft use */
|
||||
#define SFT_MASK 0x0060 /* splits device data */
|
||||
@ -153,7 +139,6 @@ sfttbl;
|
||||
#define sft_flags_hi sft_flags_union._split_sft_flags._sft_flags_hi
|
||||
#define sft_flags_lo sft_flags_union._split_sft_flags._sft_flags_lo
|
||||
|
||||
|
||||
/*
|
||||
* Log: sft.h,v
|
||||
*
|
||||
|
10
hdr/tail.h
10
hdr/tail.h
@ -30,21 +30,19 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *tail_hRcsId = "$Id$";
|
||||
static BYTE *tail_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef LINESIZE
|
||||
#define LINESIZE 127
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UBYTE ctCount; /* number of bytes returned */
|
||||
BYTE ctBuffer[LINESIZE]; /* the buffer itself */
|
||||
}
|
||||
CommandTail;
|
||||
} CommandTail;
|
||||
|
||||
/*
|
||||
* Log: tail.h,v
|
||||
|
@ -34,7 +34,8 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *time_hRcsId = "$Id$";
|
||||
static BYTE *time_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -87,4 +88,3 @@ typedef UWORD time;
|
||||
* Rev 1.0 02 Jul 1995 10:39:56 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
@ -28,7 +28,8 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *date_hRcsId = "$Id$";
|
||||
static BYTE *date_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -8,18 +8,17 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *XStructs_hRcsId = "$Id$";
|
||||
static BYTE *XStructs_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct xdpbdata
|
||||
{
|
||||
struct xdpbdata {
|
||||
UWORD xdd_dpbsize;
|
||||
struct dpb xdd_dpb;
|
||||
};
|
||||
|
||||
struct xfreespace
|
||||
{
|
||||
struct xfreespace {
|
||||
UWORD xfs_datasize; /* size of this structure */
|
||||
union {
|
||||
UWORD requested; /* requested structure version */
|
||||
@ -36,8 +35,7 @@ struct xfreespace
|
||||
UBYTE xfs_reserved[8];
|
||||
};
|
||||
|
||||
struct xdpbforformat
|
||||
{
|
||||
struct xdpbforformat {
|
||||
UWORD xdff_datasize; /* size of this structure */
|
||||
union {
|
||||
UWORD requested; /* requested structure version */
|
||||
|
@ -32,7 +32,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *blockioRcsId = "$Id$";
|
||||
static BYTE *blockioRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
@ -42,7 +43,6 @@ static BYTE *blockioRcsId = "$Id$";
|
||||
/************************************************************************/
|
||||
/* #define DISPLAY_GETBLOCK */
|
||||
|
||||
|
||||
/* */
|
||||
/* Initialize the buffer structure */
|
||||
/* */
|
||||
@ -126,8 +126,7 @@ VOID setblkno(struct buffer FAR * bp, ULONG blkno)
|
||||
|
||||
*/
|
||||
|
||||
BOOL searchblock(ULONG blkno, COUNT dsk,
|
||||
struct buffer FAR ** pBuffp)
|
||||
BOOL searchblock(ULONG blkno, COUNT dsk, struct buffer FAR ** pBuffp)
|
||||
{
|
||||
int fat_count = 0;
|
||||
struct buffer FAR *bp;
|
||||
@ -135,13 +134,10 @@ BOOL searchblock(ULONG blkno, COUNT dsk,
|
||||
struct buffer FAR *lastNonFat = NULL;
|
||||
struct buffer FAR *uncacheBuf = NULL;
|
||||
|
||||
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("[searchblock %d, blk %ld, buf ", dsk, blkno);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Search through buffers to see if the required block */
|
||||
/* is already in a buffer */
|
||||
|
||||
@ -167,7 +163,6 @@ BOOL searchblock(ULONG blkno, COUNT dsk,
|
||||
if (bp->b_flag & BFR_UNCACHE)
|
||||
uncacheBuf = bp;
|
||||
|
||||
|
||||
if (bp->b_flag & BFR_FAT)
|
||||
fat_count++;
|
||||
else
|
||||
@ -199,8 +194,6 @@ BOOL searchblock(ULONG blkno, COUNT dsk,
|
||||
printf("MISS, replace %04x:%04x]\n", FP_SEG(lbp), FP_OFF(lbp));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (lbp != firstbuf) /* move to front */
|
||||
{
|
||||
for (bp = firstbuf; bp->b_next != lbp; bp = bp->b_next)
|
||||
@ -233,7 +226,6 @@ BOOL DeleteBlockInBufferCache(ULONG blknolow, ULONG blknohigh, COUNT dsk)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void dumpBufferCache(void)
|
||||
{
|
||||
struct buffer FAR *bp;
|
||||
@ -251,7 +243,6 @@ void dumpBufferCache(void)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
/* */
|
||||
/* Return the address of a buffer structure containing the */
|
||||
/* requested block. */
|
||||
@ -265,8 +256,6 @@ struct buffer FAR *getblock(ULONG blkno, COUNT dsk)
|
||||
{
|
||||
struct buffer FAR *bp;
|
||||
|
||||
|
||||
|
||||
/* Search through buffers to see if the required block */
|
||||
/* is already in a buffer */
|
||||
|
||||
@ -278,7 +267,6 @@ struct buffer FAR *getblock(ULONG blkno, COUNT dsk)
|
||||
/* The block we need is not in a buffer, we must make a buffer */
|
||||
/* available, and fill it with the desired block */
|
||||
|
||||
|
||||
/* take the buffer that lbp points to and flush it, then read new block. */
|
||||
if (!flush1(bp))
|
||||
return NULL;
|
||||
@ -331,6 +319,7 @@ struct buffer FAR * getblockOver(ULONG blkno, COUNT dsk)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* */
|
||||
/* Mark all buffers for a disk as not valid */
|
||||
/* */
|
||||
@ -380,8 +369,7 @@ BOOL flush1(struct buffer FAR * bp)
|
||||
|
||||
if ((bp->b_flag & BFR_VALID) && (bp->b_flag & BFR_DIRTY))
|
||||
{
|
||||
result = dskxfer(bp->b_unit, getblkno(bp),
|
||||
(VOID FAR *) bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00 */
|
||||
result = dskxfer(bp->b_unit, getblkno(bp), (VOID FAR *) bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00 */
|
||||
if (bp->b_flag & BFR_FAT)
|
||||
{
|
||||
int i = bp->b_copies;
|
||||
@ -390,8 +378,7 @@ BOOL flush1(struct buffer FAR * bp)
|
||||
while (--i > 0)
|
||||
{
|
||||
blkno += bp->b_offset;
|
||||
result = dskxfer(bp->b_unit, blkno,
|
||||
(VOID FAR *) bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00 */
|
||||
result = dskxfer(bp->b_unit, blkno, (VOID FAR *) bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00 */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -428,7 +415,6 @@ BOOL flush(void)
|
||||
return (ok);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Device Driver Interface Functions */
|
||||
@ -439,14 +425,14 @@ BOOL flush(void)
|
||||
/* */
|
||||
|
||||
/* Changed to UWORD 9/4/00 BER */
|
||||
UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mode)
|
||||
UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks,
|
||||
COUNT mode)
|
||||
/* End of change */
|
||||
{
|
||||
/* REG struct dpb *dpbp = &blk_devices[dsk]; */
|
||||
|
||||
REG struct dpb FAR *dpbp = CDSp->cds_table[dsk].cdsDpb;
|
||||
|
||||
|
||||
if ((UCOUNT) dsk >= lastdrive)
|
||||
{
|
||||
return 0x0201; /* illegal command */
|
||||
@ -461,7 +447,8 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mod
|
||||
|
||||
if (KeyboardShiftState() & 0x01)
|
||||
{
|
||||
printf("dskxfer:%s %x - %lx %u\n", mode == DSKWRITE ? "write" : "read", dsk, blkno, numblocks);
|
||||
printf("dskxfer:%s %x - %lx %u\n", mode == DSKWRITE ? "write" : "read",
|
||||
dsk, blkno, numblocks);
|
||||
if ((KeyboardShiftState() & 0x03) == 3)
|
||||
dumpBufferCache();
|
||||
}
|
||||
@ -474,12 +461,21 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mod
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case DSKWRITE : if (verify_ena) { IoReqHdr.r_command = C_OUTVFY; break; }
|
||||
case DSKWRITE:
|
||||
if (verify_ena)
|
||||
{
|
||||
IoReqHdr.r_command = C_OUTVFY;
|
||||
break;
|
||||
}
|
||||
/* else fall through */
|
||||
case DSKWRITEINT26: IoReqHdr.r_command = C_OUTPUT; break;
|
||||
case DSKWRITEINT26:
|
||||
IoReqHdr.r_command = C_OUTPUT;
|
||||
break;
|
||||
|
||||
case DSKREADINT25:
|
||||
case DSKREAD : IoReqHdr.r_command = C_INPUT; break;
|
||||
case DSKREAD:
|
||||
IoReqHdr.r_command = C_INPUT;
|
||||
break;
|
||||
default:
|
||||
return 0x0100; /* illegal command */
|
||||
}
|
||||
@ -513,9 +509,6 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mod
|
||||
return (IoReqHdr.r_status);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/* Skip the abort, retry, fail code...it needs fixed...BER */
|
||||
/* End of change */
|
||||
|
||||
|
@ -33,7 +33,8 @@
|
||||
extern void ASMCFUNC spawn_int23(void);
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#define CB_FLG *(UBYTE FAR*)MK_FP(0x40, 0x71)
|
||||
@ -81,4 +82,3 @@ void handle_break(void)
|
||||
* Steffen contributed.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -31,7 +31,8 @@
|
||||
#include "portab.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *charioRcsId = "$Id$";
|
||||
static BYTE *charioRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#include "globals.h"
|
||||
@ -67,12 +68,14 @@ struct dhdr FAR *finddev(UWORD attr_mask)
|
||||
|
||||
VOID _cso(COUNT c)
|
||||
{
|
||||
if (syscon->dh_attr & ATTR_FASTCON) {
|
||||
if (syscon->dh_attr & ATTR_FASTCON)
|
||||
{
|
||||
#if defined(__TURBOC__)
|
||||
_AL = c;
|
||||
__int__(0x29);
|
||||
#else
|
||||
asm {
|
||||
asm
|
||||
{
|
||||
mov al, byte ptr c;
|
||||
int 0x29;
|
||||
}
|
||||
@ -106,15 +109,19 @@ VOID cso(COUNT c)
|
||||
case BELL:
|
||||
break;
|
||||
case BS:
|
||||
if (scr_pos > 0) scr_pos--;
|
||||
if (scr_pos > 0)
|
||||
scr_pos--;
|
||||
break;
|
||||
case HT:
|
||||
do _cso(' '); while ((++scr_pos) & 7);
|
||||
do
|
||||
_cso(' ');
|
||||
while ((++scr_pos) & 7);
|
||||
break;
|
||||
default:
|
||||
scr_pos++;
|
||||
}
|
||||
if (c != HT) _cso(c);
|
||||
if (c != HT)
|
||||
_cso(c);
|
||||
}
|
||||
|
||||
VOID sto(COUNT c)
|
||||
@ -210,8 +217,9 @@ UCOUNT _sti(BOOL check_break)
|
||||
Do_DosIdle_loop();
|
||||
if (check_break)
|
||||
con_hold();
|
||||
while (GenericRead(STDIN, 1, (BYTE FAR *) & c, (COUNT FAR *) & UnusedRetVal, TRUE)
|
||||
!= 1) ;
|
||||
while (GenericRead
|
||||
(STDIN, 1, (BYTE FAR *) & c, (COUNT FAR *) & UnusedRetVal,
|
||||
TRUE) != 1) ;
|
||||
return c;
|
||||
}
|
||||
|
||||
@ -285,10 +293,8 @@ static VOID kbfill(keyboard FAR * kp, UCOUNT c, BOOL ctlf, UWORD * vp)
|
||||
/* return number of characters before EOF if there is one, else just the total */
|
||||
UCOUNT sti_0a(keyboard FAR * kp)
|
||||
{
|
||||
REG UWORD c,
|
||||
cu_pos = scr_pos;
|
||||
UWORD
|
||||
virt_pos = scr_pos;
|
||||
REG UWORD c, cu_pos = scr_pos;
|
||||
UWORD virt_pos = scr_pos;
|
||||
UWORD init_count = 0; /* kp->kb_count; */
|
||||
BOOL eof = FALSE;
|
||||
#ifndef NOSPCL
|
||||
@ -483,4 +489,3 @@ UCOUNT sti(keyboard * kp)
|
||||
* Initial revision.
|
||||
*
|
||||
*/
|
||||
|
||||
|
169
kernel/config.c
169
kernel/config.c
@ -33,7 +33,8 @@
|
||||
#include "dyndata.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -75,26 +76,20 @@ extern sfttbl FAR * DOSFAR sfthead;
|
||||
/* System File Table head */
|
||||
extern sfttbl FAR *DOSFAR FCBp;
|
||||
|
||||
extern BYTE DOSFAR VgaSet,
|
||||
DOSFAR _HMATextAvailable, /* first byte of available CODE area */
|
||||
extern BYTE DOSFAR VgaSet, DOSFAR _HMATextAvailable, /* first byte of available CODE area */
|
||||
FAR _HMATextStart[], /* first byte of HMAable CODE area */
|
||||
FAR _HMATextEnd[],
|
||||
DOSFAR break_ena, /* break enabled flag */
|
||||
FAR _HMATextEnd[], DOSFAR break_ena, /* break enabled flag */
|
||||
DOSFAR os_major, /* major version number */
|
||||
DOSFAR os_minor, /* minor version number */
|
||||
DOSFAR switchar,
|
||||
DOSFAR _InitTextStart, /* first available byte of ram */
|
||||
DOSFAR switchar, DOSFAR _InitTextStart, /* first available byte of ram */
|
||||
DOSFAR ReturnAnyDosVersionExpected;
|
||||
|
||||
extern UWORD DOSFAR ram_top, /* How much ram in Kbytes */
|
||||
DOSFAR UMB_top,
|
||||
DOSFAR umb_start,
|
||||
DOSFAR uppermem_root,
|
||||
DOSFAR LoL_nbuffers;
|
||||
|
||||
struct config Config
|
||||
=
|
||||
{
|
||||
DOSFAR UMB_top,
|
||||
DOSFAR umb_start, DOSFAR uppermem_root, DOSFAR LoL_nbuffers;
|
||||
|
||||
struct config Config = {
|
||||
NUMBUFF,
|
||||
NFILES,
|
||||
NFCBS,
|
||||
@ -111,8 +106,7 @@ struct config Config
|
||||
, 0 /* amount required memory */
|
||||
, 0 /* pointer to loaded data */
|
||||
, 0 /* strategy for command.com is low by default */
|
||||
}
|
||||
;
|
||||
};
|
||||
/* MSC places uninitialized data into COMDEF records,
|
||||
that end up in DATA segment. this can't be tolerated
|
||||
in INIT code.
|
||||
@ -132,8 +126,6 @@ BYTE singleStep = FALSE; /* F8 processing */
|
||||
BYTE SkipAllConfig = FALSE; /* F5 processing */
|
||||
BYTE askThisSingleCommand = FALSE; /* ?device= device?= */
|
||||
|
||||
|
||||
|
||||
INIT VOID zumcb_init(UCOUNT seg, UWORD size);
|
||||
INIT VOID mumcb_init(UCOUNT seg, UWORD size);
|
||||
|
||||
@ -176,15 +168,13 @@ INIT STATIC VOID FAR *AlignParagraph(VOID FAR * lpPtr);
|
||||
|
||||
INIT struct table *LookUp(struct table *p, BYTE * token);
|
||||
|
||||
struct table
|
||||
{
|
||||
struct table {
|
||||
BYTE *entry;
|
||||
BYTE pass;
|
||||
VOID(*func) (BYTE * pLine);
|
||||
};
|
||||
|
||||
STATIC struct table commands[] =
|
||||
{
|
||||
STATIC struct table commands[] = {
|
||||
{"BREAK", 1, CfgBreak},
|
||||
{"BUFFERS", 1, Config_Buffers},
|
||||
{"COMMAND", 1, InitPgm},
|
||||
@ -229,7 +219,8 @@ void FAR * ConfigAlloc(COUNT bytes)
|
||||
|
||||
p = HMAalloc(bytes);
|
||||
|
||||
if (p == NULL) p = KernelAlloc(bytes);
|
||||
if (p == NULL)
|
||||
p = KernelAlloc(bytes);
|
||||
|
||||
/* printf("ConfigAlloc %d at %p\n", bytes, p); */
|
||||
|
||||
@ -259,8 +250,6 @@ INIT void PreConfig(void)
|
||||
/* dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE); */
|
||||
/* DebugPrintf(("Preliminary DMA scratchpad allocated at 0x%p\n",dma_scratch));*/
|
||||
|
||||
|
||||
|
||||
/* buffers = (struct buffer FAR *)
|
||||
KernelAlloc(Config.cfgBuffers * sizeof(struct buffer)); */
|
||||
#ifdef DEBUG
|
||||
@ -286,13 +275,11 @@ INIT void PreConfig(void)
|
||||
config_init_buffers(Config.cfgBuffers);
|
||||
|
||||
sfthead->sftt_next = (sfttbl FAR *)
|
||||
KernelAlloc(sizeof(sftheader)
|
||||
+ (Config.cfgFiles-5) * sizeof(sft));
|
||||
KernelAlloc(sizeof(sftheader) + (Config.cfgFiles - 5) * sizeof(sft));
|
||||
sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1;
|
||||
sfthead->sftt_next->sftt_count = Config.cfgFiles - 5;
|
||||
|
||||
CDSp = (cdstbl FAR *)
|
||||
KernelAlloc(0x58 * lastdrive);
|
||||
CDSp = (cdstbl FAR *) KernelAlloc(0x58 * lastdrive);
|
||||
|
||||
DPBp = (struct dpb FAR *)
|
||||
KernelAlloc(blk_dev.dh_name[0] * sizeof(struct dpb));
|
||||
@ -329,7 +316,6 @@ INIT void PostConfig(void)
|
||||
{
|
||||
/* close all (device) files */
|
||||
|
||||
|
||||
/* Set pass number */
|
||||
nPass = 2;
|
||||
/* compute lastdrive ... */
|
||||
@ -346,7 +332,6 @@ INIT void PostConfig(void)
|
||||
|
||||
f_nodes_cnt = Config.cfgFiles; /* and the number of allocated files */
|
||||
|
||||
|
||||
/* Initialize the base memory pointers from last time. */
|
||||
/*
|
||||
if the kernel could be moved to HMA, everything behind the dynamic
|
||||
@ -359,14 +344,12 @@ INIT void PostConfig(void)
|
||||
|
||||
DebugPrintf(("starting FAR allocations at %p\n", lpBase));
|
||||
|
||||
|
||||
/* Begin by initializing our system buffers */
|
||||
/* dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE); */
|
||||
#ifdef DEBUG
|
||||
/* printf("DMA scratchpad allocated at 0x%p\n", dma_scratch); */
|
||||
#endif
|
||||
|
||||
|
||||
config_init_buffers(Config.cfgBuffers);
|
||||
|
||||
/* sfthead = (sfttbl FAR *)&basesft; */
|
||||
@ -375,18 +358,15 @@ INIT void PostConfig(void)
|
||||
KernelAlloc(sizeof(sftheader)
|
||||
+ Config.cfgFiles * sizeof(sft)); */
|
||||
sfthead->sftt_next = (sfttbl FAR *)
|
||||
KernelAlloc(sizeof(sftheader)
|
||||
+ (Config.cfgFiles-5) * sizeof(sft));
|
||||
KernelAlloc(sizeof(sftheader) + (Config.cfgFiles - 5) * sizeof(sft));
|
||||
sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1;
|
||||
sfthead->sftt_next->sftt_count = Config.cfgFiles - 5;
|
||||
|
||||
CDSp = (cdstbl FAR *)
|
||||
KernelAlloc(0x58 * lastdrive);
|
||||
CDSp = (cdstbl FAR *) KernelAlloc(0x58 * lastdrive);
|
||||
|
||||
DPBp = (struct dpb FAR *)
|
||||
KernelAlloc(blk_dev.dh_name[0] * sizeof(struct dpb));
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Final: \n f_node 0x%x\n", f_nodes);
|
||||
/* printf(" FCB table 0x%p\n",FCBp);*/
|
||||
@ -396,7 +376,8 @@ INIT void PostConfig(void)
|
||||
#endif
|
||||
if (Config.cfgStacks)
|
||||
{
|
||||
VOID FAR *stackBase = KernelAlloc(Config.cfgStacks * Config.cfgStackSize);
|
||||
VOID FAR *stackBase =
|
||||
KernelAlloc(Config.cfgStacks * Config.cfgStackSize);
|
||||
init_stacks(stackBase, Config.cfgStacks, Config.cfgStackSize);
|
||||
|
||||
DebugPrintf(("Stacks allocated at %p\n", stackBase));
|
||||
@ -412,7 +393,8 @@ INIT VOID configDone(VOID)
|
||||
{
|
||||
lpBase = AlignParagraph(lpBase);
|
||||
|
||||
DebugPrintf(("HMA not available, moving text to %x\n",FP_SEG(lpBase)));
|
||||
DebugPrintf(("HMA not available, moving text to %x\n",
|
||||
FP_SEG(lpBase)));
|
||||
MoveKernel(FP_SEG(lpBase));
|
||||
|
||||
lpBase = AlignParagraph((BYTE FAR *) lpBase + HMAFree + 0x0f);
|
||||
@ -424,13 +406,14 @@ INIT VOID configDone(VOID)
|
||||
config_init_buffers(Config.cfgBuffers);
|
||||
}
|
||||
|
||||
if (lastdrive < nblkdev) {
|
||||
if (lastdrive < nblkdev)
|
||||
{
|
||||
|
||||
DebugPrintf(("lastdrive %c too small upping it to: %c\n", lastdrive + 'A', nblkdev + 'A' -1));
|
||||
DebugPrintf(("lastdrive %c too small upping it to: %c\n",
|
||||
lastdrive + 'A', nblkdev + 'A' - 1));
|
||||
|
||||
lastdrive = nblkdev;
|
||||
CDSp = (cdstbl FAR *)
|
||||
KernelAlloc(0x58 * lastdrive);
|
||||
CDSp = (cdstbl FAR *) KernelAlloc(0x58 * lastdrive);
|
||||
}
|
||||
first_mcb = FP_SEG(lpBase) + ((FP_OFF(lpBase) + 0x0f) >> 4);
|
||||
|
||||
@ -442,7 +425,8 @@ INIT VOID configDone(VOID)
|
||||
|
||||
mumcb_init(ram_top * 64 - 1, umb_start - 64 * ram_top);
|
||||
/* Check if any devices were loaded in umb */
|
||||
if(umb_start != FP_SEG(upBase) ){
|
||||
if (umb_start != FP_SEG(upBase))
|
||||
{
|
||||
/* make last block normal with SC for the devices */
|
||||
|
||||
UCOUNT umr_new = FP_SEG(upBase) + ((FP_OFF(upBase) + 0x0f) >> 4);
|
||||
@ -472,7 +456,8 @@ INIT VOID configDone(VOID)
|
||||
|
||||
umbz_root = uppermem_root;
|
||||
|
||||
if(UMB_get_largest(&umb_seg, &umb_size)){
|
||||
if (UMB_get_largest(&umb_seg, &umb_size))
|
||||
{
|
||||
|
||||
mcb_init(umbz_root, (umb_start + UMB_top) - uppermem_root - 1);
|
||||
|
||||
@ -485,7 +470,6 @@ INIT VOID configDone(VOID)
|
||||
/* create link mcb */
|
||||
mumcb_init(umbz_root, umb_seg - umbz_root - 1);
|
||||
|
||||
|
||||
/* should the UMB driver return
|
||||
adjacent memory in several pieces */
|
||||
if (umb_seg - umbz_root - 1 == 0)
|
||||
@ -502,7 +486,6 @@ INIT VOID configDone(VOID)
|
||||
/* The standard handles should be reopened here, because
|
||||
we may have loaded new console or printer drivers in CONFIG.SYS */
|
||||
|
||||
|
||||
}
|
||||
|
||||
INIT VOID DoConfig(VOID)
|
||||
@ -528,7 +511,6 @@ INIT VOID DoConfig(VOID)
|
||||
DebugPrintf(("Reading CONFIG.SYS...\n"));
|
||||
}
|
||||
|
||||
|
||||
/* Have one -- initialize. */
|
||||
nCfgLine = 0;
|
||||
bEof = 0;
|
||||
@ -564,8 +546,7 @@ INIT VOID DoConfig(VOID)
|
||||
break;
|
||||
}
|
||||
|
||||
if (*pLine == '\n' ||
|
||||
*pLine == EOF ) /* end of line */
|
||||
if (*pLine == '\n' || *pLine == EOF) /* end of line */
|
||||
break;
|
||||
|
||||
if (*pLine == '\r') /* ignore */
|
||||
@ -577,7 +558,6 @@ INIT VOID DoConfig(VOID)
|
||||
*pLine = 0;
|
||||
pLine = szLine;
|
||||
|
||||
|
||||
/* Skip leading white space and get verb. */
|
||||
pLine = scan(pLine, szBuf);
|
||||
|
||||
@ -601,14 +581,14 @@ INIT VOID DoConfig(VOID)
|
||||
else /* YES. DO IT */
|
||||
(*(pEntry->func)) (skipwh(pLine + 1));
|
||||
|
||||
|
||||
|
||||
/* might have been the UMB driver */
|
||||
if(UmbState == 2){
|
||||
if (UmbState == 2)
|
||||
{
|
||||
|
||||
UCOUNT umb_seg, umb_size;
|
||||
|
||||
if(UMB_get_largest(&umb_seg, &umb_size)){
|
||||
if (UMB_get_largest(&umb_seg, &umb_size))
|
||||
{
|
||||
UmbState = 1;
|
||||
upBase = MK_FP(umb_seg, 0);
|
||||
UMB_top = umb_size;
|
||||
@ -656,6 +636,7 @@ ULONG GetBiosTime(VOID)
|
||||
{
|
||||
return *(ULONG FAR *) (MK_FP(0x40, 0x6c));
|
||||
}
|
||||
|
||||
UWORD GetBiosKey(int timeout)
|
||||
{
|
||||
iregs r;
|
||||
@ -718,8 +699,6 @@ INIT BOOL SkipLine(char *pLine)
|
||||
printf("Skipping CONFIG.SYS/AUTOEXEC.BAT\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (SkipAllConfig)
|
||||
return TRUE;
|
||||
|
||||
@ -794,7 +773,8 @@ INIT void Config_Buffers(BYTE * pLine)
|
||||
return;
|
||||
|
||||
/* Got the value, assign either default or new value */
|
||||
Config.cfgBuffers = (nBuffers < 0 ? nBuffers : max(Config.cfgBuffers, nBuffers));
|
||||
Config.cfgBuffers =
|
||||
(nBuffers < 0 ? nBuffers : max(Config.cfgBuffers, nBuffers));
|
||||
}
|
||||
|
||||
INIT STATIC VOID sysScreenMode(BYTE * pLine)
|
||||
@ -818,7 +798,8 @@ INIT STATIC VOID sysScreenMode(BYTE * pLine)
|
||||
_BL = 0;
|
||||
__int__(0x10);
|
||||
#else
|
||||
asm {
|
||||
asm
|
||||
{
|
||||
mov al, byte ptr nMode;
|
||||
mov ah, 0x11;
|
||||
mov bl, 0;
|
||||
@ -829,8 +810,7 @@ INIT STATIC VOID sysScreenMode(BYTE * pLine)
|
||||
|
||||
INIT STATIC VOID sysVersion(BYTE * pLine)
|
||||
{
|
||||
COUNT major,
|
||||
minor;
|
||||
COUNT major, minor;
|
||||
char *p;
|
||||
|
||||
p = pLine;
|
||||
@ -888,7 +868,6 @@ INIT STATIC VOID CfgLastdrive(BYTE * pLine)
|
||||
UmbState of confidence, 1 is sure, 2 maybe, 4 unknown and 0 no way.
|
||||
*/
|
||||
|
||||
|
||||
INIT STATIC VOID Dosmem(BYTE * pLine)
|
||||
{
|
||||
BYTE *pTmp;
|
||||
@ -905,8 +884,16 @@ INIT STATIC VOID Dosmem(BYTE * pLine)
|
||||
|
||||
for (pTmp = szBuf;;)
|
||||
{
|
||||
if (fmemcmp(pTmp, "UMB" ,3) == 0) { UMBwanted = TRUE; pTmp += 3; }
|
||||
if (fmemcmp(pTmp, "HIGH",4) == 0) { HMAState = HMA_REQ; pTmp += 4; }
|
||||
if (fmemcmp(pTmp, "UMB", 3) == 0)
|
||||
{
|
||||
UMBwanted = TRUE;
|
||||
pTmp += 3;
|
||||
}
|
||||
if (fmemcmp(pTmp, "HIGH", 4) == 0)
|
||||
{
|
||||
HMAState = HMA_REQ;
|
||||
pTmp += 4;
|
||||
}
|
||||
/* if (fmemcmp(pTmp, "CLAIMINIT",9) == 0) { INITDataSegmentClaimed = 0; pTmp += 9; }*/
|
||||
pTmp = skipwh(pTmp);
|
||||
|
||||
@ -915,14 +902,15 @@ INIT STATIC VOID Dosmem(BYTE * pLine)
|
||||
pTmp++;
|
||||
}
|
||||
|
||||
|
||||
if(UmbState == 0){
|
||||
if (UmbState == 0)
|
||||
{
|
||||
uppermem_link = 0;
|
||||
uppermem_root = 0;
|
||||
UmbState = UMBwanted ? 2 : 0;
|
||||
}
|
||||
/* Check if HMA is available straight away */
|
||||
if (HMAState == HMA_REQ && MoveKernelToHMA()){
|
||||
if (HMAState == HMA_REQ && MoveKernelToHMA())
|
||||
{
|
||||
HMAState = HMA_DONE;
|
||||
}
|
||||
}
|
||||
@ -1046,7 +1034,6 @@ INIT STATIC VOID InitPgmHigh(BYTE * pLine)
|
||||
Config.cfgP_0_startmode = 0x80;
|
||||
}
|
||||
|
||||
|
||||
INIT STATIC VOID InitPgm(BYTE * pLine)
|
||||
{
|
||||
/* Get the string argument that represents the new init pgm */
|
||||
@ -1125,11 +1112,9 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
||||
eb.load.reloc = eb.load.load_seg = FP_SEG(dhp);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Loading device driver %s at segment %04x\n",
|
||||
szBuf, FP_SEG(dhp));
|
||||
printf("Loading device driver %s at segment %04x\n", szBuf, FP_SEG(dhp));
|
||||
#endif
|
||||
|
||||
|
||||
if ((result = init_DosExec(3, &eb, szBuf)) != SUCCESS)
|
||||
{
|
||||
CfgFailure(pLine);
|
||||
@ -1145,10 +1130,9 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
||||
/* add \r\n to the command line */
|
||||
strcat(szBuf, "\r\n");
|
||||
|
||||
|
||||
for (next_dhp = NULL; FP_OFF(next_dhp) != 0xffff &&
|
||||
(result=init_device(dhp, szBuf, mode, top))==SUCCESS
|
||||
; dhp = next_dhp)
|
||||
(result = init_device(dhp, szBuf, mode, top)) == SUCCESS;
|
||||
dhp = next_dhp)
|
||||
{
|
||||
next_dhp = dhp->dh_next;
|
||||
if (FP_SEG(next_dhp) == 0xffff)
|
||||
@ -1239,30 +1223,27 @@ INIT void FAR *AlignParagraph(VOID FAR * lpPtr)
|
||||
}
|
||||
#endif
|
||||
|
||||
INIT BYTE *
|
||||
skipwh(BYTE * s)
|
||||
INIT BYTE *skipwh(BYTE * s)
|
||||
{
|
||||
while (*s && (*s == 0x0d || *s == 0x0a || *s == ' ' || *s == '\t'))
|
||||
++s;
|
||||
return s;
|
||||
}
|
||||
|
||||
INIT BYTE *
|
||||
scan(BYTE * s, BYTE * d)
|
||||
INIT BYTE *scan(BYTE * s, BYTE * d)
|
||||
{
|
||||
askThisSingleCommand = FALSE;
|
||||
|
||||
s = skipwh(s);
|
||||
if (*s == ';') {
|
||||
if (*s == ';')
|
||||
{
|
||||
/* semicolon is a synonym for rem */
|
||||
*d++ = *s++;
|
||||
}
|
||||
else while (*s &&
|
||||
else
|
||||
while (*s &&
|
||||
!(*s == 0x0d
|
||||
|| *s == 0x0a
|
||||
|| *s == ' '
|
||||
|| *s == '\t'
|
||||
|| *s == '='))
|
||||
|| *s == 0x0a || *s == ' ' || *s == '\t' || *s == '='))
|
||||
{
|
||||
if (*s == '?')
|
||||
{
|
||||
@ -1343,8 +1324,7 @@ INIT COUNT toupper(COUNT c)
|
||||
/* The following code is 8086 dependant */
|
||||
|
||||
#if 1 /* ifdef KERNEL */
|
||||
INIT VOID
|
||||
mcb_init(UCOUNT seg, UWORD size)
|
||||
INIT VOID mcb_init(UCOUNT seg, UWORD size)
|
||||
{
|
||||
COUNT i;
|
||||
|
||||
@ -1364,8 +1344,7 @@ INIT VOID
|
||||
mem_access_mode = FIRST_FIT;
|
||||
}
|
||||
|
||||
INIT VOID
|
||||
zumcb_init(UCOUNT seg, UWORD size)
|
||||
INIT VOID zumcb_init(UCOUNT seg, UWORD size)
|
||||
{
|
||||
COUNT i;
|
||||
mcb FAR *mcbp = MK_FP(seg, 0);
|
||||
@ -1378,8 +1357,7 @@ INIT VOID
|
||||
|
||||
}
|
||||
|
||||
INIT VOID
|
||||
mumcb_init(UCOUNT seg, UWORD size)
|
||||
INIT VOID mumcb_init(UCOUNT seg, UWORD size)
|
||||
{
|
||||
COUNT i;
|
||||
mcb FAR *mcbp = MK_FP(seg, 0);
|
||||
@ -1394,8 +1372,7 @@ INIT VOID
|
||||
}
|
||||
#endif
|
||||
|
||||
INIT VOID
|
||||
strcat(REG BYTE * d, REG BYTE * s)
|
||||
INIT VOID strcat(REG BYTE * d, REG BYTE * s)
|
||||
{
|
||||
while (*d != 0)
|
||||
++d;
|
||||
@ -1443,7 +1420,6 @@ INIT COUNT strcasecmp(REG BYTE *d, REG BYTE *s)
|
||||
that saves some relocation problems
|
||||
*/
|
||||
|
||||
|
||||
VOID config_init_buffers(COUNT anzBuffers)
|
||||
{
|
||||
REG WORD i;
|
||||
@ -1479,7 +1455,8 @@ VOID config_init_buffers(COUNT anzBuffers)
|
||||
|
||||
for (i = 0;; ++i)
|
||||
{
|
||||
if (FP_SEG(pbuffer) == 0xffff) HMAcount++;
|
||||
if (FP_SEG(pbuffer) == 0xffff)
|
||||
HMAcount++;
|
||||
|
||||
pbuffer->b_dummy = FP_OFF(pbuffer);
|
||||
pbuffer->b_unit = 0;
|
||||
@ -1536,7 +1513,6 @@ VOID config_init_buffers(COUNT anzBuffers)
|
||||
they expect. be careful with it!
|
||||
*/
|
||||
|
||||
|
||||
INIT VOID SetAnyDos(BYTE * pLine)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pLine);
|
||||
@ -1622,4 +1598,3 @@ INIT VOID SetAnyDos(BYTE * pLine)
|
||||
* Rev 1.0 19 Feb 1996 3:22:16 patv
|
||||
* Added NLS, int2f and config.sys processing
|
||||
*/
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
/* Cambridge, MA 02139, USA. */
|
||||
/****************************************************************/
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Enable debugging of NLS part */
|
||||
|
||||
|
335
kernel/dosfns.c
335
kernel/dosfns.c
@ -29,7 +29,8 @@
|
||||
#include "portab.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *dosfnsRcsId = "$Id$";
|
||||
static BYTE *dosfnsRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#include "globals.h"
|
||||
@ -40,7 +41,6 @@ BOOL cmatch(COUNT, COUNT, COUNT);
|
||||
|
||||
f_node_ptr xlt_fd(COUNT);
|
||||
|
||||
|
||||
/* /// Added for SHARE. - Ron Cemer */
|
||||
|
||||
BYTE share_installed = 0;
|
||||
@ -51,16 +51,14 @@ BYTE share_installed = 0;
|
||||
error. If < 0 is returned, it is the negated error return
|
||||
code, so DOS simply negates this value and returns it in
|
||||
AX. */
|
||||
static int share_open_check
|
||||
(char far *filename, /* far pointer to fully qualified filename */
|
||||
static int share_open_check(char far * filename, /* far pointer to fully qualified filename */
|
||||
unsigned short pspseg, /* psp segment address of owner process */
|
||||
int openmode, /* 0=read-only, 1=write-only, 2=read-write */
|
||||
int sharemode); /* SHARE_COMPAT, etc... */
|
||||
|
||||
/* DOS calls this to record the fact that it has successfully
|
||||
closed a file, or the fact that the open for this file failed. */
|
||||
static void share_close_file
|
||||
(int fileno); /* file_table entry number */
|
||||
static void share_close_file(int fileno); /* file_table entry number */
|
||||
|
||||
/* DOS calls this to determine whether it can access (read or
|
||||
write) a specific section of a file. We call it internally
|
||||
@ -73,8 +71,7 @@ static void share_close_file
|
||||
generates a critical error (if allowcriter is non-zero).
|
||||
If non-zero is returned, it is the negated return value for
|
||||
the DOS call. */
|
||||
static int share_access_check
|
||||
(unsigned short pspseg,/* psp segment address of owner process */
|
||||
static int share_access_check(unsigned short pspseg, /* psp segment address of owner process */
|
||||
int fileno, /* file_table entry number */
|
||||
unsigned long ofs, /* offset into file */
|
||||
unsigned long len, /* length (in bytes) of region to access */
|
||||
@ -85,8 +82,7 @@ static int share_access_check
|
||||
returns non-zero.
|
||||
If the return value is non-zero, it is the negated error
|
||||
return code for the DOS 0x5c call. */
|
||||
static int share_lock_unlock
|
||||
(unsigned short pspseg,/* psp segment address of owner process */
|
||||
static int share_lock_unlock(unsigned short pspseg, /* psp segment address of owner process */
|
||||
int fileno, /* file_table entry number */
|
||||
unsigned long ofs, /* offset into file */
|
||||
unsigned long len, /* length (in bytes) of region to lock or unlock */
|
||||
@ -94,7 +90,6 @@ static int share_lock_unlock
|
||||
|
||||
/* /// End of additions for SHARE. - Ron Cemer */
|
||||
|
||||
|
||||
#ifdef WITHFAT32
|
||||
struct dpb FAR *GetDriveDPB(UBYTE drive, COUNT * rc)
|
||||
{
|
||||
@ -108,8 +103,7 @@ struct dpb FAR *GetDriveDPB(UBYTE drive, COUNT *rc)
|
||||
}
|
||||
|
||||
dpb = CDSp->cds_table[drive].cdsDpb;
|
||||
if (dpb == 0 ||
|
||||
CDSp->cds_table[drive].cdsFlags & CDSNETWDRV)
|
||||
if (dpb == 0 || CDSp->cds_table[drive].cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
*rc = DE_INVLDDRV;
|
||||
return 0;
|
||||
@ -141,8 +135,7 @@ sft FAR *idx_to_sft(COUNT SftIndex)
|
||||
return (sft FAR *) - 1;
|
||||
|
||||
/* Get the SFT block that contains the SFT */
|
||||
for (sp = sfthead; sp != (sfttbl FAR *) - 1;
|
||||
sp = sp->sftt_next)
|
||||
for (sp = sfthead; sp != (sfttbl FAR *) - 1; sp = sp->sftt_next)
|
||||
{
|
||||
if (SftIndex < sp->sftt_count)
|
||||
{
|
||||
@ -181,8 +174,8 @@ sft FAR *get_sft(UCOUNT hndl)
|
||||
* binary reads, while for 0x40 the type of read (binary/text) depends on what
|
||||
* the SFT says. -- ror4
|
||||
*/
|
||||
UCOUNT GenericReadSft(sft FAR *s, UCOUNT n, BYTE FAR * bp, COUNT FAR * err,
|
||||
BOOL force_binary)
|
||||
UCOUNT GenericReadSft(sft FAR * s, UCOUNT n, BYTE FAR * bp,
|
||||
COUNT FAR * err, BOOL force_binary)
|
||||
{
|
||||
UCOUNT ReadCount;
|
||||
|
||||
@ -274,15 +267,17 @@ UCOUNT GenericReadSft(sft FAR *s, UCOUNT n, BYTE FAR * bp, COUNT FAR * err,
|
||||
COUNT rc;
|
||||
|
||||
/* /// Added for SHARE - Ron Cemer */
|
||||
if (IsShareInstalled()) {
|
||||
if (s->sft_shroff >= 0) {
|
||||
int share_result = share_access_check
|
||||
(cu_psp,
|
||||
if (IsShareInstalled())
|
||||
{
|
||||
if (s->sft_shroff >= 0)
|
||||
{
|
||||
int share_result = share_access_check(cu_psp,
|
||||
s->sft_shroff,
|
||||
s->sft_posit,
|
||||
(unsigned long)n,
|
||||
1);
|
||||
if (share_result != 0) {
|
||||
if (share_result != 0)
|
||||
{
|
||||
*err = share_result;
|
||||
return 0;
|
||||
}
|
||||
@ -405,7 +400,8 @@ UCOUNT DosWriteSft(sft FAR *s, UCOUNT n, BYTE FAR * bp, COUNT FAR * err)
|
||||
{
|
||||
cso(*bp);
|
||||
}
|
||||
else FOREVER
|
||||
else
|
||||
FOREVER
|
||||
{
|
||||
rq.r_length = sizeof(request);
|
||||
rq.r_command = C_OUTPUT;
|
||||
@ -447,15 +443,17 @@ UCOUNT DosWriteSft(sft FAR *s, UCOUNT n, BYTE FAR * bp, COUNT FAR * err)
|
||||
COUNT rc;
|
||||
|
||||
/* /// Added for SHARE - Ron Cemer */
|
||||
if (IsShareInstalled()) {
|
||||
if (s->sft_shroff >= 0) {
|
||||
int share_result = share_access_check
|
||||
(cu_psp,
|
||||
if (IsShareInstalled())
|
||||
{
|
||||
if (s->sft_shroff >= 0)
|
||||
{
|
||||
int share_result = share_access_check(cu_psp,
|
||||
s->sft_shroff,
|
||||
s->sft_posit,
|
||||
(unsigned long)n,
|
||||
1);
|
||||
if (share_result != 0) {
|
||||
if (share_result != 0)
|
||||
{
|
||||
*err = share_result;
|
||||
return 0;
|
||||
}
|
||||
@ -493,7 +491,8 @@ COUNT SftSeek(sft FAR *s, LONG new_pos, COUNT mode)
|
||||
if (s->sft_flags & SFT_FSHARED)
|
||||
{
|
||||
/* seek from end of file */
|
||||
if (mode == 2) {
|
||||
if (mode == 2)
|
||||
{
|
||||
/*
|
||||
* RB list has it as Note:
|
||||
* this function is called by the DOS 3.1+ kernel, but only when seeking
|
||||
@ -515,11 +514,13 @@ COUNT SftSeek(sft FAR *s, LONG new_pos, COUNT mode)
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
if (mode == 0) {
|
||||
if (mode == 0)
|
||||
{
|
||||
s->sft_posit = new_pos;
|
||||
return SUCCESS;
|
||||
}
|
||||
if (mode == 1) {
|
||||
if (mode == 1)
|
||||
{
|
||||
s->sft_posit += new_pos;
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -537,7 +538,8 @@ COUNT SftSeek(sft FAR *s, LONG new_pos, COUNT mode)
|
||||
LONG result = dos_lseek(s->sft_status, new_pos, mode);
|
||||
if (result < 0l)
|
||||
return (int)result;
|
||||
else {
|
||||
else
|
||||
{
|
||||
s->sft_posit = result;
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -554,7 +556,8 @@ COUNT DosSeek(COUNT hndl, LONG new_pos, COUNT mode, ULONG * set_pos)
|
||||
return DE_INVLDHNDL;
|
||||
|
||||
result = SftSeek(s, new_pos, mode);
|
||||
if (result == SUCCESS) {
|
||||
if (result == SUCCESS)
|
||||
{
|
||||
*set_pos = s->sft_posit;
|
||||
}
|
||||
return result;
|
||||
@ -673,16 +676,20 @@ COUNT DosCreatSft(BYTE * fname, COUNT attrib)
|
||||
{
|
||||
sftp->sft_count += 1;
|
||||
sftp->sft_flags =
|
||||
((dhp->dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF;
|
||||
fmemcpy(sftp->sft_name, (BYTE FAR *) SecPathName, FNAME_SIZE + FEXT_SIZE);
|
||||
((dhp->
|
||||
dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF;
|
||||
fmemcpy(sftp->sft_name, (BYTE FAR *) SecPathName,
|
||||
FNAME_SIZE + FEXT_SIZE);
|
||||
sftp->sft_dev = dhp;
|
||||
return sft_idx;
|
||||
}
|
||||
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV) {
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
lpCurSft = sftp;
|
||||
result = remote_creat(sftp, attrib);
|
||||
if (result == SUCCESS) {
|
||||
if (result == SUCCESS)
|
||||
{
|
||||
sftp->sft_count += 1;
|
||||
return sft_idx;
|
||||
}
|
||||
@ -690,16 +697,15 @@ COUNT DosCreatSft(BYTE * fname, COUNT attrib)
|
||||
}
|
||||
|
||||
drive = get_verify_drive(fname);
|
||||
if (drive < 0) {
|
||||
if (drive < 0)
|
||||
{
|
||||
return drive;
|
||||
}
|
||||
|
||||
/* /// Added for SHARE. - Ron Cemer */
|
||||
if (IsShareInstalled()) {
|
||||
if ((sftp->sft_shroff = share_open_check
|
||||
((char far *)fname,
|
||||
cu_psp,
|
||||
0x02, /* read-write */
|
||||
if (IsShareInstalled())
|
||||
{
|
||||
if ((sftp->sft_shroff = share_open_check((char far *)fname, cu_psp, 0x02, /* read-write */
|
||||
0)) < 0) /* compatibility mode */
|
||||
return sftp->sft_shroff;
|
||||
}
|
||||
@ -712,9 +718,12 @@ COUNT DosCreatSft(BYTE * fname, COUNT attrib)
|
||||
sftp->sft_flags = drive;
|
||||
DosGetFile(fname, sftp->sft_name);
|
||||
return sft_idx;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */
|
||||
if (IsShareInstalled()) {
|
||||
if (IsShareInstalled())
|
||||
{
|
||||
share_close_file(sftp->sft_shroff);
|
||||
sftp->sft_shroff = -1;
|
||||
}
|
||||
@ -733,7 +742,8 @@ COUNT DosCreat(BYTE FAR * fname, COUNT attrib)
|
||||
return hndl;
|
||||
|
||||
result = truename(fname, PriPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
if (result != SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -780,7 +790,8 @@ COUNT DosDup(COUNT Handle)
|
||||
return NewHandle;
|
||||
|
||||
/* If everything looks ok, bump it up. */
|
||||
if ((Sftp->sft_flags & (SFT_FDEVICE | SFT_FSHARED)) || (Sftp->sft_status >= 0))
|
||||
if ((Sftp->sft_flags & (SFT_FDEVICE | SFT_FSHARED))
|
||||
|| (Sftp->sft_status >= 0))
|
||||
{
|
||||
p->ps_filetab[NewHandle] = p->ps_filetab[Handle];
|
||||
Sftp->sft_count += 1;
|
||||
@ -813,7 +824,8 @@ COUNT DosForceDup(COUNT OldHandle, COUNT NewHandle)
|
||||
}
|
||||
|
||||
/* If everything looks ok, bump it up. */
|
||||
if ((Sftp->sft_flags & (SFT_FDEVICE | SFT_FSHARED)) || (Sftp->sft_status >= 0))
|
||||
if ((Sftp->sft_flags & (SFT_FDEVICE | SFT_FSHARED))
|
||||
|| (Sftp->sft_status >= 0))
|
||||
{
|
||||
p->ps_filetab[NewHandle] = p->ps_filetab[OldHandle];
|
||||
|
||||
@ -855,22 +867,25 @@ COUNT DosOpenSft(BYTE * fname, COUNT mode)
|
||||
{
|
||||
sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */
|
||||
|
||||
|
||||
sftp->sft_count += 1;
|
||||
sftp->sft_flags =
|
||||
((dhp->dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF;
|
||||
fmemcpy(sftp->sft_name, (BYTE FAR *) SecPathName, FNAME_SIZE + FEXT_SIZE);
|
||||
((dhp->
|
||||
dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF;
|
||||
fmemcpy(sftp->sft_name, (BYTE FAR *) SecPathName,
|
||||
FNAME_SIZE + FEXT_SIZE);
|
||||
sftp->sft_dev = dhp;
|
||||
sftp->sft_date = dos_getdate();
|
||||
sftp->sft_time = dos_gettime();
|
||||
return sft_idx;
|
||||
}
|
||||
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV) {
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
lpCurSft = sftp;
|
||||
result = remote_open(sftp, mode);
|
||||
/* printf("open SFT %d = %p\n",sft_idx,sftp); */
|
||||
if (result == SUCCESS) {
|
||||
if (result == SUCCESS)
|
||||
{
|
||||
sftp->sft_count += 1;
|
||||
return sft_idx;
|
||||
}
|
||||
@ -878,19 +893,19 @@ COUNT DosOpenSft(BYTE * fname, COUNT mode)
|
||||
}
|
||||
|
||||
drive = get_verify_drive(fname);
|
||||
if (drive < 0) {
|
||||
if (drive < 0)
|
||||
{
|
||||
return drive;
|
||||
}
|
||||
|
||||
sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */
|
||||
|
||||
/* /// Added for SHARE. - Ron Cemer */
|
||||
if (IsShareInstalled()) {
|
||||
if (IsShareInstalled())
|
||||
{
|
||||
if ((sftp->sft_shroff = share_open_check
|
||||
((char far *)fname,
|
||||
(unsigned short)cu_psp,
|
||||
mode & 0x03,
|
||||
(mode >> 2) & 0x07)) < 0)
|
||||
(unsigned short)cu_psp, mode & 0x03, (mode >> 2) & 0x07)) < 0)
|
||||
return sftp->sft_shroff;
|
||||
}
|
||||
/* /// End of additions for SHARE. - Ron Cemer */
|
||||
@ -920,9 +935,12 @@ COUNT DosOpenSft(BYTE * fname, COUNT mode)
|
||||
sftp->sft_flags = drive;
|
||||
DosGetFile(fname, sftp->sft_name);
|
||||
return sft_idx;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */
|
||||
if (IsShareInstalled()) {
|
||||
if (IsShareInstalled())
|
||||
{
|
||||
share_close_file(sftp->sft_shroff);
|
||||
sftp->sft_shroff = -1;
|
||||
}
|
||||
@ -941,7 +959,8 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
|
||||
return hndl;
|
||||
|
||||
result = truename(fname, PriPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
if (result != SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -984,10 +1003,13 @@ COUNT DosCloseSft(WORD sft_idx)
|
||||
{
|
||||
if (sftp->sft_count > 0)
|
||||
return SUCCESS;
|
||||
else {
|
||||
else
|
||||
{
|
||||
/* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */
|
||||
if (IsShareInstalled()) {
|
||||
if (sftp->sft_shroff >= 0) share_close_file(sftp->sft_shroff);
|
||||
if (IsShareInstalled())
|
||||
{
|
||||
if (sftp->sft_shroff >= 0)
|
||||
share_close_file(sftp->sft_shroff);
|
||||
sftp->sft_shroff = -1;
|
||||
}
|
||||
/* /// End of additions for SHARE. - Ron Cemer */
|
||||
@ -1008,7 +1030,8 @@ COUNT DosClose(COUNT hndl)
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL DosGetFree(UBYTE drive, UCOUNT FAR * spc, UCOUNT FAR * navc, UCOUNT FAR * bps, UCOUNT FAR * nc)
|
||||
BOOL DosGetFree(UBYTE drive, UCOUNT FAR * spc, UCOUNT FAR * navc,
|
||||
UCOUNT FAR * bps, UCOUNT FAR * nc)
|
||||
{
|
||||
/* *nc==0xffff means: called from FatGetDrvData, fcbfns.c */
|
||||
struct dpb FAR *dpbp;
|
||||
@ -1073,7 +1096,8 @@ BOOL DosGetFree(UBYTE drive, UCOUNT FAR * spc, UCOUNT FAR * navc, UCOUNT FAR * b
|
||||
/* we shift ntotal until it is equal to or below 0xfff6 */
|
||||
cluster_size = (ULONG) dpbp->dpb_secsize << dpbp->dpb_shftcnt;
|
||||
ntotal = dpbp->dpb_xsize - 1;
|
||||
if (*nc != 0xffff) nfree = dos_free(dpbp);
|
||||
if (*nc != 0xffff)
|
||||
nfree = dos_free(dpbp);
|
||||
while (ntotal > FAT_MAGIC16 && cluster_size < 0x8000)
|
||||
{
|
||||
cluster_size <<= 1;
|
||||
@ -1092,9 +1116,11 @@ BOOL DosGetFree(UBYTE drive, UCOUNT FAR * spc, UCOUNT FAR * navc, UCOUNT FAR * b
|
||||
#endif
|
||||
/* a passed nc of 0xffff means: skip free; see FatGetDrvData
|
||||
fcbfns.c */
|
||||
if (*nc != 0xffff) *navc = (COUNT)dos_free(dpbp);
|
||||
if (*nc != 0xffff)
|
||||
*navc = (COUNT) dos_free(dpbp);
|
||||
*nc = dpbp->dpb_size - 1;
|
||||
if (*spc > 64) {
|
||||
if (*spc > 64)
|
||||
{
|
||||
/* fake for 64k clusters do confuse some DOS programs, but let
|
||||
others work without overflowing */
|
||||
*spc >>= 1;
|
||||
@ -1118,7 +1144,8 @@ COUNT DosGetExtFree(BYTE FAR *DriveString, struct xfreespace FAR *xfsp)
|
||||
|| DriveString[1] != ':')
|
||||
return DE_INVLDDRV;
|
||||
drive = DosUpFChar(*DriveString) - 'A';
|
||||
if (drive >= lastdrive) return DE_INVLDDRV;
|
||||
if (drive >= lastdrive)
|
||||
return DE_INVLDDRV;
|
||||
|
||||
cdsp = &CDSp->cds_table[drive];
|
||||
|
||||
@ -1133,12 +1160,15 @@ COUNT DosGetExtFree(BYTE FAR *DriveString, struct xfreespace FAR *xfsp)
|
||||
xfsp->xfs_totalclusters = rg[1];
|
||||
xfsp->xfs_secsize = rg[2];
|
||||
xfsp->xfs_freeclusters = rg[3];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
dpbp = CDSp->cds_table[drive].cdsDpb;
|
||||
if (dpbp == NULL || media_check(dpbp) < 0)
|
||||
return DE_INVLDDRV;
|
||||
xfsp->xfs_secsize = dpbp->dpb_secsize;
|
||||
xfsp->xfs_totalclusters = (ISFAT32(dpbp) ? dpbp->dpb_xsize : dpbp->dpb_size);
|
||||
xfsp->xfs_totalclusters =
|
||||
(ISFAT32(dpbp) ? dpbp->dpb_xsize : dpbp->dpb_size);
|
||||
xfsp->xfs_freeclusters = dos_free(dpbp);
|
||||
xfsp->xfs_clussize = dpbp->dpb_clsmask + 1;
|
||||
}
|
||||
@ -1162,7 +1192,8 @@ COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s)
|
||||
drive = (drive == 0 ? default_drive : drive - 1);
|
||||
|
||||
/* first check for valid drive */
|
||||
if (drive >= lastdrive || !(CDSp->cds_table[drive].cdsFlags & CDSVALID)) {
|
||||
if (drive >= lastdrive || !(CDSp->cds_table[drive].cdsFlags & CDSVALID))
|
||||
{
|
||||
return DE_INVLDDRV;
|
||||
}
|
||||
|
||||
@ -1189,15 +1220,15 @@ COUNT DosChangeDir(BYTE FAR * s)
|
||||
if (*p == '*' || *p == '?')
|
||||
return DE_PATHNOTFND;
|
||||
|
||||
|
||||
|
||||
drive = get_verify_drive(s);
|
||||
if (drive < 0 ) {
|
||||
if (drive < 0)
|
||||
{
|
||||
return drive;
|
||||
}
|
||||
|
||||
result = truename(s, PriPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
if (result != SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1277,7 +1308,8 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
||||
memset(SearchDir.dir_name, ' ', FNAME_SIZE + FEXT_SIZE);
|
||||
for (i = 0; i < FNAME_SIZE && *p && *p != '.'; i++)
|
||||
SearchDir.dir_name[i] = *p++;
|
||||
if (*p == '.') p++;
|
||||
if (*p == '.')
|
||||
p++;
|
||||
for (i = 0; i < FEXT_SIZE && *p && *p != '.'; i++)
|
||||
SearchDir.dir_ext[i] = *p++;
|
||||
pop_dmp(dmp);
|
||||
@ -1303,7 +1335,8 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
||||
|
||||
fmemcpy(dta, TempBuffer, 21);
|
||||
pop_dmp((dmatch FAR *) dta);
|
||||
if (rc != SUCCESS) ((dmatch FAR *)dta)->dm_attr_fnd = D_DEVICE; /* mark invalid */
|
||||
if (rc != SUCCESS)
|
||||
((dmatch FAR *) dta)->dm_attr_fnd = D_DEVICE; /* mark invalid */
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -1334,16 +1367,14 @@ COUNT DosFindNext(void)
|
||||
* (12h, DE_NFILES)
|
||||
*/
|
||||
#if 0
|
||||
printf("findnext: %d\n",
|
||||
((dmatch FAR *)dta)->dm_drive);
|
||||
printf("findnext: %d\n", ((dmatch FAR *) dta)->dm_drive);
|
||||
#endif
|
||||
fmemcpy(TempBuffer, dta, 21);
|
||||
fmemset(dta, 0, sizeof(dmatch));
|
||||
p = dta;
|
||||
dta = (BYTE FAR *) TempBuffer;
|
||||
rc = (((dmatch *) TempBuffer)->dm_drive & 0x80) ?
|
||||
remote_findnext((VOID FAR *)current_ldt) :
|
||||
dos_findnext();
|
||||
remote_findnext((VOID FAR *) current_ldt) : dos_findnext();
|
||||
|
||||
dta = p;
|
||||
fmemcpy(dta, TempBuffer, 21);
|
||||
@ -1407,17 +1438,20 @@ COUNT DosGetFattr(BYTE FAR * name)
|
||||
{
|
||||
COUNT result, drive;
|
||||
|
||||
if (IsDevice(name)) {
|
||||
if (IsDevice(name))
|
||||
{
|
||||
return DE_FILENOTFND;
|
||||
}
|
||||
|
||||
drive = get_verify_drive(name);
|
||||
if (drive < 0) {
|
||||
if (drive < 0)
|
||||
{
|
||||
return drive;
|
||||
}
|
||||
|
||||
result = truename(name, PriPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
if (result != SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1426,7 +1460,8 @@ COUNT DosGetFattr(BYTE FAR * name)
|
||||
if ((PriPathName[0] != '\0')
|
||||
&& (PriPathName[1] == ':')
|
||||
&& ((PriPathName[2] == '/') || (PriPathName[2] == '\\'))
|
||||
&& (PriPathName[3] == '\0') ) {
|
||||
&& (PriPathName[3] == '\0'))
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
@ -1435,7 +1470,8 @@ COUNT DosGetFattr(BYTE FAR * name)
|
||||
{
|
||||
return remote_getfattr();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
/* /// Use truename()'s result, which we already have in PriPathName.
|
||||
I copy it to tmp_name because PriPathName is global and seems
|
||||
to get trashed somewhere in transit.
|
||||
@ -1473,17 +1509,20 @@ COUNT DosSetFattr(BYTE FAR * name, UWORD attrp)
|
||||
{
|
||||
COUNT result, drive;
|
||||
|
||||
if (IsDevice(name) ) {
|
||||
if (IsDevice(name))
|
||||
{
|
||||
return DE_FILENOTFND;
|
||||
}
|
||||
|
||||
drive = get_verify_drive(name);
|
||||
if (drive < 0) {
|
||||
if (drive < 0)
|
||||
{
|
||||
return drive;
|
||||
}
|
||||
|
||||
result = truename(name, PriPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
if (result != SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1492,7 +1531,8 @@ COUNT DosSetFattr(BYTE FAR * name, UWORD attrp)
|
||||
{
|
||||
return remote_setfattr(attrp);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
/* /// Use truename()'s result, which we already have in PriPathName.
|
||||
I copy it to tmp_name because PriPathName is global and seems
|
||||
to get trashed somewhere in transit.
|
||||
@ -1528,22 +1568,28 @@ COUNT DosDelete(BYTE FAR *path)
|
||||
{
|
||||
COUNT result, drive;
|
||||
|
||||
if (IsDevice(path)) {
|
||||
if (IsDevice(path))
|
||||
{
|
||||
return DE_FILENOTFND;
|
||||
}
|
||||
|
||||
drive = get_verify_drive(path);
|
||||
if (drive < 0) {
|
||||
if (drive < 0)
|
||||
{
|
||||
return drive;
|
||||
}
|
||||
result = truename(path, PriPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
if (result != SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
current_ldt = &CDSp->cds_table[drive];
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV) {
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
return remote_delete();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return dos_delete(PriPathName);
|
||||
}
|
||||
}
|
||||
@ -1552,19 +1598,24 @@ COUNT DosRenameTrue(BYTE * path1, BYTE * path2)
|
||||
{
|
||||
COUNT drive1, drive2;
|
||||
|
||||
if (IsDevice(path1) || IsDevice(path2)) {
|
||||
if (IsDevice(path1) || IsDevice(path2))
|
||||
{
|
||||
return DE_FILENOTFND;
|
||||
}
|
||||
|
||||
drive1 = get_verify_drive(path1);
|
||||
drive2 = get_verify_drive(path2);
|
||||
if ((drive1 != drive2) || (drive1 < 0)) {
|
||||
if ((drive1 != drive2) || (drive1 < 0))
|
||||
{
|
||||
return DE_INVLDDRV;
|
||||
}
|
||||
current_ldt = &CDSp->cds_table[drive1];
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV) {
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
return remote_rename();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return dos_rename(PriPathName, SecPathName);
|
||||
}
|
||||
}
|
||||
@ -1574,12 +1625,14 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2)
|
||||
COUNT result;
|
||||
|
||||
result = truename(path1, PriPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
if (result != SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
result = truename(path2, SecPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
if (result != SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1590,22 +1643,28 @@ COUNT DosMkdir(BYTE FAR * dir)
|
||||
{
|
||||
COUNT result, drive;
|
||||
|
||||
if (IsDevice(dir)) {
|
||||
if (IsDevice(dir))
|
||||
{
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
|
||||
drive = get_verify_drive(dir);
|
||||
if (drive < 0) {
|
||||
if (drive < 0)
|
||||
{
|
||||
return drive;
|
||||
}
|
||||
result = truename(dir, PriPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
if (result != SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
current_ldt = &CDSp->cds_table[drive];
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV) {
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
return remote_mkdir();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return dos_mkdir(PriPathName);
|
||||
}
|
||||
}
|
||||
@ -1614,22 +1673,28 @@ COUNT DosRmdir(BYTE FAR * dir)
|
||||
{
|
||||
COUNT result, drive;
|
||||
|
||||
if (IsDevice(dir)) {
|
||||
if (IsDevice(dir))
|
||||
{
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
|
||||
drive = get_verify_drive(dir);
|
||||
if (drive < 0) {
|
||||
if (drive < 0)
|
||||
{
|
||||
return drive;
|
||||
}
|
||||
result = truename(dir, PriPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
if (result != SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
current_ldt = &CDSp->cds_table[drive];
|
||||
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
|
||||
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
return remote_rmdir();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return dos_rmdir(PriPathName);
|
||||
}
|
||||
}
|
||||
@ -1641,13 +1706,16 @@ COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock)
|
||||
sft FAR *s;
|
||||
|
||||
/* Invalid function unless SHARE is installed. */
|
||||
if (!IsShareInstalled()) return DE_INVLDFUNC;
|
||||
if (!IsShareInstalled())
|
||||
return DE_INVLDFUNC;
|
||||
|
||||
/* Get the SFT block that contains the SFT */
|
||||
if ((s = get_sft(hndl)) == (sft FAR *) -1) return DE_INVLDHNDL;
|
||||
if ((s = get_sft(hndl)) == (sft FAR *) - 1)
|
||||
return DE_INVLDHNDL;
|
||||
|
||||
/* Lock violation if this SFT entry does not support locking. */
|
||||
if (s->sft_shroff < 0) return DE_LOCK;
|
||||
if (s->sft_shroff < 0)
|
||||
return DE_LOCK;
|
||||
|
||||
/* Let SHARE do the work. */
|
||||
return share_lock_unlock(cu_psp, s->sft_shroff, pos, len, unlock);
|
||||
@ -1691,7 +1759,8 @@ struct dhdr FAR * IsDevice(BYTE FAR * fname)
|
||||
{
|
||||
*/
|
||||
|
||||
for (dhp = (struct dhdr FAR *)&nul_dev; dhp != (struct dhdr FAR *)-1; dhp = dhp->dh_next)
|
||||
for (dhp = (struct dhdr FAR *)&nul_dev; dhp != (struct dhdr FAR *)-1;
|
||||
dhp = dhp->dh_next)
|
||||
{
|
||||
|
||||
/* BUGFIX: MSCD000<00> should be handled like MSCD000<20> TE */
|
||||
@ -1704,7 +1773,9 @@ struct dhdr FAR * IsDevice(BYTE FAR * fname)
|
||||
|
||||
fmemcpy(dev_name_buff, dhp->dh_name, min(namelen, FNAME_SIZE));
|
||||
|
||||
if (fnmatch((BYTE FAR *) tmpPathName, (BYTE FAR *) dev_name_buff, FNAME_SIZE, FALSE))
|
||||
if (fnmatch
|
||||
((BYTE FAR *) tmpPathName, (BYTE FAR *) dev_name_buff, FNAME_SIZE,
|
||||
FALSE))
|
||||
{
|
||||
memcpy(SecPathName, tmpPathName, i + 1);
|
||||
return dhp;
|
||||
@ -1714,11 +1785,12 @@ struct dhdr FAR * IsDevice(BYTE FAR * fname)
|
||||
return (struct dhdr FAR *)0;
|
||||
}
|
||||
|
||||
|
||||
/* /// Added for SHARE. - Ron Cemer */
|
||||
|
||||
BOOL IsShareInstalled(void) {
|
||||
if (!share_installed) {
|
||||
BOOL IsShareInstalled(void)
|
||||
{
|
||||
if (!share_installed)
|
||||
{
|
||||
iregs regs;
|
||||
|
||||
regs.a.x = 0x1000;
|
||||
@ -1734,11 +1806,11 @@ BOOL IsShareInstalled(void) {
|
||||
error. If < 0 is returned, it is the negated error return
|
||||
code, so DOS simply negates this value and returns it in
|
||||
AX. */
|
||||
static int share_open_check
|
||||
(char far *filename, /* far pointer to fully qualified filename */
|
||||
static int share_open_check(char far * filename, /* far pointer to fully qualified filename */
|
||||
unsigned short pspseg, /* psp segment address of owner process */
|
||||
int openmode, /* 0=read-only, 1=write-only, 2=read-write */
|
||||
int sharemode) { /* SHARE_COMPAT, etc... */
|
||||
int sharemode)
|
||||
{ /* SHARE_COMPAT, etc... */
|
||||
iregs regs;
|
||||
|
||||
regs.a.x = 0x10a0;
|
||||
@ -1753,8 +1825,8 @@ static int share_open_check
|
||||
|
||||
/* DOS calls this to record the fact that it has successfully
|
||||
closed a file, or the fact that the open for this file failed. */
|
||||
static void share_close_file
|
||||
(int fileno) { /* file_table entry number */
|
||||
static void share_close_file(int fileno)
|
||||
{ /* file_table entry number */
|
||||
iregs regs;
|
||||
|
||||
regs.a.x = 0x10a1;
|
||||
@ -1773,12 +1845,12 @@ static void share_close_file
|
||||
generates a critical error (if allowcriter is non-zero).
|
||||
If non-zero is returned, it is the negated return value for
|
||||
the DOS call. */
|
||||
static int share_access_check
|
||||
(unsigned short pspseg,/* psp segment address of owner process */
|
||||
static int share_access_check(unsigned short pspseg, /* psp segment address of owner process */
|
||||
int fileno, /* file_table entry number */
|
||||
unsigned long ofs, /* offset into file */
|
||||
unsigned long len, /* length (in bytes) of region to access */
|
||||
int allowcriter) { /* allow a critical error to be generated */
|
||||
int allowcriter)
|
||||
{ /* allow a critical error to be generated */
|
||||
iregs regs;
|
||||
|
||||
regs.a.x = 0x10a2 | (allowcriter ? 0x01 : 0x00);
|
||||
@ -1797,12 +1869,12 @@ static int share_access_check
|
||||
returns non-zero.
|
||||
If the return value is non-zero, it is the negated error
|
||||
return code for the DOS 0x5c call. */
|
||||
static int share_lock_unlock
|
||||
(unsigned short pspseg,/* psp segment address of owner process */
|
||||
static int share_lock_unlock(unsigned short pspseg, /* psp segment address of owner process */
|
||||
int fileno, /* file_table entry number */
|
||||
unsigned long ofs, /* offset into file */
|
||||
unsigned long len, /* length (in bytes) of region to lock or unlock */
|
||||
int unlock) { /* non-zero to unlock; zero to lock */
|
||||
int unlock)
|
||||
{ /* non-zero to unlock; zero to lock */
|
||||
iregs regs;
|
||||
|
||||
regs.a.x = 0x10a4 | (unlock ? 0x01 : 0x00);
|
||||
@ -1905,4 +1977,3 @@ static int share_lock_unlock
|
||||
* Rev 1.0 02 Jul 1995 8:04:20 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
@ -31,7 +31,8 @@
|
||||
#include "portab.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *dosnamesRcsId = "$Id$";
|
||||
static BYTE *dosnamesRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#include "globals.h"
|
||||
@ -79,16 +80,10 @@ VOID SpacePad(BYTE * szString, COUNT nChars)
|
||||
COUNT ParseDosName(BYTE * lpszFileName,
|
||||
COUNT * pnDrive,
|
||||
BYTE * pszDir,
|
||||
BYTE * pszFile,
|
||||
BYTE * pszExt,
|
||||
BOOL bAllowWildcards)
|
||||
BYTE * pszFile, BYTE * pszExt, BOOL bAllowWildcards)
|
||||
{
|
||||
COUNT nDirCnt,
|
||||
nFileCnt,
|
||||
nExtCnt;
|
||||
BYTE *lpszLclDir,
|
||||
*lpszLclFile,
|
||||
*lpszLclExt;
|
||||
COUNT nDirCnt, nFileCnt, nExtCnt;
|
||||
BYTE *lpszLclDir, *lpszLclFile, *lpszLclExt;
|
||||
|
||||
/* Initialize the users data fields */
|
||||
if (pszDir)
|
||||
@ -123,7 +118,8 @@ COUNT ParseDosName(BYTE * lpszFileName,
|
||||
|
||||
/* Parse out the file name portion. */
|
||||
lpszFileName = lpszLclFile;
|
||||
while (bAllowWildcards ? WildChar(*lpszFileName) : NameChar(*lpszFileName))
|
||||
while (bAllowWildcards ? WildChar(*lpszFileName) :
|
||||
NameChar(*lpszFileName))
|
||||
{
|
||||
++nFileCnt;
|
||||
++lpszFileName;
|
||||
@ -151,7 +147,6 @@ COUNT ParseDosName(BYTE * lpszFileName,
|
||||
else
|
||||
return DE_FILENOTFND;
|
||||
|
||||
|
||||
/* Now we have pointers set to the directory portion and the */
|
||||
/* file portion. Now determine the existance of an extension. */
|
||||
lpszLclExt = lpszFileName;
|
||||
@ -160,12 +155,14 @@ COUNT ParseDosName(BYTE * lpszFileName,
|
||||
lpszLclExt = ++lpszFileName;
|
||||
while (*lpszFileName)
|
||||
{
|
||||
if (bAllowWildcards ? WildChar(*lpszFileName) : NameChar(*lpszFileName))
|
||||
if (bAllowWildcards ? WildChar(*lpszFileName) :
|
||||
NameChar(*lpszFileName))
|
||||
{
|
||||
++nExtCnt;
|
||||
++lpszFileName;
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
return DE_FILENOTFND;
|
||||
}
|
||||
}
|
||||
@ -199,14 +196,10 @@ COUNT ParseDosName(BYTE * lpszFileName,
|
||||
#if 0
|
||||
/* not necessary anymore because of truename */
|
||||
COUNT ParseDosPath(BYTE * lpszFileName,
|
||||
COUNT * pnDrive,
|
||||
BYTE * pszDir,
|
||||
BYTE * pszCurPath)
|
||||
COUNT * pnDrive, BYTE * pszDir, BYTE * pszCurPath)
|
||||
{
|
||||
COUNT nDirCnt,
|
||||
nPathCnt;
|
||||
BYTE *lpszLclDir,
|
||||
*pszBase = pszDir;
|
||||
COUNT nDirCnt, nPathCnt;
|
||||
BYTE *lpszLclDir, *pszBase = pszDir;
|
||||
|
||||
/* Initialize the users data fields */
|
||||
*pszDir = '\0';
|
||||
@ -237,10 +230,10 @@ COUNT ParseDosPath(BYTE * lpszFileName,
|
||||
lpszLclDir = lpszFileName;
|
||||
if (!PathSep(*lpszLclDir))
|
||||
{
|
||||
fstrncpy(pszDir, pszCurPath, PARSE_MAX - 1); /*TE*/
|
||||
nPathCnt = fstrlen(pszCurPath);
|
||||
if (!PathSep(pszDir[nPathCnt - 1]) && nPathCnt < PARSE_MAX - 1) /*TE*/
|
||||
pszDir[nPathCnt++] = '\\';
|
||||
fstrncpy(pszDir, pszCurPath, PARSE_MAX - 1);
|
||||
/*TE*/ nPathCnt = fstrlen(pszCurPath);
|
||||
if (!PathSep(pszDir[nPathCnt - 1]) && nPathCnt < PARSE_MAX - 1)
|
||||
/*TE*/ pszDir[nPathCnt++] = '\\';
|
||||
if (nPathCnt > PARSE_MAX)
|
||||
nPathCnt = PARSE_MAX;
|
||||
pszDir += nPathCnt;
|
||||
@ -248,16 +241,15 @@ COUNT ParseDosPath(BYTE * lpszFileName,
|
||||
|
||||
/* Now see how long a directory component we have. */
|
||||
while (NameChar(*lpszFileName)
|
||||
|| PathSep(*lpszFileName)
|
||||
|| '.' == *lpszFileName)
|
||||
|| PathSep(*lpszFileName) || '.' == *lpszFileName)
|
||||
{
|
||||
++nDirCnt;
|
||||
++lpszFileName;
|
||||
}
|
||||
|
||||
/* Fix lengths to maximums allowed by MS-DOS. */
|
||||
if ((nDirCnt + nPathCnt) > PARSE_MAX - 1) /*TE*/
|
||||
nDirCnt = PARSE_MAX - 1 - nPathCnt;
|
||||
if ((nDirCnt + nPathCnt) > PARSE_MAX - 1)
|
||||
/*TE*/ nDirCnt = PARSE_MAX - 1 - nPathCnt;
|
||||
|
||||
/* Finally copy whatever the user wants extracted to the user's */
|
||||
/* buffers. */
|
||||
@ -289,11 +281,8 @@ COUNT ParseDosPath(BYTE * lpszFileName,
|
||||
|
||||
VOID DosTrimPath(BYTE * lpszPathNamep)
|
||||
{
|
||||
BYTE *lpszLast,
|
||||
*lpszNext,
|
||||
*lpszRoot = NULL;
|
||||
COUNT nChars,
|
||||
flDotDot;
|
||||
BYTE *lpszLast, *lpszNext, *lpszRoot = NULL;
|
||||
COUNT nChars, flDotDot;
|
||||
|
||||
/* First, convert all '/' to '\'. Look for root as we scan */
|
||||
if (*lpszPathNamep == '\\')
|
||||
@ -302,8 +291,7 @@ VOID DosTrimPath(BYTE * lpszPathNamep)
|
||||
{
|
||||
if (*lpszNext == '/')
|
||||
*lpszNext = '\\';
|
||||
if (!lpszRoot &&
|
||||
*lpszNext == ':' && *(lpszNext + 1) == '\\')
|
||||
if (!lpszRoot && *lpszNext == ':' && *(lpszNext + 1) == '\\')
|
||||
lpszRoot = lpszNext + 1;
|
||||
}
|
||||
|
||||
@ -325,8 +313,7 @@ VOID DosTrimPath(BYTE * lpszPathNamep)
|
||||
/* as appropriate. */
|
||||
else if (*(lpszNext + 1) == '.')
|
||||
{
|
||||
if (*(lpszNext + 2) == '.'
|
||||
&& !(*(lpszNext + 3)))
|
||||
if (*(lpszNext + 2) == '.' && !(*(lpszNext + 3)))
|
||||
{
|
||||
/* At the end, just truncate */
|
||||
/* and exit. */
|
||||
@ -337,8 +324,7 @@ VOID DosTrimPath(BYTE * lpszPathNamep)
|
||||
return;
|
||||
}
|
||||
|
||||
if (*(lpszNext + 2) == '.'
|
||||
&& *(lpszNext + 3) == '\\')
|
||||
if (*(lpszNext + 2) == '.' && *(lpszNext + 3) == '\\')
|
||||
{
|
||||
fstrncpy(lpszLast, lpszNext + 3, NAMEMAX);
|
||||
/* bump back to the last */
|
||||
@ -351,8 +337,7 @@ VOID DosTrimPath(BYTE * lpszPathNamep)
|
||||
{
|
||||
--lpszLast;
|
||||
}
|
||||
while (lpszLast != lpszPathNamep
|
||||
&& *lpszLast != '\\');
|
||||
while (lpszLast != lpszPathNamep && *lpszLast != '\\');
|
||||
flDotDot = TRUE;
|
||||
}
|
||||
/* Note: we skip strange stuff that */
|
||||
@ -460,4 +445,3 @@ VOID DosTrimPath(BYTE * lpszPathNamep)
|
||||
* Initial revision.
|
||||
*
|
||||
*/
|
||||
|
||||
|
204
kernel/dsk.c
204
kernel/dsk.c
@ -29,7 +29,8 @@
|
||||
#include "dyndata.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *dskRcsId = "$Id$";
|
||||
static BYTE *dskRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG)
|
||||
@ -40,9 +41,6 @@ static BYTE *dskRcsId = "$Id$";
|
||||
|
||||
/* #define STATIC */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef PROTO
|
||||
BOOL ASMCFUNC fl_reset(WORD);
|
||||
COUNT ASMCFUNC fl_readdasd(WORD);
|
||||
@ -58,7 +56,8 @@ COUNT ASMCFUNC fl_setmediatype(WORD, WORD, WORD);
|
||||
VOID ASMCFUNC fl_readkey(VOID);
|
||||
|
||||
extern COUNT ASMCFUNC fl_lba_ReadWrite(BYTE drive, WORD mode,
|
||||
struct _bios_LBA_address_packet FAR *dap_p);
|
||||
struct _bios_LBA_address_packet FAR
|
||||
* dap_p);
|
||||
|
||||
int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer,
|
||||
ULONG LBA_address, unsigned total, UWORD * transferred);
|
||||
@ -82,8 +81,6 @@ extern BYTE FAR nblk_rel;
|
||||
|
||||
extern int FAR ASMCFUNC Get_nblk_rel(void);
|
||||
|
||||
|
||||
|
||||
#define LBA_READ 0x4200
|
||||
#define LBA_WRITE 0x4300
|
||||
UWORD LBA_WRITE_VERIFY = 0x4302;
|
||||
@ -98,14 +95,12 @@ UWORD LBA_WRITE_VERIFY = 0x4302;
|
||||
*/
|
||||
UBYTE DiskTransferBuffer[1 * SEC_SIZE];
|
||||
|
||||
static struct Access_info
|
||||
{
|
||||
static struct Access_info {
|
||||
BYTE AI_spec;
|
||||
BYTE AI_Flag;
|
||||
};
|
||||
|
||||
struct FS_info
|
||||
{
|
||||
struct FS_info {
|
||||
ULONG serialno;
|
||||
BYTE volume[11];
|
||||
BYTE fstype[8];
|
||||
@ -114,7 +109,10 @@ struct FS_info
|
||||
extern struct DynS Dyn;
|
||||
|
||||
/*TE - array access functions */
|
||||
ddt *getddt(int dev) { return &(((ddt*)Dyn.Buffer)[dev]);}
|
||||
ddt *getddt(int dev)
|
||||
{
|
||||
return &(((ddt *) Dyn.Buffer)[dev]);
|
||||
}
|
||||
|
||||
#define N_PART 4 /* number of partitions per
|
||||
table partition */
|
||||
@ -123,7 +121,6 @@ COUNT nUnits; /* number of returned units */
|
||||
|
||||
#define PARTOFF 0x1be
|
||||
|
||||
|
||||
#ifdef PROTO
|
||||
WORD
|
||||
_dsk_init(rqptr rq, ddt * pddt),
|
||||
@ -138,8 +135,7 @@ WORD
|
||||
blk_Close(rqptr rq, ddt * pddt),
|
||||
blk_Media(rqptr rq, ddt * pddt),
|
||||
blk_noerr(rqptr rq, ddt * pddt),
|
||||
blk_nondr (rqptr rq, ddt *pddt),
|
||||
blk_error (rqptr rq, ddt *pddt);
|
||||
blk_nondr(rqptr rq, ddt * pddt), blk_error(rqptr rq, ddt * pddt);
|
||||
WORD dskerr(COUNT);
|
||||
#else
|
||||
WORD _dsk_init(),
|
||||
@ -151,11 +147,7 @@ WORD _dsk_init(),
|
||||
Getlogdev(),
|
||||
Setlogdev(),
|
||||
blk_Open(),
|
||||
blk_Close(),
|
||||
blk_Media(),
|
||||
blk_noerr(),
|
||||
blk_nondr(),
|
||||
blk_error();
|
||||
blk_Close(), blk_Media(), blk_noerr(), blk_nondr(), blk_error();
|
||||
WORD dskerr();
|
||||
#endif
|
||||
|
||||
@ -197,20 +189,12 @@ static WORD(*dispatch[NENTRY]) () =
|
||||
IoctlQueblk /* Ioctl Query */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define hd(x) ((x) & DF_FIXED)
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* F U N C T I O N S --------------------------------------------------- */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
|
||||
COUNT FAR ASMCFUNC blk_driver(rqptr rp)
|
||||
{
|
||||
if (rp->r_unit >= nUnits && rp->r_command != C_INIT)
|
||||
@ -392,10 +376,12 @@ static WORD getbpb(ddt *pddt)
|
||||
if (ret != 0)
|
||||
return (dskerr(ret));
|
||||
|
||||
getword(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[0]), &pbpbarray->bpb_nbyte);
|
||||
getword(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[0]),
|
||||
&pbpbarray->bpb_nbyte);
|
||||
|
||||
if (DiskTransferBuffer[0x1fe]!=0x55 || DiskTransferBuffer[0x1ff]!=0xaa ||
|
||||
pbpbarray->bpb_nbyte != 512) {
|
||||
if (DiskTransferBuffer[0x1fe] != 0x55
|
||||
|| DiskTransferBuffer[0x1ff] != 0xaa || pbpbarray->bpb_nbyte != 512)
|
||||
{
|
||||
/* copy default bpb to be sure that there is no bogus data */
|
||||
memcpy(pbpbarray, &pddt->ddt_defbpb, sizeof(bpb));
|
||||
return S_DONE;
|
||||
@ -421,24 +407,27 @@ static WORD getbpb(ddt *pddt)
|
||||
if (pbpbarray->bpb_nfsect != 0)
|
||||
{
|
||||
/* FAT16/FAT12 boot sector */
|
||||
getlong(&((((BYTE *) & DiskTransferBuffer[0x27])[0])), &pddt->ddt_serialno);
|
||||
getlong(&((((BYTE *) & DiskTransferBuffer[0x27])[0])),
|
||||
&pddt->ddt_serialno);
|
||||
memcpy(pddt->ddt_volume, &DiskTransferBuffer[0x2B], 11);
|
||||
memcpy(pddt->ddt_fstype, &DiskTransferBuffer[0x36], 8);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FAT32 boot sector */
|
||||
getlong(&((((BYTE *) & DiskTransferBuffer[0x43])[0])), &pddt->ddt_serialno);
|
||||
getlong(&((((BYTE *) & DiskTransferBuffer[0x43])[0])),
|
||||
&pddt->ddt_serialno);
|
||||
memcpy(pddt->ddt_volume, &DiskTransferBuffer[0x47], 11);
|
||||
memcpy(pddt->ddt_fstype, &DiskTransferBuffer[0x52], 8);
|
||||
pbpbarray->bpb_ndirent = 512;
|
||||
}
|
||||
#else
|
||||
getlong(&((((BYTE *) & DiskTransferBuffer[0x27])[0])), &pddt->ddt_serialno);
|
||||
getlong(&((((BYTE *) & DiskTransferBuffer[0x27])[0])),
|
||||
&pddt->ddt_serialno);
|
||||
memcpy(pddt->ddt_volume, &DiskTransferBuffer[0x2B], 11);
|
||||
memcpy(pddt->ddt_fstype, &DiskTransferBuffer[0x36], 8);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef DSK_DEBUG
|
||||
printf("BPB_NBYTE = %04x\n", pbpbarray->bpb_nbyte);
|
||||
printf("BPB_NSECTOR = %02x\n", pbpbarray->bpb_nsector);
|
||||
@ -452,8 +441,7 @@ static WORD getbpb(ddt *pddt)
|
||||
|
||||
count =
|
||||
pbpbarray->bpb_nsize == 0 ?
|
||||
pbpbarray->bpb_huge :
|
||||
pbpbarray->bpb_nsize;
|
||||
pbpbarray->bpb_huge : pbpbarray->bpb_nsize;
|
||||
head = pbpbarray->bpb_nheads;
|
||||
sector = pbpbarray->bpb_nsecs;
|
||||
|
||||
@ -476,7 +464,6 @@ static WORD getbpb(ddt *pddt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
STATIC WORD bldbpb(rqptr rp, ddt * pddt)
|
||||
{
|
||||
WORD result;
|
||||
@ -488,12 +475,12 @@ STATIC WORD bldbpb(rqptr rp, ddt *pddt)
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
|
||||
static WORD IoctlQueblk(rqptr rp, ddt * pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
|
||||
switch(rp->r_count){
|
||||
switch (rp->r_count)
|
||||
{
|
||||
case 0x0846:
|
||||
case 0x0847:
|
||||
case 0x0860:
|
||||
@ -507,8 +494,8 @@ static WORD IoctlQueblk(rqptr rp, ddt *pddt)
|
||||
|
||||
}
|
||||
|
||||
COUNT Genblockio(ddt *pddt, UWORD mode, WORD head, WORD track, WORD sector,
|
||||
WORD count, VOID FAR *buffer)
|
||||
COUNT Genblockio(ddt * pddt, UWORD mode, WORD head, WORD track,
|
||||
WORD sector, WORD count, VOID FAR * buffer)
|
||||
{
|
||||
UWORD transferred;
|
||||
|
||||
@ -516,8 +503,7 @@ COUNT Genblockio(ddt *pddt, UWORD mode, WORD head, WORD track, WORD sector,
|
||||
return LBA_Transfer(pddt, mode, buffer,
|
||||
((ULONG) track * pddt->ddt_bpb.bpb_nheads + head) *
|
||||
(ULONG) pddt->ddt_bpb.bpb_nsecs +
|
||||
pddt->ddt_offset + sector,
|
||||
count, &transferred);
|
||||
pddt->ddt_offset + sector, count, &transferred);
|
||||
}
|
||||
|
||||
STATIC WORD Genblkdev(rqptr rp, ddt * pddt)
|
||||
@ -527,13 +513,15 @@ STATIC WORD Genblkdev(rqptr rp,ddt *pddt)
|
||||
#ifdef WITHFAT32
|
||||
int extended = 0;
|
||||
|
||||
if ((rp->r_count >> 8) == 0x48) extended = 1;
|
||||
if ((rp->r_count >> 8) == 0x48)
|
||||
extended = 1;
|
||||
else
|
||||
#endif
|
||||
if ((rp->r_count >> 8) != 8)
|
||||
return failure(E_CMD);
|
||||
|
||||
switch(rp->r_count & 0xff){
|
||||
switch (rp->r_count & 0xff)
|
||||
{
|
||||
case 0x40: /* set device parameters */
|
||||
{
|
||||
struct gblkio FAR *gblp = (struct gblkio FAR *)rp->r_trans;
|
||||
@ -544,9 +532,12 @@ STATIC WORD Genblkdev(rqptr rp,ddt *pddt)
|
||||
| (DF_DPCHANGED | DF_REFORMAT);
|
||||
pddt->ddt_ncyl = gblp->gbio_ncyl;
|
||||
/* use default dpb or current bpb? */
|
||||
pbpb = (gblp->gbio_spcfunbit & 0x01) == 0 ? &pddt->ddt_defbpb : &pddt->ddt_bpb;
|
||||
pbpb =
|
||||
(gblp->gbio_spcfunbit & 0x01) ==
|
||||
0 ? &pddt->ddt_defbpb : &pddt->ddt_bpb;
|
||||
#ifdef WITHFAT32
|
||||
if (!extended) fmemcpy(pbpb, &gblp->gbio_bpb, BPB_SIZEOF);
|
||||
if (!extended)
|
||||
fmemcpy(pbpb, &gblp->gbio_bpb, BPB_SIZEOF);
|
||||
else
|
||||
#endif
|
||||
fmemcpy(pbpb, &gblp->gbio_bpb, sizeof(gblp->gbio_bpb));
|
||||
@ -566,7 +557,9 @@ STATIC WORD Genblkdev(rqptr rp,ddt *pddt)
|
||||
{
|
||||
struct gblkfv FAR *fv = (struct gblkfv FAR *)rp->r_trans;
|
||||
COUNT tracks;
|
||||
struct thst {UBYTE track, head, sector, type;} *addrfield, afentry;
|
||||
struct thst {
|
||||
UBYTE track, head, sector, type;
|
||||
} *addrfield, afentry;
|
||||
|
||||
if (hd(pddt->ddt_descflags))
|
||||
{
|
||||
@ -588,7 +581,8 @@ STATIC WORD Genblkdev(rqptr rp,ddt *pddt)
|
||||
fv->gbfv_spcfunbit = 2;
|
||||
return dskerr(ret);
|
||||
}
|
||||
else if (ret == 0x80) {
|
||||
else if (ret == 0x80)
|
||||
{
|
||||
fv->gbfv_spcfunbit = 3; /* no disk in drive */
|
||||
return dskerr(ret);
|
||||
}
|
||||
@ -597,13 +591,16 @@ STATIC WORD Genblkdev(rqptr rp,ddt *pddt)
|
||||
{
|
||||
COUNT type = 0;
|
||||
if ((fv->gbfv_spcfunbit & 1) &&
|
||||
(ret = fl_read(pddt->ddt_driveno,0,0,1,1,DiskTransferBuffer)) != 0)
|
||||
(ret =
|
||||
fl_read(pddt->ddt_driveno, 0, 0, 1, 1,
|
||||
DiskTransferBuffer)) != 0)
|
||||
{
|
||||
fv->gbfv_spcfunbit = 3; /* no disk in drive */
|
||||
return dskerr(ret);
|
||||
}
|
||||
if (pddt->ddt_ncyl == 40 &&
|
||||
(pddt->ddt_bpb.bpb_nsecs == 9 || pddt->ddt_bpb.bpb_nsecs == 8))
|
||||
(pddt->ddt_bpb.bpb_nsecs == 9
|
||||
|| pddt->ddt_bpb.bpb_nsecs == 8))
|
||||
{
|
||||
if (pddt->ddt_type == 0)
|
||||
type = 1; /* 320/360K disk in 360K drive */
|
||||
@ -614,8 +611,7 @@ STATIC WORD Genblkdev(rqptr rp,ddt *pddt)
|
||||
pddt->ddt_bpb.bpb_nsecs == 15)
|
||||
type = 3; /* 1.2M disk in 1.2M drive */
|
||||
else if ((pddt->ddt_type == 2 || pddt->ddt_type == 7) &&
|
||||
pddt->ddt_ncyl == 80 && pddt->ddt_bpb.bpb_nsecs == 15
|
||||
)
|
||||
pddt->ddt_ncyl == 80 && pddt->ddt_bpb.bpb_nsecs == 15)
|
||||
type = 4; /* 720kb disk in 1.44M or 720kb drive */
|
||||
|
||||
if (type == 0)
|
||||
@ -627,25 +623,27 @@ STATIC WORD Genblkdev(rqptr rp,ddt *pddt)
|
||||
fl_setdisktype(pddt->ddt_driveno, type);
|
||||
}
|
||||
}
|
||||
if (fv->gbfv_spcfunbit & 1) return S_DONE;
|
||||
if (fv->gbfv_spcfunbit & 1)
|
||||
return S_DONE;
|
||||
|
||||
afentry.type = 2; /* 512 byte sectors */
|
||||
afentry.track = fv->gbfv_cyl;
|
||||
afentry.head = fv->gbfv_head;
|
||||
|
||||
for (tracks = fv->gbfv_spcfunbit & 2 ? fv->gbfv_ntracks : 1; tracks > 0;
|
||||
tracks--)
|
||||
for (tracks = fv->gbfv_spcfunbit & 2 ? fv->gbfv_ntracks : 1;
|
||||
tracks > 0; tracks--)
|
||||
{
|
||||
addrfield = (struct thst *)DiskTransferBuffer;
|
||||
|
||||
if (afentry.track > pddt->ddt_ncyl)
|
||||
return failure(E_FAILURE);
|
||||
|
||||
for (afentry.sector = 1; afentry.sector <= pddt->ddt_bpb.bpb_nsecs;
|
||||
afentry.sector++)
|
||||
for (afentry.sector = 1;
|
||||
afentry.sector <= pddt->ddt_bpb.bpb_nsecs; afentry.sector++)
|
||||
memcpy(addrfield++, &afentry, sizeof(afentry));
|
||||
|
||||
ret = Genblockio(pddt, LBA_FORMAT, afentry.head, afentry.track, 0,
|
||||
ret =
|
||||
Genblockio(pddt, LBA_FORMAT, afentry.head, afentry.track, 0,
|
||||
pddt->ddt_bpb.bpb_nsecs, DiskTransferBuffer);
|
||||
if (ret != 0)
|
||||
return dskerr(ret);
|
||||
@ -709,9 +707,12 @@ STATIC WORD Genblkdev(rqptr rp,ddt *pddt)
|
||||
gblp->gbio_media = (pddt->ddt_type == 1) && (pddt->ddt_ncyl == 40);
|
||||
gblp->gbio_ncyl = pddt->ddt_ncyl;
|
||||
/* use default dpb or current bpb? */
|
||||
pbpb = (gblp->gbio_spcfunbit & 0x01) == 0 ? &pddt->ddt_defbpb : &pddt->ddt_bpb;
|
||||
pbpb =
|
||||
(gblp->gbio_spcfunbit & 0x01) ==
|
||||
0 ? &pddt->ddt_defbpb : &pddt->ddt_bpb;
|
||||
#ifdef WITHFAT32
|
||||
if (!extended) fmemcpy(&gblp->gbio_bpb, pbpb, BPB_SIZEOF);
|
||||
if (!extended)
|
||||
fmemcpy(&gblp->gbio_bpb, pbpb, BPB_SIZEOF);
|
||||
else
|
||||
#endif
|
||||
fmemcpy(&gblp->gbio_bpb, pbpb, sizeof(gblp->gbio_bpb));
|
||||
@ -760,11 +761,17 @@ WORD blockio(rqptr rp, ddt *pddt)
|
||||
int action;
|
||||
bpb *pbpb;
|
||||
|
||||
|
||||
switch (rp->r_command){
|
||||
case C_INPUT: action = LBA_READ; break;
|
||||
case C_OUTPUT:action = LBA_WRITE; break;
|
||||
case C_OUTVFY:action = LBA_WRITE_VERIFY; break;
|
||||
switch (rp->r_command)
|
||||
{
|
||||
case C_INPUT:
|
||||
action = LBA_READ;
|
||||
break;
|
||||
case C_OUTPUT:
|
||||
action = LBA_WRITE;
|
||||
break;
|
||||
case C_OUTVFY:
|
||||
action = LBA_WRITE_VERIFY;
|
||||
break;
|
||||
default:
|
||||
return failure(E_FAILURE);
|
||||
}
|
||||
@ -777,8 +784,7 @@ WORD blockio(rqptr rp, ddt *pddt)
|
||||
pbpb = hd(pddt->ddt_descflags) ? &pddt->ddt_defbpb : &pddt->ddt_bpb;
|
||||
size = (pbpb->bpb_nsize ? pbpb->bpb_nsize : pbpb->bpb_huge);
|
||||
|
||||
if (start >= size ||
|
||||
start + rp->r_count > size)
|
||||
if (start >= size || start + rp->r_count > size)
|
||||
{
|
||||
return 0x0408;
|
||||
}
|
||||
@ -803,7 +809,6 @@ STATIC WORD blk_error(rqptr rp, ddt *pddt)
|
||||
return failure(E_FAILURE); /* general failure */
|
||||
}
|
||||
|
||||
|
||||
STATIC WORD blk_noerr(rqptr rp, ddt * pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
@ -845,7 +850,6 @@ STATIC WORD dskerr(COUNT code)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
translate LBA sectors into CHS addressing
|
||||
*/
|
||||
@ -855,9 +859,7 @@ void LBA_to_CHS(struct CHS *chs, ULONG LBA_address, ddt *pddt)
|
||||
/* we need the defbpb values since those are taken from the
|
||||
BIOS, not from some random boot sector, except when
|
||||
we're dealing with a floppy */
|
||||
bpb *pbpb = hd(pddt->ddt_descflags) ?
|
||||
&pddt->ddt_defbpb :
|
||||
&pddt->ddt_bpb;
|
||||
bpb *pbpb = hd(pddt->ddt_descflags) ? &pddt->ddt_defbpb : &pddt->ddt_bpb;
|
||||
|
||||
chs->Sector = LBA_address % pbpb->bpb_nsecs + 1;
|
||||
|
||||
@ -867,8 +869,6 @@ void LBA_to_CHS(struct CHS *chs, ULONG LBA_address, ddt *pddt)
|
||||
chs->Cylinder = LBA_address / pbpb->bpb_nheads;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Test for 64K boundary crossing and return count small */
|
||||
/* enough not to exceed the threshold. */
|
||||
|
||||
@ -888,8 +888,6 @@ STATIC unsigned DMA_max_transfer(void FAR *buffer, unsigned count)
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
int LBA_Transfer(
|
||||
ddt *pddt, physical characteristics of drive
|
||||
@ -919,7 +917,8 @@ STATIC unsigned DMA_max_transfer(void FAR *buffer, unsigned count)
|
||||
*/
|
||||
|
||||
int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer,
|
||||
ULONG LBA_address,unsigned totaltodo, UWORD *transferred)
|
||||
ULONG LBA_address, unsigned totaltodo,
|
||||
UWORD * transferred)
|
||||
{
|
||||
static struct _bios_LBA_address_packet dap = {
|
||||
16, 0, 0, 0, 0, 0, 0
|
||||
@ -954,11 +953,9 @@ int LBA_Transfer(ddt *pddt ,UWORD mode, VOID FAR *buffer,
|
||||
|
||||
count = min(count, 0x7f);
|
||||
|
||||
|
||||
/* avoid overflowing 64K DMA boundary */
|
||||
count = DMA_max_transfer(buffer, count);
|
||||
|
||||
|
||||
if (FP_SEG(buffer) >= 0xa000 || count == 0)
|
||||
{
|
||||
transfer_address = DiskTransferBuffer;
|
||||
@ -969,12 +966,11 @@ int LBA_Transfer(ddt *pddt ,UWORD mode, VOID FAR *buffer,
|
||||
fmemcpy(DiskTransferBuffer, buffer, 512);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
transfer_address = buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (num_retries = 0; num_retries < N_RETRY; num_retries++)
|
||||
{
|
||||
if (pddt->ddt_LBASupported && mode != LBA_FORMAT)
|
||||
@ -986,7 +982,6 @@ int LBA_Transfer(ddt *pddt ,UWORD mode, VOID FAR *buffer,
|
||||
dap.block_address_high = 0; /* clear high part */
|
||||
dap.block_address = LBA_address; /* clear high part */
|
||||
|
||||
|
||||
/* Load the registers and call the interrupt. */
|
||||
|
||||
if (pddt->ddt_WriteVerifySupported || mode != LBA_WRITE_VERIFY)
|
||||
@ -994,13 +989,16 @@ int LBA_Transfer(ddt *pddt ,UWORD mode, VOID FAR *buffer,
|
||||
|
||||
error_code = fl_lba_ReadWrite(pddt->ddt_driveno, mode, &dap);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
/* verify requested, but not supported */
|
||||
error_code = fl_lba_ReadWrite(pddt->ddt_driveno,LBA_WRITE, &dap);
|
||||
error_code =
|
||||
fl_lba_ReadWrite(pddt->ddt_driveno, LBA_WRITE, &dap);
|
||||
|
||||
if (error_code == 0)
|
||||
{
|
||||
error_code = fl_lba_ReadWrite(pddt->ddt_driveno,LBA_VERIFY, &dap);
|
||||
error_code =
|
||||
fl_lba_ReadWrite(pddt->ddt_driveno, LBA_VERIFY, &dap);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1018,24 +1016,28 @@ int LBA_Transfer(ddt *pddt ,UWORD mode, VOID FAR *buffer,
|
||||
|
||||
if (chs.Cylinder > 1023)
|
||||
{
|
||||
printf("LBA-Transfer error : cylinder %u > 1023\n", chs.Cylinder);
|
||||
printf("LBA-Transfer error : cylinder %u > 1023\n",
|
||||
chs.Cylinder);
|
||||
return 1;
|
||||
}
|
||||
|
||||
error_code = (mode == LBA_READ ? fl_read :
|
||||
mode == LBA_VERIFY ? fl_verify :
|
||||
mode == LBA_FORMAT ? fl_format : fl_write)(
|
||||
pddt->ddt_driveno,
|
||||
chs.Head, (UWORD)chs.Cylinder, chs.Sector,
|
||||
count, transfer_address);
|
||||
mode ==
|
||||
LBA_FORMAT ? fl_format : fl_write) (pddt->
|
||||
ddt_driveno,
|
||||
chs.Head,
|
||||
(UWORD) chs.
|
||||
Cylinder,
|
||||
chs.Sector,
|
||||
count,
|
||||
transfer_address);
|
||||
|
||||
if (error_code == 0 &&
|
||||
mode == LBA_WRITE_VERIFY)
|
||||
if (error_code == 0 && mode == LBA_WRITE_VERIFY)
|
||||
{
|
||||
error_code = fl_verify(
|
||||
pddt->ddt_driveno,
|
||||
chs.Head, (UWORD)chs.Cylinder, chs.Sector,
|
||||
count, transfer_address);
|
||||
error_code = fl_verify(pddt->ddt_driveno,
|
||||
chs.Head, (UWORD) chs.Cylinder,
|
||||
chs.Sector, count, transfer_address);
|
||||
}
|
||||
}
|
||||
if (error_code == 0)
|
||||
|
@ -4,7 +4,6 @@
|
||||
this serves requests from the INIT modules to
|
||||
allocate dynamic data.
|
||||
|
||||
|
||||
kernel layout:
|
||||
00000H 000FFH 00100H PSP PSP
|
||||
00100H 004E1H 003E2H _TEXT CODE
|
||||
@ -28,7 +27,6 @@ additionally:
|
||||
122E0H 12AA5H 007C6H ID ID
|
||||
12AA6H 12CBFH 0021AH IB IB
|
||||
|
||||
|
||||
purpose is to move the HMA_TEXT = resident kernel
|
||||
around, so that below it - after BSS, there is data
|
||||
addressable near by the kernel, to hold some arrays
|
||||
@ -47,7 +45,6 @@ additionally:
|
||||
#define DebugPrintf(x)
|
||||
#endif
|
||||
|
||||
|
||||
/*extern struct DynS FAR Dyn;*/
|
||||
|
||||
#ifndef __TURBOC__
|
||||
@ -57,8 +54,6 @@ additionally:
|
||||
extern struct DynS FAR Dyn;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void far *DynAlloc(char *what, unsigned num, unsigned size)
|
||||
{
|
||||
void far *now;
|
||||
@ -74,7 +69,8 @@ void far *DynAlloc(char *what, unsigned num, unsigned size)
|
||||
}
|
||||
|
||||
DebugPrintf(("DYNDATA:allocating %s - %u * %u bytes, total %u, %u..%u\n",
|
||||
what, num, size, total, Dyn.Allocated,Dyn.Allocated+total));
|
||||
what, num, size, total, Dyn.Allocated,
|
||||
Dyn.Allocated + total));
|
||||
|
||||
now = (void far *)&Dyn.Buffer[Dyn.Allocated];
|
||||
fmemset(now, 0, total);
|
||||
@ -91,7 +87,8 @@ void DynFree(void *ptr)
|
||||
|
||||
void FAR *DynLast()
|
||||
{
|
||||
DebugPrintf(("dynamic data end at %p\n",(void FAR *)(Dyn.Buffer+Dyn.Allocated)));
|
||||
DebugPrintf(("dynamic data end at %p\n",
|
||||
(void FAR *)(Dyn.Buffer + Dyn.Allocated)));
|
||||
|
||||
return Dyn.Buffer + Dyn.Allocated;
|
||||
}
|
||||
|
@ -29,7 +29,8 @@
|
||||
#include "portab.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *errorRcsId = "$Id$";
|
||||
static BYTE *errorRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#include "globals.h"
|
||||
@ -39,19 +40,11 @@ static BYTE *errorRcsId = "$Id$";
|
||||
VOID dump(void)
|
||||
{
|
||||
printf("Register Dump [AH = %02x CS:IP = %04x:%04x]\n",
|
||||
error_regs.AH,
|
||||
error_regs.CS,
|
||||
error_regs.IP);
|
||||
error_regs.AH, error_regs.CS, error_regs.IP);
|
||||
printf("AX:%04x BX:%04x CX:%04x DX:%04x\n",
|
||||
error_regs.AX,
|
||||
error_regs.BX,
|
||||
error_regs.CX,
|
||||
error_regs.DX);
|
||||
error_regs.AX, error_regs.BX, error_regs.CX, error_regs.DX);
|
||||
printf("SI:%04x DI:%04x DS:%04x ES:%04x\n",
|
||||
error_regs.SI,
|
||||
error_regs.DI,
|
||||
error_regs.DS,
|
||||
error_regs.ES);
|
||||
error_regs.SI, error_regs.DI, error_regs.DS, error_regs.ES);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -82,21 +75,15 @@ VOID fatal(BYTE * err_msg)
|
||||
/* Abort, retry or fail for character devices */
|
||||
COUNT char_error(request * rq, struct dhdr FAR * lpDevice)
|
||||
{
|
||||
return CriticalError(
|
||||
EFLG_CHAR | EFLG_ABORT | EFLG_RETRY | EFLG_IGNORE,
|
||||
0,
|
||||
rq->r_status & S_MASK,
|
||||
lpDevice);
|
||||
return CriticalError(EFLG_CHAR | EFLG_ABORT | EFLG_RETRY | EFLG_IGNORE,
|
||||
0, rq->r_status & S_MASK, lpDevice);
|
||||
}
|
||||
|
||||
/* Abort, retry or fail for block devices */
|
||||
COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice)
|
||||
{
|
||||
return CriticalError(
|
||||
EFLG_ABORT | EFLG_RETRY | EFLG_IGNORE,
|
||||
nDrive,
|
||||
rq->r_status & S_MASK,
|
||||
lpDevice);
|
||||
return CriticalError(EFLG_ABORT | EFLG_RETRY | EFLG_IGNORE,
|
||||
nDrive, rq->r_status & S_MASK, lpDevice);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -139,4 +126,3 @@ COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice)
|
||||
* Rev 1.0 02 Jul 1995 8:06:14 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
@ -31,7 +31,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *fatdirRcsId = "$Id$";
|
||||
static BYTE *fatdirRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
/* Description.
|
||||
@ -45,7 +46,8 @@ VOID dir_init_fnode(f_node_ptr fnp, CLUSTER dirstart)
|
||||
fnp->f_flags.f_droot = FALSE;
|
||||
fnp->f_flags.f_ddir = TRUE;
|
||||
fnp->f_flags.f_dnew = TRUE;
|
||||
fnp->f_diroff = fnp->f_offset = fnp->f_cluster_offset = fnp->f_highwater = 0l;
|
||||
fnp->f_diroff = fnp->f_offset = fnp->f_cluster_offset =
|
||||
fnp->f_highwater = 0l;
|
||||
|
||||
/* root directory */
|
||||
if (dirstart == 0)
|
||||
@ -85,8 +87,9 @@ f_node_ptr dir_open(BYTE * dirname)
|
||||
fnp->f_mode = RDWR;
|
||||
|
||||
/* determine what drive we are using... */
|
||||
if (ParseDosName(dirname, &drive, (BYTE *) 0, (BYTE *) 0, (BYTE *) 0, FALSE)
|
||||
!= SUCCESS)
|
||||
if (ParseDosName
|
||||
(dirname, &drive, (BYTE *) 0, (BYTE *) 0, (BYTE *) 0,
|
||||
FALSE) != SUCCESS)
|
||||
{
|
||||
release_f_node(fnp);
|
||||
return NULL;
|
||||
@ -104,7 +107,8 @@ f_node_ptr dir_open(BYTE * dirname)
|
||||
{
|
||||
drive = default_drive;
|
||||
}
|
||||
if (drive >= lastdrive) {
|
||||
if (drive >= lastdrive)
|
||||
{
|
||||
release_f_node(fnp);
|
||||
return NULL;
|
||||
}
|
||||
@ -191,9 +195,12 @@ f_node_ptr dir_open(BYTE * dirname)
|
||||
|
||||
while (dir_read(fnp) == 1)
|
||||
{
|
||||
if (fnp->f_dir.dir_name[0] != '\0' && fnp->f_dir.dir_name[0] != DELETED)
|
||||
if (fnp->f_dir.dir_name[0] != '\0'
|
||||
&& fnp->f_dir.dir_name[0] != DELETED)
|
||||
{
|
||||
if (fcmp(TempBuffer, (BYTE *)fnp->f_dir.dir_name, FNAME_SIZE + FEXT_SIZE))
|
||||
if (fcmp
|
||||
(TempBuffer, (BYTE *) fnp->f_dir.dir_name,
|
||||
FNAME_SIZE + FEXT_SIZE))
|
||||
{
|
||||
i = TRUE;
|
||||
break;
|
||||
@ -294,7 +301,8 @@ COUNT dir_read(REG f_node_ptr fnp)
|
||||
bp->b_flag &= ~(BFR_DATA | BFR_FAT);
|
||||
bp->b_flag |= BFR_DIR | BFR_VALID;
|
||||
|
||||
getdirent((BYTE FAR *) & bp->b_buffer[((UWORD)new_diroff) % fnp->f_dpb->dpb_secsize],
|
||||
getdirent((BYTE FAR *) & bp->
|
||||
b_buffer[((UWORD) new_diroff) % fnp->f_dpb->dpb_secsize],
|
||||
(struct dirent FAR *)&fnp->f_dir);
|
||||
|
||||
/* Update the fnode's directory info */
|
||||
@ -328,8 +336,7 @@ BOOL dir_write(REG f_node_ptr fnp)
|
||||
/* simple. */
|
||||
if (fnp->f_flags.f_droot)
|
||||
{
|
||||
bp = getblock(
|
||||
(ULONG) ((UWORD)fnp->f_diroff / secsize
|
||||
bp = getblock((ULONG) ((UWORD) fnp->f_diroff / secsize
|
||||
+ fnp->f_dpb->dpb_dirstrt),
|
||||
fnp->f_dpb->dpb_unit);
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
@ -387,7 +394,8 @@ BOOL dir_write(REG f_node_ptr fnp)
|
||||
if (fnp->f_flags.f_dnew && fnp->f_dir.dir_attrib != D_LFN)
|
||||
fmemset(&fnp->f_dir.dir_case, 0, 8);
|
||||
putdirent((struct dirent FAR *)&fnp->f_dir,
|
||||
(VOID FAR *) & bp->b_buffer[(UWORD)fnp->f_diroff % fnp->f_dpb->dpb_secsize]);
|
||||
(VOID FAR *) & bp->b_buffer[(UWORD) fnp->f_diroff %
|
||||
fnp->f_dpb->dpb_secsize]);
|
||||
|
||||
bp->b_flag &= ~(BFR_DATA | BFR_FAT);
|
||||
bp->b_flag |= BFR_DIR | BFR_DIRTY | BFR_VALID;
|
||||
@ -425,8 +433,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE *name)
|
||||
COUNT nDrive;
|
||||
BYTE *p;
|
||||
|
||||
BYTE local_name[FNAME_SIZE + 1],
|
||||
local_ext[FEXT_SIZE + 1];
|
||||
BYTE local_name[FNAME_SIZE + 1], local_ext[FEXT_SIZE + 1];
|
||||
|
||||
/* printf("ff %Fs\n", name);*/
|
||||
|
||||
@ -438,7 +445,8 @@ COUNT dos_findfirst(UCOUNT attr, BYTE *name)
|
||||
/* current directory, do a seek and read, then close the fnode. */
|
||||
|
||||
/* Parse out the drive, file name and file extension. */
|
||||
i = ParseDosName(name, &nDrive, &szDirName[2], local_name, local_ext, TRUE);
|
||||
i = ParseDosName(name, &nDrive, &szDirName[2], local_name, local_ext,
|
||||
TRUE);
|
||||
if (i != SUCCESS)
|
||||
return i;
|
||||
/*
|
||||
@ -531,6 +539,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE *name)
|
||||
return dos_findnext();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
BUGFIX TE 06/28/01
|
||||
|
||||
@ -588,7 +597,9 @@ COUNT dos_findnext(void)
|
||||
if (fnp->f_dir.dir_name[0] != '\0' && fnp->f_dir.dir_name[0] != DELETED
|
||||
&& (fnp->f_dir.dir_attrib & D_VOLID) != D_VOLID)
|
||||
{
|
||||
if (fcmp_wild((BYTE FAR *)dmp->dm_name_pat, (BYTE FAR *)fnp->f_dir.dir_name, FNAME_SIZE + FEXT_SIZE))
|
||||
if (fcmp_wild
|
||||
((BYTE FAR *) dmp->dm_name_pat, (BYTE FAR *) fnp->f_dir.dir_name,
|
||||
FNAME_SIZE + FEXT_SIZE))
|
||||
{
|
||||
/*
|
||||
MSD Command.com uses FCB FN 11 & 12 with attrib set to 0x16.
|
||||
@ -599,7 +610,8 @@ COUNT dos_findnext(void)
|
||||
|
||||
/* Test the attribute as the final step */
|
||||
if (!(fnp->f_dir.dir_attrib & D_VOLID) &&
|
||||
((~dmp->dm_attr_srch & fnp->f_dir.dir_attrib & (D_DIR | D_SYSTEM | D_HIDDEN)) == 0))
|
||||
((~dmp->dm_attr_srch & fnp->f_dir.
|
||||
dir_attrib & (D_DIR | D_SYSTEM | D_HIDDEN)) == 0))
|
||||
{
|
||||
found = TRUE;
|
||||
break;
|
||||
@ -642,8 +654,6 @@ void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName)
|
||||
noExtension = TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
fmemcpy(destSZ, srcFCBName, FNAME_SIZE);
|
||||
|
||||
srcFCBName += FNAME_SIZE;
|
||||
@ -655,8 +665,6 @@ void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName)
|
||||
}
|
||||
destSZ += loop + 1;
|
||||
|
||||
|
||||
|
||||
if (!noExtension) /* not for ".", ".." */
|
||||
{
|
||||
|
||||
@ -777,4 +785,3 @@ int FileName83Length(BYTE *filename83)
|
||||
* Rev 1.0 02 Jul 1995 8:04:34 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
220
kernel/fatfs.c
220
kernel/fatfs.c
@ -63,14 +63,12 @@ ULONG clus2phys(CLUSTER cl_no, struct dpb FAR *dpbp)
|
||||
{
|
||||
CLUSTER data =
|
||||
#ifdef WITHFAT32
|
||||
ISFAT32(dpbp) ?
|
||||
dpbp->dpb_xdata :
|
||||
ISFAT32(dpbp) ? dpbp->dpb_xdata :
|
||||
#endif
|
||||
dpbp->dpb_data;
|
||||
return ((ULONG) (cl_no - 2) << dpbp->dpb_shftcnt) + data;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Internal file handlers - open, create, read, write, close, etc. */
|
||||
@ -184,8 +182,7 @@ COUNT dos_close(COUNT fd)
|
||||
/* */
|
||||
/* split a path into it's component directory and file name */
|
||||
/* */
|
||||
f_node_ptr
|
||||
split_path(BYTE * path, BYTE * fname, BYTE * fext)
|
||||
f_node_ptr split_path(BYTE * path, BYTE * fname, BYTE * fext)
|
||||
{
|
||||
REG f_node_ptr fnp;
|
||||
COUNT nDrive;
|
||||
@ -205,7 +202,8 @@ f_node_ptr
|
||||
SpacePad(fname, FNAME_SIZE);
|
||||
SpacePad(fext, FEXT_SIZE);
|
||||
|
||||
if (nDrive >= lastdrive) {
|
||||
if (nDrive >= lastdrive)
|
||||
{
|
||||
return (f_node_ptr) 0;
|
||||
}
|
||||
cdsp = &CDSp->cds_table[nDrive];
|
||||
@ -229,7 +227,8 @@ f_node_ptr
|
||||
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
if (cdsp->cdsFlags & CDSNETWDRV) {
|
||||
if (cdsp->cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
printf("split path called for redirected file: `%s.%s'\n",
|
||||
fname, fext);
|
||||
return (f_node_ptr) 0;
|
||||
@ -293,8 +292,10 @@ COUNT remove_lfn_entries(f_node_ptr fnp)
|
||||
ULONG original_diroff = fnp->f_diroff;
|
||||
COUNT rc;
|
||||
|
||||
while (TRUE) {
|
||||
if(fnp->f_diroff == 0) break;
|
||||
while (TRUE)
|
||||
{
|
||||
if (fnp->f_diroff == 0)
|
||||
break;
|
||||
fnp->f_diroff -= 2 * DIRENT_SIZE;
|
||||
/* it cannot / should not get below 0 because of '.' and '..' */
|
||||
if ((rc = dir_read(fnp)) < 0)
|
||||
@ -310,6 +311,7 @@ COUNT remove_lfn_entries(f_node_ptr fnp)
|
||||
return rc;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* /// Added - Ron Cemer */
|
||||
/* If more than one f_node has a file open, and a write
|
||||
occurs, this function must be called to propagate the
|
||||
@ -319,26 +321,33 @@ COUNT remove_lfn_entries(f_node_ptr fnp)
|
||||
reasons, since DOS without SHARE does not share changes
|
||||
between two or more open instances of the same file
|
||||
unless these instances were generated by dup() or dup2(). */
|
||||
STATIC void merge_file_changes(f_node_ptr fnp, int collect) {
|
||||
STATIC void merge_file_changes(f_node_ptr fnp, int collect)
|
||||
{
|
||||
f_node_ptr fnp2;
|
||||
int i;
|
||||
|
||||
if (!IsShareInstalled()) return;
|
||||
for (i = 0; i < f_nodes_cnt; i++) {
|
||||
if (!IsShareInstalled())
|
||||
return;
|
||||
for (i = 0; i < f_nodes_cnt; i++)
|
||||
{
|
||||
fnp2 = (f_node_ptr) & f_nodes[i];
|
||||
if ((fnp != (f_node_ptr) 0)
|
||||
&& (fnp != fnp2)
|
||||
&& (fnp->f_count > 0)
|
||||
&& (is_same_file(fnp, fnp2)) ) {
|
||||
if (collect) {
|
||||
&& (fnp->f_count > 0) && (is_same_file(fnp, fnp2)))
|
||||
{
|
||||
if (collect)
|
||||
{
|
||||
/* We're collecting file changes from any other
|
||||
f_node which refers to this file. */
|
||||
if (fnp2->f_mode != RDONLY) {
|
||||
if (fnp2->f_mode != RDONLY)
|
||||
{
|
||||
fnp2->f_dir.dir_size = fnp2->f_highwater;
|
||||
copy_file_changes(fnp2, fnp);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We just made changes to this file, so we are
|
||||
distributing these changes to the other f_nodes
|
||||
which refer to this file. */
|
||||
@ -351,7 +360,8 @@ STATIC void merge_file_changes(f_node_ptr fnp, int collect) {
|
||||
}
|
||||
|
||||
/* /// Added - Ron Cemer */
|
||||
STATIC int is_same_file(f_node_ptr fnp1, f_node_ptr fnp2) {
|
||||
STATIC int is_same_file(f_node_ptr fnp1, f_node_ptr fnp2)
|
||||
{
|
||||
return
|
||||
(fnp1->f_dpb->dpb_unit == fnp2->f_dpb->dpb_unit)
|
||||
&& (fnp1->f_dpb->dpb_subunit == fnp2->f_dpb->dpb_subunit)
|
||||
@ -369,7 +379,8 @@ STATIC int is_same_file(f_node_ptr fnp1, f_node_ptr fnp2) {
|
||||
}
|
||||
|
||||
/* /// Added - Ron Cemer */
|
||||
STATIC void copy_file_changes(f_node_ptr src, f_node_ptr dst) {
|
||||
STATIC void copy_file_changes(f_node_ptr src, f_node_ptr dst)
|
||||
{
|
||||
dst->f_highwater = src->f_highwater;
|
||||
dst->f_dir.dir_start = src->f_dir.dir_start;
|
||||
#ifdef WITHFAT32
|
||||
@ -604,7 +615,8 @@ COUNT dos_rmdir(BYTE * path)
|
||||
{
|
||||
if (fnp1->f_dir.dir_name[0] == '\0')
|
||||
break;
|
||||
if (fnp1->f_dir.dir_name[0] == DELETED || fnp1->f_dir.dir_attrib == D_LFN)
|
||||
if (fnp1->f_dir.dir_name[0] == DELETED
|
||||
|| fnp1->f_dir.dir_attrib == D_LFN)
|
||||
continue;
|
||||
else
|
||||
{
|
||||
@ -754,20 +766,20 @@ STATIC VOID wipe_out_clusters(struct dpb FAR *dpbp, CLUSTER st)
|
||||
#ifdef WITHFAT32
|
||||
if (ISFAT32(dpbp))
|
||||
{
|
||||
if ((dpbp->dpb_xcluster == UNKNCLUSTER)
|
||||
|| (dpbp->dpb_xcluster > st))
|
||||
if ((dpbp->dpb_xcluster == UNKNCLUSTER) || (dpbp->dpb_xcluster > st))
|
||||
dpbp->dpb_xcluster = st;
|
||||
} else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ((dpbp->dpb_cluster == UNKNCLUSTER)
|
||||
|| (dpbp->dpb_cluster > st))
|
||||
if ((dpbp->dpb_cluster == UNKNCLUSTER) || (dpbp->dpb_cluster > st))
|
||||
dpbp->dpb_cluster = st;
|
||||
|
||||
/* and just follow the linked list */
|
||||
st = next;
|
||||
}
|
||||
#ifdef WITHFAT32
|
||||
if (ISFAT32(dpbp)) write_fsinfo(dpbp);
|
||||
if (ISFAT32(dpbp))
|
||||
write_fsinfo(dpbp);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -799,9 +811,7 @@ STATIC BOOL find_free(f_node_ptr fnp)
|
||||
date dos_getdate()
|
||||
{
|
||||
#ifndef NOTIME
|
||||
BYTE WeekDay,
|
||||
Month,
|
||||
MonthDay;
|
||||
BYTE WeekDay, Month, MonthDay;
|
||||
COUNT Year;
|
||||
date Date;
|
||||
|
||||
@ -809,8 +819,7 @@ date dos_getdate()
|
||||
/* on start-up or the CMOS clock */
|
||||
DosGetDate((BYTE FAR *) & WeekDay,
|
||||
(BYTE FAR *) & Month,
|
||||
(BYTE FAR *) & MonthDay,
|
||||
(COUNT FAR *) & Year);
|
||||
(BYTE FAR *) & MonthDay, (COUNT FAR *) & Year);
|
||||
Date = DT_ENCODE(Month, MonthDay, Year - EPOCH_YEAR);
|
||||
return Date;
|
||||
|
||||
@ -827,17 +836,13 @@ date dos_getdate()
|
||||
time dos_gettime()
|
||||
{
|
||||
#ifndef NOTIME
|
||||
BYTE Hour,
|
||||
Minute,
|
||||
Second,
|
||||
Hundredth;
|
||||
BYTE Hour, Minute, Second, Hundredth;
|
||||
|
||||
/* First - get the system time set by either the user */
|
||||
/* on start-up or the CMOS clock */
|
||||
DosGetTime((BYTE FAR *) & Hour,
|
||||
(BYTE FAR *) & Minute,
|
||||
(BYTE FAR *) & Second,
|
||||
(BYTE FAR *) & Hundredth);
|
||||
(BYTE FAR *) & Second, (BYTE FAR *) & Hundredth);
|
||||
return TM_ENCODE(Hour, Minute, Second / 2);
|
||||
#else
|
||||
return 0;
|
||||
@ -984,7 +989,8 @@ STATIC CLUSTER find_fat_free(f_node_ptr fnp)
|
||||
if (dpbp->dpb_xcluster != UNKNCLUSTER)
|
||||
idx = dpbp->dpb_xcluster;
|
||||
size = dpbp->dpb_xsize;
|
||||
} else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (dpbp->dpb_cluster != UNKNCLUSTER)
|
||||
idx = dpbp->dpb_cluster;
|
||||
@ -1101,7 +1107,6 @@ COUNT dos_mkdir(BYTE * dir)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* get an empty cluster, so that we make it into a */
|
||||
/* directory. */
|
||||
/* TE this has to be done (and failed) BEFORE the dir entry */
|
||||
@ -1116,7 +1121,6 @@ COUNT dos_mkdir(BYTE * dir)
|
||||
return DE_HNDLDSKFULL;
|
||||
}
|
||||
|
||||
|
||||
/* put the fnode's name into the directory. */
|
||||
memcpy(fnp->f_dir.dir_name, szFileName, FNAME_SIZE);
|
||||
memcpy(fnp->f_dir.dir_ext, szFileExt, FEXT_SIZE);
|
||||
@ -1137,7 +1141,6 @@ COUNT dos_mkdir(BYTE * dir)
|
||||
fnp->f_highwater = 0l;
|
||||
fnp->f_offset = 0l;
|
||||
|
||||
|
||||
/* Mark the cluster in the FAT as used */
|
||||
fnp->f_cluster = free_fat;
|
||||
setdstart(fnp->f_dir, free_fat);
|
||||
@ -1147,8 +1150,7 @@ COUNT dos_mkdir(BYTE * dir)
|
||||
/* Craft the new directory. Note that if we're in a new */
|
||||
/* directory just under the root, ".." pointer is 0. */
|
||||
/* as we are overwriting it completely, don't read first */
|
||||
bp = getblockOver(clus2phys(free_fat, dpbp),
|
||||
dpbp->dpb_unit);
|
||||
bp = getblockOver(clus2phys(free_fat, dpbp), dpbp->dpb_unit);
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("FAT (dos_mkdir)\n");
|
||||
#endif
|
||||
@ -1173,14 +1175,16 @@ COUNT dos_mkdir(BYTE * dir)
|
||||
/* create the ".." entry */
|
||||
memcpy(DirEntBuffer.dir_name, ".. ", FNAME_SIZE);
|
||||
#ifdef WITHFAT32
|
||||
if (ISFAT32(dpbp) && parent == dpbp->dpb_xrootclst) {
|
||||
if (ISFAT32(dpbp) && parent == dpbp->dpb_xrootclst)
|
||||
{
|
||||
parent = 0;
|
||||
}
|
||||
#endif
|
||||
setdstart(DirEntBuffer, parent);
|
||||
|
||||
/* and put it out */
|
||||
putdirent((struct dirent FAR *)&DirEntBuffer, (BYTE FAR *) & bp->b_buffer[DIRENT_SIZE]);
|
||||
putdirent((struct dirent FAR *)&DirEntBuffer,
|
||||
(BYTE FAR *) & bp->b_buffer[DIRENT_SIZE]);
|
||||
|
||||
/* fill the rest of the block with zeros */
|
||||
fmemset(&bp->b_buffer[2 * DIRENT_SIZE], 0, BUFFERSIZE - 2 * DIRENT_SIZE);
|
||||
@ -1270,7 +1274,8 @@ STATIC COUNT extend_dir(f_node_ptr fnp)
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("DIR (extend_dir)\n");
|
||||
#endif
|
||||
if (bp == NULL) {
|
||||
if (bp == NULL)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_BLKINVLD;
|
||||
}
|
||||
@ -1461,7 +1466,6 @@ COUNT map_cluster(REG f_node_ptr fnp, COUNT mode)
|
||||
|
||||
the same should be done for writes as well
|
||||
|
||||
|
||||
the time to compile the complete kernel (on some P200) is
|
||||
reduced from 67 to 56 seconds - in an otherwise identical configuration.
|
||||
|
||||
@ -1487,7 +1491,6 @@ COUNT map_cluster(REG f_node_ptr fnp, COUNT mode)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* Read block from disk */
|
||||
UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
{
|
||||
@ -1556,8 +1559,7 @@ UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
{
|
||||
/* Do an EOF test and return whatever was transferred */
|
||||
/* but only for regular files. */
|
||||
if (!(fnp->f_flags.f_ddir)
|
||||
&& (fnp->f_offset >= fnp->f_highwater))
|
||||
if (!(fnp->f_flags.f_ddir) && (fnp->f_offset >= fnp->f_highwater))
|
||||
{
|
||||
*err = SUCCESS;
|
||||
return ret_cnt;
|
||||
@ -1610,11 +1612,11 @@ UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
static ULONG startoffset;
|
||||
UCOUNT sectors_to_read, sectors_wanted;
|
||||
|
||||
|
||||
startoffset = fnp->f_offset;
|
||||
|
||||
/* avoid EOF problems */
|
||||
sectors_wanted = ((UCOUNT) min(fnp->f_highwater - fnp->f_offset, to_xfer)) /
|
||||
sectors_wanted =
|
||||
((UCOUNT) min(fnp->f_highwater - fnp->f_offset, to_xfer)) /
|
||||
secsize;
|
||||
|
||||
if (sectors_wanted < 2)
|
||||
@ -1631,7 +1633,8 @@ UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
if (map_cluster(fnp, XFR_READ) != SUCCESS)
|
||||
break;
|
||||
|
||||
if (clus2phys(fnp->f_cluster, fnp->f_dpb) != currentblock + sectors_to_read)
|
||||
if (clus2phys(fnp->f_cluster, fnp->f_dpb) !=
|
||||
currentblock + sectors_to_read)
|
||||
break;
|
||||
|
||||
sectors_to_read += fnp->f_dpb->dpb_clsmask + 1;
|
||||
@ -1659,28 +1662,21 @@ UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
return ret_cnt;
|
||||
}
|
||||
|
||||
|
||||
goto update_pointers;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* normal read: just the old, buffer = sector based read */
|
||||
normal_read:
|
||||
|
||||
|
||||
#ifdef DSK_DEBUG
|
||||
printf("read %d links; dir offset %ld, cluster %lx\n",
|
||||
fnp->f_count,
|
||||
fnp->f_diroff,
|
||||
fnp->f_cluster);
|
||||
fnp->f_count, fnp->f_diroff, fnp->f_cluster);
|
||||
#endif
|
||||
|
||||
/* Get the block we need from cache */
|
||||
bp = getblock(currentblock /*clus2phys(fnp->f_cluster, fnp->f_dpb) + fnp->f_sector*/,
|
||||
fnp->f_dpb->dpb_unit);
|
||||
bp = getblock(currentblock
|
||||
/*clus2phys(fnp->f_cluster, fnp->f_dpb) + fnp->f_sector */
|
||||
, fnp->f_dpb->dpb_unit);
|
||||
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("DATA (readblock)\n");
|
||||
@ -1713,7 +1709,6 @@ normal_read:
|
||||
bp->b_flag |= BFR_UNCACHE;
|
||||
}
|
||||
|
||||
|
||||
/* update pointers and counters */
|
||||
fnp->f_offset += xfr_cnt;
|
||||
|
||||
@ -1750,43 +1745,42 @@ STATIC COUNT dos_extend(f_node_ptr fnp)
|
||||
count = fnp->f_offset - fnp->f_highwater;
|
||||
fnp->f_offset = fnp->f_highwater;
|
||||
while (count > 0)
|
||||
{
|
||||
#endif
|
||||
{
|
||||
if (map_cluster(fnp, XFR_WRITE) != SUCCESS)
|
||||
return DE_HNDLDSKFULL;
|
||||
|
||||
#ifdef WRITEZEROS
|
||||
/* Compute the block within the cluster and the offset */
|
||||
/* within the block. */
|
||||
fnp->f_sector =
|
||||
(fnp->f_offset / secsize) & fnp->f_dpb->dpb_clsmask;
|
||||
fnp->f_sector = (fnp->f_offset / secsize) & fnp->f_dpb->dpb_clsmask;
|
||||
fnp->f_boff = fnp->f_offset & (secsize - 1);
|
||||
|
||||
#ifdef DSK_DEBUG
|
||||
printf("write %d links; dir offset %ld, cluster %d\n",
|
||||
fnp->f_count,
|
||||
fnp->f_diroff,
|
||||
fnp->f_cluster);
|
||||
fnp->f_count, fnp->f_diroff, fnp->f_cluster);
|
||||
#endif
|
||||
|
||||
xfr_cnt = count < (ULONG) secsize - fnp->f_boff ?
|
||||
(UWORD) count :
|
||||
secsize - fnp->f_boff;
|
||||
(UWORD) count : secsize - fnp->f_boff;
|
||||
|
||||
/* get a buffer to store the block in */
|
||||
if ( (fnp->f_boff == 0) && (xfr_cnt == secsize) ) {
|
||||
bp = getblockOver(clus2phys(fnp->f_cluster, fnp->f_dpb) + fnp->f_sector,
|
||||
fnp->f_dpb->dpb_unit);
|
||||
if ((fnp->f_boff == 0) && (xfr_cnt == secsize))
|
||||
{
|
||||
bp = getblockOver(clus2phys(fnp->f_cluster, fnp->f_dpb) +
|
||||
fnp->f_sector, fnp->f_dpb->dpb_unit);
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
bp = getblock(clus2phys(fnp->f_cluster, fnp->f_dpb) + fnp->f_sector,
|
||||
fnp->f_dpb->dpb_unit);
|
||||
}
|
||||
if (bp == NULL) {
|
||||
if (bp == NULL)
|
||||
{
|
||||
return DE_BLKINVLD;
|
||||
}
|
||||
|
||||
|
||||
/* set a block to zero */
|
||||
fmemset((BYTE FAR *) & bp->b_buffer[fnp->f_boff], 0, xfr_cnt);
|
||||
bp->b_flag |= BFR_DIRTY | BFR_VALID;
|
||||
@ -1799,14 +1793,11 @@ STATIC COUNT dos_extend(f_node_ptr fnp)
|
||||
/* update pointers and counters */
|
||||
count -= xfr_cnt;
|
||||
fnp->f_offset += xfr_cnt;
|
||||
fnp->f_dir.dir_size = fnp->f_offset;
|
||||
#endif
|
||||
fnp->f_highwater = fnp->f_offset;
|
||||
fnp->f_dir.dir_size = fnp->f_highwater;
|
||||
merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */
|
||||
}
|
||||
#else
|
||||
fnp->f_highwater = fnp->f_offset;
|
||||
merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@ -1948,15 +1939,12 @@ UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
|
||||
/* Compute the block within the cluster and the offset */
|
||||
/* within the block. */
|
||||
fnp->f_sector =
|
||||
(fnp->f_offset / secsize) & fnp->f_dpb->dpb_clsmask;
|
||||
fnp->f_sector = (fnp->f_offset / secsize) & fnp->f_dpb->dpb_clsmask;
|
||||
fnp->f_boff = fnp->f_offset & (secsize - 1);
|
||||
|
||||
#ifdef DSK_DEBUG
|
||||
printf("write %d links; dir offset %ld, cluster %d\n",
|
||||
fnp->f_count,
|
||||
fnp->f_diroff,
|
||||
fnp->f_cluster);
|
||||
fnp->f_count, fnp->f_diroff, fnp->f_cluster);
|
||||
#endif
|
||||
|
||||
/* /// Moved xfr_cnt calculation from below so we can
|
||||
@ -1980,20 +1968,23 @@ UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
piping and redirection in FreeCOM, as well as many other
|
||||
potential problems.
|
||||
- Ron Cemer */
|
||||
if ( (fnp->f_boff == 0) && (xfr_cnt == secsize) ) {
|
||||
bp = getblockOver(clus2phys(fnp->f_cluster, fnp->f_dpb) + fnp->f_sector,
|
||||
fnp->f_dpb->dpb_unit);
|
||||
if ((fnp->f_boff == 0) && (xfr_cnt == secsize))
|
||||
{
|
||||
bp = getblockOver(clus2phys(fnp->f_cluster, fnp->f_dpb) +
|
||||
fnp->f_sector, fnp->f_dpb->dpb_unit);
|
||||
|
||||
} else {
|
||||
bp = getblock(clus2phys(fnp->f_cluster, fnp->f_dpb) + fnp->f_sector,
|
||||
fnp->f_dpb->dpb_unit);
|
||||
}
|
||||
if (bp == NULL) {
|
||||
else
|
||||
{
|
||||
bp = getblock(clus2phys(fnp->f_cluster, fnp->f_dpb) +
|
||||
fnp->f_sector, fnp->f_dpb->dpb_unit);
|
||||
}
|
||||
if (bp == NULL)
|
||||
{
|
||||
*err = DE_BLKINVLD;
|
||||
return ret_cnt;
|
||||
}
|
||||
|
||||
|
||||
/* transfer a block */
|
||||
/* Transfer size as either a full block size, or the */
|
||||
/* requested transfer size, whichever is smaller. */
|
||||
@ -2012,7 +2003,6 @@ UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
bp->b_flag |= BFR_UNCACHE;
|
||||
}
|
||||
|
||||
|
||||
/* update pointers and counters */
|
||||
ret_cnt += xfr_cnt;
|
||||
to_xfer -= xfr_cnt;
|
||||
@ -2095,7 +2085,8 @@ CLUSTER dos_free(struct dpb FAR *dpbp)
|
||||
++cnt;
|
||||
}
|
||||
#ifdef WITHFAT32
|
||||
if (ISFAT32(dpbp)) {
|
||||
if (ISFAT32(dpbp))
|
||||
{
|
||||
dpbp->dpb_xnfreeclst = cnt;
|
||||
write_fsinfo(dpbp);
|
||||
return cnt;
|
||||
@ -2105,8 +2096,6 @@ CLUSTER dos_free(struct dpb FAR *dpbp)
|
||||
return cnt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef IPL
|
||||
COUNT dos_cd(struct cds FAR * cdsp, BYTE * PathName)
|
||||
{
|
||||
@ -2244,16 +2233,13 @@ VOID bpb_to_dpb(bpb FAR *bpbp, REG struct dpb FAR * dpbp)
|
||||
dpbp->dpb_fatstrt = bpbp->bpb_nreserved;
|
||||
dpbp->dpb_fats = bpbp->bpb_nfat;
|
||||
dpbp->dpb_dirents = bpbp->bpb_ndirent;
|
||||
size = bpbp->bpb_nsize == 0 ?
|
||||
bpbp->bpb_huge :
|
||||
(ULONG) bpbp->bpb_nsize;
|
||||
size = bpbp->bpb_nsize == 0 ? bpbp->bpb_huge : (ULONG) bpbp->bpb_nsize;
|
||||
dpbp->dpb_fatsize = bpbp->bpb_nfsect;
|
||||
dpbp->dpb_dirstrt = dpbp->dpb_fatstrt
|
||||
+ dpbp->dpb_fats * dpbp->dpb_fatsize;
|
||||
dpbp->dpb_data = dpbp->dpb_dirstrt
|
||||
+ ((DIRENT_SIZE * (ULONG) dpbp->dpb_dirents
|
||||
+ (dpbp->dpb_secsize - 1))
|
||||
/ dpbp->dpb_secsize);
|
||||
+ (dpbp->dpb_secsize - 1)) / dpbp->dpb_secsize);
|
||||
/* Michal Meller <maceman@priv4,onet.pl> patch to jimtabor */
|
||||
dpbp->dpb_size = ((size - dpbp->dpb_data)
|
||||
/ ((ULONG) bpbp->bpb_nsector) + 1);
|
||||
@ -2285,9 +2271,10 @@ VOID bpb_to_dpb(bpb FAR *bpbp, REG struct dpb FAR * dpbp)
|
||||
dpbp->dpb_dirents = 0;
|
||||
dpbp->dpb_dirstrt = 0xffff;
|
||||
dpbp->dpb_size = 0;
|
||||
dpbp->dpb_xdata = dpbp->dpb_fatstrt + dpbp->dpb_fats * dpbp->dpb_xfatsize;
|
||||
dpbp->dpb_xsize = ((size - dpbp->dpb_xdata)
|
||||
/ ((ULONG) bpbp->bpb_nsector) + 1);
|
||||
dpbp->dpb_xdata =
|
||||
dpbp->dpb_fatstrt + dpbp->dpb_fats * dpbp->dpb_xfatsize;
|
||||
dpbp->dpb_xsize =
|
||||
((size - dpbp->dpb_xdata) / ((ULONG) bpbp->bpb_nsector) + 1);
|
||||
dpbp->dpb_xrootclst = bpbp->bpb_xrootclst;
|
||||
read_fsinfo(dpbp);
|
||||
}
|
||||
@ -2310,7 +2297,8 @@ COUNT media_check(REG struct dpb FAR * dpbp)
|
||||
MediaReqHdr.r_mcmdesc = dpbp->dpb_mdb;
|
||||
MediaReqHdr.r_status = 0;
|
||||
execrh((request FAR *) & MediaReqHdr, dpbp->dpb_device);
|
||||
if (!(MediaReqHdr.r_status & S_ERROR) && (MediaReqHdr.r_status & S_DONE))
|
||||
if (!(MediaReqHdr.r_status & S_ERROR)
|
||||
&& (MediaReqHdr.r_status & S_DONE))
|
||||
break;
|
||||
else
|
||||
{
|
||||
@ -2357,12 +2345,14 @@ COUNT media_check(REG struct dpb FAR * dpbp)
|
||||
MediaReqHdr.r_mcmdesc = dpbp->dpb_mdb;
|
||||
MediaReqHdr.r_status = 0;
|
||||
execrh((request FAR *) & MediaReqHdr, dpbp->dpb_device);
|
||||
if (!(MediaReqHdr.r_status & S_ERROR) && (MediaReqHdr.r_status & S_DONE))
|
||||
if (!(MediaReqHdr.r_status & S_ERROR)
|
||||
&& (MediaReqHdr.r_status & S_DONE))
|
||||
break;
|
||||
else
|
||||
{
|
||||
loop2:
|
||||
switch (block_error(&MediaReqHdr, dpbp->dpb_unit, dpbp->dpb_device))
|
||||
switch (block_error
|
||||
(&MediaReqHdr, dpbp->dpb_unit, dpbp->dpb_device))
|
||||
{
|
||||
case ABORT:
|
||||
case FAIL:
|
||||
@ -2411,7 +2401,6 @@ struct dhdr FAR *select_unit(COUNT drive)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* TE
|
||||
if the current filesize in FAT is larger then the dir_size
|
||||
it's truncated here.
|
||||
@ -2436,7 +2425,8 @@ STATIC VOID shrink_file(f_node_ptr fnp)
|
||||
|
||||
fnp->f_offset = fnp->f_highwater; /* end of file */
|
||||
|
||||
if (fnp->f_offset) fnp->f_offset--; /* last existing cluster */
|
||||
if (fnp->f_offset)
|
||||
fnp->f_offset--; /* last existing cluster */
|
||||
|
||||
if (map_cluster(fnp, XFR_READ) != SUCCESS) /* error, don't truncate */
|
||||
goto done;
|
||||
@ -2453,7 +2443,6 @@ STATIC VOID shrink_file(f_node_ptr fnp)
|
||||
/* last cluster is encountered. */
|
||||
/* zap the FAT pointed to */
|
||||
|
||||
|
||||
if (fnp->f_highwater == 0)
|
||||
{
|
||||
setdstart(fnp->f_dir, FREE);
|
||||
@ -2617,4 +2606,3 @@ done:
|
||||
* Rev 1.0 02 Jul 1995 8:04:46 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
@ -30,7 +30,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#ifdef PROTO
|
||||
@ -62,7 +63,6 @@ int ISFAT32(struct dpb FAR *dpbp)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
struct buffer FAR *getFATblock(CLUSTER cluster, struct dpb FAR * dpbp)
|
||||
{
|
||||
ULONG sector;
|
||||
@ -84,7 +84,8 @@ struct buffer FAR *getFATblock(CLUSTER cluster, struct dpb FAR *dpbp)
|
||||
}
|
||||
sector = sector / dpbp->dpb_secsize + dpbp->dpb_fatstrt;
|
||||
#ifdef WITHFAT32
|
||||
if (ISFAT32(dpbp) && (dpbp->dpb_xflags & FAT_NO_MIRRORING)) {
|
||||
if (ISFAT32(dpbp) && (dpbp->dpb_xflags & FAT_NO_MIRRORING))
|
||||
{
|
||||
/* we must modify the active fat,
|
||||
it's number is in the 0-3 bits of dpb_xflags */
|
||||
sector += (dpbp->dpb_xflags & 0xf) * dpbp->dpb_xfatsize;
|
||||
@ -157,7 +158,8 @@ void write_fsinfo(struct dpb FAR *dpbp)
|
||||
/* 12 bytes are compressed to 9 bytes */
|
||||
/* */
|
||||
|
||||
UCOUNT link_fat(struct dpb FAR *dpbp, CLUSTER Cluster1, REG CLUSTER Cluster2)
|
||||
UCOUNT link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
REG CLUSTER Cluster2)
|
||||
{
|
||||
UCOUNT res;
|
||||
|
||||
@ -172,7 +174,6 @@ UCOUNT link_fat(struct dpb FAR *dpbp, CLUSTER Cluster1, REG CLUSTER Cluster2)
|
||||
else
|
||||
return DE_BLKINVLD;
|
||||
|
||||
|
||||
/* update the free space count */
|
||||
|
||||
if (res == SUCCESS && Cluster2 == FREE)
|
||||
@ -184,7 +185,8 @@ UCOUNT link_fat(struct dpb FAR *dpbp, CLUSTER Cluster1, REG CLUSTER Cluster2)
|
||||
/* cluster */
|
||||
++dpbp->dpb_xnfreeclst;
|
||||
write_fsinfo(dpbp);
|
||||
} else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (dpbp->dpb_nfreeclst != UNKNCLSTFREE)
|
||||
++dpbp->dpb_nfreeclst;
|
||||
@ -210,7 +212,8 @@ UCOUNT link_fat(struct dpb FAR *dpbp, CLUSTER Cluster1, REG CLUSTER Cluster2)
|
||||
}
|
||||
|
||||
#ifdef WITHFAT32
|
||||
UCOUNT link_fat32(struct dpb FAR *dpbp, CLUSTER Cluster1, CLUSTER Cluster2)
|
||||
UCOUNT link_fat32(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
CLUSTER Cluster2)
|
||||
{
|
||||
UCOUNT idx;
|
||||
struct buffer FAR *bp;
|
||||
@ -237,7 +240,8 @@ UCOUNT link_fat32(struct dpb FAR *dpbp, CLUSTER Cluster1, CLUSTER Cluster2)
|
||||
|
||||
#endif
|
||||
|
||||
UCOUNT link_fat16(struct dpb FAR *dpbp, CLUSTER Cluster1, CLUSTER Cluster2)
|
||||
UCOUNT link_fat16(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
CLUSTER Cluster2)
|
||||
{
|
||||
UCOUNT idx;
|
||||
struct buffer FAR *bp;
|
||||
@ -262,13 +266,12 @@ UCOUNT link_fat16(struct dpb FAR *dpbp, CLUSTER Cluster1, CLUSTER Cluster2)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
UCOUNT link_fat12(struct dpb FAR *dpbp, CLUSTER Cluster1, CLUSTER Cluster2)
|
||||
UCOUNT link_fat12(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
CLUSTER Cluster2)
|
||||
{
|
||||
REG UBYTE FAR *fbp0,
|
||||
FAR * fbp1;
|
||||
REG UBYTE FAR *fbp0, FAR * fbp1;
|
||||
UCOUNT idx;
|
||||
struct buffer FAR *bp,
|
||||
FAR * bp1;
|
||||
struct buffer FAR *bp, FAR * bp1;
|
||||
|
||||
/* Get the block that this cluster is in */
|
||||
bp = getFATblock(Cluster1, dpbp);
|
||||
@ -319,8 +322,10 @@ CLUSTER next_cluster(struct dpb FAR *dpbp, CLUSTER ClusterNum)
|
||||
{
|
||||
struct buffer FAR *bp;
|
||||
#ifdef DEBUG
|
||||
if (ClusterNum == LONG_LAST_CLUSTER) printf("fatal error: trying to do next_cluster(dpbp, EOC)!\n");
|
||||
if (ClusterNum == 0) printf("fatal error: trying to do next_cluster(dpbp, 0)!\n");
|
||||
if (ClusterNum == LONG_LAST_CLUSTER)
|
||||
printf("fatal error: trying to do next_cluster(dpbp, EOC)!\n");
|
||||
if (ClusterNum == 0)
|
||||
printf("fatal error: trying to do next_cluster(dpbp, 0)!\n");
|
||||
#endif
|
||||
|
||||
/* Get the block that this cluster is in */
|
||||
@ -340,7 +345,9 @@ CLUSTER next_cluster(struct dpb FAR *dpbp, CLUSTER ClusterNum)
|
||||
|
||||
/* form an index so that we can read the block as a */
|
||||
/* byte array */
|
||||
idx = (UCOUNT)(((ClusterNum << 1) + ClusterNum) >> 1) % dpbp->dpb_secsize;
|
||||
idx =
|
||||
(UCOUNT) (((ClusterNum << 1) +
|
||||
ClusterNum) >> 1) % dpbp->dpb_secsize;
|
||||
|
||||
clusterbuff.bytes[0] = bp->b_buffer[idx];
|
||||
|
||||
@ -366,7 +373,8 @@ CLUSTER next_cluster(struct dpb FAR *dpbp, CLUSTER ClusterNum)
|
||||
|
||||
#ifndef I86 /* the latter assumes byte ordering */
|
||||
if (ClusterNum & 0x01)
|
||||
idx = ((clusterbuff.byte[0] & 0xf0) >> 4) | (clusterbuff.byte[1] << 4);
|
||||
idx =
|
||||
((clusterbuff.byte[0] & 0xf0) >> 4) | (clusterbuff.byte[1] << 4);
|
||||
else
|
||||
idx = clusterbuff.byte[0] | ((clusterbuff.byte[0] & 0x0f) << 8);
|
||||
#else
|
||||
@ -401,10 +409,16 @@ CLUSTER next_cluster(struct dpb FAR *dpbp, CLUSTER ClusterNum)
|
||||
#else
|
||||
/* this saves 2 WORDS of stack :-) */
|
||||
|
||||
res = *(UWORD FAR *)&(bp->b_buffer[(UCOUNT)((ClusterNum * SIZEOF_CLST16) % dpbp->dpb_secsize)]);
|
||||
res =
|
||||
*(UWORD FAR *) & (bp->
|
||||
b_buffer[(UCOUNT)
|
||||
((ClusterNum * SIZEOF_CLST16) %
|
||||
dpbp->dpb_secsize)]);
|
||||
#endif
|
||||
if (res >= MASK16) return LONG_LAST_CLUSTER;
|
||||
if (res == BAD16) return LONG_BAD;
|
||||
if (res >= MASK16)
|
||||
return LONG_LAST_CLUSTER;
|
||||
if (res == BAD16)
|
||||
return LONG_BAD;
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -413,8 +427,13 @@ CLUSTER next_cluster(struct dpb FAR *dpbp, CLUSTER ClusterNum)
|
||||
{
|
||||
UDWORD res;
|
||||
|
||||
res = *(UDWORD FAR *)&(bp->b_buffer[(UCOUNT)((ClusterNum * SIZEOF_CLST32) % dpbp->dpb_secsize)]);
|
||||
if (res > LONG_BAD) return LONG_LAST_CLUSTER;
|
||||
res =
|
||||
*(UDWORD FAR *) & (bp->
|
||||
b_buffer[(UCOUNT)
|
||||
((ClusterNum * SIZEOF_CLST32) %
|
||||
dpbp->dpb_secsize)]);
|
||||
if (res > LONG_BAD)
|
||||
return LONG_LAST_CLUSTER;
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -477,6 +496,3 @@ CLUSTER next_cluster(struct dpb FAR *dpbp, CLUSTER ClusterNum)
|
||||
* Rev 1.0 02 Jul 1995 8:04:56 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -30,7 +30,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#define FCB_SUCCESS 0
|
||||
@ -41,7 +42,8 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
#ifdef PROTO
|
||||
fcb FAR *ExtFcbToFcb(xfcb FAR * lpExtFcb);
|
||||
fcb FAR *CommonFcbInit(xfcb FAR * lpExtFcb, BYTE * pszBuffer, COUNT * pCurDrive);
|
||||
fcb FAR *CommonFcbInit(xfcb FAR * lpExtFcb, BYTE * pszBuffer,
|
||||
COUNT * pCurDrive);
|
||||
void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive);
|
||||
VOID FcbNextRecord(fcb FAR * lpFcb);
|
||||
BOOL FcbCalcRec(xfcb FAR * lpXfcb);
|
||||
@ -56,7 +58,6 @@ BOOL FcbCalcRec();
|
||||
#define TestCmnSeps(lpFileName) (strchr(":<|>+=,", *lpFileName) != NULL)
|
||||
#define TestFieldSeps(lpFileName) (*(lpFileName) <= ' ' || strchr("/\"[]<>|.", *lpFileName) != NULL)
|
||||
|
||||
|
||||
static dmatch Dmatch;
|
||||
|
||||
VOID FatGetDrvData(UCOUNT drive, UCOUNT FAR * spc, UCOUNT FAR * bps,
|
||||
@ -142,11 +143,15 @@ WORD FcbParseFname(int wTestMode, BYTE FAR ** lpFileName, fcb FAR * lpFcb)
|
||||
}
|
||||
|
||||
/* Now to format the file name into the string */
|
||||
*lpFileName = GetNameField(*lpFileName, (BYTE FAR *) lpFcb->fcb_fname, FNAME_SIZE, (BOOL *) & wRetCodeName);
|
||||
*lpFileName =
|
||||
GetNameField(*lpFileName, (BYTE FAR *) lpFcb->fcb_fname, FNAME_SIZE,
|
||||
(BOOL *) & wRetCodeName);
|
||||
|
||||
/* Do we have an extension? If do, format it else return */
|
||||
if (**lpFileName == '.')
|
||||
*lpFileName = GetNameField(++*lpFileName, (BYTE FAR *) lpFcb->fcb_fext, FEXT_SIZE, (BOOL *) & wRetCodeExt);
|
||||
*lpFileName =
|
||||
GetNameField(++*lpFileName, (BYTE FAR *) lpFcb->fcb_fext,
|
||||
FEXT_SIZE, (BOOL *) & wRetCodeExt);
|
||||
|
||||
return (wRetCodeName | wRetCodeExt) ? PARSE_RET_WILD : PARSE_RET_NOWILD;
|
||||
}
|
||||
@ -161,8 +166,7 @@ BYTE FAR *ParseSkipWh(BYTE FAR * lpFileName)
|
||||
#if 0 /* defined above */
|
||||
BOOL TestCmnSeps(BYTE FAR * lpFileName)
|
||||
{
|
||||
BYTE *pszTest,
|
||||
*pszCmnSeps = ":<|>+=,";
|
||||
BYTE *pszTest, *pszCmnSeps = ":<|>+=,";
|
||||
|
||||
for (pszTest = pszCmnSeps; *pszTest != '\0'; ++pszTest)
|
||||
if (*lpFileName == *pszTest)
|
||||
@ -174,8 +178,7 @@ BOOL TestCmnSeps(BYTE FAR * lpFileName)
|
||||
#if 0
|
||||
BOOL TestFieldSeps(BYTE FAR * lpFileName)
|
||||
{
|
||||
BYTE *pszTest,
|
||||
*pszCmnSeps = "/\"[]<>|.";
|
||||
BYTE *pszTest, *pszCmnSeps = "/\"[]<>|.";
|
||||
|
||||
/* Another non-portable construct */
|
||||
if (*lpFileName <= ' ')
|
||||
@ -188,7 +191,6 @@ BOOL TestFieldSeps(BYTE FAR * lpFileName)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
BYTE FAR *GetNameField(BYTE FAR * lpFileName, BYTE FAR * lpDestField,
|
||||
COUNT nFieldSize, BOOL * pbWildCard)
|
||||
{
|
||||
@ -196,7 +198,8 @@ BYTE FAR *GetNameField(BYTE FAR * lpFileName, BYTE FAR * lpDestField,
|
||||
BYTE cFill = ' ';
|
||||
|
||||
*pbWildCard = FALSE;
|
||||
while (*lpFileName != '\0' && !TestFieldSeps(lpFileName) && nIndex < nFieldSize)
|
||||
while (*lpFileName != '\0' && !TestFieldSeps(lpFileName)
|
||||
&& nIndex < nFieldSize)
|
||||
{
|
||||
if (*lpFileName == ' ')
|
||||
break;
|
||||
@ -395,7 +398,8 @@ BOOL FcbCalcRec(xfcb FAR * lpXfcb)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL FcbRandomBlockRead(xfcb FAR * lpXfcb, COUNT nRecords, COUNT * nErrorCode)
|
||||
BOOL FcbRandomBlockRead(xfcb FAR * lpXfcb, COUNT nRecords,
|
||||
COUNT * nErrorCode)
|
||||
{
|
||||
FcbCalcRec(lpXfcb);
|
||||
|
||||
@ -412,7 +416,8 @@ BOOL FcbRandomBlockRead(xfcb FAR * lpXfcb, COUNT nRecords, COUNT * nErrorCode)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL FcbRandomBlockWrite(xfcb FAR * lpXfcb, COUNT nRecords, COUNT * nErrorCode)
|
||||
BOOL FcbRandomBlockWrite(xfcb FAR * lpXfcb, COUNT nRecords,
|
||||
COUNT * nErrorCode)
|
||||
{
|
||||
FcbCalcRec(lpXfcb);
|
||||
|
||||
@ -476,7 +481,8 @@ BOOL FcbCreate(xfcb FAR * lpXfcb)
|
||||
lpFcb->fcb_sftno = sft_idx;
|
||||
lpFcb->fcb_curec = 0;
|
||||
lpFcb->fcb_recsiz = (dhp ? 0 : 128);
|
||||
if (!dhp) lpFcb->fcb_drive = FcbDrive;
|
||||
if (!dhp)
|
||||
lpFcb->fcb_drive = FcbDrive;
|
||||
lpFcb->fcb_fsize = 0;
|
||||
lpFcb->fcb_date = dos_getdate();
|
||||
lpFcb->fcb_time = dos_gettime();
|
||||
@ -586,7 +592,9 @@ BOOL FcbDelete(xfcb FAR * lpXfcb)
|
||||
dmatch Dmatch;
|
||||
|
||||
dta = (BYTE FAR *) & Dmatch;
|
||||
if (DosFindFirst(D_ALL, SecPathName[1] == ':' ? &SecPathName[2] : SecPathName) != SUCCESS)
|
||||
if (DosFindFirst
|
||||
(D_ALL,
|
||||
SecPathName[1] == ':' ? &SecPathName[2] : SecPathName) != SUCCESS)
|
||||
{
|
||||
dta = lpOldDta;
|
||||
return FALSE;
|
||||
@ -625,7 +633,9 @@ BOOL FcbRename(xfcb FAR * lpXfcb)
|
||||
dmatch Dmatch;
|
||||
|
||||
dta = (BYTE FAR *) & Dmatch;
|
||||
if (DosFindFirst(D_ALL, SecPathName[1] == ':' ? &SecPathName[2] : SecPathName) != SUCCESS)
|
||||
if (DosFindFirst
|
||||
(D_ALL,
|
||||
SecPathName[1] == ':' ? &SecPathName[2] : SecPathName) != SUCCESS)
|
||||
{
|
||||
dta = lpOldDta;
|
||||
return FALSE;
|
||||
@ -634,8 +644,7 @@ BOOL FcbRename(xfcb FAR * lpXfcb)
|
||||
do
|
||||
{
|
||||
fcb LocalFcb;
|
||||
BYTE *pToName,
|
||||
*pszFrom;
|
||||
BYTE *pToName, *pszFrom;
|
||||
BYTE FAR *pFromPattern;
|
||||
COUNT nIndex;
|
||||
|
||||
@ -730,7 +739,8 @@ BOOL FcbClose(xfcb FAR * lpXfcb)
|
||||
if (!(s->sft_flags & SFT_FSHARED))
|
||||
dos_setfsize(s->sft_status, lpFcb->fcb_fsize);
|
||||
DosSetFtimeSft(lpFcb->fcb_sftno, lpFcb->fcb_date, lpFcb->fcb_time);
|
||||
if (DosCloseSft(lpFcb->fcb_sftno) == SUCCESS) {
|
||||
if (DosCloseSft(lpFcb->fcb_sftno) == SUCCESS)
|
||||
{
|
||||
lpFcb->fcb_sftno = (BYTE) 0xff;
|
||||
return TRUE;
|
||||
}
|
||||
@ -917,5 +927,3 @@ BOOL FcbFindNext(xfcb FAR * lpXfcb)
|
||||
* Rev 1.0 02 Jul 1995 8:06:06 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
||||
|
140
kernel/globals.h
140
kernel/globals.h
@ -29,11 +29,11 @@
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
#ifdef MAIN
|
||||
static BYTE *Globals_hRcsId = "$Id$";
|
||||
static BYTE *Globals_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#include "device.h"
|
||||
#include "mcb.h"
|
||||
#include "pcb.h"
|
||||
@ -127,8 +127,6 @@ static BYTE *Globals_hRcsId = "$Id$";
|
||||
#define DSKWRITEINT26 3
|
||||
#define DSKREADINT25 4
|
||||
|
||||
|
||||
|
||||
/* FAT cluster special flags */
|
||||
#define FREE 0x000
|
||||
|
||||
@ -162,16 +160,12 @@ FAR clk_dev, /* Clock device driver */
|
||||
FAR prn_dev, /* Generic printer device driver */
|
||||
FAR aux_dev, /* Generic aux device driver */
|
||||
FAR blk_dev; /* Block device (Disk) driver */
|
||||
extern UWORD
|
||||
ram_top; /* How much ram in Kbytes */
|
||||
extern COUNT *
|
||||
error_tos, /* error stack */
|
||||
extern UWORD ram_top; /* How much ram in Kbytes */
|
||||
extern COUNT *error_tos, /* error stack */
|
||||
disk_api_tos, /* API handler stack - disk fns */
|
||||
char_api_tos; /* API handler stack - char fns */
|
||||
extern BYTE
|
||||
FAR _InitTextStart; /* first available byte of ram */
|
||||
extern BYTE
|
||||
FAR _HMATextAvailable, /* first byte of available CODE area */
|
||||
extern BYTE FAR _InitTextStart; /* first available byte of ram */
|
||||
extern BYTE FAR _HMATextAvailable, /* first byte of available CODE area */
|
||||
FAR _HMATextStart[], /* first byte of HMAable CODE area */
|
||||
FAR _HMATextEnd[]; /* and the last byte of it */
|
||||
extern
|
||||
@ -183,17 +177,14 @@ extern struct ClockRecord
|
||||
/* */
|
||||
/* Global variables */
|
||||
/* */
|
||||
GLOBAL BYTE
|
||||
os_major, /* major version number */
|
||||
GLOBAL BYTE os_major, /* major version number */
|
||||
os_minor, /* minor version number */
|
||||
|
||||
rev_number /* minor version number */
|
||||
#ifdef MAIN
|
||||
= REV_NUMBER,
|
||||
#else
|
||||
,
|
||||
#endif
|
||||
|
||||
version_flags /* minor version number */
|
||||
#ifdef MAIN
|
||||
= 0;
|
||||
@ -232,7 +223,7 @@ GLOBAL BYTE os_release[]
|
||||
#if 0
|
||||
= "DOS-C version %d.%d Beta %d [FreeDOS Release] (Build %d).\n"
|
||||
#endif
|
||||
= "FreeDOS kernel version " KERNEL_VERSION_STRING \
|
||||
= "FreeDOS kernel version " KERNEL_VERSION_STRING
|
||||
" (Build " KERNEL_BUILD_STRING ") [" __DATE__ " " __TIME__ "]\n"
|
||||
#if 0
|
||||
"For technical information and description of the DOS-C operating system\n\
|
||||
@ -251,59 +242,40 @@ Freeman Publishing, Lawrence KS, USA (ISBN 0-87930-436-7).\n\
|
||||
extern UWORD NetBios;
|
||||
extern BYTE *net_name;
|
||||
extern BYTE net_set_count;
|
||||
extern BYTE NetDelay,
|
||||
NetRetry;
|
||||
extern BYTE NetDelay, NetRetry;
|
||||
|
||||
extern UWORD
|
||||
first_mcb, /* Start of user memory */
|
||||
UMB_top,
|
||||
umb_start,
|
||||
uppermem_root; /* Start of umb chain ? */
|
||||
extern UWORD first_mcb, /* Start of user memory */
|
||||
UMB_top, umb_start, uppermem_root; /* Start of umb chain ? */
|
||||
extern struct dpb
|
||||
FAR *DPBp; /* First drive Parameter Block */
|
||||
extern sfttbl
|
||||
FAR * sfthead; /* System File Table head */
|
||||
extern sfttbl FAR * sfthead; /* System File Table head */
|
||||
extern struct dhdr
|
||||
FAR *clock, /* CLOCK$ device */
|
||||
FAR * syscon; /* console device */
|
||||
extern WORD
|
||||
maxbksize; /* Number of Drives in system */
|
||||
extern WORD maxbksize; /* Number of Drives in system */
|
||||
extern struct buffer
|
||||
FAR *firstbuf; /* head of buffers linked list */
|
||||
extern cdstbl
|
||||
FAR * CDSp; /* Current Directory Structure */
|
||||
extern cdstbl FAR * CDSp; /* Current Directory Structure */
|
||||
extern
|
||||
struct cds FAR *current_ldt;
|
||||
extern LONG current_filepos; /* current file position */
|
||||
extern sfttbl
|
||||
FAR * FCBp; /* FCB table pointer */
|
||||
extern WORD
|
||||
nprotfcb; /* number of protected fcbs */
|
||||
extern UBYTE
|
||||
nblkdev, /* number of block devices */
|
||||
extern sfttbl FAR * FCBp; /* FCB table pointer */
|
||||
extern WORD nprotfcb; /* number of protected fcbs */
|
||||
extern UBYTE nblkdev, /* number of block devices */
|
||||
lastdrive, /* value of last drive */
|
||||
uppermem_link, /* UMB Link flag */
|
||||
PrinterEcho; /* Printer Echo Flag */
|
||||
|
||||
extern UWORD
|
||||
LoL_nbuffers; /* Number of buffers */
|
||||
extern UWORD LoL_nbuffers; /* Number of buffers */
|
||||
|
||||
extern struct dhdr
|
||||
nul_dev;
|
||||
extern UBYTE
|
||||
mem_access_mode; /* memory allocation scheme */
|
||||
extern BYTE
|
||||
ErrorMode, /* Critical error flag */
|
||||
extern UBYTE mem_access_mode; /* memory allocation scheme */
|
||||
extern BYTE ErrorMode, /* Critical error flag */
|
||||
InDOS, /* In DOS critical section */
|
||||
OpenMode, /* File Open Attributes */
|
||||
SAttr, /* Attrib Mask for Dir Search */
|
||||
dosidle_flag,
|
||||
Server_Call,
|
||||
CritErrLocus,
|
||||
CritErrAction,
|
||||
CritErrClass,
|
||||
VgaSet,
|
||||
njoined; /* number of joined devices */
|
||||
dosidle_flag, Server_Call, CritErrLocus, CritErrAction, CritErrClass, VgaSet, njoined; /* number of joined devices */
|
||||
|
||||
extern UWORD Int21AX;
|
||||
extern COUNT CritErrCode;
|
||||
@ -312,26 +284,21 @@ extern BYTE FAR * CritErrDev;
|
||||
extern struct dirent
|
||||
SearchDir;
|
||||
|
||||
extern struct
|
||||
{
|
||||
extern struct {
|
||||
COUNT nDrive;
|
||||
BYTE szName[FNAME_SIZE + 1];
|
||||
BYTE szExt[FEXT_SIZE + 1];
|
||||
}
|
||||
FcbSearchBuffer;
|
||||
} FcbSearchBuffer;
|
||||
|
||||
extern struct /* Path name parsing buffer */
|
||||
{
|
||||
BYTE _PriPathName[128];
|
||||
}
|
||||
_PriPathBuffer;
|
||||
} _PriPathBuffer;
|
||||
|
||||
extern struct
|
||||
{
|
||||
extern struct {
|
||||
BYTE _fname[FNAME_SIZE];
|
||||
BYTE _fext[FEXT_SIZE + 1]; /* space for 0 */
|
||||
}
|
||||
szNames;
|
||||
} szNames;
|
||||
|
||||
#define PriPathName _PriPathBuffer._PriPathName
|
||||
#define szDirName TempCDS.cdsCurrentPath
|
||||
@ -341,19 +308,15 @@ szNames;
|
||||
extern struct /* Alternate path name parsing buffer */
|
||||
{
|
||||
BYTE _SecPathName[128];
|
||||
}
|
||||
_SecPathBuffer;
|
||||
} _SecPathBuffer;
|
||||
|
||||
#define SecPathName _SecPathBuffer._SecPathName
|
||||
|
||||
extern UWORD
|
||||
wAttr;
|
||||
extern UWORD wAttr;
|
||||
|
||||
extern BYTE
|
||||
default_drive; /* default drive for dos */
|
||||
extern BYTE default_drive; /* default drive for dos */
|
||||
|
||||
extern BYTE
|
||||
TempBuffer[], /* Temporary general purpose buffer */
|
||||
extern BYTE TempBuffer[], /* Temporary general purpose buffer */
|
||||
FAR internal_data[], /* sda areas */
|
||||
FAR swap_always[], /* " " */
|
||||
FAR swap_indos[], /* " " */
|
||||
@ -361,46 +324,36 @@ extern BYTE
|
||||
break_flg, /* true if break was detected */
|
||||
break_ena, /* break enabled flag */
|
||||
FAR * dta; /* Disk transfer area (kludge) */
|
||||
extern seg
|
||||
cu_psp; /* current psp segment */
|
||||
extern iregs
|
||||
FAR * user_r; /* User registers for int 21h call */
|
||||
extern seg cu_psp; /* current psp segment */
|
||||
extern iregs FAR * user_r; /* User registers for int 21h call */
|
||||
|
||||
extern struct dirent /* Temporary directory entry */
|
||||
DirEntBuffer;
|
||||
|
||||
extern request /* I/O Request packets */
|
||||
CharReqHdr,
|
||||
IoReqHdr,
|
||||
MediaReqHdr;
|
||||
CharReqHdr, IoReqHdr, MediaReqHdr;
|
||||
|
||||
extern fcb
|
||||
FAR * lpFcb; /* Pointer to users fcb */
|
||||
extern fcb FAR * lpFcb; /* Pointer to users fcb */
|
||||
|
||||
extern sft
|
||||
FAR * lpCurSft;
|
||||
extern sft FAR * lpCurSft;
|
||||
|
||||
extern BYTE
|
||||
verify_ena, /* verify enabled flag */
|
||||
extern BYTE verify_ena, /* verify enabled flag */
|
||||
switchar, /* switch char */
|
||||
return_mode, /* Process termination rets */
|
||||
return_code; /* " " " */
|
||||
|
||||
extern BYTE
|
||||
BootDrive, /* Drive we came up from */
|
||||
extern BYTE BootDrive, /* Drive we came up from */
|
||||
scr_pos; /* screen position for bs, ht, etc */
|
||||
/*extern WORD
|
||||
NumFloppies; !!*//* How many floppies we have */
|
||||
|
||||
extern keyboard
|
||||
kb_buf;
|
||||
extern keyboard kb_buf;
|
||||
|
||||
extern struct cds
|
||||
TempCDS;
|
||||
|
||||
/* start of uncontrolled variables */
|
||||
GLOBAL seg
|
||||
RootPsp; /* Root process -- do not abort */
|
||||
GLOBAL seg RootPsp; /* Root process -- do not abort */
|
||||
|
||||
/* don't know what it should do, but its no longer in use TE
|
||||
GLOBAL struct f_node
|
||||
@ -410,8 +363,7 @@ GLOBAL struct f_node
|
||||
#ifdef DEBUG
|
||||
GLOBAL iregs error_regs; /* registers for dump */
|
||||
|
||||
GLOBAL WORD
|
||||
dump_regs; /* dump registers of bad call */
|
||||
GLOBAL WORD dump_regs; /* dump registers of bad call */
|
||||
|
||||
#endif
|
||||
|
||||
@ -430,15 +382,12 @@ GLOBAL UWORD f_nodes_cnt; /* number of allocated f_nodes */
|
||||
|
||||
/* Process related functions - not under automatic generation. */
|
||||
/* Typically, these are in ".asm" files. */
|
||||
VOID
|
||||
FAR ASMCFUNC cpm_entry(VOID)
|
||||
VOID FAR ASMCFUNC cpm_entry(VOID)
|
||||
/*INRPT FAR handle_break(VOID) */ ;
|
||||
VOID
|
||||
enable(VOID),
|
||||
disable(VOID);
|
||||
VOID enable(VOID), disable(VOID);
|
||||
COUNT
|
||||
ASMCFUNC CriticalError(
|
||||
COUNT nFlag, COUNT nDrive, COUNT nError, struct dhdr FAR * lpDevice);
|
||||
ASMCFUNC CriticalError(COUNT nFlag, COUNT nDrive, COUNT nError,
|
||||
struct dhdr FAR * lpDevice);
|
||||
|
||||
#ifdef PROTO
|
||||
VOID FAR ASMCFUNC CharMapSrvc(VOID);
|
||||
@ -519,7 +468,6 @@ void ASMCFUNC spawn_int23(void); /* procsupt.asm */
|
||||
int control_break(void); /* break.c */
|
||||
void handle_break(void); /* break.c */
|
||||
|
||||
|
||||
GLOBAL BYTE ReturnAnyDosVersionExpected;
|
||||
|
||||
GLOBAL COUNT UnusedRetVal; /* put unused errors here (to save stack space) */
|
||||
|
@ -24,8 +24,4 @@
|
||||
#pragma error("unknown compiler - please adjust")
|
||||
this should simply not compile ! !
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
extern BYTE DOSFAR version_flags; /* minor version number */
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "KConfig.h"
|
||||
extern struct _KernelConfig InitKernelConfig;
|
||||
|
||||
|
||||
/*
|
||||
* The null macro `INIT' can be used to allow the reader to differentiate
|
||||
* between functions defined in `INIT_TEXT' and those defined in `_TEXT'.
|
||||
@ -75,11 +74,8 @@ extern fmemcmp(BYTE far *s1, BYTE FAR *s2, unsigned len);
|
||||
#define MAX_HARD_DRIVE 8
|
||||
#define NDEV 26 /* up to Z: */
|
||||
|
||||
|
||||
|
||||
/* Start of configuration variables */
|
||||
struct config
|
||||
{
|
||||
struct config {
|
||||
BYTE cfgBuffers;
|
||||
/* number of buffers in the system */
|
||||
UBYTE cfgFiles;
|
||||
@ -164,7 +160,8 @@ INIT COUNT ASMCFUNC init_DosExec(COUNT mode, exec_blk * ep, BYTE * lp);
|
||||
INIT VOID ASMCFUNC keycheck(VOID);
|
||||
|
||||
/* irqstack.asm */
|
||||
VOID ASMCFUNC init_stacks(VOID FAR * stack_base, COUNT nStacks, WORD stackSize);
|
||||
VOID ASMCFUNC init_stacks(VOID FAR * stack_base, COUNT nStacks,
|
||||
WORD stackSize);
|
||||
|
||||
/* inthndlr.c */
|
||||
VOID far ASMCFUNC int21_entry(iregs UserRegs);
|
||||
@ -187,7 +184,8 @@ VOID FAR ASMCFUNC int2f_handler(void);
|
||||
|
||||
/* main.c */
|
||||
INIT VOID ASMCFUNC FreeDOSmain(void);
|
||||
INIT BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT top);
|
||||
INIT BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine,
|
||||
COUNT mode, COUNT top);
|
||||
INIT VOID init_fatal(BYTE * err_msg);
|
||||
|
||||
/* prf.c */
|
||||
|
@ -29,7 +29,8 @@
|
||||
#include "init-dat.h"
|
||||
#include "dyndata.h"
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *dskRcsId = "$Id$";
|
||||
static BYTE *dskRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -159,7 +160,6 @@ extern UWORD DOSFAR LBA_WRITE_VERIFY;
|
||||
|
||||
#define _BETA_ /* messages for initial phase only */
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
#define DebugPrintf(x) printf x
|
||||
#else
|
||||
@ -172,7 +172,6 @@ extern UWORD DOSFAR LBA_WRITE_VERIFY;
|
||||
#define BetaPrintf(x)
|
||||
#endif
|
||||
|
||||
|
||||
#define LBA_to_CHS init_LBA_to_CHS
|
||||
|
||||
/*
|
||||
@ -184,7 +183,6 @@ extern UWORD DOSFAR LBA_WRITE_VERIFY;
|
||||
#define SCAN_EXTENDED 0x02
|
||||
#define SCAN_PRIMARY2 0x03
|
||||
|
||||
|
||||
#define FAT12 0x01
|
||||
#define FAT16SMALL 0x04
|
||||
#define EXTENDED 0x05
|
||||
@ -248,11 +246,9 @@ struct _bios_LBA_disk_parameterS {
|
||||
ULONG eddparameters;
|
||||
};
|
||||
|
||||
|
||||
/* physical characteristics of a drive */
|
||||
|
||||
struct DriveParamS
|
||||
{
|
||||
struct DriveParamS {
|
||||
UBYTE driveno; /* = 0x8x */
|
||||
BITS LBA_supported:1; /* set, if INT13 extensions enabled */
|
||||
BITS WriteVerifySupported:1; /* */
|
||||
@ -282,7 +278,8 @@ COUNT init_readdasd(UBYTE drive)
|
||||
regs.a.b.h = 0x15;
|
||||
regs.d.b.l = drive;
|
||||
init_call_intr(0x13, ®s);
|
||||
if ((regs.flags & 1) == 0) switch (regs.a.b.h)
|
||||
if ((regs.flags & 1) == 0)
|
||||
switch (regs.a.b.h)
|
||||
{
|
||||
case 2:
|
||||
return DF_CHANGELINE;
|
||||
@ -292,8 +289,7 @@ COUNT init_readdasd(UBYTE drive)
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UWORD bpb_nbyte; /* Bytes per Sector */
|
||||
UBYTE bpb_nsector; /* Sectors per Allocation Unit */
|
||||
UWORD bpb_nreserved; /* # Reserved Sectors */
|
||||
@ -350,7 +346,8 @@ COUNT init_getdriveparm(UBYTE drive, bpb FAR *pbpbarray)
|
||||
copied and pasted from dsk.c!
|
||||
*/
|
||||
|
||||
void init_LBA_to_CHS(struct CHS *chs, ULONG LBA_address, struct DriveParamS *driveparam)
|
||||
void init_LBA_to_CHS(struct CHS *chs, ULONG LBA_address,
|
||||
struct DriveParamS *driveparam)
|
||||
{
|
||||
chs->Sector = LBA_address % driveparam->chs.Sector + 1;
|
||||
|
||||
@ -394,19 +391,22 @@ VOID CalculateFATData(ddt FAR *pddt, ULONG NumSectors, UBYTE FileSystem)
|
||||
|
||||
/* FAT related items */
|
||||
defbpb->bpb_nfat = 2;
|
||||
defbpb->bpb_ndirent = (FileSystem == FAT32 || FileSystem == FAT32_LBA) ? 0 : 512;
|
||||
defbpb->bpb_ndirent = (FileSystem == FAT32
|
||||
|| FileSystem == FAT32_LBA) ? 0 : 512;
|
||||
/* normal value of number of entries in root dir */
|
||||
defbpb->bpb_nreserved = (FileSystem == FAT32 || FileSystem == FAT32_LBA) ? 0x20 : 1;
|
||||
defbpb->bpb_nreserved = (FileSystem == FAT32
|
||||
|| FileSystem == FAT32_LBA) ? 0x20 : 1;
|
||||
|
||||
fatdata = NumSectors - cdiv (defbpb->bpb_ndirent * DIRENT_SIZE, defbpb->bpb_nbyte) -
|
||||
defbpb->bpb_nreserved;
|
||||
fatdata =
|
||||
NumSectors - cdiv(defbpb->bpb_ndirent * DIRENT_SIZE,
|
||||
defbpb->bpb_nbyte) - defbpb->bpb_nreserved;
|
||||
maxclustsize = 128;
|
||||
#ifdef DEBUG
|
||||
if (FileSystem != FAT12)
|
||||
DebugPrintf(( "%ld sectors for FAT+data, starting with %d sectors/cluster\n",
|
||||
fatdata, defbpb->bpb_nsector ));
|
||||
DebugPrintf(("%ld sectors for FAT+data, starting with %d sectors/cluster\n", fatdata, defbpb->bpb_nsector));
|
||||
#endif
|
||||
switch(FileSystem) {
|
||||
switch (FileSystem)
|
||||
{
|
||||
|
||||
case FAT12:
|
||||
case FAT12_LBA:
|
||||
@ -420,19 +420,24 @@ VOID CalculateFATData(ddt FAR *pddt, ULONG NumSectors, UBYTE FileSystem)
|
||||
fatdata = 32640;
|
||||
/* The factor 2 below avoids cut-off errors for nr_fats == 1.
|
||||
* The "defbpb->bpb_nfat*3" is for the reserved first two FAT entries */
|
||||
clust = 2*((ULONG) fatdata * defbpb->bpb_nbyte + defbpb->bpb_nfat*3) /
|
||||
(2*(ULONG) defbpb->bpb_nsector * defbpb->bpb_nbyte + defbpb->bpb_nfat*3);
|
||||
clust =
|
||||
2 * ((ULONG) fatdata * defbpb->bpb_nbyte +
|
||||
defbpb->bpb_nfat * 3) / (2 * (ULONG) defbpb->bpb_nsector *
|
||||
defbpb->bpb_nbyte +
|
||||
defbpb->bpb_nfat * 3);
|
||||
fatlength = cdiv(((clust + 2) * 3 + 1) >> 1, defbpb->bpb_nbyte);
|
||||
/* Need to recalculate number of clusters, since the unused parts of the
|
||||
* FATS and data area together could make up space for an additional,
|
||||
* not really present cluster. */
|
||||
clust = (fatdata - defbpb->bpb_nfat*fatlength)/defbpb->bpb_nsector;
|
||||
clust =
|
||||
(fatdata - defbpb->bpb_nfat * fatlength) / defbpb->bpb_nsector;
|
||||
maxclust = (fatlength * 2 * defbpb->bpb_nbyte) / 3;
|
||||
if (maxclust > FAT12MAX)
|
||||
maxclust = FAT12MAX;
|
||||
DebugPrintf(("FAT12: #clu=%lu, fatlen=%lu, maxclu=%lu, limit=%u\n",
|
||||
clust, fatlength, maxclust, FATMAX12));
|
||||
if (clust > maxclust-2) {
|
||||
if (clust > maxclust - 2)
|
||||
{
|
||||
clust = maxclust - 2;
|
||||
DebugPrintf(("FAT12: too many clusters: setting to maxclu-2\n"));
|
||||
}
|
||||
@ -452,25 +457,34 @@ VOID CalculateFATData(ddt FAR *pddt, ULONG NumSectors, UBYTE FileSystem)
|
||||
max FAT16 size for FreeDOS = 4,293,984,256 bytes = 4GiB-983,040 */
|
||||
if (fatdata > 8386688ul)
|
||||
fatdata = 8386688ul;
|
||||
do {
|
||||
DebugPrintf(( "Trying with %d sectors/cluster:\n", defbpb->bpb_nsector ));
|
||||
do
|
||||
{
|
||||
DebugPrintf(("Trying with %d sectors/cluster:\n",
|
||||
defbpb->bpb_nsector));
|
||||
|
||||
clust = ((ULONG) fatdata *defbpb->bpb_nbyte + defbpb->bpb_nfat*4) /
|
||||
((ULONG) defbpb->bpb_nsector * defbpb->bpb_nbyte + defbpb->bpb_nfat*2);
|
||||
clust =
|
||||
((ULONG) fatdata * defbpb->bpb_nbyte +
|
||||
defbpb->bpb_nfat * 4) / ((ULONG) defbpb->bpb_nsector *
|
||||
defbpb->bpb_nbyte +
|
||||
defbpb->bpb_nfat * 2);
|
||||
fatlength = cdiv((clust + 2) * 2, defbpb->bpb_nbyte);
|
||||
/* Need to recalculate number of clusters, since the unused parts of the
|
||||
* FATS and data area together could make up space for an additional,
|
||||
* not really present cluster. */
|
||||
clust = (fatdata - defbpb->bpb_nfat*fatlength)/defbpb->bpb_nsector;
|
||||
clust =
|
||||
(fatdata - defbpb->bpb_nfat * fatlength) / defbpb->bpb_nsector;
|
||||
maxclust = (fatlength * defbpb->bpb_nbyte) / 2;
|
||||
if (maxclust > FAT16MAX)
|
||||
maxclust = FAT16MAX;
|
||||
DebugPrintf(("FAT16: #clu=%lu, fatlen=%lu, maxclu=%lu, limit=%u\n",
|
||||
clust, fatlength, maxclust, FAT_MAGIC16));
|
||||
if (clust > maxclust-2) {
|
||||
if (clust > maxclust - 2)
|
||||
{
|
||||
DebugPrintf(("FAT16: too many clusters\n"));
|
||||
clust = 0;
|
||||
} else if (clust <= FAT_MAGIC) {
|
||||
}
|
||||
else if (clust <= FAT_MAGIC)
|
||||
{
|
||||
/* The <= 4086 avoids that the filesystem will be misdetected as having a
|
||||
* 12 bit FAT. */
|
||||
DebugPrintf(("FAT16: would be misdetected as FAT12\n"));
|
||||
@ -492,7 +506,8 @@ VOID CalculateFATData(ddt FAR *pddt, ULONG NumSectors, UBYTE FileSystem)
|
||||
* otherwise 1 sector per cluster. This is also what M$'s format
|
||||
* command does for FAT32. */
|
||||
defbpb->bpb_nsector = (NumSectors >= 512 * 1024ul ? 8 : 1);
|
||||
do {
|
||||
do
|
||||
{
|
||||
/* simple calculation - no long long available */
|
||||
clust = (ULONG) fatdata / defbpb->bpb_nsector;
|
||||
/* this calculation below yields a smaller value - the above is non-optimal
|
||||
@ -503,7 +518,8 @@ VOID CalculateFATData(ddt FAR *pddt, ULONG NumSectors, UBYTE FileSystem)
|
||||
/* Need to recalculate number of clusters, since the unused parts of the
|
||||
* FATS and data area together could make up space for an additional,
|
||||
* not really present cluster. */
|
||||
clust = (fatdata - defbpb->bpb_nfat*fatlength)/defbpb->bpb_nsector;
|
||||
clust =
|
||||
(fatdata - defbpb->bpb_nfat * fatlength) / defbpb->bpb_nsector;
|
||||
maxclust = (fatlength * defbpb->bpb_nbyte) / 4;
|
||||
if (maxclust > FAT32MAX)
|
||||
maxclust = FAT32MAX;
|
||||
@ -517,7 +533,8 @@ VOID CalculateFATData(ddt FAR *pddt, ULONG NumSectors, UBYTE FileSystem)
|
||||
if (clust)
|
||||
break;
|
||||
defbpb->bpb_nsector <<= 1;
|
||||
} while (defbpb->bpb_nsector && defbpb->bpb_nsector <= maxclustsize);
|
||||
}
|
||||
while (defbpb->bpb_nsector && defbpb->bpb_nsector <= maxclustsize);
|
||||
defbpb->bpb_nfsect = 0;
|
||||
defbpb->bpb_xnfsect = fatlength;
|
||||
/* set up additional FAT32 fields */
|
||||
@ -533,9 +550,9 @@ VOID CalculateFATData(ddt FAR *pddt, ULONG NumSectors, UBYTE FileSystem)
|
||||
pddt->ddt_fstype[8] = '\0';
|
||||
}
|
||||
|
||||
|
||||
void DosDefinePartition(struct DriveParamS *driveParam,
|
||||
ULONG StartSector, struct PartTableEntry *pEntry, int extendedPartNo, int PrimaryNum)
|
||||
ULONG StartSector, struct PartTableEntry *pEntry,
|
||||
int extendedPartNo, int PrimaryNum)
|
||||
{
|
||||
ddt FAR *pddt = DynAlloc("ddt", 1, sizeof(ddt));
|
||||
struct CHS chs;
|
||||
@ -590,12 +607,12 @@ void DosDefinePartition(struct DriveParamS *driveParam,
|
||||
{
|
||||
LBA_to_CHS(&chs, StartSector, driveParam);
|
||||
|
||||
printf("%c: HD%d",
|
||||
'A' + nUnits,
|
||||
(driveParam->driveno & 0x7f)+1);
|
||||
printf("%c: HD%d", 'A' + nUnits, (driveParam->driveno & 0x7f) + 1);
|
||||
|
||||
if (extendedPartNo) printf(" Ext:%d", extendedPartNo);
|
||||
else printf(" Pri:%d", PrimaryNum + 1);
|
||||
if (extendedPartNo)
|
||||
printf(" Ext:%d", extendedPartNo);
|
||||
else
|
||||
printf(" Pri:%d", PrimaryNum + 1);
|
||||
|
||||
printCHS(" CHS= ", &chs);
|
||||
|
||||
@ -605,12 +622,9 @@ void DosDefinePartition(struct DriveParamS *driveParam,
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
nUnits++;
|
||||
}
|
||||
|
||||
|
||||
/* Get the parameters of the hard disk */
|
||||
int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam)
|
||||
{
|
||||
@ -623,7 +637,6 @@ int LBA_Get_Drive_Parameters(int drive,struct DriveParamS *driveParam)
|
||||
|
||||
driveParam->LBA_supported = FALSE;
|
||||
|
||||
|
||||
drive |= 0x80;
|
||||
|
||||
/* for tests - disable LBA support,
|
||||
@ -639,7 +652,6 @@ int LBA_Get_Drive_Parameters(int drive,struct DriveParamS *driveParam)
|
||||
|
||||
init_call_intr(0x13, ®s);
|
||||
|
||||
|
||||
if (regs.b.x != 0xaa55 || (regs.flags & 0x01))
|
||||
{
|
||||
goto StandardBios;
|
||||
@ -654,26 +666,21 @@ int LBA_Get_Drive_Parameters(int drive,struct DriveParamS *driveParam)
|
||||
goto StandardBios;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* drive supports LBA addressing */
|
||||
|
||||
/* version 1.0, 2.0 have different verify */
|
||||
if (regs.a.x < 0x2100)
|
||||
LBA_WRITE_VERIFY = 0x4301;
|
||||
|
||||
|
||||
memset(&lba_bios_parameters, 0, sizeof(lba_bios_parameters));
|
||||
lba_bios_parameters.size = sizeof(lba_bios_parameters);
|
||||
|
||||
|
||||
regs.si = FP_OFF(&lba_bios_parameters);
|
||||
regs.ds = FP_SEG(&lba_bios_parameters);
|
||||
regs.a.b.h = 0x48;
|
||||
regs.d.b.l = drive;
|
||||
init_call_intr(0x13, ®s);
|
||||
|
||||
|
||||
if (regs.flags & 0x01)
|
||||
{
|
||||
goto StandardBios;
|
||||
@ -708,33 +715,25 @@ int LBA_Get_Drive_Parameters(int drive,struct DriveParamS *driveParam)
|
||||
/* if we arrive here, success */
|
||||
driveParam->LBA_supported = TRUE;
|
||||
|
||||
|
||||
|
||||
|
||||
StandardBios: /* old way to get parameters */
|
||||
|
||||
|
||||
regs.a.b.h = 0x08;
|
||||
regs.d.b.l = drive;
|
||||
|
||||
init_call_intr(0x13, ®s);
|
||||
|
||||
|
||||
if (regs.flags & 0x01)
|
||||
goto ErrorReturn;
|
||||
|
||||
|
||||
driveParam->chs.Head = (regs.d.x >> 8) + 1;
|
||||
driveParam->chs.Sector = (regs.c.x & 0x3f);
|
||||
driveParam->chs.Cylinder = (regs.c.x >> 8) | ((regs.c.x & 0xc0) << 2);
|
||||
|
||||
|
||||
if (!driveParam->LBA_supported)
|
||||
{
|
||||
driveParam->total_sectors =
|
||||
min(driveParam->chs.Cylinder, 1023)
|
||||
* driveParam->chs.Head
|
||||
* driveParam->chs.Sector;
|
||||
* driveParam->chs.Head * driveParam->chs.Sector;
|
||||
}
|
||||
|
||||
driveParam->driveno = drive;
|
||||
@ -742,25 +741,20 @@ StandardBios: /* old way to get parameters */
|
||||
DebugPrintf(("drive parameters %02x - %04lu-%u-%u",
|
||||
drive,
|
||||
driveParam->chs.Cylinder,
|
||||
driveParam->chs.Head,
|
||||
driveParam->chs.Sector));
|
||||
driveParam->chs.Head, driveParam->chs.Sector));
|
||||
DebugPrintf((" total size %luMB\n\n", driveParam->total_sectors / 2048));
|
||||
|
||||
|
||||
|
||||
ErrorReturn:
|
||||
|
||||
return driveParam->driveno;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
converts physical into logical representation of partition entry
|
||||
*/
|
||||
|
||||
ConvPartTableEntryToIntern(struct PartTableEntry *pEntry, UBYTE FAR * pDisk)
|
||||
ConvPartTableEntryToIntern(struct PartTableEntry * pEntry,
|
||||
UBYTE FAR * pDisk)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -789,7 +783,6 @@ ConvPartTableEntryToIntern(struct PartTableEntry *pEntry, UBYTE FAR * pDisk)
|
||||
pEntry->End.Cylinder = *(UBYTE FAR *) (pDisk + 7) +
|
||||
((UWORD) (0xc0 & *(UBYTE FAR *) (pDisk + 6)) << 2);
|
||||
|
||||
|
||||
pEntry->RelSect = *(ULONG FAR *) (pDisk + 8);
|
||||
pEntry->NumSect = *(ULONG FAR *) (pDisk + 12);
|
||||
}
|
||||
@ -798,15 +791,13 @@ ConvPartTableEntryToIntern(struct PartTableEntry *pEntry, UBYTE FAR * pDisk)
|
||||
|
||||
ScanForPrimaryPartitions(struct DriveParamS * driveParam, int scan_type,
|
||||
struct PartTableEntry * pEntry, ULONG startSector,
|
||||
int partitionsToIgnore, int extendedPartNo
|
||||
)
|
||||
int partitionsToIgnore, int extendedPartNo)
|
||||
{
|
||||
int i;
|
||||
struct CHS chs, end;
|
||||
ULONG partitionStart;
|
||||
char partitionName[12];
|
||||
|
||||
|
||||
for (i = 0; i < 4; i++, pEntry++)
|
||||
{
|
||||
if (pEntry->FileSystem == 0)
|
||||
@ -815,14 +806,12 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
if (partitionsToIgnore & (1 << i))
|
||||
continue;
|
||||
|
||||
|
||||
if (IsExtPartition(pEntry->FileSystem))
|
||||
continue;
|
||||
|
||||
if (scan_type == SCAN_PRIMARYBOOT && !pEntry->Bootable)
|
||||
continue;
|
||||
|
||||
|
||||
partitionStart = startSector + pEntry->RelSect;
|
||||
|
||||
if (!IsFATPartition(pEntry->FileSystem))
|
||||
@ -830,11 +819,10 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (extendedPartNo) sprintf(partitionName, "Ext:%d", extendedPartNo);
|
||||
else sprintf(partitionName, "Pri:%d",i+1);
|
||||
|
||||
if (extendedPartNo)
|
||||
sprintf(partitionName, "Ext:%d", extendedPartNo);
|
||||
else
|
||||
sprintf(partitionName, "Pri:%d", i + 1);
|
||||
|
||||
/*
|
||||
some sanity checks, that partition
|
||||
@ -843,7 +831,6 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
LBA_to_CHS(&chs, partitionStart, driveParam);
|
||||
LBA_to_CHS(&end, partitionStart + pEntry->NumSect - 1, driveParam);
|
||||
|
||||
|
||||
/* some FDISK's enter for partitions
|
||||
> 8 GB cyl = 1023, other (cyl&1023)
|
||||
*/
|
||||
@ -862,11 +849,9 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (((end.Cylinder & 0x3ff) != pEntry->End.Cylinder &&
|
||||
1023 != pEntry->End.Cylinder) ||
|
||||
end.Head != pEntry->End.Head ||
|
||||
end.Sector != pEntry->End.Sector )
|
||||
end.Head != pEntry->End.Head || end.Sector != pEntry->End.Sector)
|
||||
{
|
||||
if (pEntry->NumSect == 0)
|
||||
{
|
||||
@ -884,13 +869,13 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (chs.Cylinder > 1023 || end.Cylinder > 1023)
|
||||
{
|
||||
|
||||
if (!driveParam->LBA_supported)
|
||||
{
|
||||
printf("can't use LBA partition without LBA support - part %s FS %02x",
|
||||
printf
|
||||
("can't use LBA partition without LBA support - part %s FS %02x",
|
||||
partitionName, pEntry->FileSystem);
|
||||
|
||||
printCHS(" start ", &chs);
|
||||
@ -900,9 +885,11 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!InitKernelConfig.ForceLBA && !IsLBAPartition(pEntry->FileSystem))
|
||||
if (!InitKernelConfig.ForceLBA
|
||||
&& !IsLBAPartition(pEntry->FileSystem))
|
||||
{
|
||||
printf("WARNING: Partition ID does not suggest LBA - part %s FS %02x.\n"
|
||||
printf
|
||||
("WARNING: Partition ID does not suggest LBA - part %s FS %02x.\n"
|
||||
"Please run FDISK to correct this - using LBA to access partition.\n",
|
||||
partitionName, pEntry->FileSystem);
|
||||
|
||||
@ -911,7 +898,8 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
printf("\n");
|
||||
pEntry->FileSystem = (pEntry->FileSystem == FAT12 ? FAT12_LBA :
|
||||
pEntry->FileSystem == FAT32 ? FAT32_LBA :
|
||||
/* pEntry->FileSystem == FAT16 ? */ FAT16_LBA);
|
||||
/* pEntry->FileSystem == FAT16 ? */
|
||||
FAT16_LBA);
|
||||
}
|
||||
|
||||
/* else its a diagnostic message only */
|
||||
@ -924,7 +912,6 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
here we have a partition table in our hand !!
|
||||
*/
|
||||
@ -934,8 +921,7 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
DosDefinePartition(driveParam, partitionStart, pEntry,
|
||||
extendedPartNo, i);
|
||||
|
||||
if (scan_type == SCAN_PRIMARYBOOT ||
|
||||
scan_type == SCAN_PRIMARY )
|
||||
if (scan_type == SCAN_PRIMARYBOOT || scan_type == SCAN_PRIMARY)
|
||||
{
|
||||
return partitionsToIgnore;
|
||||
}
|
||||
@ -946,7 +932,8 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
|
||||
void BIOS_drive_reset(unsigned drive);
|
||||
|
||||
int Read1LBASector(struct DriveParamS *driveParam, unsigned drive, ULONG LBA_address, void FAR *buffer)
|
||||
int Read1LBASector(struct DriveParamS *driveParam, unsigned drive,
|
||||
ULONG LBA_address, void FAR * buffer)
|
||||
{
|
||||
static struct _bios_LBA_address_packet dap = {
|
||||
16, 0, 0, 0, 0, 0, 0
|
||||
@ -962,7 +949,8 @@ int Read1LBASector(struct DriveParamS *driveParam, unsigned drive, ULONG LBA_add
|
||||
#if 0
|
||||
if (LBA_address >= driveParam->total_sectors)
|
||||
{
|
||||
printf("LBA-Transfer error : address overflow = %lu > %lu max\n",LBA_address+1,driveParam->total_sectors);
|
||||
printf("LBA-Transfer error : address overflow = %lu > %lu max\n",
|
||||
LBA_address + 1, driveParam->total_sectors);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@ -995,12 +983,15 @@ int Read1LBASector(struct DriveParamS *driveParam, unsigned drive, ULONG LBA_add
|
||||
|
||||
regs.a.x = 0x0201;
|
||||
regs.b.x = FP_OFF(buffer);
|
||||
regs.c.x = ((chs.Cylinder&0xff) << 8) + ((chs.Cylinder&0x300) >> 2) + chs.Sector;
|
||||
regs.c.x =
|
||||
((chs.Cylinder & 0xff) << 8) + ((chs.Cylinder & 0x300) >> 2) +
|
||||
chs.Sector;
|
||||
regs.d.b.h = chs.Head;
|
||||
regs.es = FP_SEG(buffer);
|
||||
} /* end of retries */
|
||||
init_call_intr(0x13, ®s);
|
||||
if ((regs.flags & FLG_CARRY) == 0) break;
|
||||
if ((regs.flags & FLG_CARRY) == 0)
|
||||
break;
|
||||
BIOS_drive_reset(driveParam->driveno);
|
||||
}
|
||||
|
||||
@ -1035,20 +1026,18 @@ int ProcessDisk(int scanType, unsigned drive, int PartitionsToIgnore)
|
||||
RelSectorOffset = 0; /* boot sector */
|
||||
ExtendedPartitionOffset = 0; /* not found yet */
|
||||
|
||||
|
||||
|
||||
/* Read the Primary Partition Table. */
|
||||
|
||||
|
||||
ReadNextPartitionTable:
|
||||
|
||||
strangeHardwareLoop = 0;
|
||||
strange_restart:
|
||||
|
||||
|
||||
if (Read1LBASector(&driveParam, drive, RelSectorOffset, DiskTransferBuffer))
|
||||
if (Read1LBASector
|
||||
(&driveParam, drive, RelSectorOffset, DiskTransferBuffer))
|
||||
{
|
||||
printf("Error reading partition table drive %02x sector %lu",drive,RelSectorOffset);
|
||||
printf("Error reading partition table drive %02x sector %lu", drive,
|
||||
RelSectorOffset);
|
||||
return PartitionsToIgnore;
|
||||
}
|
||||
|
||||
@ -1062,18 +1051,20 @@ strange_restart:
|
||||
if (++strangeHardwareLoop < 3)
|
||||
goto strange_restart;
|
||||
|
||||
printf("illegal partition table - drive %02x sector %lu\n",drive,RelSectorOffset);
|
||||
printf("illegal partition table - drive %02x sector %lu\n", drive,
|
||||
RelSectorOffset);
|
||||
return PartitionsToIgnore;
|
||||
}
|
||||
|
||||
if (scanType == SCAN_PRIMARYBOOT ||
|
||||
scanType == SCAN_PRIMARY ||
|
||||
scanType==SCAN_PRIMARY2 ||
|
||||
num_extended_found !=0 )
|
||||
scanType == SCAN_PRIMARY2 || num_extended_found != 0)
|
||||
{
|
||||
|
||||
PartitionsToIgnore = ScanForPrimaryPartitions(&driveParam, scanType,
|
||||
PTable, RelSectorOffset,PartitionsToIgnore,num_extended_found);
|
||||
PTable, RelSectorOffset,
|
||||
PartitionsToIgnore,
|
||||
num_extended_found);
|
||||
}
|
||||
|
||||
if (scanType != SCAN_EXTENDED)
|
||||
@ -1084,7 +1075,6 @@ strange_restart:
|
||||
/* scan for extended partitions now */
|
||||
PartitionsToIgnore = 0;
|
||||
|
||||
|
||||
for (iPart = 0; iPart < 4; iPart++)
|
||||
{
|
||||
if (IsExtPartition(PTable[iPart].FileSystem))
|
||||
@ -1111,7 +1101,6 @@ strange_restart:
|
||||
return PartitionsToIgnore;
|
||||
}
|
||||
|
||||
|
||||
int BIOS_nrdrives(void)
|
||||
{
|
||||
iregs regs;
|
||||
@ -1152,13 +1141,11 @@ starting with any active primary partitions (if there is one), otherwise,
|
||||
scan the first primary partition on each drive. Assign next available
|
||||
letter starting with C:
|
||||
|
||||
|
||||
Repeat scan for all fixed hard disks and removable (JAZ, MO) disks
|
||||
and assign drive letters to all logical drives in an extended partition,
|
||||
or the removable disk(s) as enumerated. Assign next available letter
|
||||
starting with C:
|
||||
|
||||
|
||||
Finally, repeat scan for all fixed hard disk drives, and assign drive
|
||||
letters to all remaining primary partitions. Assign next available letter
|
||||
starting with C:
|
||||
@ -1179,13 +1166,11 @@ to the first physical floppy disk drive that is found.
|
||||
|
||||
If a second physical floppy disk drive is present, it is assigned drive letter B. If it is not present, a logical drive B is created that uses the first physical floppy disk drive.
|
||||
|
||||
|
||||
Regardless of whether a second floppy disk drive is present,
|
||||
MS-DOS then assigns the drive letter C to the primary MS-DOS
|
||||
partition on the first physical hard disk, and then goes on
|
||||
to check for a second hard disk.
|
||||
|
||||
|
||||
If a second physical hard disk is found, and a primary partition exists
|
||||
on the second physical drive, the primary MS-DOS partition on the second
|
||||
physical hard drive is assigned the letter D. MS-DOS version 5.0, which
|
||||
@ -1195,12 +1180,10 @@ hard disk is found, and a primary partition exists on the third physical
|
||||
drive, the primary MS-DOS partition on the third physical hard drive is
|
||||
assigned the letter E.
|
||||
|
||||
|
||||
MS-DOS returns to the first physical hard disk drive and assigns drive
|
||||
letters to any additional logical drives (in extended MS-DOS partitions)
|
||||
on that drive in sequence.
|
||||
|
||||
|
||||
MS-DOS repeats this process for the second physical hard disk drive,
|
||||
if present. MS-DOS 5.0 will repeat this process for up to eight physical
|
||||
hard drives, if present. After all logical drives (in extended MS-DOS
|
||||
@ -1211,7 +1194,6 @@ additional primary MS-DOS partitions. This support for multiple primary
|
||||
MS-DOS partitions was added to version 5.0 for backward compatibility
|
||||
with the previous OEM MS-DOS versions that support multiple primary partitions.
|
||||
|
||||
|
||||
After all logical drives on the hard disk(s) have been assigned drive
|
||||
letters, drive letters are assigned to drives installed using DRIVER.SYS
|
||||
or created using RAMDRIVE.SYS in the order in which the drivers are loaded
|
||||
@ -1268,14 +1250,17 @@ void ReadAllPartitionTables(void)
|
||||
test for A: also, need not exist
|
||||
*/
|
||||
init_call_intr(0x11, ®s); /* get equipment list */
|
||||
if ((regs.a.x & 1) && (regs.a.x & 0xc0)) {
|
||||
if ((regs.a.x & 1) && (regs.a.x & 0xc0))
|
||||
{
|
||||
pddt->ddt_driveno = 1;
|
||||
pddt->ddt_type = init_getdriveparm(1, &pddt->ddt_defbpb);
|
||||
pddt->ddt_descflags = init_readdasd(1);
|
||||
pddt->ddt_ncyl = (pddt->ddt_type & 7) ? 80 : 40;
|
||||
/* floppy drives installed and a B: drive */
|
||||
/*if ((r.a.x & 1)==0) *//* no floppy drives installed */
|
||||
} else { /* set up the DJ method : multiple logical drives */
|
||||
}
|
||||
else
|
||||
{ /* set up the DJ method : multiple logical drives */
|
||||
(pddt - 1)->ddt_descflags |= DF_CURLOG | DF_MULTLOG;
|
||||
pddt->ddt_descflags |= DF_MULTLOG;
|
||||
}
|
||||
@ -1284,22 +1269,16 @@ void ReadAllPartitionTables(void)
|
||||
|
||||
memset(foundPartitions, 0, sizeof(foundPartitions));
|
||||
|
||||
|
||||
|
||||
|
||||
DebugPrintf(("DSK init: found %d disk drives\n", nHardDisk));
|
||||
|
||||
/* Reset the drives */
|
||||
for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++)
|
||||
BIOS_drive_reset(HardDrive);
|
||||
|
||||
|
||||
|
||||
if (InitKernelConfig.DLASortByDriveNo == 0)
|
||||
{
|
||||
/* printf("Drive Letter Assignment - DOS order \n"); */
|
||||
|
||||
|
||||
/* Process primary partition table 1 partition only */
|
||||
for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++)
|
||||
{
|
||||
@ -1307,7 +1286,8 @@ void ReadAllPartitionTables(void)
|
||||
ProcessDisk(SCAN_PRIMARYBOOT, HardDrive, 0);
|
||||
|
||||
if (foundPartitions[HardDrive] == 0)
|
||||
foundPartitions[HardDrive] = ProcessDisk(SCAN_PRIMARY, HardDrive, 0);
|
||||
foundPartitions[HardDrive] =
|
||||
ProcessDisk(SCAN_PRIMARY, HardDrive, 0);
|
||||
}
|
||||
|
||||
/* Process extended partition table */
|
||||
@ -1326,7 +1306,6 @@ void ReadAllPartitionTables(void)
|
||||
{
|
||||
printf("Drive Letter Assignment - sorted by drive\n");
|
||||
|
||||
|
||||
/* Process primary partition table 1 partition only */
|
||||
for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++)
|
||||
{
|
||||
@ -1334,12 +1313,12 @@ void ReadAllPartitionTables(void)
|
||||
ProcessDisk(SCAN_PRIMARYBOOT, HardDrive, 0);
|
||||
|
||||
if (foundPartitions[HardDrive] == 0)
|
||||
foundPartitions[HardDrive] = ProcessDisk(SCAN_PRIMARY, HardDrive, 0);
|
||||
foundPartitions[HardDrive] =
|
||||
ProcessDisk(SCAN_PRIMARY, HardDrive, 0);
|
||||
|
||||
/* Process extended partition table */
|
||||
ProcessDisk(SCAN_EXTENDED, HardDrive, 0);
|
||||
|
||||
|
||||
/* Process primary a 2nd time */
|
||||
ProcessDisk(SCAN_PRIMARY2, HardDrive, foundPartitions[HardDrive]);
|
||||
}
|
||||
@ -1366,7 +1345,6 @@ COUNT dsk_init()
|
||||
/* Initial number of disk units */
|
||||
nUnits = 2;
|
||||
|
||||
|
||||
ReadAllPartitionTables();
|
||||
|
||||
return nUnits;
|
||||
|
104
kernel/inithma.c
104
kernel/inithma.c
@ -63,49 +63,44 @@
|
||||
parameter is forced.
|
||||
*/
|
||||
|
||||
|
||||
#include "portab.h"
|
||||
#include "init-mod.h"
|
||||
#include "init-dat.h"
|
||||
|
||||
|
||||
|
||||
extern BYTE
|
||||
FAR _HMATextAvailable, /* first byte of available CODE area */
|
||||
extern BYTE FAR _HMATextAvailable, /* first byte of available CODE area */
|
||||
FAR _HMATextStart[], /* first byte of HMAable CODE area */
|
||||
FAR _HMATextEnd[]; /* and the last byte of it */
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
|
||||
BYTE DosLoadedInHMA = FALSE; /* set to TRUE if loaded HIGH */
|
||||
BYTE HMAclaimed = FALSE; /* set to TRUE if claimed from HIMEM */
|
||||
WORD HMAFree = 0; /* first byte in HMA not yet used */
|
||||
|
||||
|
||||
extern BYTE FAR *DOSTEXTFAR ASMCFUNC XMSDriverAddress;
|
||||
extern FAR ASMCFUNC _EnableA20(VOID);
|
||||
extern FAR ASMCFUNC _DisableA20(VOID);
|
||||
|
||||
|
||||
extern void FAR *ASMCFUNC DetectXMSDriver(VOID);
|
||||
extern int ASMCFUNC init_call_XMScall( void FAR * driverAddress, UWORD ax, UWORD dx);
|
||||
extern int ASMCFUNC init_call_XMScall(void FAR * driverAddress, UWORD ax,
|
||||
UWORD dx);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef __TURBOC__
|
||||
#define int3() __int__(3);
|
||||
#else
|
||||
void int3()
|
||||
{ __asm int 3;
|
||||
{
|
||||
__asm int 3;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#define int3()
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#define HMAInitPrintf(x) printf x
|
||||
#else
|
||||
@ -114,7 +109,6 @@ extern int ASMCFUNC init_call_XMScall( void FAR * driverAddress, UWORD ax, UWOR
|
||||
|
||||
void MoveKernel(unsigned NewKernelSegment);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
VOID hdump(BYTE FAR * p)
|
||||
{
|
||||
@ -130,10 +124,8 @@ VOID hdump(BYTE FAR *p)
|
||||
#define hdump(ptr)
|
||||
#endif
|
||||
|
||||
|
||||
#define KeyboardShiftState() (*(BYTE FAR *)(MK_FP(0x40,0x17)))
|
||||
|
||||
|
||||
/* of course, this should go to ASMSUPT */
|
||||
fmemcmp(BYTE far * s1, BYTE FAR * s2, unsigned len)
|
||||
{
|
||||
@ -145,7 +137,6 @@ fmemcmp(BYTE far *s1, BYTE FAR *s2, unsigned len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
this tests, if the HMA area can be enabled.
|
||||
if so, it simply leaves it on
|
||||
@ -162,7 +153,6 @@ int EnableHMA(VOID)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
_DisableA20();
|
||||
|
||||
if (fmemcmp(MK_FP(0x0000, 0x0000), MK_FP(0xffff, 0x0010), 128) != 0)
|
||||
@ -183,9 +173,6 @@ int EnableHMA(VOID)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
move the kernel up to high memory
|
||||
this is very unportable
|
||||
@ -196,7 +183,6 @@ int EnableHMA(VOID)
|
||||
#define HMAOFFSET 0x20
|
||||
#define HMASEGMENT 0xffff
|
||||
|
||||
|
||||
int MoveKernelToHMA()
|
||||
{
|
||||
|
||||
@ -214,7 +200,8 @@ int MoveKernelToHMA()
|
||||
*/
|
||||
if (KeyboardShiftState() & 0x0f)
|
||||
{
|
||||
printf("Keyboard state is %0x, NOT moving to HMA\n",KeyboardShiftState());
|
||||
printf("Keyboard state is %0x, NOT moving to HMA\n",
|
||||
KeyboardShiftState());
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
@ -231,7 +218,8 @@ int MoveKernelToHMA()
|
||||
/* allocate HMA through XMS driver */
|
||||
|
||||
if (HMAclaimed == 0 &&
|
||||
(HMAclaimed = init_call_XMScall( XMSDriverAddress, 0x0100, 0xffff)) == 0)
|
||||
(HMAclaimed =
|
||||
init_call_XMScall(XMSDriverAddress, 0x0100, 0xffff)) == 0)
|
||||
{
|
||||
printf("Can't reserve HMA area ??\n");
|
||||
|
||||
@ -240,7 +228,6 @@ int MoveKernelToHMA()
|
||||
|
||||
MoveKernel(0xffff);
|
||||
|
||||
|
||||
{
|
||||
/* E) up to now, nothing really bad was done.
|
||||
but now, we reuse the HMA area. bad things will happen
|
||||
@ -249,7 +236,6 @@ int MoveKernelToHMA()
|
||||
cause INT 3 on all accesses to this area
|
||||
*/
|
||||
|
||||
|
||||
DosLoadedInHMA = TRUE;
|
||||
}
|
||||
|
||||
@ -260,7 +246,6 @@ int MoveKernelToHMA()
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* not necessary anymore : BO */
|
||||
/*
|
||||
now protect against HIMEM/FDXMS/... by simulating a VDISK
|
||||
@ -280,22 +265,24 @@ void InstallVDISK(VOID)
|
||||
BYTE dummy3[6];
|
||||
WORD Sektoren;
|
||||
BYTE dummy4;
|
||||
} VDISK_BOOT_SEKTOR =
|
||||
} VDISK_BOOT_SEKTOR = {
|
||||
{
|
||||
{ 0xcf, ' ', ' '},
|
||||
{ 'V', 'D', 'I', 'S', 'K'},
|
||||
{ ' ', ' ', ' '},
|
||||
512,
|
||||
{ 'F', 'D', 'O', 'S', ' ', ' '},
|
||||
128, /* 128*512 = 64K */
|
||||
' '
|
||||
};
|
||||
0xcf, ' ', ' '},
|
||||
{
|
||||
'V', 'D', 'I', 'S', 'K'},
|
||||
{
|
||||
' ', ' ', ' '}, 512,
|
||||
{
|
||||
'F', 'D', 'O', 'S', ' ', ' '}, 128, /* 128*512 = 64K */
|
||||
' '};
|
||||
|
||||
if (!DosLoadedInHMA) return;
|
||||
if (HMAclaimed) return;
|
||||
if (!DosLoadedInHMA)
|
||||
return;
|
||||
if (HMAclaimed)
|
||||
return;
|
||||
|
||||
|
||||
fmemcpy(MK_FP(0xffff,0x0010), &VDISK_BOOT_SEKTOR, sizeof(VDISK_BOOT_SEKTOR));
|
||||
fmemcpy(MK_FP(0xffff, 0x0010), &VDISK_BOOT_SEKTOR,
|
||||
sizeof(VDISK_BOOT_SEKTOR));
|
||||
|
||||
setvec(0x19, MK_FP(0xffff, 0x0010)); /* let INT 19 point to VDISK */
|
||||
|
||||
@ -303,7 +290,6 @@ void InstallVDISK(VOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
this should be called, after each device driver
|
||||
has been loaded with FALSE
|
||||
@ -334,9 +320,11 @@ VOID FAR *HMAalloc(COUNT bytesToAllocate)
|
||||
{
|
||||
VOID FAR *HMAptr;
|
||||
|
||||
if (!DosLoadedInHMA) return NULL;
|
||||
if (!DosLoadedInHMA)
|
||||
return NULL;
|
||||
|
||||
if (HMAFree >= 0xfff0 - bytesToAllocate) return NULL;
|
||||
if (HMAFree >= 0xfff0 - bytesToAllocate)
|
||||
return NULL;
|
||||
|
||||
HMAptr = MK_FP(0xffff, HMAFree);
|
||||
|
||||
@ -350,8 +338,6 @@ VOID FAR *HMAalloc(COUNT bytesToAllocate)
|
||||
return HMAptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned CurrentKernelSegment = 0;
|
||||
|
||||
void MoveKernel(unsigned NewKernelSegment)
|
||||
@ -367,8 +353,8 @@ void MoveKernel(unsigned NewKernelSegment)
|
||||
if (CurrentKernelSegment == 0xffff)
|
||||
return;
|
||||
|
||||
|
||||
HMASource = MK_FP(CurrentKernelSegment,(FP_OFF(_HMATextStart) & 0xfff0));
|
||||
HMASource =
|
||||
MK_FP(CurrentKernelSegment, (FP_OFF(_HMATextStart) & 0xfff0));
|
||||
HMADest = MK_FP(NewKernelSegment, 0x0000);
|
||||
|
||||
len = (FP_OFF(_HMATextEnd) | 0x000f) - (FP_OFF(_HMATextStart) & 0xfff0);
|
||||
@ -386,14 +372,17 @@ void MoveKernel(unsigned NewKernelSegment)
|
||||
if (NewKernelSegment < CurrentKernelSegment ||
|
||||
NewKernelSegment == 0xffff)
|
||||
{
|
||||
unsigned i; UBYTE FAR *s,FAR *d;
|
||||
unsigned i;
|
||||
UBYTE FAR *s, FAR * d;
|
||||
|
||||
for (i = 0, s = HMASource, d = HMADest; i < len; i++)
|
||||
d[i] = s[i];
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
/* might overlap */
|
||||
unsigned i; UBYTE FAR *s,FAR *d;
|
||||
unsigned i;
|
||||
UBYTE FAR *s, FAR * d;
|
||||
|
||||
for (i = len, s = HMASource, d = HMADest; i != 0; i--)
|
||||
d[i] = s[i];
|
||||
@ -441,7 +430,10 @@ void MoveKernel(unsigned NewKernelSegment)
|
||||
rp->callNear != 0xe8 || /* call NEAR */
|
||||
0)
|
||||
{
|
||||
printf("illegal relocation entry # %d\n",(FP_OFF(rp) - FP_OFF(_HMARelocationTableStart))/sizeof(struct RelocationTable));
|
||||
printf("illegal relocation entry # %d\n",
|
||||
(FP_OFF(rp) -
|
||||
FP_OFF(_HMARelocationTableStart)) /
|
||||
sizeof(struct RelocationTable));
|
||||
int3();
|
||||
goto errorReturn;
|
||||
}
|
||||
@ -477,16 +469,15 @@ void MoveKernel(unsigned NewKernelSegment)
|
||||
UWORD jmpSegment;
|
||||
};
|
||||
extern struct initRelocationTable
|
||||
_HMAinitRelocationTableStart[],
|
||||
_HMAinitRelocationTableEnd[];
|
||||
_HMAinitRelocationTableStart[], _HMAinitRelocationTableEnd[];
|
||||
struct initRelocationTable *rp;
|
||||
|
||||
/* verify, that all entries are valid */
|
||||
|
||||
for (rp = _HMAinitRelocationTableStart; rp < _HMAinitRelocationTableEnd; rp++)
|
||||
for (rp = _HMAinitRelocationTableStart;
|
||||
rp < _HMAinitRelocationTableEnd; rp++)
|
||||
{
|
||||
if (
|
||||
rp->callNear != 0xe8 || /* call NEAR */
|
||||
if (rp->callNear != 0xe8 || /* call NEAR */
|
||||
rp->jmpFar != 0xea || /* jmp FAR */
|
||||
rp->jmpSegment != CurrentKernelSegment || /* will only relocate HMA_TEXT */
|
||||
0)
|
||||
@ -499,7 +490,8 @@ void MoveKernel(unsigned NewKernelSegment)
|
||||
|
||||
/* OK, all valid, go to relocate */
|
||||
|
||||
for (rp = _HMAinitRelocationTableStart; rp < _HMAinitRelocationTableEnd; rp++)
|
||||
for (rp = _HMAinitRelocationTableStart;
|
||||
rp < _HMAinitRelocationTableEnd; rp++)
|
||||
{
|
||||
rp->jmpSegment = NewKernelSegment;
|
||||
}
|
||||
|
@ -31,7 +31,8 @@
|
||||
#include "init-mod.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
UWORD init_oem(void)
|
||||
@ -94,4 +95,3 @@ UWORD init_oem(void)
|
||||
* Rev 1.0 02 Jul 1995 8:31:54 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
@ -32,7 +32,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
BYTE *RcsId = "$Id$";
|
||||
BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#ifdef TSC
|
||||
@ -51,8 +52,7 @@ VOID FAR int21_entry(iregs UserRegs)
|
||||
#endif
|
||||
|
||||
/* Structures needed for int 25 / int 26 */
|
||||
struct HugeSectorBlock
|
||||
{
|
||||
struct HugeSectorBlock {
|
||||
ULONG blkno;
|
||||
WORD nblks;
|
||||
BYTE FAR *buf;
|
||||
@ -89,7 +89,6 @@ VOID ASMCFUNC int21_syscall(iregs FAR * irp)
|
||||
break_ena = tmp != 0;
|
||||
}
|
||||
|
||||
|
||||
/* Get Boot Drive */
|
||||
case 0x05:
|
||||
irp->DL = BootDrive;
|
||||
@ -153,14 +152,12 @@ VOID ASMCFUNC int21_syscall(iregs FAR * irp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID ASMCFUNC int21_service(iregs FAR * r)
|
||||
{
|
||||
COUNT rc = 0;
|
||||
void FAR *FP_DS_DX = MK_FP(r->DS, r->DX); /* this is saved so often,
|
||||
that this saves ~100 bytes */
|
||||
|
||||
|
||||
#define CLEAR_CARRY_FLAG() r->FLAGS &= ~FLG_CARRY
|
||||
#define SET_CARRY_FLAG() r->FLAGS |= FLG_CARRY
|
||||
|
||||
@ -233,7 +230,8 @@ dispatch:
|
||||
case 0x03:
|
||||
{
|
||||
COUNT scratch;
|
||||
GenericRead(STDAUX, 1, (BYTE FAR *) & r->AL, (COUNT FAR *) & scratch, TRUE);
|
||||
GenericRead(STDAUX, 1, (BYTE FAR *) & r->AL,
|
||||
(COUNT FAR *) & scratch, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -285,7 +283,8 @@ dispatch:
|
||||
q = FP_DS_DX;
|
||||
while (*q != '$')
|
||||
++q;
|
||||
DosWrite(STDOUT, FP_OFF(q) - FP_OFF(FP_DS_DX), FP_DS_DX, (COUNT FAR *) & UnusedRetVal);
|
||||
DosWrite(STDOUT, FP_OFF(q) - FP_OFF(FP_DS_DX), FP_DS_DX,
|
||||
(COUNT FAR *) & UnusedRetVal);
|
||||
}
|
||||
r->AL = '$';
|
||||
break;
|
||||
@ -440,8 +439,7 @@ dispatch:
|
||||
FatGetDrvData(0,
|
||||
(UCOUNT FAR *) & r->AX,
|
||||
(UCOUNT FAR *) & r->CX,
|
||||
(UCOUNT FAR *) & r->DX,
|
||||
(BYTE FAR **) & p);
|
||||
(UCOUNT FAR *) & r->DX, (BYTE FAR **) & p);
|
||||
r->DS = FP_SEG(p);
|
||||
r->BX = FP_OFF(p);
|
||||
}
|
||||
@ -455,8 +453,7 @@ dispatch:
|
||||
FatGetDrvData(r->DL,
|
||||
(UCOUNT FAR *) & r->AX,
|
||||
(UCOUNT FAR *) & r->CX,
|
||||
(UCOUNT FAR *) & r->DX,
|
||||
(BYTE FAR **) & p);
|
||||
(UCOUNT FAR *) & r->DX, (BYTE FAR **) & p);
|
||||
r->DS = FP_SEG(p);
|
||||
r->BX = FP_OFF(p);
|
||||
}
|
||||
@ -542,9 +539,7 @@ dispatch:
|
||||
BYTE FAR *lpFileName;
|
||||
|
||||
lpFileName = MK_FP(r->DS, r->SI);
|
||||
r->AL = FcbParseFname(r->AL,
|
||||
&lpFileName,
|
||||
MK_FP(r->ES, r->DI));
|
||||
r->AL = FcbParseFname(r->AL, &lpFileName, MK_FP(r->ES, r->DI));
|
||||
r->DS = FP_SEG(lpFileName);
|
||||
r->SI = FP_OFF(lpFileName);
|
||||
}
|
||||
@ -552,8 +547,7 @@ dispatch:
|
||||
|
||||
/* Get Date */
|
||||
case 0x2a:
|
||||
DosGetDate(
|
||||
(BYTE FAR *) & (r->AL), /* WeekDay */
|
||||
DosGetDate((BYTE FAR *) & (r->AL), /* WeekDay */
|
||||
(BYTE FAR *) & (r->DH), /* Month */
|
||||
(BYTE FAR *) & (r->DL), /* MonthDay */
|
||||
(COUNT FAR *) & (r->CX)); /* Year */
|
||||
@ -561,8 +555,7 @@ dispatch:
|
||||
|
||||
/* Set Date */
|
||||
case 0x2b:
|
||||
rc = DosSetDate(
|
||||
r->DH, /* Month */
|
||||
rc = DosSetDate(r->DH, /* Month */
|
||||
r->DL, /* MonthDay */
|
||||
r->CX); /* Year */
|
||||
r->AL = (rc != SUCCESS ? 0xff : 0);
|
||||
@ -570,8 +563,7 @@ dispatch:
|
||||
|
||||
/* Get Time */
|
||||
case 0x2c:
|
||||
DosGetTime(
|
||||
(BYTE FAR *) & (r->CH), /* Hour */
|
||||
DosGetTime((BYTE FAR *) & (r->CH), /* Hour */
|
||||
(BYTE FAR *) & (r->CL), /* Minutes */
|
||||
(BYTE FAR *) & (r->DH), /* Seconds */
|
||||
(BYTE FAR *) & (r->DL)); /* Hundredths */
|
||||
@ -579,8 +571,7 @@ dispatch:
|
||||
|
||||
/* Set Date */
|
||||
case 0x2d:
|
||||
rc = DosSetTime(
|
||||
r->CH, /* Hour */
|
||||
rc = DosSetTime(r->CH, /* Hour */
|
||||
r->CL, /* Minutes */
|
||||
r->DH, /* Seconds */
|
||||
r->DL); /* Hundredths */
|
||||
@ -624,8 +615,7 @@ dispatch:
|
||||
r->AH = retp[2];
|
||||
}
|
||||
else if (retp[0] == 0x86 && /* xchg al,ah */
|
||||
retp[1] == 0xc4 &&
|
||||
retp[2] == 0x3d && /* cmp ax, xxyy */
|
||||
retp[1] == 0xc4 && retp[2] == 0x3d && /* cmp ax, xxyy */
|
||||
(retp[5] == 0x75 || retp[5] == 0x74)) /* je/jne error */
|
||||
{
|
||||
r->AL = retp[4];
|
||||
@ -655,8 +645,10 @@ dispatch:
|
||||
struct dpb FAR *dpb;
|
||||
UCOUNT drv = r->DL;
|
||||
|
||||
if (drv == 0 || r->AH == 0x1f) drv = default_drive;
|
||||
else drv--;
|
||||
if (drv == 0 || r->AH == 0x1f)
|
||||
drv = default_drive;
|
||||
else
|
||||
drv--;
|
||||
|
||||
if (drv >= lastdrive)
|
||||
{
|
||||
@ -666,8 +658,7 @@ dispatch:
|
||||
}
|
||||
|
||||
dpb = CDSp->cds_table[drv].cdsDpb;
|
||||
if (dpb == 0 ||
|
||||
CDSp->cds_table[drv].cdsFlags & CDSNETWDRV)
|
||||
if (dpb == 0 || CDSp->cds_table[drv].cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
r->AL = 0xFF;
|
||||
CritErrCode = 0x0f;
|
||||
@ -720,12 +711,10 @@ dispatch:
|
||||
|
||||
/* Dos Get Disk Free Space */
|
||||
case 0x36:
|
||||
DosGetFree(
|
||||
r->DL,
|
||||
DosGetFree(r->DL,
|
||||
(UCOUNT FAR *) & r->AX,
|
||||
(UCOUNT FAR *) & r->BX,
|
||||
(UCOUNT FAR *) & r->CX,
|
||||
(UCOUNT FAR *) & r->DX);
|
||||
(UCOUNT FAR *) & r->CX, (UCOUNT FAR *) & r->DX);
|
||||
break;
|
||||
|
||||
/* Undocumented Get/Set Switchar */
|
||||
@ -759,11 +748,14 @@ dispatch:
|
||||
else if (cntry == 0xff)
|
||||
cntry = r->BX;
|
||||
|
||||
if (0xffff == r->DX) {
|
||||
if (0xffff == r->DX)
|
||||
{
|
||||
/* Set Country Code */
|
||||
if ((rc = DosSetCountry(cntry)) < 0)
|
||||
goto error_invalid;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get Country Information */
|
||||
if ((rc = DosGetCountryInformation(cntry, FP_DS_DX)) < 0)
|
||||
goto error_invalid;
|
||||
@ -843,7 +835,9 @@ dispatch:
|
||||
case 0x42:
|
||||
{
|
||||
ULONG lrc;
|
||||
if ((rc = DosSeek(r->BX, (LONG) ((((LONG) (r->CX)) << 16) | r->DX), r->AL, &lrc)) < 0)
|
||||
if ((rc =
|
||||
DosSeek(r->BX, (LONG) ((((LONG) (r->CX)) << 16) | r->DX),
|
||||
r->AL, &lrc)) < 0)
|
||||
goto error_exit;
|
||||
else
|
||||
{
|
||||
@ -913,7 +907,8 @@ dispatch:
|
||||
|
||||
/* Allocate memory */
|
||||
case 0x48:
|
||||
if ((rc = DosMemAlloc(r->BX, mem_access_mode, &(r->AX), &(r->BX))) < 0)
|
||||
if ((rc =
|
||||
DosMemAlloc(r->BX, mem_access_mode, &(r->AX), &(r->BX))) < 0)
|
||||
{
|
||||
DosMemLargest(&(r->BX));
|
||||
goto error_exit;
|
||||
@ -958,8 +953,7 @@ dispatch:
|
||||
case 0x4b:
|
||||
break_flg = FALSE;
|
||||
|
||||
if ((rc = DosExec(r->AL, MK_FP(r->ES, r->BX), FP_DS_DX))
|
||||
!= SUCCESS)
|
||||
if ((rc = DosExec(r->AL, MK_FP(r->ES, r->BX), FP_DS_DX)) != SUCCESS)
|
||||
goto error_exit;
|
||||
break;
|
||||
|
||||
@ -1038,7 +1032,8 @@ dispatch:
|
||||
|
||||
case 0x53:
|
||||
/* DOS 2+ internal - TRANSLATE BIOS PARAMETER BLOCK TO DRIVE PARAM BLOCK */
|
||||
bpb_to_dpb((bpb FAR *)MK_FP(r->DS, r->SI), (struct dpb FAR *)MK_FP(r->ES, r->BP)
|
||||
bpb_to_dpb((bpb FAR *) MK_FP(r->DS, r->SI),
|
||||
(struct dpb FAR *)MK_FP(r->ES, r->BP)
|
||||
#ifdef WITHFAT32
|
||||
, (r->CX == 0x4558 && r->DX == 0x4152)
|
||||
#endif
|
||||
@ -1059,7 +1054,8 @@ dispatch:
|
||||
|
||||
/* Dos Rename */
|
||||
case 0x56:
|
||||
rc = DosRename((BYTE FAR *) FP_DS_DX, (BYTE FAR *) MK_FP(r->ES, r->DI));
|
||||
rc = DosRename((BYTE FAR *) FP_DS_DX,
|
||||
(BYTE FAR *) MK_FP(r->ES, r->DI));
|
||||
if (rc < SUCCESS)
|
||||
goto error_exit;
|
||||
else
|
||||
@ -1072,8 +1068,7 @@ dispatch:
|
||||
switch (r->AL)
|
||||
{
|
||||
case 0x00:
|
||||
rc = DosGetFtime(
|
||||
(COUNT) r->BX, /* Handle */
|
||||
rc = DosGetFtime((COUNT) r->BX, /* Handle */
|
||||
(date FAR *) & r->DX, /* FileDate */
|
||||
(time FAR *) & r->CX); /* FileTime */
|
||||
if (rc < SUCCESS)
|
||||
@ -1081,8 +1076,7 @@ dispatch:
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
rc = DosSetFtime(
|
||||
(COUNT) r->BX, /* Handle */
|
||||
rc = DosSetFtime((COUNT) r->BX, /* Handle */
|
||||
(date) r->DX, /* FileDate */
|
||||
(time) r->CX); /* FileTime */
|
||||
if (rc < SUCCESS)
|
||||
@ -1195,8 +1189,10 @@ dispatch:
|
||||
case 0x5c:
|
||||
if ((rc = DosLockUnlock
|
||||
(r->BX,
|
||||
(((unsigned long)r->CX)<<16)|(((unsigned long)r->DX)&0xffffL),
|
||||
(((unsigned long)r->SI)<<16)|(((unsigned long)r->DI)&0xffffL),
|
||||
(((unsigned long)r->CX) << 16) | (((unsigned long)r->
|
||||
DX) & 0xffffL),
|
||||
(((unsigned long)r->SI) << 16) | (((unsigned long)r->
|
||||
DI) & 0xffffL),
|
||||
((r->AX & 0xff) != 0))) != 0)
|
||||
goto error_exit;
|
||||
CLEAR_CARRY_FLAG();
|
||||
@ -1256,8 +1252,10 @@ dispatch:
|
||||
break;
|
||||
|
||||
default:
|
||||
rc = remote_printset(r->BX, r->CX, r->DX, (MK_FP(r->ES, r->DI)), r->SI, (MK_FP(r->DS, Int21AX)));
|
||||
if (rc != SUCCESS) goto error_exit;
|
||||
rc = remote_printset(r->BX, r->CX, r->DX, (MK_FP(r->ES, r->DI)),
|
||||
r->SI, (MK_FP(r->DS, Int21AX)));
|
||||
if (rc != SUCCESS)
|
||||
goto error_exit;
|
||||
r->AX = SUCCESS;
|
||||
break;
|
||||
}
|
||||
@ -1268,13 +1266,15 @@ dispatch:
|
||||
switch (r->AL)
|
||||
{
|
||||
case 0x07:
|
||||
if (r->DL < lastdrive) {
|
||||
if (r->DL < lastdrive)
|
||||
{
|
||||
CDSp->cds_table[r->DL].cdsFlags |= 0x100;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x08:
|
||||
if (r->DL < lastdrive) {
|
||||
if (r->DL < lastdrive)
|
||||
{
|
||||
CDSp->cds_table[r->DL].cdsFlags &= ~0x100;
|
||||
}
|
||||
break;
|
||||
@ -1286,7 +1286,8 @@ dispatch:
|
||||
break;*/
|
||||
|
||||
rc = remote_doredirect(r->BX, r->CX, r->DX,
|
||||
(MK_FP(r->ES, r->DI)), r->SI, (MK_FP(r->DS, Int21AX)));
|
||||
(MK_FP(r->ES, r->DI)), r->SI,
|
||||
(MK_FP(r->DS, Int21AX)));
|
||||
if (rc != SUCCESS)
|
||||
goto error_exit;
|
||||
r->AX = SUCCESS;
|
||||
@ -1297,7 +1298,8 @@ dispatch:
|
||||
case 0x60: /* TRUENAME */
|
||||
CLEAR_CARRY_FLAG();
|
||||
if ((rc = truename(MK_FP(r->DS, r->SI),
|
||||
adjust_far(MK_FP(r->ES, r->DI)), FALSE)) != SUCCESS)
|
||||
adjust_far(MK_FP(r->ES, r->DI)),
|
||||
FALSE)) != SUCCESS)
|
||||
goto error_exit;
|
||||
break;
|
||||
|
||||
@ -1331,8 +1333,7 @@ dispatch:
|
||||
/* UNDOCUMENTED: Double byte and korean tables */
|
||||
case 0x63:
|
||||
{
|
||||
static char dbcsTable[4] =
|
||||
{
|
||||
static char dbcsTable[4] = {
|
||||
0, 0, 0, 0
|
||||
};
|
||||
r->DS = FP_SEG(&dbcsTable);
|
||||
@ -1352,7 +1353,8 @@ dispatch:
|
||||
|
||||
/* Extended country info */
|
||||
case 0x65:
|
||||
switch(r->AL) {
|
||||
switch (r->AL)
|
||||
{
|
||||
case 0x20: /* upcase single character */
|
||||
r->DL = DosUpChar(r->DL);
|
||||
break;
|
||||
@ -1375,9 +1377,9 @@ dispatch:
|
||||
r->AX = DosYesNo(r->DL);
|
||||
break;
|
||||
default:
|
||||
if ((rc = DosGetData(
|
||||
r->AL, r->BX, r->DX, r->CX,
|
||||
MK_FP(r->ES, r->DI))) < 0) {
|
||||
if ((rc = DosGetData(r->AL, r->BX, r->DX, r->CX,
|
||||
MK_FP(r->ES, r->DI))) < 0)
|
||||
{
|
||||
#ifdef NLS_DEBUG
|
||||
printf("DosGetData() := %d\n", rc);
|
||||
#endif
|
||||
@ -1392,9 +1394,9 @@ dispatch:
|
||||
CLEAR_CARRY_FLAG();
|
||||
break;
|
||||
|
||||
|
||||
/* Code Page functions */
|
||||
case 0x66: {
|
||||
case 0x66:
|
||||
{
|
||||
int rc;
|
||||
switch (r->AL)
|
||||
{
|
||||
@ -1434,10 +1436,12 @@ dispatch:
|
||||
if (rc < lastdrive)
|
||||
{
|
||||
UWORD saveCX = r->CX;
|
||||
if (CDSp->cds_table[rc].cdsFlags & CDSNETWDRV) {
|
||||
if (CDSp->cds_table[rc].cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
goto error_invalid;
|
||||
}
|
||||
switch(r->AL){
|
||||
switch (r->AL)
|
||||
{
|
||||
case 0x00:
|
||||
r->AL = 0x0d;
|
||||
r->CX = 0x0866;
|
||||
@ -1479,7 +1483,8 @@ dispatch:
|
||||
goto error_exit;
|
||||
/* else try to create below */
|
||||
}
|
||||
else switch (r->DL & 0x0f)
|
||||
else
|
||||
switch (r->DL & 0x0f)
|
||||
{
|
||||
case 0x0:
|
||||
/* fail if file exists */
|
||||
@ -1517,7 +1522,8 @@ break_out:
|
||||
/* Get extended drive parameter block */
|
||||
case 0x02:
|
||||
{
|
||||
struct xdpbdata FAR *xddp = (struct xdpbdata FAR *)MK_FP(r->ES, r->DI);
|
||||
struct xdpbdata FAR *xddp =
|
||||
(struct xdpbdata FAR *)MK_FP(r->ES, r->DI);
|
||||
struct dpb FAR *dpb;
|
||||
|
||||
if (r->CX < sizeof(struct xdpbdata))
|
||||
@ -1527,7 +1533,8 @@ break_out:
|
||||
}
|
||||
|
||||
dpb = GetDriveDPB(r->DL, &rc);
|
||||
if (rc != SUCCESS) goto error_exit;
|
||||
if (rc != SUCCESS)
|
||||
goto error_exit;
|
||||
|
||||
flush_buffers(dpb->dpb_unit);
|
||||
dpb->dpb_flags = M_CHANGED; /* force reread of drive BPB/DPB */
|
||||
@ -1574,7 +1581,8 @@ break_out:
|
||||
goto error_out;
|
||||
}
|
||||
dpb = GetDriveDPB(r->DL, &rc);
|
||||
if (rc != SUCCESS) goto error_exit;
|
||||
if (rc != SUCCESS)
|
||||
goto error_exit;
|
||||
|
||||
CLEAR_CARRY_FLAG();
|
||||
xdffp->xdff_datasize = sizeof(struct xdpbforformat);
|
||||
@ -1588,10 +1596,10 @@ break_out:
|
||||
DWORD cluster = xdffp->xdff_f.setdpbcounts.cluster;
|
||||
if (ISFAT32(dpb))
|
||||
{
|
||||
if ((dpb->dpb_xfsinfosec == 0xffff && (nfreeclst != 0 ||
|
||||
cluster != 0)) ||
|
||||
nfreeclst == 1 || nfreeclst > dpb->dpb_xsize ||
|
||||
cluster == 1 || cluster > dpb->dpb_xsize)
|
||||
if ((dpb->dpb_xfsinfosec == 0xffff
|
||||
&& (nfreeclst != 0 || cluster != 0))
|
||||
|| nfreeclst == 1 || nfreeclst > dpb->dpb_xsize
|
||||
|| cluster == 1 || cluster > dpb->dpb_xsize)
|
||||
{
|
||||
r->AX = -DE_INVLDPARM;
|
||||
goto error_out;
|
||||
@ -1637,14 +1645,18 @@ rebuild_dpb:
|
||||
{
|
||||
struct buffer FAR *bp;
|
||||
bpb FAR *bpbp;
|
||||
DWORD newmirroring = xdffp->xdff_f.setmirroring.newmirroring;
|
||||
DWORD newmirroring =
|
||||
xdffp->xdff_f.setmirroring.newmirroring;
|
||||
|
||||
if (newmirroring != -1 && (ISFAT32(dpb) && (newmirroring & ~(0xf | 0x80))))
|
||||
if (newmirroring != -1
|
||||
&& (ISFAT32(dpb)
|
||||
&& (newmirroring & ~(0xf | 0x80))))
|
||||
{
|
||||
r->AX = -DE_INVLDPARM;
|
||||
goto error_out;
|
||||
}
|
||||
xdffp->xdff_f.setmirroring.oldmirroring = (ISFAT32(dpb) ? dpb->dpb_xflags : 0);
|
||||
xdffp->xdff_f.setmirroring.oldmirroring =
|
||||
(ISFAT32(dpb) ? dpb->dpb_xflags : 0);
|
||||
if (newmirroring != -1 && ISFAT32(dpb))
|
||||
{
|
||||
bp = getblock(1, dpb->dpb_unit);
|
||||
@ -1660,8 +1672,10 @@ rebuild_dpb:
|
||||
struct buffer FAR *bp;
|
||||
bpb FAR *bpbp;
|
||||
DWORD rootclst = xdffp->xdff_f.setroot.newrootclst;
|
||||
if (!ISFAT32(dpb) || (rootclst != -1 && (rootclst == 1 ||
|
||||
rootclst > dpb->dpb_xsize)))
|
||||
if (!ISFAT32(dpb)
|
||||
|| (rootclst != -1
|
||||
&& (rootclst == 1
|
||||
|| rootclst > dpb->dpb_xsize)))
|
||||
{
|
||||
r->AX = -DE_INVLDPARM;
|
||||
goto error_out;
|
||||
@ -1703,11 +1717,14 @@ rebuild_dpb:
|
||||
}
|
||||
CLEAR_CARRY_FLAG();
|
||||
|
||||
if (r->SI == 0) mode = DSKREAD;
|
||||
else mode = DSKWRITE;
|
||||
if (r->SI == 0)
|
||||
mode = DSKREAD;
|
||||
else
|
||||
mode = DSKWRITE;
|
||||
InDOS++;
|
||||
|
||||
r->AX=dskxfer(r->DL - 1, SectorBlock->blkno, SectorBlock->buf,
|
||||
r->AX =
|
||||
dskxfer(r->DL - 1, SectorBlock->blkno, SectorBlock->buf,
|
||||
SectorBlock->nblks, mode);
|
||||
|
||||
if (mode == DSKWRITE)
|
||||
@ -1722,7 +1739,6 @@ rebuild_dpb:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
r->AX = 0;
|
||||
r->flags &= ~FLG_CARRY;
|
||||
--InDOS;
|
||||
@ -1799,7 +1815,9 @@ rebuild_dpb:
|
||||
/* No kernel INT-23 handler required no longer -- 1999/04/15 ska */
|
||||
/* ctrl-Break handler */
|
||||
#pragma argsused
|
||||
VOID INRPT FAR int23_handler(int es, int ds, int di, int si, int bp, int sp, int bx, int dx, int cx, int ax, int ip, int cs, int flags)
|
||||
VOID INRPT FAR int23_handler(int es, int ds, int di, int si, int bp,
|
||||
int sp, int bx, int dx, int cx, int ax,
|
||||
int ip, int cs, int flags)
|
||||
{
|
||||
tsr = FALSE;
|
||||
return_mode = 1;
|
||||
@ -1813,21 +1831,11 @@ VOID INRPT FAR int23_handler(int es, int ds, int di, int si, int bp, int sp, int
|
||||
}
|
||||
#endif
|
||||
|
||||
struct int25regs
|
||||
{
|
||||
UWORD es,
|
||||
ds;
|
||||
UWORD di,
|
||||
si,
|
||||
bp,
|
||||
sp;
|
||||
UWORD bx,
|
||||
dx,
|
||||
cx,
|
||||
ax;
|
||||
UWORD flags,
|
||||
ip,
|
||||
cs;
|
||||
struct int25regs {
|
||||
UWORD es, ds;
|
||||
UWORD di, si, bp, sp;
|
||||
UWORD bx, dx, cx, ax;
|
||||
UWORD flags, ip, cs;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -1840,8 +1848,10 @@ VOID ASMCFUNC int2526_handler(WORD mode, struct int25regs FAR * r)
|
||||
BYTE FAR *buf;
|
||||
UBYTE drv;
|
||||
|
||||
if (mode == 0x26) mode = DSKWRITEINT26;
|
||||
else mode = DSKREADINT25;
|
||||
if (mode == 0x26)
|
||||
mode = DSKWRITEINT26;
|
||||
else
|
||||
mode = DSKREADINT25;
|
||||
|
||||
drv = r->ax;
|
||||
|
||||
@ -1875,7 +1885,6 @@ VOID ASMCFUNC int2526_handler(WORD mode, struct int25regs FAR * r)
|
||||
buf = ((struct HugeSectorBlock FAR *)buf)->buf;
|
||||
}
|
||||
|
||||
|
||||
InDOS++;
|
||||
|
||||
r->ax = dskxfer(drv, blkno, buf, nblks, mode);
|
||||
@ -1891,20 +1900,17 @@ VOID ASMCFUNC int2526_handler(WORD mode, struct int25regs FAR * r)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
r->ax = 0;
|
||||
r->flags &= ~FLG_CARRY;
|
||||
--InDOS;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
VOID int25_handler(struct int25regs FAR * r) { int2526_handler(DSKREAD,r); }
|
||||
VOID int26_handler(struct int25regs FAR * r) { int2526_handler(DSKWRITE,r); }
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef TSC
|
||||
static VOID StartTrace(VOID)
|
||||
{
|
||||
@ -1926,8 +1932,7 @@ static VOID StartTrace(VOID)
|
||||
this function is called from an assembler wrapper function
|
||||
and serves the internal dos calls - int2f/12xx
|
||||
*/
|
||||
struct int2f12regs
|
||||
{
|
||||
struct int2f12regs {
|
||||
UWORD es, ds;
|
||||
UWORD di, si, bp, bx, dx, cx, ax;
|
||||
UWORD ip, cs, flags;
|
||||
@ -1955,11 +1960,9 @@ VOID ASMCFUNC int2F_12_handler(volatile struct int2f12regs r)
|
||||
|
||||
/* code, drive number, error, device header */
|
||||
r.ax &= 0xff00;
|
||||
r.ax |= CriticalError(
|
||||
r.callerARG1 >> 8,
|
||||
(r.callerARG1 & (EFLG_CHAR << 8)) ? 0 : r.callerARG1 & 0xff,
|
||||
r.di,
|
||||
MK_FP(r.bp,r.si));
|
||||
r.ax |= CriticalError(r.callerARG1 >> 8,
|
||||
(r.callerARG1 & (EFLG_CHAR << 8)) ? 0 : r.
|
||||
callerARG1 & 0xff, r.di, MK_FP(r.bp, r.si));
|
||||
break;
|
||||
|
||||
case 0x08: /* decrease SFT reference count */
|
||||
@ -1968,7 +1971,8 @@ VOID ASMCFUNC int2F_12_handler(volatile struct int2f12regs r)
|
||||
|
||||
r.ax = p->sft_count;
|
||||
|
||||
if (--p->sft_count == 0) --p->sft_count;
|
||||
if (--p->sft_count == 0)
|
||||
--p->sft_count;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2001,7 +2005,6 @@ VOID ASMCFUNC int2F_12_handler(volatile struct int2f12regs r)
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 0x16: /* get address of system file table entry - used by NET.EXE
|
||||
BX system file table entry number ( such as returned from 2F/1220)
|
||||
returns
|
||||
@ -2069,7 +2072,8 @@ VOID ASMCFUNC int2F_12_handler(volatile struct int2f12regs r)
|
||||
r.bx = (r.bx & 0xff) | (dhp->dh_attr << 8);
|
||||
r.flags &= ~FLG_CARRY;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
r.flags |= FLG_CARRY;
|
||||
}
|
||||
|
||||
@ -2082,7 +2086,6 @@ VOID ASMCFUNC int2F_12_handler(volatile struct int2f12regs r)
|
||||
r.cx = fstrlen(MK_FP(r.ds, r.si)) + 1;
|
||||
break;
|
||||
|
||||
|
||||
case 0x2a: /* Set FastOpen but does nothing. */
|
||||
|
||||
r.flags &= ~FLG_CARRY;
|
||||
@ -2103,7 +2106,8 @@ VOID ASMCFUNC int2F_12_handler(volatile struct int2f12regs r)
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("unimplemented internal dos function INT2F/12%02x\n",function);
|
||||
printf("unimplemented internal dos function INT2F/12%02x\n",
|
||||
function);
|
||||
r.flags |= FLG_CARRY;
|
||||
break;
|
||||
|
||||
|
@ -30,7 +30,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -53,7 +54,6 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
*/
|
||||
|
||||
|
||||
COUNT DosDevIOctl(iregs FAR * r)
|
||||
{
|
||||
sft FAR *s;
|
||||
@ -67,8 +67,6 @@ COUNT DosDevIOctl(iregs FAR * r)
|
||||
CharReqHdr.r_status = 0;
|
||||
CharReqHdr.r_count = r->CX;
|
||||
|
||||
|
||||
|
||||
/* Test that the handle is valid */
|
||||
switch (r->AL)
|
||||
{
|
||||
@ -216,16 +214,16 @@ COUNT DosDevIOctl(iregs FAR * r)
|
||||
}
|
||||
if (((r->AL == 0x04) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL))
|
||||
|| ((r->AL == 0x05) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL))
|
||||
|| ((r->AL == 0x11) && !(dpbp->dpb_device->dh_attr & ATTR_QRYIOCTL))
|
||||
|| ((r->AL == 0x0d) && !(dpbp->dpb_device->dh_attr & ATTR_GENIOCTL)))
|
||||
|| ((r->AL == 0x11)
|
||||
&& !(dpbp->dpb_device->dh_attr & ATTR_QRYIOCTL))
|
||||
|| ((r->AL == 0x0d)
|
||||
&& !(dpbp->dpb_device->dh_attr & ATTR_GENIOCTL)))
|
||||
{
|
||||
return DE_INVLDFUNC;
|
||||
}
|
||||
|
||||
|
||||
CharReqHdr.r_command = nMode;
|
||||
execrh((request FAR *) & CharReqHdr,
|
||||
dpbp->dpb_device);
|
||||
execrh((request FAR *) & CharReqHdr, dpbp->dpb_device);
|
||||
|
||||
if (CharReqHdr.r_status & S_ERROR)
|
||||
{
|
||||
@ -315,10 +313,8 @@ COUNT DosDevIOctl(iregs FAR * r)
|
||||
if ((dpbp->dpb_device->dh_attr & ATTR_GENIOCTL))
|
||||
{
|
||||
|
||||
|
||||
CharReqHdr.r_command = nMode;
|
||||
execrh((request FAR *) & CharReqHdr,
|
||||
dpbp->dpb_device);
|
||||
execrh((request FAR *) & CharReqHdr, dpbp->dpb_device);
|
||||
|
||||
if (CharReqHdr.r_status & S_ERROR)
|
||||
{
|
||||
@ -391,6 +387,3 @@ COUNT DosDevIOctl(iregs FAR * r)
|
||||
* Rev 1.0 02 Jul 1995 8:32:04 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *lfnaidRcsId = "$Id$";
|
||||
static BYTE *lfnaidRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#ifdef WITHLFNAPI
|
||||
@ -36,7 +37,8 @@ COUNT lfn_allocate_inode(VOID)
|
||||
{
|
||||
f_node_ptr fnp = get_f_node();
|
||||
struct cds FAR *cdsp;
|
||||
if (fnp == 0) return LHE_NOFREEHNDL;
|
||||
if (fnp == 0)
|
||||
return LHE_NOFREEHNDL;
|
||||
|
||||
cdsp = &CDSp->cds_table[default_drive];
|
||||
|
||||
@ -60,7 +62,8 @@ COUNT lfn_allocate_inode(VOID)
|
||||
COUNT lfn_free_inode(COUNT handle)
|
||||
{
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0) return LHE_INVLDHNDL;
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
|
||||
release_f_node(fnp);
|
||||
|
||||
@ -70,7 +73,8 @@ COUNT lfn_free_inode(COUNT handle)
|
||||
COUNT lfn_setup_inode(COUNT handle, CLUSTER dirstart, ULONG diroff)
|
||||
{
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0) return LHE_INVLDHNDL;
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
|
||||
dir_init_fnode(fnp, dirstart);
|
||||
fnp->f_diroff = diroff;
|
||||
@ -78,16 +82,20 @@ COUNT lfn_setup_inode(COUNT handle, CLUSTER dirstart, ULONG diroff)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
BOOL transfer_unicode(UNICODE FAR **dptr, UNICODE FAR **sptr, COUNT count)
|
||||
BOOL transfer_unicode(UNICODE FAR ** dptr, UNICODE FAR ** sptr,
|
||||
COUNT count)
|
||||
{
|
||||
COUNT j;
|
||||
BOOL found_zerro = FALSE;
|
||||
|
||||
for (j = 0; j < count; j++, (*dptr)++, (*sptr)++)
|
||||
{
|
||||
if (found_zerro) **dptr = UNICODE_FILLER;
|
||||
else **dptr = **sptr;
|
||||
if (**sptr == 0) found_zerro = TRUE;
|
||||
if (found_zerro)
|
||||
**dptr = UNICODE_FILLER;
|
||||
else
|
||||
**dptr = **sptr;
|
||||
if (**sptr == 0)
|
||||
found_zerro = TRUE;
|
||||
}
|
||||
|
||||
return found_zerro;
|
||||
@ -98,11 +106,14 @@ BOOL lfn_to_unicode(UNICODE FAR **name, struct lfn_entry FAR *lep)
|
||||
UNICODE FAR *ptr;
|
||||
|
||||
ptr = lep->lfn_name0_4;
|
||||
if (!transfer_unicode(name, &ptr, 5)) return FALSE;
|
||||
if (!transfer_unicode(name, &ptr, 5))
|
||||
return FALSE;
|
||||
ptr = lep->lfn_name5_10;
|
||||
if (!transfer_unicode(name, &ptr, 6)) return FALSE;
|
||||
if (!transfer_unicode(name, &ptr, 6))
|
||||
return FALSE;
|
||||
ptr = lep->lfn_name11_12;
|
||||
if (!transfer_unicode(name, &ptr, 2)) return FALSE;
|
||||
if (!transfer_unicode(name, &ptr, 2))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -127,15 +138,20 @@ COUNT lfn_dir_read(COUNT handle, lfn_inode_ptr lip)
|
||||
ULONG sfn_diroff;
|
||||
BOOL name_tail = FALSE;
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0) return LHE_INVLDHNDL;
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
rc = dir_read(fnp);
|
||||
if (rc == 0) return SUCCESS;
|
||||
else if (rc == DE_SEEK) return LHE_SEEK;
|
||||
else if (rc == DE_BLKINVLD) return LHE_IOERROR;
|
||||
if (fnp->f_dir.dir_name[0] != DELETED && fnp->f_dir.dir_attrib != D_LFN)
|
||||
if (rc == 0)
|
||||
return SUCCESS;
|
||||
else if (rc == DE_SEEK)
|
||||
return LHE_SEEK;
|
||||
else if (rc == DE_BLKINVLD)
|
||||
return LHE_IOERROR;
|
||||
if (fnp->f_dir.dir_name[0] != DELETED
|
||||
&& fnp->f_dir.dir_attrib != D_LFN)
|
||||
{
|
||||
fmemcpy(&lip->l_dir, &fnp->f_dir, sizeof(struct dirent));
|
||||
sfn_diroff = fnp->f_diroff;
|
||||
@ -147,17 +163,21 @@ COUNT lfn_dir_read(COUNT handle, lfn_inode_ptr lip)
|
||||
fmemset(lip->name, 0, 256 * sizeof(UNICODE));
|
||||
while (TRUE)
|
||||
{
|
||||
if (fnp->f_diroff == 0) break;
|
||||
if (fnp->f_diroff == 0)
|
||||
break;
|
||||
fnp->f_diroff -= 2 * DIRENT_SIZE;
|
||||
rc = dir_read(fnp);
|
||||
if (rc == DE_BLKINVLD) return LHE_IOERROR;
|
||||
if (rc == DE_BLKINVLD)
|
||||
return LHE_IOERROR;
|
||||
if (fnp->f_dir.dir_name[0] == DELETED
|
||||
|| fnp->f_dir.dir_attrib != D_LFN) break;
|
||||
|| fnp->f_dir.dir_attrib != D_LFN)
|
||||
break;
|
||||
name_tail = lfn_to_unicode(&lfn_name, lfn(fnp));
|
||||
real_id = lfn(fnp)->lfn_id;
|
||||
if (real_id & 0x40)
|
||||
{
|
||||
if ((real_id | 0x40) != id) return LHE_DAMAGEDFS;
|
||||
if ((real_id | 0x40) != id)
|
||||
return LHE_DAMAGEDFS;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -176,7 +196,8 @@ COUNT lfn_dir_read(COUNT handle, lfn_inode_ptr lip)
|
||||
COUNT lfn_dir_write(COUNT handle)
|
||||
{
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0) return LHE_INVLDHNDL;
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
|
||||
if (!dir_write(fnp))
|
||||
{
|
||||
@ -196,10 +217,10 @@ COUNT lfn_create_entries(COUNT handle, lfn_inode_ptr lip)
|
||||
COUNT entries_needed, free_entries, i, rc;
|
||||
UNICODE FAR *lfn_name = lip->name;
|
||||
ULONG sfn_offset;
|
||||
if (fnp == 0 || fnp->f_count <= 0) return LHE_INVLDHNDL;
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
|
||||
entries_needed = (ufstrlen(lfn_name) + CHARS_IN_LFN_ENTRY - 1)
|
||||
/ CHARS_IN_LFN_ENTRY + 1; /* We want to create SFN entry too */
|
||||
entries_needed = (ufstrlen(lfn_name) + CHARS_IN_LFN_ENTRY - 1) / CHARS_IN_LFN_ENTRY + 1; /* We want to create SFN entry too */
|
||||
|
||||
/* Scan the directory from the very begining for the free directory entries */
|
||||
lfn_setup_inode(handle, fnp->f_dirstart, 0);
|
||||
@ -213,17 +234,22 @@ COUNT lfn_create_entries(COUNT handle, lfn_inode_ptr lip)
|
||||
if (free_entries == entries_needed)
|
||||
break;
|
||||
}
|
||||
else free_entries = 0;
|
||||
else
|
||||
free_entries = 0;
|
||||
}
|
||||
if (rc == DE_BLKINVLD) return LHE_IOERROR;
|
||||
if (rc == DE_BLKINVLD)
|
||||
return LHE_IOERROR;
|
||||
/* We have reached the end of the directory here. */
|
||||
|
||||
if (free_entries != entries_needed) free_entries = 0;
|
||||
if (free_entries != entries_needed)
|
||||
free_entries = 0;
|
||||
while (free_entries != entries_needed)
|
||||
{
|
||||
rc = dir_read(fnp);
|
||||
if (rc == 0) free_entries++;
|
||||
else if (rc == DE_BLKINVLD) return LHE_IOERROR;
|
||||
if (rc == 0)
|
||||
free_entries++;
|
||||
else if (rc == DE_BLKINVLD)
|
||||
return LHE_IOERROR;
|
||||
else if (rc == DE_SEEK && extend_dir(fnp) != SUCCESS)
|
||||
{
|
||||
lfn_allocate_inode(); /* Another hack. */
|
||||
@ -238,7 +264,8 @@ COUNT lfn_create_entries(COUNT handle, lfn_inode_ptr lip)
|
||||
lfn_name = &lip->name[i * CHARS_IN_LFN_ENTRY];
|
||||
unicode_to_lfn(&lfn_name, lfn(fnp));
|
||||
fnp->f_dir.dir_attrib = D_LFN;
|
||||
if (!dir_write(fnp)) return LHE_IOERROR;
|
||||
if (!dir_write(fnp))
|
||||
return LHE_IOERROR;
|
||||
fnp->f_diroff -= DIRENT_SIZE;
|
||||
}
|
||||
|
||||
@ -250,9 +277,11 @@ COUNT lfn_create_entries(COUNT handle, lfn_inode_ptr lip)
|
||||
COUNT lfn_remove_entries(COUNT handle)
|
||||
{
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0) return LHE_INVLDHNDL;
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
|
||||
if(remove_lfn_entries(fnp) < 0) return LHE_IOERROR;
|
||||
if (remove_lfn_entries(fnp) < 0)
|
||||
return LHE_IOERROR;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ GLOBAL BYTE copyright[] =
|
||||
"GNU General Public License as published by the Free Software Foundation;\n"
|
||||
"either version 2, or (at your option) any later version.\n";
|
||||
|
||||
|
||||
/*
|
||||
These are the far variables from the DOS data segment that we need here. The
|
||||
init procedure uses a different default DS data segment, which is discarded
|
||||
@ -48,14 +47,11 @@ GLOBAL BYTE copyright[] =
|
||||
|
||||
-- Bart
|
||||
*/
|
||||
extern UBYTE DOSFAR nblkdev,
|
||||
DOSFAR lastdrive; /* value of last drive */
|
||||
extern UBYTE DOSFAR nblkdev, DOSFAR lastdrive; /* value of last drive */
|
||||
|
||||
GLOBAL BYTE
|
||||
DOSFAR os_major, /* major version number */
|
||||
GLOBAL BYTE DOSFAR os_major, /* major version number */
|
||||
DOSFAR os_minor, /* minor version number */
|
||||
DOSFAR dosidle_flag,
|
||||
DOSFAR BootDrive, /* Drive we came up from */
|
||||
DOSFAR dosidle_flag, DOSFAR BootDrive, /* Drive we came up from */
|
||||
DOSFAR default_drive; /* default drive for dos */
|
||||
|
||||
GLOBAL BYTE DOSFAR os_release[];
|
||||
@ -70,18 +66,17 @@ extern struct dhdr FAR * DOSFAR clock, /* CLOCK$ device
|
||||
extern struct dhdr DOSTEXTFAR con_dev, /* console device drive */
|
||||
DOSTEXTFAR clk_dev, /* Clock device driver */
|
||||
DOSTEXTFAR blk_dev; /* Block device (Disk) driver */
|
||||
extern UWORD
|
||||
DOSFAR ram_top; /* How much ram in Kbytes */
|
||||
extern UWORD DOSFAR ram_top; /* How much ram in Kbytes */
|
||||
extern iregs FAR *DOSFAR user_r; /* User registers for int 21h call */
|
||||
extern BYTE FAR _HMATextEnd[];
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *mainRcsId = "$Id$";
|
||||
static BYTE *mainRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
struct _KernelConfig InitKernelConfig = { "", 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
|
||||
extern WORD days[2][13];
|
||||
extern BYTE FAR *lpBase;
|
||||
extern BYTE FAR *lpOldTop;
|
||||
@ -111,7 +106,6 @@ __segment DosTextSeg = 0;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
INIT VOID ASMCFUNC FreeDOSmain(void)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
@ -123,7 +117,6 @@ INIT VOID ASMCFUNC FreeDOSmain(void)
|
||||
|
||||
fmemcpy(&InitKernelConfig, &LowKernelConfig, sizeof(InitKernelConfig));
|
||||
|
||||
|
||||
setvec(0, int0_handler); /* zero divide */
|
||||
setvec(1, empty_handler); /* single step */
|
||||
setvec(3, empty_handler); /* debug breakpoint */
|
||||
@ -320,8 +313,7 @@ INIT VOID signon()
|
||||
{
|
||||
printf("\n%S", (void FAR *)os_release);
|
||||
|
||||
printf("Kernel compatibility %d.%d",
|
||||
os_major, os_minor );
|
||||
printf("Kernel compatibility %d.%d", os_major, os_minor);
|
||||
|
||||
#if defined(__TURBOC__)
|
||||
printf(" - TURBOC");
|
||||
@ -332,7 +324,6 @@ INIT VOID signon()
|
||||
#else
|
||||
generate some bullshit error here, as the compiler should be known
|
||||
#endif
|
||||
|
||||
#if defined (I386)
|
||||
printf(" - 80386 CPU required");
|
||||
#elif defined (I186)
|
||||
@ -348,8 +339,7 @@ INIT VOID signon()
|
||||
INIT void kernel()
|
||||
{
|
||||
#if 0
|
||||
BYTE FAR *ep,
|
||||
*sp;
|
||||
BYTE FAR *ep, *sp;
|
||||
#endif
|
||||
exec_blk exb;
|
||||
CommandTail Cmd;
|
||||
@ -386,11 +376,8 @@ INIT void kernel()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
RootPsp = ~0;
|
||||
|
||||
|
||||
|
||||
/* process 0 */
|
||||
/* Execute command.com /P from the drive we just booted from */
|
||||
fstrncpy(Cmd.ctBuffer, Config.cfgInitTail,
|
||||
@ -400,9 +387,6 @@ INIT void kernel()
|
||||
if (Cmd.ctBuffer[Cmd.ctCount] == '\r')
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
/* if stepping CONFIG.SYS (F5/F8), tell COMMAND.COM about it */
|
||||
|
||||
if (Cmd.ctCount < 127 - 3)
|
||||
@ -411,9 +395,11 @@ INIT void kernel()
|
||||
extern int SkipAllConfig;
|
||||
char *insertString = NULL;
|
||||
|
||||
if (singleStep) insertString = " /Y"; /* single step AUTOEXEC */
|
||||
if (singleStep)
|
||||
insertString = " /Y"; /* single step AUTOEXEC */
|
||||
|
||||
if (SkipAllConfig) insertString = " /D"; /* disable AUTOEXEC */
|
||||
if (SkipAllConfig)
|
||||
insertString = " /D"; /* disable AUTOEXEC */
|
||||
|
||||
if (insertString)
|
||||
{
|
||||
@ -424,8 +410,7 @@ INIT void kernel()
|
||||
for (cmdEnd = 0; cmdEnd < 127; cmdEnd++)
|
||||
{
|
||||
if (Cmd.ctBuffer[cmdEnd] == ' ' ||
|
||||
Cmd.ctBuffer[cmdEnd] == '\t' ||
|
||||
Cmd.ctBuffer[cmdEnd] == '\r')
|
||||
Cmd.ctBuffer[cmdEnd] == '\t' || Cmd.ctBuffer[cmdEnd] == '\r')
|
||||
{
|
||||
for (i = 127 - slen; i >= cmdEnd; i--)
|
||||
Cmd.ctBuffer[i + slen] = Cmd.ctBuffer[i];
|
||||
@ -440,8 +425,6 @@ INIT void kernel()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
exb.exec.cmd_line = (CommandTail FAR *) & Cmd;
|
||||
exb.exec.fcb_1 = exb.exec.fcb_2 = (fcb FAR *) 0;
|
||||
|
||||
@ -449,11 +432,15 @@ INIT void kernel()
|
||||
printf("Process 0 starting: %s\n\n", Config.cfgInit);
|
||||
#endif
|
||||
|
||||
while ((rc = init_DosExec(Config.cfgP_0_startmode, &exb, Config.cfgInit)) != SUCCESS)
|
||||
while ((rc =
|
||||
init_DosExec(Config.cfgP_0_startmode, &exb,
|
||||
Config.cfgInit)) != SUCCESS)
|
||||
{
|
||||
BYTE *pLine;
|
||||
printf("\nBad or missing Command Interpreter: %d - %s\n", rc, Cmd.ctBuffer);
|
||||
printf("\nPlease enter the correct location (for example C:\\COMMAND.COM):\n");
|
||||
printf("\nBad or missing Command Interpreter: %d - %s\n", rc,
|
||||
Cmd.ctBuffer);
|
||||
printf
|
||||
("\nPlease enter the correct location (for example C:\\COMMAND.COM):\n");
|
||||
rc = read(STDIN, Cmd.ctBuffer, sizeof(Cmd.ctBuffer) - 1);
|
||||
Cmd.ctBuffer[rc] = '\0';
|
||||
|
||||
@ -486,10 +473,13 @@ static VOID update_dcb(struct dhdr FAR * dhp)
|
||||
|
||||
if (nblkdev == 0)
|
||||
dpb = DPBp;
|
||||
else {
|
||||
for (dpb = DPBp; (ULONG)dpb->dpb_next != 0xffffffffl; dpb = dpb->dpb_next)
|
||||
else
|
||||
{
|
||||
for (dpb = DPBp; (ULONG) dpb->dpb_next != 0xffffffffl;
|
||||
dpb = dpb->dpb_next)
|
||||
;
|
||||
dpb = dpb->dpb_next = (struct dpb FAR *)KernelAlloc(nunits*sizeof(struct dpb));
|
||||
dpb = dpb->dpb_next =
|
||||
(struct dpb FAR *)KernelAlloc(nunits * sizeof(struct dpb));
|
||||
}
|
||||
|
||||
for (Index = 0; Index < nunits; Index++)
|
||||
@ -510,10 +500,10 @@ static VOID update_dcb(struct dhdr FAR * dhp)
|
||||
(dpb - 1)->dpb_next = (void FAR *)0xFFFFFFFFl;
|
||||
}
|
||||
|
||||
|
||||
/* If cmdLine is NULL, this is an internal driver */
|
||||
|
||||
BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT r_top)
|
||||
BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode,
|
||||
COUNT r_top)
|
||||
{
|
||||
request rq;
|
||||
|
||||
@ -540,7 +530,8 @@ BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT r_
|
||||
if (rq.r_status & S_ERROR)
|
||||
return TRUE;
|
||||
|
||||
if(cmdLine){
|
||||
if (cmdLine)
|
||||
{
|
||||
if (mode)
|
||||
{
|
||||
/* Don't link in device drivers which do not take up memory */
|
||||
@ -558,7 +549,8 @@ BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT r_
|
||||
}
|
||||
}
|
||||
|
||||
if (!(dhp->dh_attr & ATTR_CHAR) && (rq.r_nunits != 0)) {
|
||||
if (!(dhp->dh_attr & ATTR_CHAR) && (rq.r_nunits != 0))
|
||||
{
|
||||
dhp->dh_name[0] = rq.r_nunits;
|
||||
update_dcb(dhp);
|
||||
}
|
||||
@ -571,7 +563,6 @@ BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT r_
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
INIT static void InitIO(void)
|
||||
{
|
||||
/* Initialize driver chain */
|
||||
@ -705,5 +696,3 @@ INIT VOID InitPrinters(VOID)
|
||||
* Rev 1.0 02 Jul 1995 8:33:18 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -30,7 +30,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRING
|
||||
static BYTE *memmgrRcsId = "$Id$";
|
||||
static BYTE *memmgrRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
VOID mcb_init();
|
||||
@ -98,7 +99,8 @@ VOID FAR *add_far(VOID FAR * fp, ULONG off)
|
||||
{
|
||||
UWORD off2;
|
||||
|
||||
if (FP_SEG(fp) == 0xffff) return ((BYTE FAR *)fp) + FP_OFF(off);
|
||||
if (FP_SEG(fp) == 0xffff)
|
||||
return ((BYTE FAR *) fp) + FP_OFF(off);
|
||||
|
||||
off += FP_OFF(fp);
|
||||
off2 = ((off >> 16) << 12) + ((UWORD) off >> 4);
|
||||
@ -114,7 +116,8 @@ VOID FAR *adjust_far(VOID FAR * fp)
|
||||
/* and return an adddress adjusted to the nearest paragraph */
|
||||
/* boundary. */
|
||||
|
||||
if (FP_SEG(fp) == 0xffff) return fp;
|
||||
if (FP_SEG(fp) == 0xffff)
|
||||
return fp;
|
||||
|
||||
return MK_FP(FP_SEG(fp) + (FP_OFF(fp) >> 4), FP_OFF(fp) & 0xf);
|
||||
}
|
||||
@ -132,7 +135,8 @@ VOID FAR *adjust_far(VOID FAR * fp)
|
||||
size is the minimum size of the block to search for,
|
||||
even if mode == LARGEST.
|
||||
*/
|
||||
COUNT DosMemAlloc(UWORD size, COUNT mode, seg FAR * para, UWORD FAR * asize)
|
||||
COUNT DosMemAlloc(UWORD size, COUNT mode, seg FAR * para,
|
||||
UWORD FAR * asize)
|
||||
{
|
||||
REG mcb FAR *p;
|
||||
mcb FAR *foundSeg;
|
||||
@ -213,7 +217,8 @@ searchAgain:
|
||||
if (!foundSeg || !foundSeg->m_size)
|
||||
{ /* no block to fullfill the request */
|
||||
if ((mode != LARGEST) && (mode & FIRST_FIT_U) &&
|
||||
uppermem_link && uppermem_root) {
|
||||
uppermem_link && uppermem_root)
|
||||
{
|
||||
mode &= ~FIRST_FIT_U;
|
||||
goto searchAgain;
|
||||
}
|
||||
@ -230,7 +235,8 @@ stopIt: /* reached from FIRST_FIT on match */
|
||||
/* foundSeg := pointer to allocated block
|
||||
p := pointer to MCB that will form the rest of the block
|
||||
*/
|
||||
if ((mode == LAST_FIT)||(mode == LAST_FIT_UO)||(mode == LAST_FIT_U))
|
||||
if ((mode == LAST_FIT) || (mode == LAST_FIT_UO)
|
||||
|| (mode == LAST_FIT_U))
|
||||
{
|
||||
/* allocate the block from the end of the found block */
|
||||
p = foundSeg;
|
||||
@ -283,9 +289,8 @@ COUNT DosMemLargest(UWORD FAR * size)
|
||||
REG mcb FAR *p;
|
||||
|
||||
/* Initialize */
|
||||
p = ((mem_access_mode & (FIRST_FIT_UO | FIRST_FIT_U)) && uppermem_link && uppermem_root)
|
||||
? para2far(uppermem_root)
|
||||
: para2far(first_mcb);
|
||||
p = ((mem_access_mode & (FIRST_FIT_UO | FIRST_FIT_U)) && uppermem_link
|
||||
&& uppermem_root) ? para2far(uppermem_root) : para2far(first_mcb);
|
||||
|
||||
/* Cycle through the whole MCB chain to find the largest unused
|
||||
area. Join all unused areas together. */
|
||||
@ -384,8 +389,7 @@ COUNT DosMemFree(UWORD para)
|
||||
*/
|
||||
COUNT DosMemChange(UWORD para, UWORD size, UWORD * maxSize)
|
||||
{
|
||||
REG mcb FAR *p,
|
||||
FAR * q;
|
||||
REG mcb FAR *p, FAR * q;
|
||||
REG COUNT i;
|
||||
|
||||
/* Initialize */
|
||||
@ -552,12 +556,10 @@ VOID mcb_print(mcb FAR * mcbp)
|
||||
|
||||
fmemcpy((BYTE FAR *) buff, (BYTE FAR *) (mcbp->m_name), 8);
|
||||
buff[8] = '\0';
|
||||
printf("%04x:%04x -> |%s| m_type = 0x%02x '%c'; m_psp = 0x%04x; m_size = 0x%04x\n",
|
||||
FP_SEG(mcbp),
|
||||
FP_OFF(mcbp),
|
||||
*buff == '\0' ? "*NO-ID*" : buff,
|
||||
mcbp->m_type, mcbp->m_type > ' ' ? mcbp->m_type : ' ',
|
||||
mcbp->m_psp,
|
||||
printf
|
||||
("%04x:%04x -> |%s| m_type = 0x%02x '%c'; m_psp = 0x%04x; m_size = 0x%04x\n",
|
||||
FP_SEG(mcbp), FP_OFF(mcbp), *buff == '\0' ? "*NO-ID*" : buff,
|
||||
mcbp->m_type, mcbp->m_type > ' ' ? mcbp->m_type : ' ', mcbp->m_psp,
|
||||
mcbp->m_size);
|
||||
}
|
||||
#endif
|
||||
@ -590,8 +592,7 @@ VOID DosUmbLink(BYTE n)
|
||||
uppermem_link = n;
|
||||
|
||||
}
|
||||
else
|
||||
if((uppermem_link == 0) && (n == 1))
|
||||
else if ((uppermem_link == 0) && (n == 1))
|
||||
{
|
||||
while (q->m_type != MCB_LAST)
|
||||
{
|
||||
@ -632,7 +633,6 @@ VOID ClaimINITDataSegment()
|
||||
return;
|
||||
INITDataSegmentClaimed = 1;
|
||||
|
||||
|
||||
ilow = (unsigned)_INIT_DATA_START;
|
||||
ilow = (ilow + 0x0f) & ~0x000f;
|
||||
ihigh = (unsigned)_INIT_DATA_END;
|
||||
@ -643,7 +643,6 @@ VOID ClaimINITDataSegment()
|
||||
printf("CLAIMING INIT_DATA memory - %u bytes\n", ihigh - ilow);
|
||||
}
|
||||
|
||||
|
||||
((mcb *) ilow)->m_type = MCB_NORMAL; /* 'M' */
|
||||
((mcb *) ilow)->m_psp = FREE_PSP; /* '0' */
|
||||
((mcb *) ilow)->m_size = (ihigh - ilow - 0x10) >> 4; /* '0' */
|
||||
@ -712,4 +711,3 @@ VOID ClaimINITDataSegment()
|
||||
* Rev 1.0 02 Jul 1995 8:33:08 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
@ -29,7 +29,8 @@
|
||||
#include "portab.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *miscRcsId = "$Id$";
|
||||
static BYTE *miscRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#include "globals.h"
|
||||
@ -119,4 +120,3 @@ VOID fmemset(REG VOID FAR * s, REG int ch, REG COUNT n)
|
||||
* Rev 1.0 02 Jul 1995 8:06:28 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
@ -31,7 +31,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
/* see RBIL D-2152 and D-215D06 before attempting
|
||||
@ -66,4 +67,3 @@ VOID set_machine_name(BYTE FAR * netname, UWORD name_num)
|
||||
* *** empty log message ***
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -26,7 +26,8 @@
|
||||
/****************************************************************/
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *mainRcsId = "$Id$";
|
||||
static BYTE *mainRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#include "portab.h"
|
||||
@ -39,8 +40,7 @@ static BYTE *mainRcsId = "$Id$";
|
||||
*/
|
||||
int SetJFTSize(UWORD nHandles)
|
||||
{
|
||||
UWORD block,
|
||||
maxBlock;
|
||||
UWORD block, maxBlock;
|
||||
psp FAR *ppsp = MK_FP(cu_psp, 0);
|
||||
UBYTE FAR *newtab;
|
||||
COUNT i;
|
||||
@ -51,7 +51,8 @@ int SetJFTSize(UWORD nHandles)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if ((DosMemAlloc((nHandles + 0xf) >> 4, mem_access_mode, &block, &maxBlock)) < 0)
|
||||
if ((DosMemAlloc
|
||||
((nHandles + 0xf) >> 4, mem_access_mode, &block, &maxBlock)) < 0)
|
||||
return DE_NOMEM;
|
||||
|
||||
++block;
|
||||
@ -74,13 +75,8 @@ int DosMkTmp(BYTE FAR * pathname, UWORD attr)
|
||||
{
|
||||
/* create filename from current date and time */
|
||||
char FAR *ptmp = pathname;
|
||||
BYTE wd,
|
||||
month,
|
||||
day;
|
||||
BYTE h,
|
||||
m,
|
||||
s,
|
||||
hund;
|
||||
BYTE wd, month, day;
|
||||
BYTE h, m, s, hund;
|
||||
WORD sh;
|
||||
WORD year;
|
||||
int rc;
|
||||
@ -101,21 +97,20 @@ int DosMkTmp(BYTE FAR * pathname, UWORD attr)
|
||||
for (loop = 0; loop < 0xfff; loop++)
|
||||
{
|
||||
sprintf(name83, "%x%x%x%x%x%03x.%03x",
|
||||
|
||||
year & 0xf,month & 0xf, day & 0xf,h & 0xf,m & 0xf, sh&0xfff,
|
||||
loop & 0xfff);
|
||||
year & 0xf, month & 0xf, day & 0xf, h & 0xf, m & 0xf,
|
||||
sh & 0xfff, loop & 0xfff);
|
||||
|
||||
fmemcpy(ptmp, name83, 13);
|
||||
|
||||
if ((rc = DosOpen(pathname, 0)) < 0 &&
|
||||
rc != DE_ACCESS /* subdirectory ?? */
|
||||
if ((rc = DosOpen(pathname, 0)) < 0 && rc != DE_ACCESS /* subdirectory ?? */
|
||||
/* todo: sharing collision on
|
||||
network drive
|
||||
*/
|
||||
)
|
||||
break;
|
||||
|
||||
if (rc >= 0) DosClose(rc);
|
||||
if (rc >= 0)
|
||||
DosClose(rc);
|
||||
}
|
||||
|
||||
if (rc == DE_FILENOTFND)
|
||||
@ -194,7 +189,8 @@ COUNT ASMCFUNC truename(char FAR * src, char FAR * dest, COUNT t)
|
||||
*/
|
||||
/* check for a device */
|
||||
|
||||
if ((*src != '.') && (*src != '\\') && (*src != '/') && ((dhp = IsDevice(src)) != NULL))
|
||||
if ((*src != '.') && (*src != '\\') && (*src != '/')
|
||||
&& ((dhp = IsDevice(src)) != NULL))
|
||||
{
|
||||
|
||||
froot = get_root(src);
|
||||
@ -208,21 +204,29 @@ COUNT ASMCFUNC truename(char FAR * src, char FAR * dest, COUNT t)
|
||||
/* /// Bug: should be only copying up to first space.
|
||||
- Ron Cemer */
|
||||
|
||||
for (d = 0; d < FNAME_SIZE && dhp->dh_name[d] != 0 && dhp->dh_name[d] != ' '; d++)
|
||||
for (d = 0;
|
||||
d < FNAME_SIZE && dhp->dh_name[d] != 0 && dhp->dh_name[d] != ' ';
|
||||
d++)
|
||||
*bufp++ = dhp->dh_name[d];
|
||||
/* /// DOS will return C:/NUL.LST if you pass NUL.LST in.
|
||||
DOS will also return C:/NUL.??? if you pass NUL.* in.
|
||||
Code added here to support this.
|
||||
- Ron Cemer */
|
||||
while ( (*froot != '.') && (*froot != '\0') ) froot++;
|
||||
if (*froot) froot++;
|
||||
if (*froot) {
|
||||
while ((*froot != '.') && (*froot != '\0'))
|
||||
froot++;
|
||||
if (*froot)
|
||||
froot++;
|
||||
if (*froot)
|
||||
{
|
||||
*bufp++ = '.';
|
||||
for (i = 0; i < FEXT_SIZE; i++) {
|
||||
for (i = 0; i < FEXT_SIZE; i++)
|
||||
{
|
||||
if ((*froot == '\0') || (*froot == '.'))
|
||||
break;
|
||||
if (*froot == '*') {
|
||||
for (; i < FEXT_SIZE; i++) *bufp++ = '?';
|
||||
if (*froot == '*')
|
||||
{
|
||||
for (; i < FEXT_SIZE; i++)
|
||||
*bufp++ = '?';
|
||||
break;
|
||||
}
|
||||
*bufp++ = *froot++;
|
||||
@ -240,15 +244,20 @@ COUNT ASMCFUNC truename(char FAR * src, char FAR * dest, COUNT t)
|
||||
* path to the executable file.
|
||||
* Jun 11, 2000 - rbc */
|
||||
/* /// Changed to "while" from "if". - Ron Cemer */
|
||||
while ( (src[0] == '.') && (src[1] == '\\') ) src += 2;
|
||||
while ((src[0] == '.') && (src[1] == '\\'))
|
||||
src += 2;
|
||||
|
||||
current_ldt = &CDSp->cds_table[i];
|
||||
|
||||
/* Always give the redirector a chance to rewrite the filename */
|
||||
fstrncpy(bufp - 1, src, sizeof(buf) - (bufp - buf));
|
||||
if ((t == FALSE) && (QRemote_Fn(buf, dest) == SUCCESS) && (dest[0] != '\0')) {
|
||||
if ((t == FALSE) && (QRemote_Fn(buf, dest) == SUCCESS)
|
||||
&& (dest[0] != '\0'))
|
||||
{
|
||||
return SUCCESS;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
bufp[-1] = '\\';
|
||||
}
|
||||
if (t == FALSE)
|
||||
@ -327,7 +336,8 @@ COUNT ASMCFUNC truename(char FAR * src, char FAR * dest, COUNT t)
|
||||
case '/': /* convert to backslash */
|
||||
case '\\':
|
||||
|
||||
if (bufp[-1] != '\\'){
|
||||
if (bufp[-1] != '\\')
|
||||
{
|
||||
*bufp++ = '\\';
|
||||
n = 9;
|
||||
}
|
||||
@ -384,92 +394,119 @@ COUNT ASMCFUNC truename(char FAR * src, char FAR * dest, COUNT t)
|
||||
char c, *bufend = buf + (sizeof(buf) - 1);
|
||||
int gotAnyWildcards = 0;
|
||||
int seglen, copylen, state;
|
||||
while ( (*src) && (bufp < bufend) ) {
|
||||
while ((*src) && (bufp < bufend))
|
||||
{
|
||||
/* Skip duplicated slashes. */
|
||||
while ( (*src == '/') || (*src == '\\') ) src++;
|
||||
if (!(*src)) break;
|
||||
while ((*src == '/') || (*src == '\\'))
|
||||
src++;
|
||||
if (!(*src))
|
||||
break;
|
||||
/* Find the end of this segment in the source string. */
|
||||
for (seglen = 0; ; seglen++) {
|
||||
for (seglen = 0;; seglen++)
|
||||
{
|
||||
c = src[seglen];
|
||||
if ((c == '\0') || (c == '/') || (c == '\\'))
|
||||
break;
|
||||
}
|
||||
if (seglen > 0) {
|
||||
if (seglen > 0)
|
||||
{
|
||||
/* Ignore all ".\" or "\." path segments. */
|
||||
if ( (seglen != 1) || (*src != '.') ) {
|
||||
if ((seglen != 1) || (*src != '.'))
|
||||
{
|
||||
/* Apply ".." to the path by removing
|
||||
last path segment from buf. */
|
||||
if ( (seglen==2) && (src[0] == '.') && (src[1] == '.') ) {
|
||||
if (bufp > (buf+rootEndPos)) {
|
||||
if ((seglen == 2) && (src[0] == '.') && (src[1] == '.'))
|
||||
{
|
||||
if (bufp > (buf + rootEndPos))
|
||||
{
|
||||
bufp--;
|
||||
while ((bufp > (buf + rootEndPos))
|
||||
&& (*bufp != '/')
|
||||
&& (*bufp != '\\') )
|
||||
&& (*bufp != '/') && (*bufp != '\\'))
|
||||
bufp--;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* .. in root dir illegal */
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* New segment. If any wildcards in previous
|
||||
segment(s), this is an invalid path. */
|
||||
if (gotAnyWildcards || src[0]=='.') return DE_PATHNOTFND;
|
||||
if (gotAnyWildcards || src[0] == '.')
|
||||
return DE_PATHNOTFND;
|
||||
/* Append current path segment to result. */
|
||||
*(bufp++) = '\\';
|
||||
if (bufp >= bufend) break;
|
||||
if (bufp >= bufend)
|
||||
break;
|
||||
copylen = state = 0;
|
||||
for (i=0; ( (i < seglen) && (bufp < bufend) ); i++) {
|
||||
for (i = 0; ((i < seglen) && (bufp < bufend)); i++)
|
||||
{
|
||||
c = src[i];
|
||||
gotAnyWildcards |= ((c == '?') || (c == '*'));
|
||||
switch (state) {
|
||||
switch (state)
|
||||
{
|
||||
case 0: /* Copying filename (excl. extension) */
|
||||
if (c == '*') {
|
||||
while (copylen < FNAME_SIZE) {
|
||||
if (c == '*')
|
||||
{
|
||||
while (copylen < FNAME_SIZE)
|
||||
{
|
||||
*(bufp++) = '?';
|
||||
if (bufp >= bufend) break;
|
||||
if (bufp >= bufend)
|
||||
break;
|
||||
copylen++;
|
||||
}
|
||||
copylen = 0;
|
||||
state = 1; /* Go wait for dot */
|
||||
break;
|
||||
}
|
||||
if (c == '.') {
|
||||
if (src[i+1] != '.' && i+1 < seglen) *(bufp++) = '.';
|
||||
if (c == '.')
|
||||
{
|
||||
if (src[i + 1] != '.' && i + 1 < seglen)
|
||||
*(bufp++) = '.';
|
||||
copylen = 0;
|
||||
state = 2; /* Copy extension next */
|
||||
break;
|
||||
}
|
||||
*(bufp++) = c;
|
||||
copylen++;
|
||||
if (copylen >= FNAME_SIZE) {
|
||||
if (copylen >= FNAME_SIZE)
|
||||
{
|
||||
copylen = 0;
|
||||
state = 1; /* Go wait for dot */
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: /* Looking for dot so we can copy exten */
|
||||
if (src[i] == '.' && src[i+1] != '.' && i+1 < seglen) {
|
||||
if (src[i] == '.' && src[i + 1] != '.' && i + 1 < seglen)
|
||||
{
|
||||
*(bufp++) = '.';
|
||||
state = 2;
|
||||
}
|
||||
break;
|
||||
case 2: /* Copying extension */
|
||||
if (c == '*') {
|
||||
while (copylen < FEXT_SIZE) {
|
||||
if (c == '*')
|
||||
{
|
||||
while (copylen < FEXT_SIZE)
|
||||
{
|
||||
*(bufp++) = '?';
|
||||
if (bufp >= bufend) break;
|
||||
if (bufp >= bufend)
|
||||
break;
|
||||
copylen++;
|
||||
}
|
||||
i = seglen; /* Done with segment */
|
||||
break;
|
||||
}
|
||||
if (c == '.') {
|
||||
if (c == '.')
|
||||
{
|
||||
i = seglen; /* Done with segment */
|
||||
break;
|
||||
}
|
||||
*(bufp++) = c;
|
||||
copylen++;
|
||||
if (copylen >= FEXT_SIZE) {
|
||||
if (copylen >= FEXT_SIZE)
|
||||
{
|
||||
i = seglen; /* Done with segment */
|
||||
break;
|
||||
}
|
||||
@ -480,7 +517,8 @@ COUNT ASMCFUNC truename(char FAR * src, char FAR * dest, COUNT t)
|
||||
}
|
||||
} /* if (seglen > 0) */
|
||||
src += seglen;
|
||||
if (*src) src++;
|
||||
if (*src)
|
||||
src++;
|
||||
} /* while ( (*src) && (bufp < bufend) ) */
|
||||
}
|
||||
/* /// End of new code. - Ron Cemer */
|
||||
@ -553,4 +591,3 @@ exit_tn:
|
||||
* Rev 1.1 22 Jan 1997 13:21:22 patv
|
||||
* pre-0.92 Svante Frey bug fixes.
|
||||
*/
|
||||
|
||||
|
134
kernel/nls.c
134
kernel/nls.c
@ -39,7 +39,8 @@
|
||||
#include <nls.h>
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -50,8 +51,10 @@ static BYTE *RcsId = "$Id$";
|
||||
#ifdef NLS_DEBUG
|
||||
#define assertDSeqSS() if(_DS != _SS) assertDSneSS();
|
||||
void assertDSneSS(void)
|
||||
{ panic("DS unequal to SS");
|
||||
{
|
||||
panic("DS unequal to SS");
|
||||
}
|
||||
|
||||
#define log(a) printf a
|
||||
#define log1(a) printf a
|
||||
#else
|
||||
@ -64,7 +67,6 @@ void assertDSneSS(void)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
struct nlsInfoBlock nlsInfo = {
|
||||
(char FAR *)0 /* filename to COUNTRY.SYS */
|
||||
, 437 /* system code page */
|
||||
@ -80,7 +82,6 @@ struct nlsInfoBlock nlsInfo = {
|
||||
, &nlsPackageHardcoded /* first item in chain */
|
||||
};
|
||||
|
||||
|
||||
/* getTableX return the pointer to the X'th table; X==subfct */
|
||||
/* subfct 2: normal upcase table; 4: filename upcase table */
|
||||
#ifdef NLS_REORDER_POINTERS
|
||||
@ -98,7 +99,6 @@ struct nlsInfoBlock nlsInfo = {
|
||||
#define getCharTbl4(nls) \
|
||||
(((struct nlsCharTbl FAR*)getTable4(nls))->tbl - 0x80)
|
||||
|
||||
|
||||
/********************************************************************
|
||||
***** MUX calling functions ****************************************
|
||||
********************************************************************/
|
||||
@ -107,8 +107,8 @@ struct nlsInfoBlock nlsInfo = {
|
||||
* subfct can use these registers for anything different. ==ska*/
|
||||
STATIC COUNT muxGo(int subfct, iregs * rp)
|
||||
{
|
||||
log( ("NLS: muxGo(): subfct=%x, cntry=%u, cp=%u, ES:DI=%04x:%04x\n", subfct
|
||||
, rp->DX, rp->BX, rp->ES, rp->DI) );
|
||||
log(("NLS: muxGo(): subfct=%x, cntry=%u, cp=%u, ES:DI=%04x:%04x\n",
|
||||
subfct, rp->DX, rp->BX, rp->ES, rp->DI));
|
||||
rp->SI = FP_OFF(&nlsInfo);
|
||||
rp->DS = FP_SEG(&nlsInfo);
|
||||
rp->AX = 0x1400 | subfct;
|
||||
@ -121,7 +121,8 @@ log( ("NLS: muxGo(): return value = %d\n", rp->AX) );
|
||||
* Call NLSFUNC to load the NLS package
|
||||
*/
|
||||
COUNT muxLoadPkg(UWORD cp, UWORD cntry)
|
||||
{ iregs r;
|
||||
{
|
||||
iregs r;
|
||||
|
||||
assertDSeqSS(); /* because "&r" */
|
||||
|
||||
@ -143,14 +144,14 @@ COUNT muxLoadPkg(UWORD cp, UWORD cntry)
|
||||
return muxGo(NLSFUNC_LOAD_PKG, &r);
|
||||
}
|
||||
|
||||
STATIC int muxBufGo(int subfct, int bp, UWORD cp, UWORD cntry, UWORD bufsize
|
||||
, VOID FAR *buf)
|
||||
{ iregs r;
|
||||
STATIC int muxBufGo(int subfct, int bp, UWORD cp, UWORD cntry,
|
||||
UWORD bufsize, VOID FAR * buf)
|
||||
{
|
||||
iregs r;
|
||||
|
||||
assertDSeqSS(); /* because "&r" */
|
||||
|
||||
log( ("NLS: muxBufGo(): subfct=%x, BP=%u, cp=%u, cntry=%u, len=%u, buf=%04x:%04x\n",
|
||||
subfct, bp, cp, cntry, bufsize, FP_SEG(buf), FP_OFF(buf)) );
|
||||
log(("NLS: muxBufGo(): subfct=%x, BP=%u, cp=%u, cntry=%u, len=%u, buf=%04x:%04x\n", subfct, bp, cp, cntry, bufsize, FP_SEG(buf), FP_OFF(buf)));
|
||||
|
||||
r.DX = cntry;
|
||||
r.BX = cp;
|
||||
@ -170,14 +171,14 @@ log( ("NLS: muxBufGo(): subfct=%x, BP=%u, cp=%u, cntry=%u, len=%u, buf=%04x:%04x
|
||||
***** Helper functions**********************************************
|
||||
********************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* Search for the NLS package within the chain
|
||||
* Also resolves the default values (-1) into the currently
|
||||
* active codepage/country code.
|
||||
*/
|
||||
STATIC struct nlsPackage FAR *searchPackage(UWORD cp, UWORD cntry)
|
||||
{ struct nlsPackage FAR *nls;
|
||||
{
|
||||
struct nlsPackage FAR *nls;
|
||||
|
||||
if (cp == NLS_DEFAULT)
|
||||
cp = nlsInfo.actPkg->cp;
|
||||
@ -195,11 +196,12 @@ STATIC struct nlsPackage FAR *searchPackage(UWORD cp, UWORD cntry)
|
||||
at other places, locateSubfct() returns NULL (== "not found"),
|
||||
if nls == NULL on entry. */
|
||||
STATIC VOID FAR *locateSubfct(struct nlsPackage FAR * nls, int subfct)
|
||||
{ int cnt;
|
||||
{
|
||||
int cnt;
|
||||
struct nlsPointer FAR *p;
|
||||
|
||||
if(nls) for(cnt = nls->numSubfct, p = &nls->nlsPointers[0]
|
||||
; cnt--; ++p)
|
||||
if (nls)
|
||||
for (cnt = nls->numSubfct, p = &nls->nlsPointers[0]; cnt--; ++p)
|
||||
if (p->subfct == (UBYTE) subfct)
|
||||
return p;
|
||||
|
||||
@ -214,15 +216,19 @@ STATIC VOID FAR *locateSubfct(struct nlsPackage FAR *nls, int subfct)
|
||||
to let the user (some kernel function) deal with non-existing
|
||||
tables -- 2000/02/26 ska*/
|
||||
STATIC VOID FAR *getTable(UBYTE subfct, struct nlsPackage FAR * nls)
|
||||
{ struct nlsPointer FAR *poi;
|
||||
{
|
||||
struct nlsPointer FAR *poi;
|
||||
|
||||
if ((poi = locateSubfct(nls, subfct)) != NULL)
|
||||
return poi;
|
||||
|
||||
/* Failed --> return the hardcoded table */
|
||||
switch(subfct) {
|
||||
case 2: return &nlsUpHardcodedTable;
|
||||
case 4: return &nlsFnameUpHardcodedTable;
|
||||
switch (subfct)
|
||||
{
|
||||
case 2:
|
||||
return &nlsUpHardcodedTable;
|
||||
case 4:
|
||||
return &nlsFnameUpHardcodedTable;
|
||||
/* case 5: return &nlsFnameTermHardcodedTable; */
|
||||
/* case 6: return &nlsCollHardcodedTable; */
|
||||
}
|
||||
@ -239,18 +245,17 @@ STATIC VOID FAR *getTable(UBYTE subfct, struct nlsPackage FAR *nls)
|
||||
* the code to push bufsize, buf, call cpyBuf() and return its result.
|
||||
* The parameter were ordered to allow this code optimization.
|
||||
*/
|
||||
STATIC COUNT cpyBuf(VOID FAR *dst, UWORD dstlen
|
||||
, VOID FAR *src, UWORD srclen)
|
||||
STATIC COUNT cpyBuf(VOID FAR * dst, UWORD dstlen, VOID FAR * src,
|
||||
UWORD srclen)
|
||||
{
|
||||
if (srclen <= dstlen)
|
||||
{
|
||||
if(srclen <= dstlen) {
|
||||
fmemcpy(dst, src, srclen);
|
||||
return SUCCESS;
|
||||
}
|
||||
return DE_INVLDFUNC; /* buffer too small */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This function assumes that 'map' is adjusted such that
|
||||
* map[0x80] is the uppercase of character 0x80.
|
||||
@ -265,7 +270,8 @@ STATIC VOID upMMem(UBYTE FAR *map, UBYTE FAR * str, unsigned len)
|
||||
|
||||
oldStr = str;
|
||||
oldLen = len;
|
||||
log( ("NLS: upMMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str), FP_OFF(str)) );
|
||||
log(("NLS: upMMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str),
|
||||
FP_OFF(str)));
|
||||
for (c = 0; c < len; ++c)
|
||||
printf("%c", str[c] > 32 ? str[c] : '.');
|
||||
printf("\"\n");
|
||||
@ -288,7 +294,6 @@ printf("NLS: upMMem(): result=\"");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************
|
||||
***** Lowlevel interface *******************************************
|
||||
********************************************************************/
|
||||
@ -297,9 +302,10 @@ printf("NLS: upMMem(): result=\"");
|
||||
the direct-access interface.
|
||||
subfct == NLS_DOS_38 is a value > 0xff in order to not clash
|
||||
with subfunctions valid to be passed as DOS-65-XX. */
|
||||
STATIC int nlsGetData(struct nlsPackage FAR *nls, int subfct, UBYTE FAR *buf
|
||||
, unsigned bufsize)
|
||||
{ VOID FAR *poi;
|
||||
STATIC int nlsGetData(struct nlsPackage FAR * nls, int subfct,
|
||||
UBYTE FAR * buf, unsigned bufsize)
|
||||
{
|
||||
VOID FAR *poi;
|
||||
|
||||
log(("NLS: nlsGetData(): subfct=%x, bufsize=%u, cp=%u, cntry=%u\n",
|
||||
subfct, bufsize, nls->cp, nls->cntry));
|
||||
@ -312,16 +318,16 @@ log( ("NLS: nlsGetData(): subfct=%x, bufsize=%u, cp=%u, cntry=%u\n",
|
||||
in order to handle all subfunctions.
|
||||
Also, NLS is often NOT used in any case, so this code is more
|
||||
size than speed optimized. */
|
||||
if((poi = locateSubfct(nls, subfct)) != NULL) {
|
||||
if ((poi = locateSubfct(nls, subfct)) != NULL)
|
||||
{
|
||||
log(("NLS: nlsGetData(): subfunction found\n"));
|
||||
switch(subfct) {
|
||||
switch (subfct)
|
||||
{
|
||||
case 1: /* Extended Country Information */
|
||||
return cpyBuf(buf, bufsize, poi
|
||||
, ((struct nlsExtCntryInfo FAR*)poi)->size + 3);
|
||||
return cpyBuf(buf, bufsize, poi,
|
||||
((struct nlsExtCntryInfo FAR *)poi)->size + 3);
|
||||
case NLS_DOS_38: /* Normal Country Information */
|
||||
return cpyBuf(buf, bufsize
|
||||
, &(((struct nlsExtCntryInfo FAR*)poi)->dateFmt)
|
||||
, 24); /* standard cinfo has no more 34 _used_ bytes */
|
||||
return cpyBuf(buf, bufsize, &(((struct nlsExtCntryInfo FAR *)poi)->dateFmt), 24); /* standard cinfo has no more 34 _used_ bytes */
|
||||
/* don't copy 34, copy only 0x18 instead,
|
||||
see comment at DosGetCountryInformation TE */
|
||||
default:
|
||||
@ -379,7 +385,8 @@ STATIC COUNT nlsSetPackage(struct nlsPackage FAR *nls)
|
||||
return SUCCESS;
|
||||
}
|
||||
STATIC COUNT DosSetPackage(UWORD cp, UWORD cntry)
|
||||
{ struct nlsPackage FAR*nls; /* NLS package to use to return the info from */
|
||||
{
|
||||
struct nlsPackage FAR *nls; /* NLS package to use to return the info from */
|
||||
|
||||
/* nls := NLS package of cntry/codepage */
|
||||
if ((nls = searchPackage(cp, cntry)) != NULL)
|
||||
@ -401,7 +408,8 @@ log( ("NLS: nlsFUpMem()\n") );
|
||||
upMMem(getCharTbl4(nls), (UBYTE FAR *) str, len);
|
||||
}
|
||||
|
||||
STATIC VOID xUpMem(struct nlsPackage FAR *nls, VOID FAR * str, unsigned len)
|
||||
STATIC VOID xUpMem(struct nlsPackage FAR * nls, VOID FAR * str,
|
||||
unsigned len)
|
||||
/* upcase a memory area */
|
||||
{
|
||||
log(("NLS: xUpMem(): cp=%u, cntry=%u\n", nls->cp, nls->cntry));
|
||||
@ -433,7 +441,6 @@ log( ("NLS: nlsYesNo(): upcased ch=%u (%c)\n", ch, ch>32? ch: ' ') );
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************
|
||||
***** DOS API ******************************************************
|
||||
********************************************************************/
|
||||
@ -447,10 +454,10 @@ BYTE DosYesNo(unsigned char ch)
|
||||
return muxYesNo(ch);
|
||||
}
|
||||
|
||||
|
||||
#ifndef DosUpMem
|
||||
VOID DosUpMem(VOID FAR * str, unsigned len)
|
||||
{ xUpMem(nlsInfo.actPkg, str, len);
|
||||
{
|
||||
xUpMem(nlsInfo.actPkg, str, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -481,7 +488,8 @@ VOID DosUpFMem(VOID FAR *str, unsigned len)
|
||||
{
|
||||
#ifdef NLS_DEBUG
|
||||
unsigned c;
|
||||
log( ("NLS: DosUpFMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str), FP_OFF(str)) );
|
||||
log(("NLS: DosUpFMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str),
|
||||
FP_OFF(str)));
|
||||
for (c = 0; c < len; ++c)
|
||||
printf("%c", str[c] > 32 ? str[c] : '.');
|
||||
printf("\"\n");
|
||||
@ -514,9 +522,10 @@ VOID DosUpFString(char FAR *str)
|
||||
* loaded, MUX-14 is invoked; otherwise the pkg's NLS_Fct_buf
|
||||
* function is invoked.
|
||||
*/
|
||||
COUNT DosGetData(int subfct, UWORD cp, UWORD cntry
|
||||
, UWORD bufsize, VOID FAR * buf)
|
||||
{ struct nlsPackage FAR*nls; /* NLS package to use to return the info from */
|
||||
COUNT DosGetData(int subfct, UWORD cp, UWORD cntry, UWORD bufsize,
|
||||
VOID FAR * buf)
|
||||
{
|
||||
struct nlsPackage FAR *nls; /* NLS package to use to return the info from */
|
||||
|
||||
log(("NLS: GetData(): subfct=%x, cp=%u, cntry=%u, bufsize=%u\n",
|
||||
subfct, cp, cntry, bufsize));
|
||||
@ -528,7 +537,8 @@ log( ("NLS: GetData(): subfct=%x, cp=%u, cntry=%u, bufsize=%u\n",
|
||||
|
||||
/* nls := NLS package of cntry/codepage */
|
||||
if ((nls = searchPackage(cp, cntry)) == NULL
|
||||
|| (nls->flags & NLS_FLAG_DIRECT_GETDATA) == 0) {
|
||||
|| (nls->flags & NLS_FLAG_DIRECT_GETDATA) == 0)
|
||||
{
|
||||
/* If the NLS pkg is not loaded into memory or the
|
||||
direct-access flag is disabled, the request must
|
||||
be passed through MUX */
|
||||
@ -541,7 +551,6 @@ log( ("NLS: GetData(): subfct=%x, cp=%u, cntry=%u, bufsize=%u\n",
|
||||
return nlsGetData(nls, subfct, buf, bufsize);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called for DOS-38 get info
|
||||
*
|
||||
@ -559,7 +568,8 @@ log( ("NLS: GetData(): subfct=%x, cp=%u, cntry=%u, bufsize=%u\n",
|
||||
|
||||
#ifndef DosGetCountryInformation
|
||||
COUNT DosGetCountryInformation(UWORD cntry, VOID FAR * buf)
|
||||
{ return DosGetData(NLS_DOS_38, NLS_DEFAULT, cntry, 0x18, buf);
|
||||
{
|
||||
return DosGetData(NLS_DOS_38, NLS_DEFAULT, cntry, 0x18, buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -568,7 +578,8 @@ COUNT DosGetCountryInformation(UWORD cntry, VOID FAR *buf)
|
||||
*/
|
||||
#ifndef DosSetCountry
|
||||
COUNT DosSetCountry(UWORD cntry)
|
||||
{ return DosSetPackage(NLS_DEFAULT, cntry);
|
||||
{
|
||||
return DosSetPackage(NLS_DEFAULT, cntry);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -576,7 +587,8 @@ COUNT DosSetCountry(UWORD cntry)
|
||||
* Called for DOS-66-01 get CP
|
||||
*/
|
||||
COUNT DosGetCodepage(UWORD FAR * actCP, UWORD FAR * sysCP)
|
||||
{ *sysCP = nlsInfo.sysCodePage;
|
||||
{
|
||||
*sysCP = nlsInfo.sysCodePage;
|
||||
*actCP = nlsInfo.actPkg->cp;
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -587,7 +599,8 @@ COUNT DosGetCodepage(UWORD FAR* actCP, UWORD FAR* sysCP)
|
||||
* to specify it, is lost to me. (2000/02/13 ska)
|
||||
*/
|
||||
COUNT DosSetCodepage(UWORD actCP, UWORD sysCP)
|
||||
{ if(sysCP == NLS_DEFAULT || sysCP == nlsInfo.sysCodePage)
|
||||
{
|
||||
if (sysCP == NLS_DEFAULT || sysCP == nlsInfo.sysCodePage)
|
||||
return DosSetPackage(actCP, NLS_DEFAULT);
|
||||
return DE_INVLDDATA;
|
||||
}
|
||||
@ -608,7 +621,8 @@ COUNT DosSetCodepage(UWORD actCP, UWORD sysCP)
|
||||
if AL == 0, Carry must be cleared, otherwise set
|
||||
*/
|
||||
UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS)
|
||||
{ struct nlsPackage FAR*nls; /* addressed NLS package */
|
||||
{
|
||||
struct nlsPackage FAR *nls; /* addressed NLS package */
|
||||
|
||||
UNREFERENCED_PARAMETER(flags);
|
||||
UNREFERENCED_PARAMETER(cs);
|
||||
@ -617,15 +631,15 @@ UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS)
|
||||
UNREFERENCED_PARAMETER(es);
|
||||
UNREFERENCED_PARAMETER(si);
|
||||
|
||||
log( ("NLS: MUX14(): subfct=%x, cp=%u, cntry=%u\n",
|
||||
AL, BX, DX) );
|
||||
log(("NLS: MUX14(): subfct=%x, cp=%u, cntry=%u\n", AL, BX, DX));
|
||||
|
||||
if ((nls = searchPackage(BX, DX)) == NULL)
|
||||
return DE_INVLDFUNC; /* no such package */
|
||||
|
||||
log(("NLS: MUX14(): NLS pkg found\n"));
|
||||
|
||||
switch(AL) {
|
||||
switch (AL)
|
||||
{
|
||||
case NLSFUNC_INSTALL_CHECK:
|
||||
BX = NLS_FREEDOS_NLSFUNC_ID;
|
||||
return SUCCESS; /* kernel just simulates default functions */
|
||||
@ -646,7 +660,8 @@ log( ("NLS: MUX14(): NLS pkg found\n") );
|
||||
return SUCCESS;
|
||||
case NLSFUNC_FILE_UPMEM:
|
||||
#ifdef NLS_DEBUG
|
||||
{ unsigned j;
|
||||
{
|
||||
unsigned j;
|
||||
BYTE FAR *p;
|
||||
log(("NLS: MUX14(FILE_UPMEM): len=%u, %04x:%04x=\"", CX, ES, DI));
|
||||
for (j = 0, p = MK_FP(ES, DI); j < CX; ++j)
|
||||
@ -668,4 +683,3 @@ log( ("NLS: MUX14(): Invalid function %x\n", AL) );
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -28,14 +28,14 @@
|
||||
/* Cambridge, MA 02139, USA. */
|
||||
/****************************************************************/
|
||||
|
||||
|
||||
#include "portab.h"
|
||||
#include "globals.h"
|
||||
//#include "pcb.h"
|
||||
#include <nls.h>
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#define filename Config.cfgCSYS_fnam
|
||||
@ -44,40 +44,44 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
static int err(void)
|
||||
{
|
||||
printf("Syntax error in or invalid COUNTRY.SYS: \"%s\"\n"
|
||||
, filename);
|
||||
printf("Syntax error in or invalid COUNTRY.SYS: \"%s\"\n", filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define readStruct(s) readStructure(&(s), sizeof(s), fd)
|
||||
static int readStructure(void *buf, int size, COUNT fd)
|
||||
{ if(DosRead(fd, buf, size) == size)
|
||||
{
|
||||
if (DosRead(fd, buf, size) == size)
|
||||
return 1;
|
||||
|
||||
return err();
|
||||
}
|
||||
|
||||
/* Evaluate each argument only once */
|
||||
#define readFct(p,f) readFct_((p), (f), fd)
|
||||
int readFct_(void *buf, struct csys_function *fct, COUNT fd)
|
||||
{ if(DosLseek(fd, fct->csys_rpos, 0) >= 0)
|
||||
{
|
||||
if (DosLseek(fd, fct->csys_rpos, 0) >= 0)
|
||||
return readStructure(buf, fct->csys_length, fd);
|
||||
return err();
|
||||
}
|
||||
|
||||
#define seek(n) rseek((LONG)(n), fd)
|
||||
static rseek(LONG rpos, COUNT fd)
|
||||
{ if(DosLseek(fd, rpos, 1) >= 0)
|
||||
{
|
||||
if (DosLseek(fd, rpos, 1) >= 0)
|
||||
return 1;
|
||||
|
||||
return err();
|
||||
}
|
||||
|
||||
|
||||
COUNT csysOpen(void)
|
||||
{ COUNT fd;
|
||||
{
|
||||
COUNT fd;
|
||||
struct nlsCSys_fileHeader header;
|
||||
|
||||
if((fd = DosOpen((BYTE FAR*)filename, 0)) < 0) {
|
||||
if ((fd = DosOpen((BYTE FAR *) filename, 0)) < 0)
|
||||
{
|
||||
printf("Cannot open: \"%s\"\n", filename);
|
||||
return 1;
|
||||
}
|
||||
@ -85,9 +89,10 @@ COUNT csysOpen(void)
|
||||
if (DosRead(fd, &header, sizeof(header)) != sizeof(header);
|
||||
||strcmp(header.csys_idstring, CSYS_FD_IDSTRING) != 0
|
||||
|| DosLseek(fd, (LONG) sizeof(csys_completeFileHeader), 0)
|
||||
!= (LONG)sizeof(csys_completeFileHeader)) {
|
||||
printf("No valid COUNTRY.SYS: \"%s\"\n\nTry NLSFUNC /i %s\n"
|
||||
, filename, filename);
|
||||
!= (LONG) sizeof(csys_completeFileHeader))
|
||||
{
|
||||
printf("No valid COUNTRY.SYS: \"%s\"\n\nTry NLSFUNC /i %s\n", filename,
|
||||
filename);
|
||||
DosClose(fd);
|
||||
return -1;
|
||||
}
|
||||
@ -97,13 +102,15 @@ COUNT csysOpen(void)
|
||||
|
||||
/* Searches for function definition of table #fctID and
|
||||
moves it at index idx */
|
||||
static int chkTable(int idx, int fctID, struct csys_function *fcts
|
||||
, int numFct)
|
||||
{ struct csys_function *fct, hfct;
|
||||
static int chkTable(int idx, int fctID, struct csys_function *fcts,
|
||||
int numFct)
|
||||
{
|
||||
struct csys_function *fct, hfct;
|
||||
int i;
|
||||
|
||||
for (i = 0, fct = fcts; i < numFct; ++i, ++fct)
|
||||
if(fct->csys_fctID == fctID) {
|
||||
if (fct->csys_fctID == fctID)
|
||||
{
|
||||
/* function found */
|
||||
if (i == idx) /* already best place */
|
||||
return 1;
|
||||
@ -117,6 +124,7 @@ static int chkTable(int idx, int fctID, struct csys_function *fcts
|
||||
printf("Mandatory table %u not found.\n", fctID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Description of the algorithm the COUNTRY= information is loaded.
|
||||
|
||||
@ -172,7 +180,6 @@ a) The area containing the S3 structures, and
|
||||
b) probably the last loaded data could be found within the memory already,
|
||||
so the nlsPackage structure is larger than necessary.
|
||||
|
||||
|
||||
8) But the memory allocation in pass 1 is temporary anyway, because in
|
||||
the PostConfig() phase, all memory allocations are revoked and created
|
||||
anew. At this point -- immediately after revoking all memory and
|
||||
@ -197,7 +204,8 @@ indicates that the FP_OFF(...) is the offset base-relative to the data
|
||||
offset; which is base-relative to the "nls" pointer.
|
||||
*/
|
||||
int csysLoadPackage(COUNT fd)
|
||||
{ struct csys_numEntries entries;
|
||||
{
|
||||
struct csys_numEntries entries;
|
||||
struct csys_ccDefinition entry;
|
||||
struct csys_function *fcts;
|
||||
struct nlsPackage *nls;
|
||||
@ -215,17 +223,19 @@ int csysLoadPackage(COUNT fd)
|
||||
at offset 128 (number of country/codepage pairs) */
|
||||
if (!readStruct(entries))
|
||||
return 0;
|
||||
while(numE--) {
|
||||
while (numE--)
|
||||
{
|
||||
if (!readStruct(entry))
|
||||
return 0;
|
||||
if (entry.csys_cntry == cntry
|
||||
&& (cp == NLS_DEFAULT || entry.csys_cp == cp)) {
|
||||
&& (cp == NLS_DEFAULT || entry.csys_cp == cp))
|
||||
{
|
||||
/* Requested entry found! */
|
||||
if(!seek(entry.csys_rpos)
|
||||
|| !readStruct(entries))
|
||||
if (!seek(entry.csys_rpos) || !readStruct(entries))
|
||||
return 0;
|
||||
/* Now reading the function definitions at this position */
|
||||
if(numE < 5) {
|
||||
if (numE < 5)
|
||||
{
|
||||
printf("Syntax error in COUNTRY.SYS: Too few subfunctions\n");
|
||||
return 0;
|
||||
}
|
||||
@ -237,23 +247,31 @@ int csysLoadPackage(COUNT fd)
|
||||
{
|
||||
if (!readStruct(fct))
|
||||
return 0;
|
||||
switch(fct.csys_fctID) {
|
||||
case 0: case 0x20: case 0x21: case 0x22:
|
||||
case 0xA0: case 0xA1: case 0xA2:
|
||||
switch (fct.csys_fctID)
|
||||
{
|
||||
case 0:
|
||||
case 0x20:
|
||||
case 0x21:
|
||||
case 0x22:
|
||||
case 0xA0:
|
||||
case 0xA1:
|
||||
case 0xA2:
|
||||
printf("Invalid subfunction %u ignored", fct.csys_fctID);
|
||||
continue;
|
||||
case 0x23:
|
||||
if(fct.csys_length != 2) {
|
||||
if (fct.csys_length != 2)
|
||||
{
|
||||
printf("Pseudo-table 35 length mismatch\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* Search if the subfunction is already there */
|
||||
for(j = 0; j < numFcts && fcts[j].csys_fctID != fct.csys_fctID
|
||||
; ++j);
|
||||
if(j != numFct) {
|
||||
printf("Subfunction %u defined multiple times, ignored\n"
|
||||
, fct.csys_fctID);
|
||||
for (j = 0; j < numFcts && fcts[j].csys_fctID != fct.csys_fctID;
|
||||
++j) ;
|
||||
if (j != numFct)
|
||||
{
|
||||
printf("Subfunction %u defined multiple times, ignored\n",
|
||||
fct.csys_fctID);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -261,7 +279,8 @@ int csysLoadPackage(COUNT fd)
|
||||
fct.csys_rpos += DosLtell(fd);
|
||||
totalSize += fct.csys_length;
|
||||
++numFct;
|
||||
} while(--numE);
|
||||
}
|
||||
while (--numE) ;
|
||||
|
||||
/* i is the number of available function definition */
|
||||
/* check if all mandatory tables are loaded, at the same
|
||||
@ -286,7 +305,8 @@ int csysLoadPackage(COUNT fd)
|
||||
already within totalSize as the length of pseudo-table
|
||||
0x23 has been counted. */
|
||||
nls = KernelAlloc((data = sizeof(nlsPackage)
|
||||
+ (numFct - 3) * sizeof(struct nlsPointer)) + totalSize);
|
||||
+ (numFct - 3) * sizeof(struct nlsPointer)) +
|
||||
totalSize);
|
||||
/* data := first byte not used by the control area of
|
||||
the nlsPackage structure; at this point it is the
|
||||
offset where table #1 is to be loaded to */
|
||||
@ -305,7 +325,8 @@ int csysLoadPackage(COUNT fd)
|
||||
data += fcts->csys_length; /* first byte of local data area */
|
||||
highmark = data; /* first unused byte */
|
||||
|
||||
for(j = 0, poi = nls->nlsPointers; j < numFct - 1; ++j, ++poi) {
|
||||
for (j = 0, poi = nls->nlsPointers; j < numFct - 1; ++j, ++poi)
|
||||
{
|
||||
/* consecutively load all functions */
|
||||
if (!readFct(bufp(data), ++fcts))
|
||||
return 0;
|
||||
@ -318,9 +339,10 @@ int csysLoadPackage(COUNT fd)
|
||||
/** brute force **/
|
||||
/* For the standard tables one need to match tables
|
||||
2 and 4 only. */
|
||||
for(i = data; i + fcts->csys_length < highmark; ++i) {
|
||||
if(memcmp(bufp(i), bufp(highmark), fcts->csys_length)
|
||||
== 0) {
|
||||
for (i = data; i + fcts->csys_length < highmark; ++i)
|
||||
{
|
||||
if (memcmp(bufp(i), bufp(highmark), fcts->csys_length) == 0)
|
||||
{
|
||||
/* found! */
|
||||
/* ==> leave highmark untouch, but modify pointer */
|
||||
poi->pointer = MK_FP(0, i);
|
||||
@ -330,9 +352,10 @@ int csysLoadPackage(COUNT fd)
|
||||
}
|
||||
}
|
||||
/* Now try the hardcoded area */
|
||||
for(p = hcTablesStart; p < hcTablesEnd - fcts->csys_length
|
||||
; ++p) {
|
||||
if(fmemcmp(p, bufp(highmark), fcts->csys_length) == 0) {
|
||||
for (p = hcTablesStart; p < hcTablesEnd - fcts->csys_length; ++p)
|
||||
{
|
||||
if (fmemcmp(p, bufp(highmark), fcts->csys_length) == 0)
|
||||
{
|
||||
/* found! */
|
||||
/* ==> leave highmark untouch, but modify pointer */
|
||||
poi->pointer = p;
|
||||
@ -358,24 +381,29 @@ int csysLoadPackage(COUNT fd)
|
||||
printf("No definition of country ID %u in file \"%s\"\n",
|
||||
cntry, filename);
|
||||
else
|
||||
printf("No definition of country ID %u for codepage %u in file \"%s\"\n",
|
||||
printf
|
||||
("No definition of country ID %u for codepage %u in file \"%s\"\n",
|
||||
cntry, cp, filename);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INIT BOOL LoadCountryInfo(char *fnam)
|
||||
{ COUNT fd;
|
||||
{
|
||||
COUNT fd;
|
||||
int rc;
|
||||
|
||||
if(strlen(fnam) < sizeof(filename)) {
|
||||
if (strlen(fnam) < sizeof(filename))
|
||||
{
|
||||
strcpy(filename, fnam);
|
||||
if((fd = csysOpen()) >= 0) {
|
||||
if ((fd = csysOpen()) >= 0)
|
||||
{
|
||||
rc = csysLoadPackage(fd);
|
||||
DosClose(fd);
|
||||
return rc;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
printf("Filename too long\n");
|
||||
return 0;
|
||||
}
|
||||
@ -387,4 +415,3 @@ INIT BOOL LoadCountryInfo(char *fnam)
|
||||
* Add new files and update cvs with patches and changes
|
||||
*
|
||||
*/
|
||||
|
||||
|
164
kernel/prf.c
164
kernel/prf.c
@ -43,9 +43,9 @@
|
||||
|
||||
COUNT ASMCFUNC fstrlen(BYTE FAR * s); /* don't want globals.h, sorry */
|
||||
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *prfRcsId = "$Id$";
|
||||
static BYTE *prfRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
static BYTE *charp = 0;
|
||||
@ -82,8 +82,7 @@ COUNT fstrlen (BYTE FAR * s) /* don't want globals.h, sorry */
|
||||
#endif
|
||||
|
||||
/* special console output routine */
|
||||
VOID
|
||||
put_console(COUNT c)
|
||||
VOID put_console(COUNT c)
|
||||
{
|
||||
if (c == '\n')
|
||||
put_console('\r');
|
||||
@ -96,7 +95,8 @@ put_console(COUNT c)
|
||||
_BX = 0x0070;
|
||||
__int__(0x10);
|
||||
#else
|
||||
__asm {
|
||||
__asm
|
||||
{
|
||||
mov al, byte ptr c;
|
||||
mov ah, 0x0e;
|
||||
mov bx, 0x0070;
|
||||
@ -107,8 +107,7 @@ put_console(COUNT c)
|
||||
}
|
||||
|
||||
/* special handler to switch between sprintf and printf */
|
||||
static VOID
|
||||
handle_char(COUNT c)
|
||||
static VOID handle_char(COUNT c)
|
||||
{
|
||||
if (charp == 0)
|
||||
put_console(c);
|
||||
@ -117,8 +116,7 @@ static VOID
|
||||
}
|
||||
|
||||
/* ltob -- convert an long integer to a string in any base (2-16) */
|
||||
BYTE *
|
||||
ltob(LONG n, BYTE * s, COUNT base)
|
||||
BYTE *ltob(LONG n, BYTE * s, COUNT base)
|
||||
{
|
||||
ULONG u;
|
||||
BYTE *p, *q;
|
||||
@ -155,7 +153,6 @@ BYTE *
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
#define LEFT 0
|
||||
#define RIGHT 1
|
||||
|
||||
@ -183,8 +180,7 @@ WORD printf(CONST BYTE * fmt, ...)
|
||||
}
|
||||
#endif
|
||||
|
||||
WORD
|
||||
sprintf(BYTE * buff, CONST BYTE * fmt, ...)
|
||||
WORD sprintf(BYTE * buff, CONST BYTE * fmt, ...)
|
||||
{
|
||||
WORD ret;
|
||||
|
||||
@ -193,6 +189,7 @@ sprintf(BYTE * buff, CONST BYTE * fmt, ...)
|
||||
handle_char(NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
ULONG FAR retcs(int i)
|
||||
{
|
||||
@ -202,16 +199,11 @@ ULONG FAR retcs(int i)
|
||||
return *(ULONG *)p;
|
||||
}
|
||||
*/
|
||||
COUNT
|
||||
do_printf(CONST BYTE * fmt, BYTE ** arg)
|
||||
COUNT do_printf(CONST BYTE * fmt, BYTE ** arg)
|
||||
{
|
||||
int base;
|
||||
BYTE s[11],
|
||||
FAR *p;
|
||||
int c,
|
||||
flag,
|
||||
size,
|
||||
fill;
|
||||
BYTE s[11], FAR * p;
|
||||
int c, flag, size, fill;
|
||||
int longarg;
|
||||
long currentArg;
|
||||
|
||||
@ -257,15 +249,12 @@ COUNT
|
||||
size = size * 10 + (*fmt++ - '0');
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (*fmt == 'l')
|
||||
{
|
||||
longarg = TRUE;
|
||||
fmt++;
|
||||
}
|
||||
|
||||
|
||||
c = *fmt++;
|
||||
switch (c)
|
||||
{
|
||||
@ -363,7 +352,6 @@ do_outputstring:
|
||||
handle_char(c);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -382,8 +370,6 @@ void hexd(char *title,UBYTE FAR *p,COUNT numBytes)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
/*
|
||||
this testprogram verifies that the strings are printed correctly
|
||||
@ -397,8 +383,10 @@ void hexd(char *title,UBYTE FAR *p,COUNT numBytes)
|
||||
|
||||
*/
|
||||
#include <c:\tc\include\conio.h>
|
||||
void cso(char c) { putch(c); }
|
||||
|
||||
void cso(char c)
|
||||
{
|
||||
putch(c);
|
||||
}
|
||||
|
||||
struct {
|
||||
char *should;
|
||||
@ -406,52 +394,71 @@ struct {
|
||||
unsigned lowint;
|
||||
unsigned highint;
|
||||
|
||||
} testarray[] =
|
||||
} testarray[] = {
|
||||
{
|
||||
{ "hello world", "%s %s", (unsigned)"hello",(unsigned)"world"},
|
||||
{ "hello", "%3s", (unsigned)"hello",0},
|
||||
{ " hello", "%7s", (unsigned)"hello",0},
|
||||
{ "hello ", "%-7s", (unsigned)"hello",0},
|
||||
{ "hello", "%s", (unsigned)"hello",0},
|
||||
|
||||
|
||||
|
||||
{ "1", "%d", 1, 0},
|
||||
{ "-1", "%d", -1,0},
|
||||
{ "65535", "%u", -1,0},
|
||||
{ "-32768", "%d", 0x8000,0},
|
||||
{ "32767", "%d", 0x7fff,0},
|
||||
{ "-32767", "%d", 0x8001,0},
|
||||
|
||||
{"8000", "%x", 0x8000, 0},
|
||||
{" 1", "%4x", 1, 0},
|
||||
{"0001", "%04x", 1, 0},
|
||||
{"1 ", "%-4x", 1, 0},
|
||||
{"1000", "%-04x", 1, 0},
|
||||
|
||||
{ "1", "%ld", 1, 0},
|
||||
{ "-1", "%ld", -1,-1},
|
||||
{ "65535", "%ld", -1,0},
|
||||
{ "65535", "%u", -1,0},
|
||||
{"8000", "%lx", 0x8000, 0},
|
||||
{"80000000", "%lx", 0,0x8000},
|
||||
{" 1", "%4lx", 1, 0},
|
||||
{"0001", "%04lx", 1, 0},
|
||||
{"1 ", "%-4lx", 1, 0},
|
||||
{"1000", "%-04lx", 1, 0},
|
||||
|
||||
{ "-2147483648", "%ld", 0,0x8000},
|
||||
{ "2147483648", "%lu", 0,0x8000},
|
||||
{ "2147483649", "%lu", 1,0x8000},
|
||||
{ "-2147483647", "%ld", 1,0x8000},
|
||||
{ "32767", "%ld", 0x7fff,0},
|
||||
|
||||
{ "ptr 1234:5678", "ptr %p", 0x5678,0x1234},
|
||||
|
||||
|
||||
|
||||
0
|
||||
};
|
||||
"hello world", "%s %s", (unsigned)"hello", (unsigned)"world"},
|
||||
{
|
||||
"hello", "%3s", (unsigned)"hello", 0},
|
||||
{
|
||||
" hello", "%7s", (unsigned)"hello", 0},
|
||||
{
|
||||
"hello ", "%-7s", (unsigned)"hello", 0},
|
||||
{
|
||||
"hello", "%s", (unsigned)"hello", 0},
|
||||
{
|
||||
"1", "%d", 1, 0},
|
||||
{
|
||||
"-1", "%d", -1, 0},
|
||||
{
|
||||
"65535", "%u", -1, 0},
|
||||
{
|
||||
"-32768", "%d", 0x8000, 0},
|
||||
{
|
||||
"32767", "%d", 0x7fff, 0},
|
||||
{
|
||||
"-32767", "%d", 0x8001, 0},
|
||||
{
|
||||
"8000", "%x", 0x8000, 0},
|
||||
{
|
||||
" 1", "%4x", 1, 0},
|
||||
{
|
||||
"0001", "%04x", 1, 0},
|
||||
{
|
||||
"1 ", "%-4x", 1, 0},
|
||||
{
|
||||
"1000", "%-04x", 1, 0},
|
||||
{
|
||||
"1", "%ld", 1, 0},
|
||||
{
|
||||
"-1", "%ld", -1, -1},
|
||||
{
|
||||
"65535", "%ld", -1, 0},
|
||||
{
|
||||
"65535", "%u", -1, 0},
|
||||
{
|
||||
"8000", "%lx", 0x8000, 0},
|
||||
{
|
||||
"80000000", "%lx", 0, 0x8000},
|
||||
{
|
||||
" 1", "%4lx", 1, 0},
|
||||
{
|
||||
"0001", "%04lx", 1, 0},
|
||||
{
|
||||
"1 ", "%-4lx", 1, 0},
|
||||
{
|
||||
"1000", "%-04lx", 1, 0},
|
||||
{
|
||||
"-2147483648", "%ld", 0, 0x8000},
|
||||
{
|
||||
"2147483648", "%lu", 0, 0x8000},
|
||||
{
|
||||
"2147483649", "%lu", 1, 0x8000},
|
||||
{
|
||||
"-2147483647", "%ld", 1, 0x8000},
|
||||
{
|
||||
"32767", "%ld", 0x7fff, 0},
|
||||
{
|
||||
"ptr 1234:5678", "ptr %p", 0x5678, 0x1234}, 0};
|
||||
|
||||
test(char *should, char *format, unsigned lowint, unsigned highint)
|
||||
{
|
||||
@ -461,9 +468,12 @@ test(char *should, char *format, unsigned lowint, unsigned highint)
|
||||
|
||||
printf("'%s' = '%s'\n", should, b);
|
||||
|
||||
if (strcmp(b,should)) { printf("\nhit the ANYKEY\n"); getch(); }
|
||||
if (strcmp(b, should))
|
||||
{
|
||||
printf("\nhit the ANYKEY\n");
|
||||
getch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
main()
|
||||
{
|
||||
@ -472,7 +482,8 @@ main()
|
||||
|
||||
for (i = 0; testarray[i].should; i++)
|
||||
{
|
||||
test(testarray[i].should,testarray[i].format, testarray[i].lowint, testarray[i].highint);
|
||||
test(testarray[i].should, testarray[i].format, testarray[i].lowint,
|
||||
testarray[i].highint);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -517,4 +528,3 @@ main()
|
||||
* Rev 1.0 02 Jul 1995 8:05:10 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
@ -28,11 +28,11 @@
|
||||
|
||||
#ifdef MAIN
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *Proto_hRcsId = "$Id$";
|
||||
static BYTE *Proto_hRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* blockio.c */
|
||||
ULONG getblkno(struct buffer FAR *);
|
||||
VOID setblkno(struct buffer FAR *, ULONG);
|
||||
@ -45,7 +45,8 @@ BOOL flush(void);
|
||||
BOOL fill(REG struct buffer FAR * bp, ULONG blkno, COUNT dsk);
|
||||
BOOL DeleteBlockInBufferCache(ULONG blknolow, ULONG blknohigh, COUNT dsk);
|
||||
/* *** Changed on 9/4/00 BER */
|
||||
UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mode);
|
||||
UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks,
|
||||
COUNT mode);
|
||||
/* *** End of change */
|
||||
|
||||
/* chario.c */
|
||||
@ -71,14 +72,15 @@ struct dpb FAR *GetDriveDPB(UBYTE drive, COUNT *rc);
|
||||
BYTE FAR *get_root(BYTE FAR *);
|
||||
BOOL fnmatch(BYTE FAR *, BYTE FAR *, COUNT, COUNT);
|
||||
BOOL check_break(void);
|
||||
UCOUNT GenericReadSft(sft far *sftp, UCOUNT n, BYTE FAR * bp, COUNT FAR * err,
|
||||
BOOL force_binary);
|
||||
UCOUNT GenericReadSft(sft far * sftp, UCOUNT n, BYTE FAR * bp,
|
||||
COUNT FAR * err, BOOL force_binary);
|
||||
COUNT SftSeek(sft FAR * sftp, LONG new_pos, COUNT mode);
|
||||
/* COUNT DosRead(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err); */
|
||||
#define GenericRead(hndl, n, bp, err, t) GenericReadSft(get_sft(hndl), n, bp, err, t)
|
||||
#define DosRead(hndl, n, bp, err) GenericRead(hndl, n, bp, err, FALSE)
|
||||
#define DosReadSft(sftp, n, bp, err) GenericReadSft(sftp, n, bp, err, FALSE)
|
||||
UCOUNT DosWriteSft(sft FAR *sftp, UCOUNT n, BYTE FAR * bp, COUNT FAR * err);
|
||||
UCOUNT DosWriteSft(sft FAR * sftp, UCOUNT n, BYTE FAR * bp,
|
||||
COUNT FAR * err);
|
||||
#define DosWrite(hndl, n, bp, err) DosWriteSft(get_sft(hndl), n, bp, err)
|
||||
COUNT DosSeek(COUNT hndl, LONG new_pos, COUNT mode, ULONG * set_pos);
|
||||
COUNT DosCreat(BYTE FAR * fname, COUNT attrib);
|
||||
@ -90,7 +92,8 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode);
|
||||
COUNT DosOpenSft(BYTE * fname, COUNT mode);
|
||||
COUNT DosClose(COUNT hndl);
|
||||
COUNT DosCloseSft(WORD sft_idx);
|
||||
BOOL DosGetFree(UBYTE drive, UCOUNT FAR * spc, UCOUNT FAR * navc, UCOUNT FAR * bps, UCOUNT FAR * nc);
|
||||
BOOL DosGetFree(UBYTE drive, UCOUNT FAR * spc, UCOUNT FAR * navc,
|
||||
UCOUNT FAR * bps, UCOUNT FAR * nc);
|
||||
COUNT DosGetExtFree(BYTE FAR * DriveString, struct xfreespace FAR * xfsp);
|
||||
COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s);
|
||||
COUNT DosChangeDir(BYTE FAR * s);
|
||||
@ -193,10 +196,14 @@ VOID bpb_to_dpb(bpb FAR *bpbp, REG struct dpb FAR * dpbp);
|
||||
/* fattab.c */
|
||||
void read_fsinfo(struct dpb FAR * dpbp);
|
||||
void write_fsinfo(struct dpb FAR * dpbp);
|
||||
UCOUNT link_fat(struct dpb FAR *dpbp, CLUSTER Cluster1, REG CLUSTER Cluster2);
|
||||
UCOUNT link_fat32(struct dpb FAR *dpbp, CLUSTER Cluster1, CLUSTER Cluster2);
|
||||
UCOUNT link_fat16(struct dpb FAR *dpbp, CLUSTER Cluster1, CLUSTER Cluster2);
|
||||
UCOUNT link_fat12(struct dpb FAR *dpbp, CLUSTER Cluster1, CLUSTER Cluster2);
|
||||
UCOUNT link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
REG CLUSTER Cluster2);
|
||||
UCOUNT link_fat32(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
CLUSTER Cluster2);
|
||||
UCOUNT link_fat16(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
CLUSTER Cluster2);
|
||||
UCOUNT link_fat12(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
CLUSTER Cluster2);
|
||||
CLUSTER next_cluster(struct dpb FAR * dpbp, REG CLUSTER ClusterNum);
|
||||
CLUSTER next_cl32(struct dpb FAR * dpbp, REG CLUSTER ClusterNum);
|
||||
CLUSTER next_cl16(struct dpb FAR * dpbp, REG CLUSTER ClusterNum);
|
||||
@ -209,19 +216,23 @@ int DosCharInput(VOID);
|
||||
VOID DosDirectConsoleIO(iregs FAR * r);
|
||||
VOID DosCharOutput(COUNT c);
|
||||
VOID DosDisplayOutput(COUNT c);
|
||||
VOID FatGetDrvData(UCOUNT drive, UCOUNT FAR * spc, UCOUNT FAR * bps, UCOUNT FAR * nc, BYTE FAR ** mdp);
|
||||
VOID FatGetDrvData(UCOUNT drive, UCOUNT FAR * spc, UCOUNT FAR * bps,
|
||||
UCOUNT FAR * nc, BYTE FAR ** mdp);
|
||||
WORD FcbParseFname(int wTestMode, BYTE FAR ** lpFileName, fcb FAR * lpFcb);
|
||||
BYTE FAR *ParseSkipWh(BYTE FAR * lpFileName);
|
||||
BOOL TestCmnSeps(BYTE FAR * lpFileName);
|
||||
BOOL TestFieldSeps(BYTE FAR * lpFileName);
|
||||
BYTE FAR *GetNameField(BYTE FAR * lpFileName, BYTE FAR * lpDestField, COUNT nFieldSize, BOOL * pbWildCard);
|
||||
BYTE FAR *GetNameField(BYTE FAR * lpFileName, BYTE FAR * lpDestField,
|
||||
COUNT nFieldSize, BOOL * pbWildCard);
|
||||
BOOL FcbRead(xfcb FAR * lpXfcb, COUNT * nErrorCode);
|
||||
BOOL FcbWrite(xfcb FAR * lpXfcb, COUNT * nErrorCode);
|
||||
BOOL FcbGetFileSize(xfcb FAR * lpXfcb);
|
||||
BOOL FcbSetRandom(xfcb FAR * lpXfcb);
|
||||
BOOL FcbCalcRec(xfcb FAR * lpXfcb);
|
||||
BOOL FcbRandomBlockRead(xfcb FAR * lpXfcb, COUNT nRecords, COUNT * nErrorCode);
|
||||
BOOL FcbRandomBlockWrite(xfcb FAR * lpXfcb, COUNT nRecords, COUNT * nErrorCode);
|
||||
BOOL FcbRandomBlockRead(xfcb FAR * lpXfcb, COUNT nRecords,
|
||||
COUNT * nErrorCode);
|
||||
BOOL FcbRandomBlockWrite(xfcb FAR * lpXfcb, COUNT nRecords,
|
||||
COUNT * nErrorCode);
|
||||
BOOL FcbRandomIO(xfcb FAR * lpXfcb, COUNT * nErrorCode,
|
||||
BOOL(*FcbFunc) (xfcb FAR *, COUNT *));
|
||||
BOOL FcbCreate(xfcb FAR * lpXfcb);
|
||||
@ -242,7 +253,8 @@ seg far2para(VOID FAR * p);
|
||||
seg long2para(ULONG size);
|
||||
VOID FAR *add_far(VOID FAR * fp, ULONG off);
|
||||
VOID FAR *adjust_far(VOID FAR * fp);
|
||||
COUNT DosMemAlloc(UWORD size, COUNT mode, seg FAR * para, UWORD FAR * asize);
|
||||
COUNT DosMemAlloc(UWORD size, COUNT mode, seg FAR * para,
|
||||
UWORD FAR * asize);
|
||||
COUNT DosMemLargest(UWORD FAR * size);
|
||||
COUNT DosMemFree(UWORD para);
|
||||
COUNT DosMemChange(UWORD para, UWORD size, UWORD * maxSize);
|
||||
@ -284,8 +296,8 @@ VOID DosUpString(char FAR *str);
|
||||
VOID DosUpFMem(VOID FAR * str, unsigned len);
|
||||
unsigned char DosUpFChar(unsigned char ch);
|
||||
VOID DosUpFString(char FAR * str);
|
||||
COUNT DosGetData(int subfct, UWORD cp, UWORD cntry
|
||||
, UWORD bufsize, VOID FAR * buf);
|
||||
COUNT DosGetData(int subfct, UWORD cp, UWORD cntry, UWORD bufsize,
|
||||
VOID FAR * buf);
|
||||
#ifndef DosGetCountryInformation
|
||||
COUNT DosGetCountryInformation(UWORD cntry, VOID FAR * buf);
|
||||
#endif
|
||||
@ -341,18 +353,19 @@ WORD con_driver(rqptr rp);
|
||||
VOID break_handler(void);
|
||||
|
||||
/* systime.c */
|
||||
VOID DosGetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp, BYTE FAR * hdp);
|
||||
VOID DosGetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp,
|
||||
BYTE FAR * hdp);
|
||||
COUNT DosSetTime(BYTE h, BYTE m, BYTE s, BYTE hd);
|
||||
VOID DosGetDate(BYTE FAR * wdp, BYTE FAR * mp, BYTE FAR * mdp, COUNT FAR * yp);
|
||||
VOID DosGetDate(BYTE FAR * wdp, BYTE FAR * mp, BYTE FAR * mdp,
|
||||
COUNT FAR * yp);
|
||||
COUNT DosSetDate(UWORD Month, UWORD DayOfMonth, UWORD Year);
|
||||
|
||||
UWORD *is_leap_year_monthdays(UWORD year);
|
||||
UWORD DaysFromYearMonthDay(UWORD Year, UWORD Month, UWORD DayOfMonth);
|
||||
|
||||
|
||||
|
||||
/* task.c */
|
||||
COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg, char far * pathname);
|
||||
COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg,
|
||||
char far * pathname);
|
||||
VOID new_psp(psp FAR * p, int psize);
|
||||
VOID return_user(void);
|
||||
COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp);
|
||||
@ -366,8 +379,10 @@ COUNT get_verify_drive(char FAR * src);
|
||||
COUNT ASMCFUNC truename(char FAR * src, char FAR * dest, COUNT t);
|
||||
|
||||
/* network.c */
|
||||
COUNT ASMCFUNC remote_doredirect(UWORD b, UCOUNT n, UWORD d, VOID FAR * s, UWORD i, VOID FAR * data);
|
||||
COUNT ASMCFUNC remote_printset(UWORD b, UCOUNT n, UWORD d, VOID FAR * s, UWORD i, VOID FAR * data);
|
||||
COUNT ASMCFUNC remote_doredirect(UWORD b, UCOUNT n, UWORD d, VOID FAR * s,
|
||||
UWORD i, VOID FAR * data);
|
||||
COUNT ASMCFUNC remote_printset(UWORD b, UCOUNT n, UWORD d, VOID FAR * s,
|
||||
UWORD i, VOID FAR * data);
|
||||
COUNT ASMCFUNC remote_rename(VOID);
|
||||
COUNT ASMCFUNC remote_delete(VOID);
|
||||
COUNT ASMCFUNC remote_chdir(VOID);
|
||||
@ -399,7 +414,6 @@ VOID ASMCFUNC exec_user(iregs FAR * irp);
|
||||
/* detect.c */
|
||||
unsigned long FAR is_dosemu(void);
|
||||
|
||||
|
||||
/* new by TE */
|
||||
|
||||
/*
|
||||
|
@ -29,7 +29,8 @@
|
||||
#include "portab.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *stringsRcsId = "$Id$";
|
||||
static BYTE *stringsRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#ifndef I86
|
||||
@ -187,4 +188,3 @@ BYTE *strchr(BYTE * s, BYTE c)
|
||||
* Rev 1.0 02 Jul 1995 8:33:46 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
@ -30,7 +30,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#ifdef PROTO
|
||||
@ -56,7 +57,6 @@ VOID DayToBcd();
|
||||
/* */
|
||||
extern UWORD days[2][13]; /* this is defined by SYSTIME.C */
|
||||
|
||||
|
||||
static struct ClockRecord clk;
|
||||
|
||||
/*
|
||||
@ -82,19 +82,11 @@ static COUNT BcdToByte(COUNT x)
|
||||
|
||||
WORD FAR ASMCFUNC clk_driver(rqptr rp)
|
||||
{
|
||||
COUNT
|
||||
c;
|
||||
COUNT c;
|
||||
UWORD *pdays;
|
||||
BYTE bcd_days[4],
|
||||
bcd_minutes,
|
||||
bcd_hours,
|
||||
bcd_seconds;
|
||||
BYTE bcd_days[4], bcd_minutes, bcd_hours, bcd_seconds;
|
||||
ULONG Ticks;
|
||||
UWORD Month,
|
||||
Day,
|
||||
Year;
|
||||
|
||||
|
||||
UWORD Month, Day, Year;
|
||||
|
||||
switch (rp->r_command)
|
||||
{
|
||||
@ -102,8 +94,9 @@ WORD FAR ASMCFUNC clk_driver(rqptr rp)
|
||||
/* If AT clock exists, copy AT clock time to system clock */
|
||||
if (!ReadATClock(bcd_days, &bcd_hours, &bcd_minutes, &bcd_seconds))
|
||||
{
|
||||
DaysSinceEpoch = DaysFromYearMonthDay(
|
||||
100 * BcdToByte(bcd_days[3]) + BcdToByte(bcd_days[2]),
|
||||
DaysSinceEpoch =
|
||||
DaysFromYearMonthDay(100 * BcdToByte(bcd_days[3]) +
|
||||
BcdToByte(bcd_days[2]),
|
||||
BcdToByte(bcd_days[1]),
|
||||
BcdToByte(bcd_days[0]));
|
||||
|
||||
@ -126,8 +119,7 @@ WORD FAR ASMCFUNC clk_driver(rqptr rp)
|
||||
|
||||
case C_INPUT:
|
||||
{
|
||||
ULONG remainder,
|
||||
hs;
|
||||
ULONG remainder, hs;
|
||||
if (ReadPCClock(&Ticks))
|
||||
++DaysSinceEpoch;
|
||||
clk.clkDays = DaysSinceEpoch;
|
||||
@ -196,7 +188,8 @@ WORD FAR ASMCFUNC clk_driver(rqptr rp)
|
||||
clk.clkHundredths = remainder % 100ul;
|
||||
}
|
||||
|
||||
fmemcpy(rp->r_trans, &clk, min(sizeof(struct ClockRecord),rp->r_count ));
|
||||
fmemcpy(rp->r_trans, &clk,
|
||||
min(sizeof(struct ClockRecord), rp->r_count));
|
||||
return S_DONE;
|
||||
|
||||
case C_OUTPUT:
|
||||
@ -209,8 +202,7 @@ WORD FAR ASMCFUNC clk_driver(rqptr rp)
|
||||
ULONG hs;
|
||||
hs = 360000ul * clk.clkHours +
|
||||
6000ul * clk.clkMinutes +
|
||||
100ul * clk.clkSeconds +
|
||||
clk.clkHundredths;
|
||||
100ul * clk.clkSeconds + clk.clkHundredths;
|
||||
Ticks = 0;
|
||||
#if 0
|
||||
if (hs >= 64 * 108000ul)
|
||||
@ -287,7 +279,6 @@ WORD FAR ASMCFUNC clk_driver(rqptr rp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DayToBcd((BYTE *) bcd_days, &Month, &Day, &Year);
|
||||
bcd_minutes = ByteToBcd(clk.clkMinutes);
|
||||
bcd_hours = ByteToBcd(clk.clkHours);
|
||||
@ -364,4 +355,3 @@ VOID DayToBcd(BYTE * x, UWORD * mon, UWORD * day, UWORD * yr)
|
||||
* Rev 1.0 02 Jul 1995 8:32:30 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
@ -31,7 +31,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *syspackRcsId = "$Id$";
|
||||
static BYTE *syspackRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#ifdef NONNATIVE
|
||||
@ -55,7 +56,8 @@ VOID getbyte(VOID * vp, BYTE * bp)
|
||||
|
||||
VOID fgetword(REG VOID FAR * vp, WORD FAR * wp)
|
||||
{
|
||||
*wp = (((BYTE FAR *) vp)[0] & 0xff) + ((((BYTE FAR *) vp)[1] & 0xff) << 8);
|
||||
*wp =
|
||||
(((BYTE FAR *) vp)[0] & 0xff) + ((((BYTE FAR *) vp)[1] & 0xff) << 8);
|
||||
}
|
||||
|
||||
VOID fgetlong(REG VOID FAR * vp, LONG FAR * lp)
|
||||
|
@ -32,17 +32,16 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
UWORD days[2][13] =
|
||||
{
|
||||
UWORD days[2][13] = {
|
||||
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
|
||||
{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
|
||||
};
|
||||
|
||||
extern request
|
||||
ClkReqHdr;
|
||||
extern request ClkReqHdr;
|
||||
|
||||
/*
|
||||
return a pointer to an array with the days for that year
|
||||
@ -55,19 +54,20 @@ UWORD *is_leap_year_monthdays(UWORD y)
|
||||
|
||||
/* this will work until 2200 - long enough for me - and saves 0x1f bytes */
|
||||
|
||||
if ((y & 3) || y == 2100) return days[0];
|
||||
if ((y & 3) || y == 2100)
|
||||
return days[0];
|
||||
|
||||
return days[1];
|
||||
}
|
||||
|
||||
UWORD DaysFromYearMonthDay(UWORD Year, UWORD Month, UWORD DayOfMonth)
|
||||
{
|
||||
if (Year < 1980) return 0;
|
||||
if (Year < 1980)
|
||||
return 0;
|
||||
|
||||
return DayOfMonth - 1
|
||||
+ is_leap_year_monthdays(Year)[Month - 1]
|
||||
+ ((Year - 1980) * 365)
|
||||
+ ((Year - 1980 + 3) / 4);
|
||||
+ ((Year - 1980) * 365) + ((Year - 1980 + 3) / 4);
|
||||
|
||||
}
|
||||
|
||||
@ -82,9 +82,8 @@ void ExecuteClockDriverRequest(BYTE command)
|
||||
execrh((request FAR *) & ClkReqHdr, (struct dhdr FAR *)clock);
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID DosGetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp, BYTE FAR * hdp)
|
||||
VOID DosGetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp,
|
||||
BYTE FAR * hdp)
|
||||
{
|
||||
ExecuteClockDriverRequest(C_INPUT);
|
||||
|
||||
@ -99,7 +98,8 @@ VOID DosGetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp, BYTE FAR * hdp)
|
||||
|
||||
COUNT DosSetTime(BYTE h, BYTE m, BYTE s, BYTE hd)
|
||||
{
|
||||
BYTE Month, DayOfMonth, DayOfWeek; COUNT Year;
|
||||
BYTE Month, DayOfMonth, DayOfWeek;
|
||||
COUNT Year;
|
||||
|
||||
DosGetDate((BYTE FAR *) & DayOfWeek, (BYTE FAR *) & Month,
|
||||
(BYTE FAR *) & DayOfMonth, (COUNT FAR *) & Year);
|
||||
@ -119,9 +119,7 @@ COUNT DosSetTime(BYTE h, BYTE m, BYTE s, BYTE hd)
|
||||
}
|
||||
|
||||
VOID DosGetDate(wdp, mp, mdp, yp)
|
||||
BYTE FAR *wdp,
|
||||
FAR * mp,
|
||||
FAR * mdp;
|
||||
BYTE FAR *wdp, FAR * mp, FAR * mdp;
|
||||
COUNT FAR *yp;
|
||||
{
|
||||
UWORD c;
|
||||
@ -164,20 +162,16 @@ COUNT FAR *yp;
|
||||
}
|
||||
|
||||
COUNT DosSetDate(Month, DayOfMonth, Year)
|
||||
UWORD Month,
|
||||
DayOfMonth,
|
||||
Year;
|
||||
UWORD Month, DayOfMonth, Year;
|
||||
{
|
||||
UWORD *pdays;
|
||||
pdays = is_leap_year_monthdays(Year);
|
||||
|
||||
if (Year < 1980 || Year > 2099
|
||||
|| Month < 1 || Month > 12
|
||||
|| DayOfMonth < 1
|
||||
|| DayOfMonth > pdays[Month] - pdays[Month-1])
|
||||
|| DayOfMonth < 1 || DayOfMonth > pdays[Month] - pdays[Month - 1])
|
||||
return DE_INVLDDATA;
|
||||
|
||||
|
||||
DosGetTime((BYTE FAR *) & ClkRecord.clkHours,
|
||||
(BYTE FAR *) & ClkRecord.clkMinutes,
|
||||
(BYTE FAR *) & ClkRecord.clkSeconds,
|
||||
|
103
kernel/task.c
103
kernel/task.c
@ -30,7 +30,8 @@
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId = "$Id$";
|
||||
static BYTE *RcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#define toupper(c) ((c) >= 'a' && (c) <= 'z' ? (c) + ('A' - 'a') : (c))
|
||||
@ -88,7 +89,8 @@ LONG DosGetFsize(COUNT hndl)
|
||||
return dos_getfsize(s->sft_status);
|
||||
}
|
||||
|
||||
COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg, char far * pathname)
|
||||
COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg,
|
||||
char far * pathname)
|
||||
{
|
||||
BYTE FAR *pSrc;
|
||||
BYTE FAR *pDest;
|
||||
@ -101,14 +103,12 @@ COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg, char far * pathname)
|
||||
/* copy parent's environment if exec.env_seg == 0 */
|
||||
|
||||
pSrc = exp->exec.env_seg ?
|
||||
MK_FP(exp->exec.env_seg, 0) :
|
||||
MK_FP(ppsp->ps_environ, 0);
|
||||
MK_FP(exp->exec.env_seg, 0) : MK_FP(ppsp->ps_environ, 0);
|
||||
|
||||
#if 0
|
||||
/* Every process requires an environment because of argv[0]
|
||||
-- 1999/04/21 ska */
|
||||
*/
|
||||
if (!pSrc) /* no environment to copy */
|
||||
*/if (!pSrc) /* no environment to copy */
|
||||
{
|
||||
*pChildEnvSeg = 0;
|
||||
return SUCCESS;
|
||||
@ -157,7 +157,8 @@ COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg, char far * pathname)
|
||||
pDest += sizeof(UWORD) / sizeof(BYTE);
|
||||
|
||||
/* copy complete pathname */
|
||||
if ((RetCode = truename(pathname, pDest, TRUE)) != SUCCESS) {
|
||||
if ((RetCode = truename(pathname, pDest, TRUE)) != SUCCESS)
|
||||
{
|
||||
return RetCode;
|
||||
}
|
||||
|
||||
@ -303,9 +304,14 @@ set_name:
|
||||
|
||||
/* return value: AX value to be passed based on FCB values */
|
||||
return ((psp->ps_fcb1.fcb_drive < lastdrive &&
|
||||
CDSp->cds_table[psp->ps_fcb1.fcb_drive].cdsFlags & CDSVALID) ? 0 : 0xff) +
|
||||
((psp->ps_fcb2.fcb_drive<lastdrive &&
|
||||
CDSp->cds_table[psp->ps_fcb2.fcb_drive].cdsFlags & CDSVALID) ? 0 : 0xff) * 0x100;
|
||||
CDSp->cds_table[psp->ps_fcb1.fcb_drive].
|
||||
cdsFlags & CDSVALID) ? 0 : 0xff) + ((psp->ps_fcb2.fcb_drive <
|
||||
lastdrive
|
||||
&& CDSp->cds_table[psp->
|
||||
ps_fcb2.
|
||||
fcb_drive].
|
||||
cdsFlags & CDSVALID) ? 0 :
|
||||
0xff) * 0x100;
|
||||
}
|
||||
|
||||
COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
@ -315,8 +321,7 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
/*,env_size */ ;
|
||||
COUNT nread;
|
||||
UWORD mem;
|
||||
UWORD env,
|
||||
asize;
|
||||
UWORD env, asize;
|
||||
BYTE FAR *sp;
|
||||
psp FAR *p;
|
||||
psp FAR *q = MK_FP(cu_psp, 0);
|
||||
@ -352,13 +357,15 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
}
|
||||
|
||||
/* Allocate our memory and pass back any errors */
|
||||
if ((rc = DosMemAlloc((seg) com_size, mem_access_mode, (seg FAR *) & mem
|
||||
,(UWORD FAR *) & asize)) < 0)
|
||||
if ((rc =
|
||||
DosMemAlloc((seg) com_size, mem_access_mode, (seg FAR *) & mem,
|
||||
(UWORD FAR *) & asize)) < 0)
|
||||
{
|
||||
if (rc == DE_NOMEM)
|
||||
{
|
||||
if ((rc = DosMemAlloc(0, LARGEST, (seg FAR *) & mem
|
||||
,(UWORD FAR *) & asize)) < 0)
|
||||
if ((rc =
|
||||
DosMemAlloc(0, LARGEST, (seg FAR *) & mem,
|
||||
(UWORD FAR *) & asize)) < 0)
|
||||
{
|
||||
DosMemFree(env);
|
||||
return rc;
|
||||
@ -387,7 +394,6 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
DosUmbLink(UMBstate); /* restore link state */
|
||||
}
|
||||
|
||||
|
||||
/* Now load the executable */
|
||||
/* If file not found - error */
|
||||
/* NOTE - this is fatal because we lost it in transit */
|
||||
@ -412,7 +418,6 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
|
||||
/* BUG !! in case of LH, memory may be smaller then 64K TE */
|
||||
|
||||
|
||||
if (com_size > ((LONG) asize << 4)) /* less memory than the .COM file has */
|
||||
com_size = (LONG) asize << 4;
|
||||
}
|
||||
@ -452,7 +457,6 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
in case of LH, this is not necessarily true
|
||||
*/
|
||||
|
||||
|
||||
*((UWORD FAR *) MK_FP(mem, 0xfffe)) = (UWORD) 0;
|
||||
|
||||
/* build the user area on the stack */
|
||||
@ -463,12 +467,7 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
irp->CS = mem;
|
||||
irp->IP = 0x100;
|
||||
irp->AX = asize; /* fcbcode */
|
||||
irp->BX =
|
||||
irp->CX =
|
||||
irp->DX =
|
||||
irp->SI =
|
||||
irp->DI =
|
||||
irp->BP = 0;
|
||||
irp->BX = irp->CX = irp->DX = irp->SI = irp->DI = irp->BP = 0;
|
||||
irp->FLAGS = 0x200;
|
||||
|
||||
if (InDOS)
|
||||
@ -491,8 +490,7 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
|
||||
VOID return_user(void)
|
||||
{
|
||||
psp FAR *p,
|
||||
FAR * q;
|
||||
psp FAR *p, FAR * q;
|
||||
REG COUNT i;
|
||||
iregs FAR *irp;
|
||||
/* long j;*/
|
||||
@ -519,7 +517,6 @@ VOID return_user(void)
|
||||
FreeProcessMem(cu_psp);
|
||||
}
|
||||
|
||||
|
||||
cu_psp = p->ps_parent;
|
||||
q = MK_FP(cu_psp, 0);
|
||||
dta = q->ps_dta;
|
||||
@ -540,17 +537,13 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
/*err, */
|
||||
/*env_size, */
|
||||
|
||||
UWORD mem,
|
||||
env,
|
||||
asize,
|
||||
start_seg;
|
||||
UWORD mem, env, asize, start_seg;
|
||||
|
||||
int ModeLoadHigh = mode & 0x80;
|
||||
UBYTE UMBstate = uppermem_link;
|
||||
|
||||
mode &= 0x7f;
|
||||
|
||||
|
||||
/* Clone the environement and create a memory arena */
|
||||
if (mode != OVERLAY)
|
||||
{
|
||||
@ -560,14 +553,12 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
else
|
||||
mem = exp->load.load_seg;
|
||||
|
||||
|
||||
{
|
||||
ULONG image_size;
|
||||
ULONG image_offset;
|
||||
LONG exe_size;
|
||||
mcb FAR *mp;
|
||||
|
||||
|
||||
/* compute image offset from the header */
|
||||
image_offset = (ULONG) header.exHeaderSize * 16;
|
||||
|
||||
@ -600,7 +591,6 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
|
||||
exe_size = (LONG) long2para(image_size) + header.exMinAlloc;
|
||||
|
||||
|
||||
/* + long2para((LONG) sizeof(psp)); ?? see above
|
||||
image_size += sizeof(psp) -- 1999/04/21 ska */
|
||||
if (exe_size > asize && (mem_access_mode & 0x80))
|
||||
@ -633,7 +623,6 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
if ((header.exMinAlloc | header.exMaxAlloc) == 0)
|
||||
exe_size = asize;
|
||||
|
||||
|
||||
/* /// Removed closing curly brace. We should not attempt to allocate
|
||||
memory if we are overlaying the current process, because the new
|
||||
process will simply re-use the block we already have allocated.
|
||||
@ -642,18 +631,19 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
Jun 11, 2000 - rbc
|
||||
} */
|
||||
|
||||
|
||||
/* Allocate our memory and pass back any errors */
|
||||
/* We can still get an error on first fit if the above */
|
||||
/* returned size was a bet fit case */
|
||||
/* ModeLoadHigh = 80 = try high, then low */
|
||||
if ((rc = DosMemAlloc((seg) exe_size, mem_access_mode | ModeLoadHigh, (seg FAR *) & mem
|
||||
,(UWORD FAR *) & asize)) < 0)
|
||||
if ((rc =
|
||||
DosMemAlloc((seg) exe_size, mem_access_mode | ModeLoadHigh,
|
||||
(seg FAR *) & mem, (UWORD FAR *) & asize)) < 0)
|
||||
{
|
||||
if (rc == DE_NOMEM)
|
||||
{
|
||||
if ((rc = DosMemAlloc(0, LARGEST, (seg FAR *) & mem
|
||||
,(UWORD FAR *) & asize)) < 0)
|
||||
if ((rc =
|
||||
DosMemAlloc(0, LARGEST, (seg FAR *) & mem,
|
||||
(UWORD FAR *) & asize)) < 0)
|
||||
{
|
||||
DosMemFree(env);
|
||||
return rc;
|
||||
@ -697,7 +687,6 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
DosUmbLink(UMBstate); /* restore link state */
|
||||
}
|
||||
|
||||
|
||||
if (mode != OVERLAY)
|
||||
{
|
||||
/* memory found large enough - continue processing */
|
||||
@ -760,7 +749,10 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
|
||||
do
|
||||
{
|
||||
nBytesRead = DosRead((COUNT) rc, (COUNT) (exe_size < CHUNK ? exe_size : CHUNK), (VOID FAR *) sp, &UnusedRetVal);
|
||||
nBytesRead =
|
||||
DosRead((COUNT) rc,
|
||||
(COUNT) (exe_size < CHUNK ? exe_size : CHUNK),
|
||||
(VOID FAR *) sp, &UnusedRetVal);
|
||||
sp = add_far((VOID FAR *) sp, (ULONG) nBytesRead);
|
||||
exe_size -= nBytesRead;
|
||||
}
|
||||
@ -776,7 +768,9 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
doslseek(rc, (LONG) header.exRelocTable, 0);
|
||||
for (i = 0; i < header.exRelocItems; i++)
|
||||
{
|
||||
if (DosRead(rc, sizeof(reloc), (VOID FAR *) & reloc[0], &UnusedRetVal) != sizeof(reloc))
|
||||
if (DosRead
|
||||
(rc, sizeof(reloc), (VOID FAR *) & reloc[0],
|
||||
&UnusedRetVal) != sizeof(reloc))
|
||||
{
|
||||
return DE_INVLDDATA;
|
||||
}
|
||||
@ -801,7 +795,6 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
if (mode == OVERLAY)
|
||||
return SUCCESS;
|
||||
|
||||
|
||||
{
|
||||
psp FAR *p;
|
||||
psp FAR *q = MK_FP(cu_psp, 0);
|
||||
@ -825,7 +818,8 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
{
|
||||
/* build the user area on the stack */
|
||||
iregs FAR *irp = MK_FP(header.exInitSS + start_seg,
|
||||
((header.exInitSP - sizeof(iregs)) & 0xffff));
|
||||
((header.exInitSP -
|
||||
sizeof(iregs)) & 0xffff));
|
||||
|
||||
/* start allocating REGs */
|
||||
/* Note: must match es & ds memory segment */
|
||||
@ -833,12 +827,7 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
irp->CS = header.exInitCS + start_seg;
|
||||
irp->IP = header.exInitIP;
|
||||
irp->AX = asize; /* asize = fcbcode */
|
||||
irp->BX =
|
||||
irp->CX =
|
||||
irp->DX =
|
||||
irp->SI =
|
||||
irp->DI =
|
||||
irp->BP = 0;
|
||||
irp->BX = irp->CX = irp->DX = irp->SI = irp->DI = irp->BP = 0;
|
||||
irp->FLAGS = 0x200;
|
||||
|
||||
cu_psp = mem;
|
||||
@ -854,9 +843,11 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
|
||||
case LOAD:
|
||||
cu_psp = mem;
|
||||
exp->exec.stack = MK_FP(header.exInitSS + start_seg, header.exInitSP);
|
||||
exp->exec.stack =
|
||||
MK_FP(header.exInitSS + start_seg, header.exInitSP);
|
||||
*((UWORD FAR *) exp->exec.stack) = asize; /* fcbcode */
|
||||
exp->exec.start_addr = MK_FP(header.exInitCS + start_seg, header.exInitIP);
|
||||
exp->exec.start_addr =
|
||||
MK_FP(header.exInitCS + start_seg, header.exInitIP);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -885,7 +876,6 @@ COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp)
|
||||
return DE_FILENOTFND;
|
||||
}
|
||||
|
||||
|
||||
if (DosRead(rc, sizeof(exe_header), (VOID FAR *) & header, &UnusedRetVal)
|
||||
!= sizeof(exe_header))
|
||||
{
|
||||
@ -995,4 +985,3 @@ COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp)
|
||||
* Rev 1.0 02 Jul 1995 8:34:06 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
|
@ -8,7 +8,8 @@ int main(int argc, char **argv)
|
||||
|
||||
if (argc < 4)
|
||||
{
|
||||
fprintf(stderr, "Usage: bin2c <output bin file> <output h file> <array name>\n");
|
||||
fprintf(stderr,
|
||||
"Usage: bin2c <output bin file> <output h file> <array name>\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -15,12 +15,10 @@
|
||||
|
||||
/* This source compiled & tested with Borland C/C++ 3.1 + TC 2.01*/
|
||||
|
||||
|
||||
char VERSION[] = "v1.00";
|
||||
char PROGRAM[] = "SYS CONFIG";
|
||||
char KERNEL[] = "KERNEL.SYS";
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -32,7 +30,6 @@ char KERNEL[] = "KERNEL.SYS";
|
||||
|
||||
KernelConfig cfg = { 0 };
|
||||
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef signed char sbyte;
|
||||
typedef unsigned short word;
|
||||
@ -40,14 +37,11 @@ typedef signed short sword;
|
||||
typedef unsigned long dword;
|
||||
typedef signed long sdword;
|
||||
|
||||
|
||||
/* These structures need to be byte packed, if your compiler
|
||||
does not do this by default, add the appropriate command,
|
||||
such as #pragma pack(1) here, protected with #ifdefs of course.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Displays command line syntax */
|
||||
void showUsage(void)
|
||||
{
|
||||
@ -60,10 +54,10 @@ void showUsage(void)
|
||||
printf(" If no options are given, the current values are shown.\n");
|
||||
printf(" /help or /? displays this usage information.\n"
|
||||
" [drive:][path]KERNEL.SYS specifies the kernel file to\n"
|
||||
" modify, if not given defaults to %s\n",
|
||||
KERNEL);
|
||||
" modify, if not given defaults to %s\n", KERNEL);
|
||||
printf("\n");
|
||||
printf(" option=value ... specifies one or more options and the values\n"
|
||||
printf
|
||||
(" option=value ... specifies one or more options and the values\n"
|
||||
" to set each to. If an option is given multiple times,\n"
|
||||
" the value set will be the rightmost one.\n");
|
||||
printf(" Current Options are: DLASORT=0|1, SHOWDRIVEASSIGNMENT=0|1\n"
|
||||
@ -71,14 +65,11 @@ void showUsage(void)
|
||||
" GLOBALENABLELBASUPPORT=0|1\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* simply reads in current configuration values, exiting program
|
||||
with an error message and error code unable to, otherwise
|
||||
cfg & kfile are valid on return.
|
||||
*/
|
||||
|
||||
|
||||
/* Reads in the current kernel configuration settings,
|
||||
return 0 on success, nonzero on error. If there was
|
||||
an actual error the return value is positive, if there
|
||||
@ -98,7 +89,6 @@ int readConfigSettings(int kfile, char *kfilename, KernelConfig *cfg)
|
||||
int configBlkFound;
|
||||
word cfgSize;
|
||||
|
||||
|
||||
/* Seek to start of kernel file */
|
||||
if (lseek(kfile, 2, SEEK_SET) != 2)
|
||||
printf("can't seek to offset 2\n"), exit(1);
|
||||
@ -108,7 +98,8 @@ int readConfigSettings(int kfile, char *kfilename, KernelConfig *cfg)
|
||||
|
||||
if (memcmp(cfg->CONFIG, "CONFIG", 6) != 0)
|
||||
{
|
||||
printf("Error: no CONFIG section found in kernel file <%s>\n", kfilename);
|
||||
printf("Error: no CONFIG section found in kernel file <%s>\n",
|
||||
kfilename);
|
||||
printf("Only FreeDOS kernels after 2025 contain a CONFIG section!\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -116,7 +107,6 @@ int readConfigSettings(int kfile, char *kfilename, KernelConfig *cfg)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Writes config values out to file.
|
||||
Returns 0 on success, nonzero on error.
|
||||
*/
|
||||
@ -135,7 +125,6 @@ int writeConfigSettings(int kfile, KernelConfig *cfg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Displays kernel configuration information */
|
||||
void displayConfigSettings(KernelConfig * cfg)
|
||||
{
|
||||
@ -143,31 +132,36 @@ void displayConfigSettings(KernelConfig *cfg)
|
||||
|
||||
if (cfg->ConfigSize >= 1)
|
||||
{
|
||||
printf("DLASORT=0x%02X Sort disks by drive order: *0=no, 1=yes\n",
|
||||
printf
|
||||
("DLASORT=0x%02X Sort disks by drive order: *0=no, 1=yes\n",
|
||||
cfg->DLASortByDriveNo);
|
||||
}
|
||||
|
||||
if (cfg->ConfigSize >= 2)
|
||||
{
|
||||
printf("SHOWDRIVEASSIGNMENT=0x%02X Show how drives assigned: *1=yes 0=no\n",
|
||||
printf
|
||||
("SHOWDRIVEASSIGNMENT=0x%02X Show how drives assigned: *1=yes 0=no\n",
|
||||
cfg->InitDiskShowDriveAssignment);
|
||||
}
|
||||
|
||||
if (cfg->ConfigSize >= 3)
|
||||
{
|
||||
printf("SKIPCONFIGSECONDS=%-3d time to wait for F5/F8 : *2 sec (skip < 0)\n",
|
||||
printf
|
||||
("SKIPCONFIGSECONDS=%-3d time to wait for F5/F8 : *2 sec (skip < 0)\n",
|
||||
cfg->SkipConfigSeconds);
|
||||
}
|
||||
|
||||
if (cfg->ConfigSize >= 4)
|
||||
{
|
||||
printf("FORCELBA=0x%02X Always use LBA if possible: *0=no, 1=yes\n",
|
||||
printf
|
||||
("FORCELBA=0x%02X Always use LBA if possible: *0=no, 1=yes\n",
|
||||
cfg->ForceLBA);
|
||||
}
|
||||
|
||||
if (cfg->ConfigSize >= 5)
|
||||
{
|
||||
printf("GLOBALENABLELBASUPPORT=0x%02X Enable LBA support: *1=yes, 0=no\n",
|
||||
printf
|
||||
("GLOBALENABLELBASUPPORT=0x%02X Enable LBA support: *1=yes, 0=no\n",
|
||||
cfg->GlobalEnableLBAsupport);
|
||||
}
|
||||
|
||||
@ -180,8 +174,10 @@ void displayConfigSettings(KernelConfig *cfg)
|
||||
"supported by this tool. The current extra values are (in Hex):\n");
|
||||
for (i = 0; i < (cfg->configSize - sizeof(ConfigData)); i++)
|
||||
{
|
||||
if ((i%32) == 0) printf("\n");
|
||||
else if ((i%4) == 0) printf(" ");
|
||||
if ((i % 32) == 0)
|
||||
printf("\n");
|
||||
else if ((i % 4) == 0)
|
||||
printf(" ");
|
||||
printf("%02X", (unsigned int)cfg->extra[i]);
|
||||
}
|
||||
printf("\n");
|
||||
@ -190,8 +186,6 @@ void displayConfigSettings(KernelConfig *cfg)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Note: The setXXXOption functions will set the config option of
|
||||
type XXX to the value given. It will display a warning, but
|
||||
allow probably invalid values to be used (cause I believe in
|
||||
@ -205,7 +199,8 @@ void displayConfigSettings(KernelConfig *cfg)
|
||||
/* Sets the given location to an unsigned byte value if different,
|
||||
displays warning if values exceeds max
|
||||
*/
|
||||
void setByteOption(byte *option, char *value, word max, int *updated, char *name)
|
||||
void setByteOption(byte * option, char *value, word max, int *updated,
|
||||
char *name)
|
||||
{
|
||||
unsigned long optionValue;
|
||||
|
||||
@ -233,7 +228,8 @@ void setByteOption(byte *option, char *value, word max, int *updated, char *name
|
||||
/* Sets the given location to a signed byte value if different,
|
||||
displays warning if values exceeds max or is less than min
|
||||
*/
|
||||
void setSByteOption(sbyte *option, char *value, sword min, sword max, int *updated, char *name)
|
||||
void setSByteOption(sbyte * option, char *value, sword min, sword max,
|
||||
int *updated, char *name)
|
||||
{
|
||||
signed long optionValue;
|
||||
|
||||
@ -262,7 +258,8 @@ void setSByteOption(sbyte *option, char *value, sword min, sword max, int *updat
|
||||
/* Sets the given location to an unsigned word value if different,
|
||||
displays warning if values exceeds max
|
||||
*/
|
||||
void setWordOption(word *option, char *value, dword max, int *updated, char *name)
|
||||
void setWordOption(word * option, char *value, dword max, int *updated,
|
||||
char *name)
|
||||
{
|
||||
unsigned long optionValue;
|
||||
|
||||
@ -290,7 +287,8 @@ void setWordOption(word *option, char *value, dword max, int *updated, char *nam
|
||||
/* Sets the given location to a signed byte value if different,
|
||||
displays warning if values exceeds max or is less than min
|
||||
*/
|
||||
void setSWordOption(sword *option, char *value, sdword min, sdword max, int *updated, char *name)
|
||||
void setSWordOption(sword * option, char *value, sdword min, sdword max,
|
||||
int *updated, char *name)
|
||||
{
|
||||
signed long optionValue;
|
||||
|
||||
@ -317,7 +315,6 @@ void setSWordOption(sword *option, char *value, sdword min, sdword max, int *upd
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Main, processes command line options and calls above
|
||||
functions as required.
|
||||
*/
|
||||
@ -332,7 +329,6 @@ int FDKrnConfigMain(int argc,char **argv)
|
||||
|
||||
printf("FreeDOS Kernel Configuration %s\n", VERSION);
|
||||
|
||||
|
||||
/* 1st go through and just process arguments (help/filename/etc) */
|
||||
for (i = 2; i < argc; i++)
|
||||
{
|
||||
@ -376,13 +372,11 @@ int FDKrnConfigMain(int argc,char **argv)
|
||||
argstart++;
|
||||
}
|
||||
|
||||
|
||||
kfile = open(kfilename, O_RDWR | O_BINARY);
|
||||
|
||||
if (kfile < 0)
|
||||
printf("Error: unable to open kernel file <%s>\n", kfilename), exit(1);
|
||||
|
||||
|
||||
/* now that we know the filename (default or given) get config info */
|
||||
readConfigSettings(kfile, kfilename, &cfg);
|
||||
|
||||
@ -400,8 +394,7 @@ int FDKrnConfigMain(int argc,char **argv)
|
||||
/* allow 3 valid characters */
|
||||
if (memicmp(argptr, "DLASORT", 3) == 0)
|
||||
{
|
||||
setByteOption(&(cfg.DLASortByDriveNo),
|
||||
cptr, 1, &updates, "DLASORT");
|
||||
setByteOption(&(cfg.DLASortByDriveNo), cptr, 1, &updates, "DLASORT");
|
||||
}
|
||||
else if (memicmp(argptr, "SHOWDRIVEASSIGNMENT", 3) == 0)
|
||||
{
|
||||
@ -415,8 +408,7 @@ int FDKrnConfigMain(int argc,char **argv)
|
||||
}
|
||||
else if (memicmp(argptr, "FORCELBA", 3) == 0)
|
||||
{
|
||||
setByteOption(&(cfg.ForceLBA),
|
||||
cptr, 1, &updates, "FORCELBA");
|
||||
setByteOption(&(cfg.ForceLBA), cptr, 1, &updates, "FORCELBA");
|
||||
}
|
||||
else if (memicmp(argptr, "GLOBALENABLELBASUPPORT", 3) == 0)
|
||||
{
|
||||
@ -444,14 +436,12 @@ illegal_arg:
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* display new settings */
|
||||
printf("\nUpdated Kernel settings.\n");
|
||||
}
|
||||
else
|
||||
printf("\nCurrent Kernel settings.\n");
|
||||
|
||||
|
||||
/* display current settings */
|
||||
displayConfigSettings(&cfg);
|
||||
|
||||
@ -460,4 +450,3 @@ illegal_arg:
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
75
sys/sys.c
75
sys/sys.c
@ -69,7 +69,6 @@ BOOL copy(COUNT drive, BYTE * srcPath, BYTE * rootPath, BYTE * file);
|
||||
COUNT DiskRead(WORD, WORD, WORD, WORD, WORD, BYTE FAR *);
|
||||
COUNT DiskWrite(WORD, WORD, WORD, WORD, WORD, BYTE FAR *);
|
||||
|
||||
|
||||
#define SEC_SIZE 512
|
||||
#define COPY_SIZE 32768u
|
||||
|
||||
@ -77,8 +76,7 @@ COUNT DiskWrite(WORD, WORD, WORD, WORD, WORD, BYTE FAR *);
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
struct bootsectortype
|
||||
{
|
||||
struct bootsectortype {
|
||||
UBYTE bsJump[3];
|
||||
char OemName[8];
|
||||
UWORD bsBytesPerSec;
|
||||
@ -106,8 +104,7 @@ struct bootsectortype
|
||||
ULONG sysDataStart; /* first data sector */
|
||||
};
|
||||
|
||||
struct bootsectortype32
|
||||
{
|
||||
struct bootsectortype32 {
|
||||
UBYTE bsJump[3];
|
||||
char OemName[8];
|
||||
UWORD bsBytesPerSec;
|
||||
@ -144,14 +141,12 @@ struct bootsectortype32
|
||||
|
||||
UBYTE newboot[SEC_SIZE], oldboot[SEC_SIZE];
|
||||
|
||||
|
||||
#define SBOFFSET 11
|
||||
#define SBSIZE (sizeof(struct bootsectortype) - SBOFFSET)
|
||||
#define SBSIZE32 (sizeof(struct bootsectortype32) - SBOFFSET)
|
||||
|
||||
/* essentially - verify alignment on byte boundaries at compile time */
|
||||
struct VerifyBootSectorSize
|
||||
{
|
||||
struct VerifyBootSectorSize {
|
||||
char failure1[sizeof(struct bootsectortype) == 78 ? 1 : -1];
|
||||
char failure2[sizeof(struct bootsectortype) == 78 ? 1 : 0];
|
||||
};
|
||||
@ -199,11 +194,14 @@ int main(int argc, char **argv)
|
||||
if (drivearg == 0)
|
||||
{
|
||||
printf("Usage: %s [source] drive: [bootsect [BOTH]]\n", pgm);
|
||||
printf(" source = A:,B:,C:\\KERNEL\\BIN\\,etc., or current directory if not given\n");
|
||||
printf
|
||||
(" source = A:,B:,C:\\KERNEL\\BIN\\,etc., or current directory if not given\n");
|
||||
printf(" drive = A,B,etc.\n");
|
||||
printf(" bootsect = name of 512-byte boot sector file image for drive:\n");
|
||||
printf
|
||||
(" bootsect = name of 512-byte boot sector file image for drive:\n");
|
||||
printf(" to write to instead of real boot sector\n");
|
||||
printf(" BOTH : write to both the real boot sector and the image file\n");
|
||||
printf
|
||||
(" BOTH : write to both the real boot sector and the image file\n");
|
||||
printf("%s CONFIG /help\n", pgm);
|
||||
exit(1);
|
||||
}
|
||||
@ -211,7 +209,8 @@ int main(int argc, char **argv)
|
||||
|
||||
if (drive < 0 || drive >= 26)
|
||||
{
|
||||
printf( "%s: drive %c must be A:..Z:\n", pgm,*argv[(argc == 3 ? 2 : 1)]);
|
||||
printf("%s: drive %c must be A:..Z:\n", pgm,
|
||||
*argv[(argc == 3 ? 2 : 1)]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -228,19 +227,19 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Don't try root if src==dst drive or source path given */
|
||||
if ( (drive == srcDrive) || (*srcPath && ((srcPath[1] != ':') || ((srcPath[1] == ':') && srcPath[2]))) )
|
||||
if ((drive == srcDrive)
|
||||
|| (*srcPath
|
||||
&& ((srcPath[1] != ':') || ((srcPath[1] == ':') && srcPath[2]))))
|
||||
*rootPath = '\0';
|
||||
else
|
||||
sprintf(rootPath, "%c:\\", 'A' + srcDrive);
|
||||
|
||||
|
||||
if (!check_space(drive, oldboot))
|
||||
{
|
||||
printf("%s: Not enough space to transfer system files\n", pgm);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
printf("\nCopying KERNEL.SYS...\n");
|
||||
if (!copy(drive, srcPath, rootPath, "kernel.sys"))
|
||||
{
|
||||
@ -260,7 +259,8 @@ int main(int argc, char **argv)
|
||||
|
||||
printf("\nWriting boot sector...\n");
|
||||
put_boot(drive, bsFile,
|
||||
(argc > drivearg+2) && memicmp(argv[drivearg+2], "BOTH", 4) == 0);
|
||||
(argc > drivearg + 2)
|
||||
&& memicmp(argv[drivearg + 2], "BOTH", 4) == 0);
|
||||
|
||||
printf("\nSystem transferred.\n");
|
||||
return 0;
|
||||
@ -295,13 +295,13 @@ VOID dump_sector(unsigned char far * sec)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
TC absRead not functional on MSDOS 6.2, large disks
|
||||
MSDOS requires int25, CX=ffff for drives > 32MB
|
||||
*/
|
||||
|
||||
int MyAbsReadWrite(int DosDrive, int count, ULONG sector, void *buffer, unsigned intno)
|
||||
int MyAbsReadWrite(int DosDrive, int count, ULONG sector, void *buffer,
|
||||
unsigned intno)
|
||||
{
|
||||
struct {
|
||||
unsigned long sectorNumber;
|
||||
@ -311,7 +311,6 @@ int MyAbsReadWrite(int DosDrive, int count, ULONG sector, void *buffer, unsigned
|
||||
int retval;
|
||||
union REGS regs;
|
||||
|
||||
|
||||
diskReadPacket.sectorNumber = sector;
|
||||
diskReadPacket.count = count;
|
||||
diskReadPacket.address = buffer;
|
||||
@ -320,7 +319,8 @@ int MyAbsReadWrite(int DosDrive, int count, ULONG sector, void *buffer, unsigned
|
||||
regs.x.bx = (short)&diskReadPacket;
|
||||
regs.x.cx = 0xffff;
|
||||
|
||||
if (intno != 0x25 && intno != 0x26) return 0xff;
|
||||
if (intno != 0x25 && intno != 0x26)
|
||||
return 0xff;
|
||||
|
||||
int86(intno, ®s, ®s);
|
||||
|
||||
@ -339,7 +339,6 @@ int MyAbsReadWrite(int DosDrive, int count, ULONG sector, void *buffer, unsigned
|
||||
return regs.x.cflag ? 0xff : 0;
|
||||
}
|
||||
|
||||
|
||||
VOID put_boot(COUNT drive, BYTE * bsFile, BOOL both)
|
||||
{
|
||||
COUNT i, z;
|
||||
@ -356,7 +355,6 @@ VOID put_boot(COUNT drive, BYTE *bsFile, BOOL both)
|
||||
char drivename[] = "A:\\";
|
||||
unsigned char x[0x40];
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Reading old bootsector from drive %c:\n", drive + 'A');
|
||||
#endif
|
||||
@ -367,7 +365,6 @@ VOID put_boot(COUNT drive, BYTE *bsFile, BOOL both)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef DDEBUG
|
||||
printf("Old Boot Sector:\n");
|
||||
dump_sector(oldboot);
|
||||
@ -401,12 +398,15 @@ VOID put_boot(COUNT drive, BYTE *bsFile, BOOL both)
|
||||
|
||||
if (regs.x.dx <= 0xff6)
|
||||
{
|
||||
if (fs != 12) printf("warning : new detection overrides old detection\a\n");
|
||||
if (fs != 12)
|
||||
printf("warning : new detection overrides old detection\a\n");
|
||||
fs = 12;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
|
||||
if (fs != 16) printf("warning : new detection overrides old detection\a\n");
|
||||
if (fs != 16)
|
||||
printf("warning : new detection overrides old detection\a\n");
|
||||
fs = 16;
|
||||
|
||||
/* fs = 16/32.
|
||||
@ -429,7 +429,8 @@ VOID put_boot(COUNT drive, BYTE *bsFile, BOOL both)
|
||||
{
|
||||
printf("get extended drive space not supported --> no FAT32\n");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (*(unsigned long *)(x + 0x2c) /* total number of clusters */
|
||||
> (unsigned)65526l)
|
||||
{
|
||||
@ -438,7 +439,6 @@ VOID put_boot(COUNT drive, BYTE *bsFile, BOOL both)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fs == 16)
|
||||
{
|
||||
memcpy(newboot, b_fat16, SEC_SIZE); /* copy FAT16 boot sector */
|
||||
@ -485,7 +485,8 @@ VOID put_boot(COUNT drive, BYTE *bsFile, BOOL both)
|
||||
bs32->sysFatSecMask = bs32->bsBytesPerSec / 4 - 1;
|
||||
|
||||
temp = bs32->sysFatSecMask + 1;
|
||||
for (bs32->sysFatSecShift = 0; temp != 1; bs32->sysFatSecShift++, temp >>= 1);
|
||||
for (bs32->sysFatSecShift = 0; temp != 1;
|
||||
bs32->sysFatSecShift++, temp >>= 1) ;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (fs == 32)
|
||||
@ -502,7 +503,8 @@ VOID put_boot(COUNT drive, BYTE *bsFile, BOOL both)
|
||||
/* TE thinks : never, see above */
|
||||
/* temporary HACK for the load segment (0x0060): it is in unused */
|
||||
/* only needed for older kernels */
|
||||
*((UWORD *)(bs->unused)) = *((UWORD *)(((struct bootsectortype *)&b_fat16)->unused));
|
||||
*((UWORD *) (bs->unused)) =
|
||||
*((UWORD *) (((struct bootsectortype *)&b_fat16)->unused));
|
||||
/* end of HACK */
|
||||
/* root directory sectors */
|
||||
|
||||
@ -534,7 +536,6 @@ VOID put_boot(COUNT drive, BYTE *bsFile, BOOL both)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DDEBUG
|
||||
printf("\nNew Boot Sector:\n");
|
||||
dump_sector(newboot);
|
||||
@ -563,7 +564,9 @@ VOID put_boot(COUNT drive, BYTE *bsFile, BOOL both)
|
||||
#endif
|
||||
|
||||
/* write newboot to bsFile */
|
||||
if ((fd = open(bsFile, O_RDWR | O_TRUNC | O_CREAT | O_BINARY,S_IREAD|S_IWRITE)) < 0)
|
||||
if ((fd =
|
||||
open(bsFile, O_RDWR | O_TRUNC | O_CREAT | O_BINARY,
|
||||
S_IREAD | S_IWRITE)) < 0)
|
||||
{
|
||||
printf(" %s: can't create\"%s\"\nDOS errnum %d", pgm, bsFile, errno);
|
||||
exit(1);
|
||||
@ -579,7 +582,6 @@ VOID put_boot(COUNT drive, BYTE *bsFile, BOOL both)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL check_space(COUNT drive, BYTE * BlkBuffer)
|
||||
{
|
||||
/* this should check, if on destination is enough space
|
||||
@ -588,7 +590,6 @@ BOOL check_space(COUNT drive, BYTE * BlkBuffer)
|
||||
UNREFERENCED_PARAMETER(drive);
|
||||
UNREFERENCED_PARAMETER(BlkBuffer);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -630,7 +631,9 @@ BOOL copy(COUNT drive, BYTE * srcPath, BYTE * rootPath, BYTE * file)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((fdout = open(dest, O_RDWR | O_TRUNC | O_CREAT | O_BINARY,S_IREAD|S_IWRITE)) < 0)
|
||||
if ((fdout =
|
||||
open(dest, O_RDWR | O_TRUNC | O_CREAT | O_BINARY,
|
||||
S_IREAD | S_IWRITE)) < 0)
|
||||
{
|
||||
printf(" %s: can't create\"%s\"\nDOS errnum %d", pgm, dest, errno);
|
||||
close(fdin);
|
||||
@ -672,7 +675,6 @@ BOOL copy(COUNT drive, BYTE * srcPath, BYTE * rootPath, BYTE * file)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
printf("%lu Bytes transferred", copied);
|
||||
|
||||
return TRUE;
|
||||
@ -755,4 +757,3 @@ BOOL copy(COUNT drive, BYTE * srcPath, BYTE * rootPath, BYTE * file)
|
||||
* it create a .COM file.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -21,13 +21,11 @@
|
||||
#define FALSE (0==1)
|
||||
#endif
|
||||
|
||||
|
||||
struct {
|
||||
char *sin, *sout;
|
||||
} repl[100];
|
||||
int repl_count;
|
||||
|
||||
|
||||
void quit(char *s, ...)
|
||||
{
|
||||
vprintf(s, (void *)((char *)&s + sizeof(s)));
|
||||
@ -70,7 +68,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (*argptr != '-' && *argptr != '-')
|
||||
{
|
||||
if (inname == 0) { inname = argptr; continue;}
|
||||
if (inname == 0)
|
||||
{
|
||||
inname = argptr;
|
||||
continue;
|
||||
}
|
||||
define_replace(argptr);
|
||||
continue;
|
||||
}
|
||||
@ -86,15 +88,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (inname == 0)
|
||||
quit("Inputfile must be specified\n");
|
||||
|
||||
if (repl_count == 0)
|
||||
quit("no replacements defined");
|
||||
|
||||
|
||||
if ((fd = fopen(inname, "rb")) == NULL) /* open for READ/WRITE */
|
||||
quit("can't read %s\n", inname);
|
||||
|
||||
@ -117,23 +116,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
usage()
|
||||
{
|
||||
fputs(
|
||||
"DELSYM V1.0 5'95by tom ehlert, SIG Aachen\n"
|
||||
fputs("DELSYM V1.0 5'95by tom ehlert, SIG Aachen\n"
|
||||
" delete symbolic info in object files\n"
|
||||
"usage:\n"
|
||||
" DELSYM infile [outfile]\n"
|
||||
,stderr);
|
||||
"usage:\n" " DELSYM infile [outfile]\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
struct record
|
||||
{
|
||||
struct record {
|
||||
unsigned char rectyp;
|
||||
unsigned datalen;
|
||||
unsigned char buffer[0x2000];
|
||||
} Record, Outrecord;
|
||||
|
||||
|
||||
go_records(FILE * fdin, FILE * fdo)
|
||||
{
|
||||
unsigned char stringlen;
|
||||
@ -141,8 +135,10 @@ go_records(FILE *fdin,FILE *fdo)
|
||||
int i, j;
|
||||
unsigned char chksum;
|
||||
|
||||
do {
|
||||
if (fread(&Record,1,3,fdin) != 3) { /* read type and reclen*/
|
||||
do
|
||||
{
|
||||
if (fread(&Record, 1, 3, fdin) != 3)
|
||||
{ /* read type and reclen */
|
||||
/* printf("end of fdin read\n"); */
|
||||
break;
|
||||
}
|
||||
@ -155,8 +151,6 @@ do {
|
||||
quit("can't continue\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (Record.rectyp != 0x96) /* we are only interested in LNAMES */
|
||||
{
|
||||
fwrite(&Record, 1, 3 + Record.datalen, fdo);
|
||||
@ -166,11 +160,6 @@ do {
|
||||
Outrecord.rectyp = 0x96;
|
||||
Outrecord.datalen = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (i = 0; i < Record.datalen - 1;)
|
||||
{
|
||||
stringlen = Record.buffer[i];
|
||||
@ -179,11 +168,9 @@ do {
|
||||
string = &Record.buffer[i];
|
||||
i += stringlen;
|
||||
|
||||
|
||||
if (i > Record.datalen)
|
||||
quit("invalid lnames record");
|
||||
|
||||
|
||||
for (j = 0; j < repl_count; j++)
|
||||
if (memcmp(string, repl[j].sin, stringlen) == 0
|
||||
&& strlen(repl[j].sin) == stringlen)
|
||||
@ -198,7 +185,8 @@ do {
|
||||
}
|
||||
|
||||
chksum = 0;
|
||||
for (s = (unsigned char *)&Outrecord; s < &Outrecord.buffer[Outrecord.datalen]; s++)
|
||||
for (s = (unsigned char *)&Outrecord;
|
||||
s < &Outrecord.buffer[Outrecord.datalen]; s++)
|
||||
chksum += *s;
|
||||
|
||||
Outrecord.buffer[Outrecord.datalen] = ~chksum;
|
||||
@ -206,10 +194,10 @@ do {
|
||||
|
||||
/* printf("^sum = %02x - %02x\n",chksum,~chksum); */
|
||||
|
||||
|
||||
fwrite(&Outrecord, 1, 3 + Outrecord.datalen, fdo);
|
||||
|
||||
} while (Record.rectyp != 0x00 /*ENDFIL*/);
|
||||
}
|
||||
while (Record.rectyp != 0x00 /*ENDFIL*/);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -18,13 +18,10 @@
|
||||
**
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
* /
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
typedef unsigned short UWORD;
|
||||
typedef unsigned long ULONG;
|
||||
#ifndef _MSC_VER
|
||||
@ -33,8 +30,7 @@ typedef unsigned long ULONG;
|
||||
#endif
|
||||
|
||||
/* from EXE.H */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
UWORD exSignature;
|
||||
UWORD exExtraBytes;
|
||||
UWORD exPages;
|
||||
@ -49,8 +45,7 @@ typedef struct
|
||||
UWORD exInitCS;
|
||||
UWORD exRelocTable;
|
||||
UWORD exOverlay;
|
||||
}
|
||||
exe_header;
|
||||
} exe_header;
|
||||
|
||||
#define MAGIC 0x5a4d
|
||||
|
||||
@ -65,20 +60,24 @@ int __cdecl compReloc(const void *p1, const void *p2)
|
||||
struct relocEntry *r1 = (struct relocEntry *)p1;
|
||||
struct relocEntry *r2 = (struct relocEntry *)p2;
|
||||
|
||||
if (r1->refseg > r2->refseg) return 1;
|
||||
if (r1->refseg < r2->refseg) return -1;
|
||||
if (r1->refseg > r2->refseg)
|
||||
return 1;
|
||||
if (r1->refseg < r2->refseg)
|
||||
return -1;
|
||||
|
||||
if (r1->seg > r2->seg) return 1;
|
||||
if (r1->seg < r2->seg) return -1;
|
||||
if (r1->seg > r2->seg)
|
||||
return 1;
|
||||
if (r1->seg < r2->seg)
|
||||
return -1;
|
||||
|
||||
if (r1->off > r2->off) return 1;
|
||||
if (r1->off < r2->off) return -1;
|
||||
if (r1->off > r2->off)
|
||||
return 1;
|
||||
if (r1->off < r2->off)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fdin;
|
||||
@ -88,7 +87,6 @@ main(int argc,char *argv[])
|
||||
int i;
|
||||
ULONG image_offset;
|
||||
|
||||
|
||||
if (argc < 2 || (fdin = fopen(argv[1], "rb")) == NULL)
|
||||
{
|
||||
printf("can't open %s\n", argv[1]);
|
||||
@ -157,7 +155,8 @@ main(int argc,char *argv[])
|
||||
{
|
||||
if (i == 0)
|
||||
printf("# seg:off references data in -->\n");
|
||||
printf("%3d %04x:%04x -> %04x\n", i,reloc[i].seg, reloc[i].off, reloc[i].refseg);
|
||||
printf("%3d %04x:%04x -> %04x\n", i, reloc[i].seg, reloc[i].off,
|
||||
reloc[i].refseg);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user