Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@265 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
c1b1896480
commit
03865c6b69
@ -1,3 +1,31 @@
|
||||
+ fixes Bart
|
||||
* ioctl.c fix for INT21/AX=4400 + sft driveno field
|
||||
* various small fcb fixes
|
||||
* put file position number and pointers to Pri/SecPathName into
|
||||
SDA. Now MSCDEX works as redirector
|
||||
* redirector set attribute fixes + various cleanups
|
||||
* truename+attr+ioctl fix => DJGPP libc compiles cleanly!
|
||||
+ changes Bart
|
||||
* use the output of truename() consistently: this saves a lot of
|
||||
headaches in parsing later and also allows a lot of simplifying:
|
||||
made many parameters in fatfs.c and fatdir.c NEAR
|
||||
+ added Bart
|
||||
* partly implemented the "Drive Data Table" see RBIL INT2f/AX=0803
|
||||
* implemented construction of default BPB in initdisk.c
|
||||
* implemented the access flag in dsk.c
|
||||
* printf writes to DOSEMU log if prf.c compiled with #define DOSEMU
|
||||
+ fixes Bart
|
||||
* dsk.c uses default BPB in the right places (with help from Tom and Brian)
|
||||
* Brian's FORMAT now works
|
||||
* Tab fix (bug reported by Martin Stromberg)
|
||||
* INT21/AH=0x1f now simply uses AH=0x32 for the default drive
|
||||
+ fixes Tom
|
||||
* saved some static variables
|
||||
* implementation of int_2f_111e_call() for network/LAN manager
|
||||
* return AX=0001 for default redirector handler
|
||||
* enable use of multiple UMBs
|
||||
* fixed task.c 'LOADHIGH executables': minAlloc == maxAlloc = 0
|
||||
and an fixed overwriting the MCB
|
||||
2001 Jul 9 - Build 2024/d
|
||||
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
|
||||
+ fixes Bart:
|
||||
|
72
hdr/device.h
72
hdr/device.h
@ -35,6 +35,9 @@ static BYTE *device_hRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.7 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.6 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
@ -264,6 +267,75 @@ typedef struct
|
||||
}
|
||||
bpb;
|
||||
|
||||
#define N_RETRY 5 /* number of retries permitted */
|
||||
#define SEC_SIZE 512 /* size of sector in bytes */
|
||||
|
||||
#define LBA_READ 0x4200
|
||||
#define LBA_WRITE 0x4300
|
||||
|
||||
|
||||
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 */
|
||||
unsigned char reserved_1; /* set to 0...unused */
|
||||
unsigned char number_of_blocks; /* 0 < number_of_blocks < 128 */
|
||||
unsigned char reserved_2; /* set to 0...unused */
|
||||
UBYTE far * buffer_address; /* addr of transfer buffer */
|
||||
unsigned long block_address; /* LBA address */
|
||||
unsigned long block_address_high; /* high bytes of LBA addr...unused */
|
||||
};
|
||||
|
||||
struct CHS {
|
||||
ULONG Cylinder;
|
||||
UWORD Head;
|
||||
UWORD Sector;
|
||||
};
|
||||
|
||||
/* DOS 4.0-7.0 drive data table (see RBIL at INT2F,AX=0803) */
|
||||
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) */
|
||||
UBYTE ddt_logdriveno; /* logical drive number (0=A:) */
|
||||
bpb ddt_bpb; /* BIOS Parameter Block */
|
||||
UBYTE ddt_flags;
|
||||
/* bit 6: 16-bit FAT instead of 12-bit
|
||||
bit 7: unsupportable disk (all accesses will return Not Ready) */
|
||||
UWORD ddt_FileOC; /* Count of Open files on Drv */
|
||||
UBYTE ddt_type; /* device type */
|
||||
UWORD ddt_descflags;/* bit flags describing drive */
|
||||
UWORD ddt_ncyl; /* number of cylinders
|
||||
(for partition only, if hard disk) */
|
||||
bpb ddt_defbpb; /* BPB for default (highest) capacity supported */
|
||||
UBYTE ddt_reserved[6]; /* (part of BPB above) */
|
||||
UBYTE ddt_ltrack; /* last track accessed */
|
||||
union
|
||||
{
|
||||
ULONG ddt_lasttime; /* removable media: time of last access
|
||||
in clock ticks (FFFFFFFFh if never) */
|
||||
struct
|
||||
{
|
||||
UWORD ddt_part; /* partition (FFFFh = primary, 0001h = extended)
|
||||
always 0001h for DOS 5+ */
|
||||
UWORD ddt_absyl; /* absolute cylinder number of partition's
|
||||
start on physical drive
|
||||
(FFFFh if primary partition in DOS 4.x)*/
|
||||
} ddt_hd;
|
||||
} ddt_fh;
|
||||
UBYTE ddt_volume[12]; /* ASCIIZ volume label or "NO NAME " if none
|
||||
(apparently taken from extended boot record
|
||||
rather than root directory) */
|
||||
ULONG ddt_serialno; /* serial number */
|
||||
UBYTE ddt_fstype[9]; /* ASCIIZ filesystem type ("FAT12 " or "FAT16 ")*/
|
||||
ULONG ddt_offset; /* relative partition offset */
|
||||
BITS ddt_LBASupported:1; /* set, if INT13 extensions enabled */
|
||||
BITS ddt_WriteVerifySupported:1;
|
||||
} ddt;
|
||||
|
||||
/* typedef struct ddtstruct ddt;*/
|
||||
|
||||
struct gblkio
|
||||
{
|
||||
UBYTE gbio_spcfunbit;
|
||||
|
@ -35,6 +35,9 @@ static BYTE *sft_hRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.5 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.4 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -135,6 +138,7 @@ typedef struct
|
||||
WORD sft_psp; /* owner psp */
|
||||
WORD sft_shroff; /* Sharing offset */
|
||||
WORD sft_status; /* this sft status */
|
||||
BYTE FAR * sft_ifsptr; /* pointer to IFS driver for file, 0000000h if native DOS */
|
||||
}
|
||||
sft;
|
||||
|
||||
|
@ -37,6 +37,9 @@ static BYTE *blockioRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.12 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.11 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -618,9 +621,9 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mod
|
||||
if (mode >= DSKWRITEINT26)
|
||||
return (IoReqHdr.r_status);
|
||||
|
||||
/* Changed 9/4/00 BER */
|
||||
/* Changed 9/4/00 BER
|
||||
return (IoReqHdr.r_status);
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -89,6 +89,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.25 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.24 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -279,8 +282,8 @@ static BYTE szBuf[256];
|
||||
int singleStep = FALSE;
|
||||
int SkipAllConfig = FALSE;
|
||||
|
||||
INIT VOID zumcb_init(mcb FAR * mcbp, UWORD size);
|
||||
INIT VOID mumcb_init(mcb FAR * mcbp, UWORD size);
|
||||
INIT VOID zumcb_init(UCOUNT seg, UWORD size);
|
||||
INIT VOID mumcb_init(UCOUNT seg, UWORD size);
|
||||
|
||||
INIT VOID Config_Buffers(BYTE * pLine);
|
||||
INIT VOID sysScreenMode(BYTE * pLine);
|
||||
@ -464,8 +467,7 @@ INIT void PreConfig(void)
|
||||
#endif
|
||||
|
||||
/* We expect ram_top as Kbytes, so convert to paragraphs */
|
||||
mcb_init((mcb FAR *) (MK_FP(first_mcb, 0)),
|
||||
((UCOUNT)ram_top << 6) - first_mcb - 1);
|
||||
mcb_init(first_mcb, ram_top*64 - first_mcb - 1);
|
||||
nPass = 1;
|
||||
}
|
||||
|
||||
@ -593,27 +595,65 @@ INIT VOID configDone(VOID)
|
||||
first_mcb = FP_SEG(lpBase) + ((FP_OFF(lpBase) + 0x0f) >> 4);
|
||||
|
||||
/* We expect ram_top as Kbytes, so convert to paragraphs */
|
||||
mcb_init((mcb FAR *) (MK_FP(first_mcb, 0)),
|
||||
((UCOUNT)ram_top << 6) - first_mcb - 1);
|
||||
mcb_init(first_mcb, ram_top*64 - first_mcb - 1);
|
||||
|
||||
if(UmbState == 1)
|
||||
{
|
||||
|
||||
mumcb_init((mcb FAR *) (MK_FP(64*ram_top - 1, 0)),
|
||||
umb_start - 64*ram_top);
|
||||
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) ){
|
||||
/* make last block normal with SC for the devices */
|
||||
|
||||
UCOUNT umr_new = FP_SEG(upBase) + ((FP_OFF(upBase) + 0x0f) >> 4);
|
||||
|
||||
mumcb_init((mcb FAR *) (MK_FP(uppermem_root, 0)), umr_new - uppermem_root - 1);
|
||||
mumcb_init(uppermem_root, umr_new - uppermem_root - 1);
|
||||
|
||||
uppermem_root = umr_new;
|
||||
zumcb_init((mcb FAR *) (MK_FP(uppermem_root, 0)),
|
||||
(umb_start + UMB_top ) - uppermem_root - 1);
|
||||
zumcb_init(uppermem_root, (umb_start + UMB_top ) - uppermem_root - 1);
|
||||
upBase += 16;
|
||||
}
|
||||
|
||||
{
|
||||
/* are there any more UMB's ??
|
||||
this happens, if memory mapped devces are in between
|
||||
like UMB memory c800..c8ff, d8ff..efff with device at d000..d7ff
|
||||
*/
|
||||
|
||||
/* TE - this code
|
||||
a) isn't the best I ever wrote :-(
|
||||
b) works for 2 memory areas (no while(), use of UMB_top,...)
|
||||
and the first discovered is the larger one.
|
||||
no idea what happens, if the larger one is higher in memory.
|
||||
might work, though
|
||||
*/
|
||||
|
||||
UCOUNT umb_seg, umb_size, umbz_root;
|
||||
|
||||
umbz_root = uppermem_root;
|
||||
|
||||
if(UMB_get_largest(&umb_seg, &umb_size)){
|
||||
|
||||
mcb_init(umbz_root, (umb_start + UMB_top ) - uppermem_root - 1);
|
||||
|
||||
/* change UMB 'Z' to 'M' */
|
||||
((mcb FAR *)MK_FP(umbz_root,0))->m_type = 'M';
|
||||
|
||||
/* move to end */
|
||||
umbz_root += ((mcb FAR *)MK_FP(umbz_root,0))->m_size + 1;
|
||||
|
||||
/* 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)
|
||||
((mcb FAR *)MK_FP(umbz_root,0))->m_psp = FREE_PSP;
|
||||
|
||||
/* create new 'Z' mcb */
|
||||
zumcb_init(umb_seg, umb_size - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -721,13 +761,19 @@ INIT VOID DoConfig(VOID)
|
||||
|
||||
/* might have been the UMB driver */
|
||||
if(UmbState == 2){
|
||||
if(!Umb_Test()){
|
||||
|
||||
UCOUNT umb_seg, umb_size;
|
||||
|
||||
if(UMB_get_largest(&umb_seg, &umb_size)){
|
||||
UmbState = 1;
|
||||
upBase = MK_FP(umb_start , 0);
|
||||
upBase = MK_FP(umb_seg , 0);
|
||||
UMB_top = umb_size;
|
||||
umb_start = umb_seg;
|
||||
|
||||
/* reset root */
|
||||
uppermem_root = umb_start;
|
||||
uppermem_root = umb_seg;
|
||||
/* setup the real mcb for the devicehigh block */
|
||||
zumcb_init((mcb FAR *) upBase, UMB_top - 1);
|
||||
zumcb_init(umb_seg, UMB_top - 1);
|
||||
upBase += 16;
|
||||
}
|
||||
}
|
||||
@ -1429,10 +1475,12 @@ INIT COUNT toupper(COUNT c)
|
||||
|
||||
#if 1 /* ifdef KERNEL */
|
||||
INIT VOID
|
||||
mcb_init(mcb FAR * mcbp, UWORD size)
|
||||
mcb_init(UCOUNT seg, UWORD size)
|
||||
{
|
||||
COUNT i;
|
||||
|
||||
mcb FAR * mcbp = MK_FP(seg,0);
|
||||
|
||||
mcbp->m_type = MCB_LAST;
|
||||
mcbp->m_psp = FREE_PSP;
|
||||
|
||||
@ -1448,9 +1496,11 @@ INIT VOID
|
||||
}
|
||||
|
||||
INIT VOID
|
||||
zumcb_init(mcb FAR * mcbp, UWORD size)
|
||||
zumcb_init(UCOUNT seg, UWORD size)
|
||||
{
|
||||
COUNT i;
|
||||
mcb FAR * mcbp = MK_FP(seg,0);
|
||||
|
||||
mcbp->m_type = MCB_LAST;
|
||||
mcbp->m_psp = FREE_PSP;
|
||||
mcbp->m_size = size;
|
||||
@ -1460,9 +1510,11 @@ INIT VOID
|
||||
}
|
||||
|
||||
INIT VOID
|
||||
mumcb_init(mcb FAR * mcbp, UWORD size)
|
||||
mumcb_init(UCOUNT seg, UWORD size)
|
||||
{
|
||||
COUNT i;
|
||||
mcb FAR * mcbp = MK_FP(seg,0);
|
||||
|
||||
static char name[8] = "SC\0\0\0\0\0\0";
|
||||
|
||||
mcbp->m_type = MCB_NORMAL;
|
||||
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
DISK.H
|
||||
|
||||
common constants + structures, shared between
|
||||
|
||||
DSK.C and INITDISK.C
|
||||
|
||||
note:
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#define MAX_HARD_DRIVE 8
|
||||
#define N_RETRY 5 /* number of retries permitted */
|
||||
#define NDEV 20 /* only one for demo */
|
||||
#define SEC_SIZE 512 /* size of sector in bytes */
|
||||
|
||||
|
||||
#define LBA_READ 0x4200
|
||||
#define LBA_WRITE 0x4300
|
||||
|
||||
|
||||
/* physical characteristics of a drive */
|
||||
|
||||
struct CHS {
|
||||
ULONG Cylinder;
|
||||
UWORD Head;
|
||||
UWORD Sector;
|
||||
};
|
||||
|
||||
struct DriveParamS
|
||||
{
|
||||
UBYTE driveno; /* = 0x8x */
|
||||
unsigned LBA_supported:1; /* set, if INT13 extensions enabled */
|
||||
unsigned WriteVerifySupported:1; /* */
|
||||
ULONG total_sectors;
|
||||
|
||||
struct CHS chs; /* for normal INT 13 */
|
||||
};
|
||||
|
||||
struct media_info
|
||||
{
|
||||
struct DriveParamS drive; /* physical charactereistics of drive */
|
||||
ULONG mi_size; /* physical sector count */
|
||||
ULONG mi_offset; /* relative partition offset */
|
||||
ULONG mi_FileOC; /* Count of Open files on Drv */
|
||||
|
||||
|
||||
struct FS_info
|
||||
{
|
||||
ULONG serialno;
|
||||
BYTE volume[11];
|
||||
BYTE fstype[8];
|
||||
}fs;
|
||||
|
||||
};
|
||||
|
||||
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 */
|
||||
unsigned char reserved_1; /* set to 0...unused */
|
||||
unsigned char number_of_blocks; /* 0 < number_of_blocks < 128 */
|
||||
unsigned char reserved_2; /* set to 0...unused */
|
||||
UBYTE far * buffer_address; /* addr of transfer buffer */
|
||||
unsigned long block_address; /* LBA address */
|
||||
unsigned long block_address_high; /* high bytes of LBA addr...unused */
|
||||
};
|
170
kernel/dosfns.c
170
kernel/dosfns.c
@ -37,6 +37,9 @@ static BYTE *dosfnsRcsId = "$Id$";
|
||||
* /// Added SHARE support. 2000/09/04 Ron Cemer
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.20 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.19 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -241,7 +244,7 @@ static int share_lock_unlock
|
||||
/* /// End of additions for SHARE. - Ron Cemer */
|
||||
|
||||
|
||||
static VOID DosGetFile(BYTE FAR * lpszPath, BYTE FAR * lpszDosFileName)
|
||||
static VOID DosGetFile(BYTE * lpszPath, BYTE FAR * lpszDosFileName)
|
||||
{
|
||||
BYTE szLclName[FNAME_SIZE + 1];
|
||||
BYTE szLclExt[FEXT_SIZE + 1];
|
||||
@ -543,6 +546,7 @@ UCOUNT DosWrite(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err)
|
||||
break;
|
||||
case HT:
|
||||
do cso(' '); while ((++scr_pos) & 7);
|
||||
break;
|
||||
default:
|
||||
scr_pos++;
|
||||
}
|
||||
@ -844,16 +848,16 @@ COUNT DosCreat(BYTE FAR * fname, COUNT attrib)
|
||||
}
|
||||
/* /// End of additions for SHARE. - Ron Cemer */
|
||||
|
||||
sftp->sft_status = dos_creat(fname, attrib);
|
||||
sftp->sft_status = dos_creat(PriPathName, attrib);
|
||||
if (sftp->sft_status >= 0)
|
||||
{
|
||||
p->ps_filetab[hndl] = sft_idx;
|
||||
sftp->sft_count += 1;
|
||||
sftp->sft_mode = SFT_MRDWR;
|
||||
sftp->sft_attrib = attrib;
|
||||
sftp->sft_flags = 0;
|
||||
sftp->sft_flags = drive;
|
||||
sftp->sft_psp = cu_psp;
|
||||
DosGetFile(fname, sftp->sft_name);
|
||||
DosGetFile(PriPathName, sftp->sft_name);
|
||||
return hndl;
|
||||
} else {
|
||||
/* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */
|
||||
@ -951,9 +955,7 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
|
||||
WORD sft_idx;
|
||||
sft FAR *sftp;
|
||||
struct dhdr FAR *dhp;
|
||||
/* BYTE FAR *froot;*/
|
||||
/* WORD i;*/
|
||||
COUNT drive, result;
|
||||
COUNT drive, result;
|
||||
|
||||
/* /// Added to adjust for filenames which begin with ".\"
|
||||
The problem was manifesting itself in the inability
|
||||
@ -962,7 +964,7 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
|
||||
contained ".", unless you explicitly specified the full
|
||||
path to the executable file.
|
||||
Jun 11, 2000 - rbc */
|
||||
if ( (fname[0] == '.') && (fname[1] == '\\') ) fname += 2;
|
||||
if ( (fname[0] == '.') && ((fname[1] == '\\') || (fname[1] == '/'))) fname += 2;
|
||||
|
||||
/* test if mode is in range */
|
||||
if ((mode & ~SFT_OMASK) != 0)
|
||||
@ -979,48 +981,52 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
|
||||
if ((sftp = get_free_sft((WORD FAR *) & sft_idx)) == (sft FAR *) - 1)
|
||||
return DE_TOOMANY;
|
||||
|
||||
fmemset(sftp, 0, sizeof(sft));
|
||||
|
||||
/* check for a device */
|
||||
dhp = IsDevice(fname);
|
||||
if ( dhp )
|
||||
{
|
||||
sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */
|
||||
|
||||
sftp->sft_mode = mode;
|
||||
|
||||
sftp->sft_count += 1;
|
||||
sftp->sft_flags =
|
||||
((dhp->dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF;
|
||||
sftp->sft_psp = cu_psp;
|
||||
fbcopy((BYTE FAR *) SecPathName, sftp->sft_name, FNAME_SIZE + FEXT_SIZE);
|
||||
sftp->sft_dev = dhp;
|
||||
sftp->sft_date = dos_getdate();
|
||||
sftp->sft_time = dos_gettime();
|
||||
p->ps_filetab[hndl] = sft_idx;
|
||||
return hndl;
|
||||
}
|
||||
|
||||
drive = get_verify_drive(fname);
|
||||
if (drive < 0) {
|
||||
return drive;
|
||||
}
|
||||
|
||||
result = truename(fname, PriPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
|
||||
lpCurSft = (sfttbl FAR *)sftp;
|
||||
result = -int2f_Remote_call(REM_OPEN, 0, 0, 0, (VOID FAR *) sftp, 0, MK_FP(0, mode));
|
||||
if (result == SUCCESS) {
|
||||
sftp->sft_count += 1;
|
||||
p->ps_filetab[hndl] = sft_idx;
|
||||
return hndl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */
|
||||
|
||||
sftp->sft_mode = mode;
|
||||
|
||||
/* check for a device */
|
||||
dhp = IsDevice(fname);
|
||||
if ( dhp )
|
||||
{
|
||||
sftp->sft_count += 1;
|
||||
sftp->sft_attrib = 0;
|
||||
sftp->sft_flags =
|
||||
((dhp->dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF;
|
||||
sftp->sft_psp = cu_psp;
|
||||
fbcopy((BYTE FAR *) SecPathName, sftp->sft_name, FNAME_SIZE + FEXT_SIZE);
|
||||
sftp->sft_dev = dhp;
|
||||
sftp->sft_date = dos_getdate();
|
||||
sftp->sft_time = dos_gettime();
|
||||
p->ps_filetab[hndl] = sft_idx;
|
||||
return hndl;
|
||||
}
|
||||
|
||||
drive = get_verify_drive(fname);
|
||||
if (drive < 0) {
|
||||
return drive;
|
||||
}
|
||||
|
||||
result = truename(fname, PriPathName, FALSE);
|
||||
if (result != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
|
||||
lpCurSft = (sfttbl FAR *)sftp;
|
||||
result = -int2f_Remote_call(REM_OPEN, 0, 0, 0, (VOID FAR *) sftp, 0, MK_FP(0, mode));
|
||||
if (result == SUCCESS) {
|
||||
sftp->sft_count += 1;
|
||||
p->ps_filetab[hndl] = sft_idx;
|
||||
return hndl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* /// Added for SHARE. - Ron Cemer */
|
||||
if (IsShareInstalled()) {
|
||||
if ((sftp->sft_shroff = share_open_check
|
||||
@ -1032,7 +1038,7 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
|
||||
}
|
||||
/* /// End of additions for SHARE. - Ron Cemer */
|
||||
|
||||
sftp->sft_status = dos_open(fname, mode);
|
||||
sftp->sft_status = dos_open(PriPathName, mode);
|
||||
|
||||
if (sftp->sft_status >= 0)
|
||||
{
|
||||
@ -1050,10 +1056,9 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
|
||||
|
||||
sftp->sft_count += 1;
|
||||
sftp->sft_mode = mode;
|
||||
sftp->sft_attrib = 0;
|
||||
sftp->sft_flags = 0;
|
||||
sftp->sft_flags = drive;
|
||||
sftp->sft_psp = cu_psp;
|
||||
DosGetFile(fname, sftp->sft_name);
|
||||
DosGetFile(PriPathName, sftp->sft_name);
|
||||
return hndl;
|
||||
} else {
|
||||
/* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */
|
||||
@ -1119,7 +1124,7 @@ VOID DosGetFree(UBYTE drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps,
|
||||
{
|
||||
struct dpb FAR *dpbp;
|
||||
struct cds FAR *cdsp;
|
||||
static COUNT rg[4];
|
||||
COUNT rg[4];
|
||||
|
||||
/* next - "log" in the drive */
|
||||
drive = (drive == 0 ? default_drive : drive - 1);
|
||||
@ -1244,7 +1249,7 @@ COUNT DosChangeDir(BYTE FAR * s)
|
||||
|
||||
COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
||||
{
|
||||
COUNT nDrive;
|
||||
COUNT nDrive, rc;
|
||||
REG dmatch FAR *dmp = (dmatch FAR *) dta;
|
||||
|
||||
/* /// Added code here to do matching against device names.
|
||||
@ -1256,19 +1261,6 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
||||
- Ron Cemer */
|
||||
fmemset(dmp, 0, sizeof(dmatch));
|
||||
|
||||
nDrive=get_verify_drive(name);
|
||||
if (nDrive < 0)
|
||||
return nDrive;
|
||||
|
||||
current_ldt = &CDSp->cds_table[nDrive];
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
COUNT rc = -Remote_find(REM_FINDFIRST, attr, name);
|
||||
if (dmp->dm_drive & 0x80)
|
||||
return rc;
|
||||
fmemset(dmp, 0, sizeof(dmatch));
|
||||
/* still have to resolve locally if dm_drive not set to remote */
|
||||
}
|
||||
if (IsDevice(name))
|
||||
{
|
||||
/* Found a matching device. Hence there cannot be wildcards. */
|
||||
@ -1279,7 +1271,27 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
||||
return SUCCESS;
|
||||
}
|
||||
/* /// End of additions. - Ron Cemer ; heavily edited - Bart Oldeman */
|
||||
return dos_findfirst(attr, name);
|
||||
|
||||
nDrive=get_verify_drive(name);
|
||||
if (nDrive < 0)
|
||||
return nDrive;
|
||||
SAttr = (BYTE) attr;
|
||||
|
||||
current_ldt = &CDSp->cds_table[nDrive];
|
||||
|
||||
rc = truename(name, PriPathName, FALSE);
|
||||
if (rc != SUCCESS)
|
||||
return rc;
|
||||
|
||||
if (current_ldt->cdsFlags & CDSNETWDRV)
|
||||
{
|
||||
return -Remote_find(REM_FINDFIRST);
|
||||
}
|
||||
else
|
||||
{
|
||||
dmp->dm_drive = nDrive;
|
||||
return dos_findfirst(attr, PriPathName);
|
||||
}
|
||||
}
|
||||
|
||||
COUNT DosFindNext(void)
|
||||
@ -1311,7 +1323,7 @@ COUNT DosFindNext(void)
|
||||
((dmatch FAR *)dta)->dm_drive);
|
||||
#endif
|
||||
return (((dmatch FAR *)dta)->dm_drive & 0x80) ?
|
||||
-Remote_find(REM_FINDNEXT, 0, NULL) :
|
||||
-Remote_find(REM_FINDNEXT) :
|
||||
dos_findnext();
|
||||
}
|
||||
|
||||
@ -1376,9 +1388,9 @@ COUNT DosSetFtime(COUNT hndl, date FAR * dp, time FAR * tp)
|
||||
return dos_setftime(s->sft_status, dp, tp);
|
||||
}
|
||||
|
||||
COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
COUNT DosGetFattr(BYTE FAR * name)
|
||||
{
|
||||
static UWORD srfa[5];
|
||||
UWORD srfa[5];
|
||||
COUNT result, drive;
|
||||
struct cds FAR *last_cds;
|
||||
|
||||
@ -1402,8 +1414,7 @@ COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
&& (PriPathName[1] == ':')
|
||||
&& ( (PriPathName[2] == '/') || (PriPathName[2] == '\\') )
|
||||
&& (PriPathName[3] == '\0') ) {
|
||||
*attrp = 0x10;
|
||||
return SUCCESS;
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV)
|
||||
@ -1412,8 +1423,7 @@ COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
current_ldt = &CDSp->cds_table[drive];
|
||||
result = -int2f_Remote_call(REM_GETATTRZ, 0, 0, 0, 0, 0, (VOID FAR *) srfa);
|
||||
current_ldt = last_cds;
|
||||
*attrp = srfa[0];
|
||||
return result;
|
||||
return (result < SUCCESS ? result : srfa[0]);
|
||||
}
|
||||
else {
|
||||
/* /// Use truename()'s result, which we already have in PriPathName.
|
||||
@ -1444,12 +1454,12 @@ COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
shit.
|
||||
tom
|
||||
*/
|
||||
return dos_getfattr(name, attrp);
|
||||
return dos_getfattr(PriPathName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
COUNT DosSetFattr(BYTE FAR * name, UWORD attrp)
|
||||
{
|
||||
COUNT result, drive;
|
||||
struct cds FAR *last_cds;
|
||||
@ -1488,7 +1498,7 @@ COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
|
||||
see DosGetAttr()
|
||||
*/
|
||||
return dos_setfattr(name, attrp);
|
||||
return dos_setfattr(PriPathName, attrp);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1530,7 +1540,7 @@ COUNT DosDelete(BYTE FAR *path)
|
||||
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
|
||||
return -int2f_Remote_call(REM_DELETE, 0, 0, 0, 0, 0, 0);
|
||||
} else {
|
||||
return dos_delete(path);
|
||||
return dos_delete(PriPathName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1559,7 +1569,7 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2)
|
||||
if (CDSp->cds_table[drive1].cdsFlags & CDSNETWDRV) {
|
||||
return -int2f_Remote_call(REM_RENAME, 0, 0, 0, 0, 0, 0);
|
||||
} else {
|
||||
return dos_rename(path1, path2);
|
||||
return dos_rename(PriPathName, SecPathName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1583,7 +1593,7 @@ COUNT DosMkdir(BYTE FAR * dir)
|
||||
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
|
||||
return -int2f_Remote_call(REM_MKDIR, 0, 0, 0, 0, 0, 0);
|
||||
} else {
|
||||
return dos_mkdir(dir);
|
||||
return dos_mkdir(PriPathName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1607,7 +1617,7 @@ COUNT DosRmdir(BYTE FAR * dir)
|
||||
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
|
||||
return -int2f_Remote_call(REM_RMDIR, 0, 0, 0, 0, 0, 0);
|
||||
} else {
|
||||
return dos_rmdir(dir);
|
||||
return dos_rmdir(PriPathName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,9 @@ static BYTE *dosnamesRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.10 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.9 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
@ -130,7 +133,7 @@ static BYTE *dosnamesRcsId = "$Id$";
|
||||
#define WildChar(c) (!strchr(".\"/\\[]:|<>+=;,", (c)))
|
||||
|
||||
VOID XlateLcase(BYTE * szFname, COUNT nChars);
|
||||
VOID DosTrimPath(BYTE FAR * lpszPathNamep);
|
||||
VOID DosTrimPath(BYTE * lpszPathNamep);
|
||||
|
||||
/* Should be converted to a portable version after v1.0 is released. */
|
||||
VOID XlateLcase(BYTE * szFname, COUNT nChars)
|
||||
@ -157,7 +160,7 @@ VOID SpacePad(BYTE * szString, COUNT nChars)
|
||||
(..) == Back one directory *.*
|
||||
|
||||
*/
|
||||
COUNT ParseDosName(BYTE FAR * lpszFileName,
|
||||
COUNT ParseDosName(BYTE * lpszFileName,
|
||||
COUNT * pnDrive,
|
||||
BYTE * pszDir,
|
||||
BYTE * pszFile,
|
||||
@ -167,9 +170,9 @@ COUNT ParseDosName(BYTE FAR * lpszFileName,
|
||||
COUNT nDirCnt,
|
||||
nFileCnt,
|
||||
nExtCnt;
|
||||
BYTE FAR *lpszLclDir,
|
||||
FAR * lpszLclFile,
|
||||
FAR * lpszLclExt;
|
||||
BYTE *lpszLclDir,
|
||||
*lpszLclFile,
|
||||
*lpszLclExt;
|
||||
|
||||
/* Initialize the users data fields */
|
||||
if (pszDir)
|
||||
@ -237,7 +240,7 @@ COUNT ParseDosName(BYTE FAR * lpszFileName,
|
||||
nDirCnt += 2;
|
||||
if (nDirCnt > PARSE_MAX-1)
|
||||
nDirCnt = PARSE_MAX-1;
|
||||
fbcopy(lpszLclDir, (BYTE FAR *) pszDir, nDirCnt);
|
||||
bcopy(lpszLclDir, pszDir, nDirCnt);
|
||||
if (((lpszFileName - lpszLclFile) == 2) && (nDirCnt < PARSE_MAX))
|
||||
pszDir[nDirCnt++] = '\\'; /* make DosTrimPath() enjoy, for tail DotDot */
|
||||
pszDir[nDirCnt] = '\0';
|
||||
@ -292,17 +295,17 @@ COUNT ParseDosName(BYTE FAR * lpszFileName,
|
||||
/* buffers. */
|
||||
if (pszDir)
|
||||
{
|
||||
fbcopy(lpszLclDir, (BYTE FAR *) pszDir, nDirCnt);
|
||||
bcopy(lpszLclDir, pszDir, nDirCnt);
|
||||
pszDir[nDirCnt] = '\0';
|
||||
}
|
||||
if (pszFile)
|
||||
{
|
||||
fbcopy(lpszLclFile, (BYTE FAR *) pszFile, nFileCnt);
|
||||
bcopy(lpszLclFile, pszFile, nFileCnt);
|
||||
pszFile[nFileCnt] = '\0';
|
||||
}
|
||||
if (pszExt)
|
||||
{
|
||||
fbcopy(lpszLclExt, (BYTE FAR *) pszExt, nExtCnt);
|
||||
bcopy(lpszLclExt, pszExt, nExtCnt);
|
||||
pszExt[nExtCnt] = '\0';
|
||||
}
|
||||
|
||||
@ -314,14 +317,16 @@ COUNT ParseDosName(BYTE FAR * lpszFileName,
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
COUNT ParseDosPath(BYTE FAR * lpszFileName,
|
||||
#if 0
|
||||
/* not necessary anymore because of truename */
|
||||
COUNT ParseDosPath(BYTE * lpszFileName,
|
||||
COUNT * pnDrive,
|
||||
BYTE * pszDir,
|
||||
BYTE FAR * pszCurPath)
|
||||
BYTE * pszCurPath)
|
||||
{
|
||||
COUNT nDirCnt,
|
||||
nPathCnt;
|
||||
BYTE FAR *lpszLclDir,
|
||||
BYTE *lpszLclDir,
|
||||
*pszBase = pszDir;
|
||||
|
||||
/* Initialize the users data fields */
|
||||
@ -379,12 +384,12 @@ COUNT ParseDosPath(BYTE FAR * lpszFileName,
|
||||
/* buffers. */
|
||||
if (pszDir)
|
||||
{
|
||||
fbcopy(lpszLclDir, (BYTE FAR *) pszDir, nDirCnt);
|
||||
bcopy(lpszLclDir, pszDir, nDirCnt);
|
||||
pszDir[nDirCnt] = '\0';
|
||||
}
|
||||
|
||||
/* Clean up before leaving */
|
||||
DosTrimPath((BYTE FAR *) pszBase);
|
||||
DosTrimPath(pszBase);
|
||||
|
||||
/* Before returning to the user, eliminate any useless */
|
||||
/* trailing "\\." since the path prior to this is sufficient. */
|
||||
@ -402,13 +407,13 @@ COUNT ParseDosPath(BYTE FAR * lpszFileName,
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
VOID DosTrimPath(BYTE FAR * lpszPathNamep)
|
||||
VOID DosTrimPath(BYTE * lpszPathNamep)
|
||||
{
|
||||
BYTE FAR *lpszLast,
|
||||
FAR * lpszNext,
|
||||
FAR * lpszRoot = (BYTE FAR *) 0;
|
||||
BYTE *lpszLast,
|
||||
*lpszNext,
|
||||
*lpszRoot = NULL;
|
||||
COUNT nChars,
|
||||
flDotDot;
|
||||
|
||||
@ -477,6 +482,7 @@ VOID DosTrimPath(BYTE FAR * lpszPathNamep)
|
||||
else if (*(lpszNext + 2) == '\\')
|
||||
{
|
||||
fstrncpy(lpszNext, lpszNext + 2, NAMEMAX);
|
||||
flDotDot = TRUE;
|
||||
}
|
||||
/* If we're at the end of a string, */
|
||||
/* just exit. */
|
||||
|
245
kernel/dsk.c
245
kernel/dsk.c
@ -26,13 +26,15 @@
|
||||
|
||||
#include "portab.h"
|
||||
#include "globals.h"
|
||||
#include "disk.h"
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *dskRcsId = "$Id$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.18 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.17 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -152,7 +154,7 @@ static BYTE *dskRcsId = "$Id$";
|
||||
#define DebugPrintf(x)
|
||||
#endif
|
||||
|
||||
#define STATIC
|
||||
/* #define STATIC */
|
||||
|
||||
|
||||
|
||||
@ -170,7 +172,7 @@ COUNT fl_verify(WORD, WORD, WORD, WORD, WORD, BYTE FAR *);
|
||||
extern COUNT fl_lba_ReadWrite (BYTE drive, WORD mode,
|
||||
struct _bios_LBA_address_packet FAR *dap_p);
|
||||
|
||||
int LBA_Transfer(struct DriveParamS *driveParam ,UWORD mode, VOID FAR *buffer,
|
||||
int LBA_Transfer(ddt *pddt ,UWORD mode, VOID FAR *buffer,
|
||||
ULONG LBA_address,unsigned total, UWORD *transferred);
|
||||
#else
|
||||
BOOL fl_reset();
|
||||
@ -207,13 +209,18 @@ static struct Access_info
|
||||
BYTE AI_Flag;
|
||||
};
|
||||
|
||||
struct media_info *miarrayptr; /* Internal media info structs */
|
||||
bpb bpbarray[NDEV]; /* BIOS parameter blocks */
|
||||
struct FS_info
|
||||
{
|
||||
ULONG serialno;
|
||||
BYTE volume[11];
|
||||
BYTE fstype[8];
|
||||
};
|
||||
|
||||
ddt *pddt0; /* Internal media info structs */
|
||||
/* STATIC bpb *bpbptrs[NDEV]; pointers to bpbs */
|
||||
|
||||
/*TE - array access functions */
|
||||
struct media_info *getPMiarray(int dev) { return &miarrayptr[dev];}
|
||||
bpb *getPBpbarray(unsigned dev){ return &bpbarray[dev];}
|
||||
ddt *getddt(int dev) { return &pddt0[dev];}
|
||||
|
||||
#define N_PART 4 /* number of partitions per
|
||||
table partition */
|
||||
@ -225,20 +232,20 @@ COUNT nUnits; /* number of returned units */
|
||||
|
||||
#ifdef PROTO
|
||||
WORD
|
||||
_dsk_init (rqptr rq, struct media_info *pmiarray),
|
||||
mediachk (rqptr rq, struct media_info *pmiarray),
|
||||
bldbpb (rqptr rq, struct media_info *pmiarray),
|
||||
blockio (rqptr rq, struct media_info *pmiarray),
|
||||
IoctlQueblk(rqptr rq, struct media_info *pmiarray),
|
||||
Genblkdev (rqptr rq, struct media_info *pmiarray),
|
||||
Getlogdev (rqptr rq, struct media_info *pmiarray),
|
||||
Setlogdev (rqptr rq, struct media_info *pmiarray),
|
||||
blk_Open (rqptr rq, struct media_info *pmiarray),
|
||||
blk_Close (rqptr rq, struct media_info *pmiarray),
|
||||
blk_Media (rqptr rq, struct media_info *pmiarray),
|
||||
blk_noerr (rqptr rq, struct media_info *pmiarray),
|
||||
blk_nondr (rqptr rq, struct media_info *pmiarray),
|
||||
blk_error (rqptr rq, struct media_info *pmiarray);
|
||||
_dsk_init (rqptr rq, ddt *pddt),
|
||||
mediachk (rqptr rq, ddt *pddt),
|
||||
bldbpb (rqptr rq, ddt *pddt),
|
||||
blockio (rqptr rq, ddt *pddt),
|
||||
IoctlQueblk(rqptr rq, ddt *pddt),
|
||||
Genblkdev (rqptr rq, ddt *pddt),
|
||||
Getlogdev (rqptr rq, ddt *pddt),
|
||||
Setlogdev (rqptr rq, ddt *pddt),
|
||||
blk_Open (rqptr rq, ddt *pddt),
|
||||
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);
|
||||
WORD dskerr(COUNT);
|
||||
#else
|
||||
WORD _dsk_init(),
|
||||
@ -263,7 +270,7 @@ WORD dskerr();
|
||||
/* */
|
||||
|
||||
#ifdef PROTO
|
||||
static WORD(*dispatch[NENTRY]) (rqptr rq, struct media_info *pmiarray) =
|
||||
static WORD(*dispatch[NENTRY]) (rqptr rq, ddt *pddt) =
|
||||
#else
|
||||
static WORD(*dispatch[NENTRY]) () =
|
||||
#endif
|
||||
@ -319,21 +326,21 @@ COUNT FAR blk_driver(rqptr rp)
|
||||
return failure(E_FAILURE); /* general failure */
|
||||
}
|
||||
else
|
||||
return ((*dispatch[rp->r_command]) (rp, getPMiarray(rp->r_unit)));
|
||||
return ((*dispatch[rp->r_command]) (rp, getddt(rp->r_unit)));
|
||||
}
|
||||
|
||||
/* disk init is done in diskinit.c, so this should never be called */
|
||||
WORD _dsk_init(rqptr rp, struct media_info *pmiarray)
|
||||
WORD _dsk_init(rqptr rp, ddt *pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
UNREFERENCED_PARAMETER(pmiarray);
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
fatal("No disk init!");
|
||||
return S_DONE; /* to keep the compiler happy */
|
||||
}
|
||||
|
||||
WORD mediachk(rqptr rp, struct media_info *pmiarray)
|
||||
WORD mediachk(rqptr rp, ddt *pddt)
|
||||
{
|
||||
COUNT drive = pmiarray->drive.driveno;
|
||||
COUNT drive = pddt->ddt_driveno;
|
||||
COUNT result;
|
||||
|
||||
/* if it's a hard drive, media never changes */
|
||||
@ -365,24 +372,24 @@ WORD mediachk(rqptr rp, struct media_info *pmiarray)
|
||||
*/
|
||||
STATIC WORD RWzero(rqptr rp, WORD t)
|
||||
{
|
||||
struct media_info *pmiarray = getPMiarray(rp->r_unit);
|
||||
ddt *pddt = getddt(rp->r_unit);
|
||||
UWORD done;
|
||||
|
||||
return LBA_Transfer(&pmiarray->drive,
|
||||
return LBA_Transfer(pddt,
|
||||
t == 0 ? LBA_READ : LBA_WRITE,
|
||||
(UBYTE FAR *)&DiskTransferBuffer,
|
||||
pmiarray->mi_offset,1,&done);
|
||||
pddt->ddt_offset,1,&done);
|
||||
}
|
||||
|
||||
/*
|
||||
0 if not set, 1 = a, 2 = b, etc, assume set.
|
||||
page 424 MS Programmer's Ref.
|
||||
*/
|
||||
static WORD Getlogdev(rqptr rp, struct media_info *pmiarray)
|
||||
static WORD Getlogdev(rqptr rp, ddt *pddt)
|
||||
{
|
||||
BYTE x = rp->r_unit;
|
||||
|
||||
UNREFERENCED_PARAMETER(pmiarray);
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
|
||||
x++;
|
||||
if( x > nblk_rel )
|
||||
@ -392,69 +399,78 @@ static WORD Getlogdev(rqptr rp, struct media_info *pmiarray)
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
static WORD Setlogdev(rqptr rp, struct media_info *pmiarray)
|
||||
static WORD Setlogdev(rqptr rp, ddt *pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
UNREFERENCED_PARAMETER(pmiarray);
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
static WORD blk_Open(rqptr rp, struct media_info *pmiarray)
|
||||
static WORD blk_Open(rqptr rp, ddt *pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
|
||||
pmiarray->mi_FileOC++;
|
||||
pddt->ddt_FileOC++;
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
static WORD blk_Close(rqptr rp, struct media_info *pmiarray)
|
||||
static WORD blk_Close(rqptr rp, ddt *pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
|
||||
pmiarray->mi_FileOC--;
|
||||
pddt->ddt_FileOC--;
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
static WORD blk_nondr(rqptr rp, struct media_info *pmiarray)
|
||||
static WORD blk_nondr(rqptr rp, ddt *pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
UNREFERENCED_PARAMETER(pmiarray);
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
|
||||
return S_BUSY|S_DONE;
|
||||
}
|
||||
|
||||
static WORD blk_Media(rqptr rp, struct media_info *pmiarray)
|
||||
static WORD blk_Media(rqptr rp, ddt *pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
|
||||
if (hd( pmiarray->drive.driveno))
|
||||
if (hd( pddt->ddt_driveno))
|
||||
return S_BUSY|S_DONE; /* Hard Drive */
|
||||
else
|
||||
return S_DONE; /* Floppy */
|
||||
}
|
||||
|
||||
STATIC WORD bldbpb(rqptr rp, struct media_info *pmiarray)
|
||||
STATIC WORD bldbpb(rqptr rp, ddt *pddt)
|
||||
{
|
||||
ULONG count;
|
||||
bpb *pbpbarray;
|
||||
bpb *pbpbarray = &pddt->ddt_bpb;
|
||||
WORD head,/*track,*/sector,ret;
|
||||
|
||||
ret = RWzero( rp, 0);
|
||||
getword(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[BPB_NBYTE]), &pbpbarray->bpb_nbyte);
|
||||
|
||||
pddt->ddt_descflags |= 0x200; /* set drive to not accessible */
|
||||
|
||||
if (ret != 0)
|
||||
return (dskerr(ret));
|
||||
return (dskerr(ret));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
pddt->ddt_descflags &= ~0x200; /* set drive to accessible */
|
||||
|
||||
/*TE ~ 200 bytes*/
|
||||
pbpbarray = getPBpbarray(rp->r_unit);
|
||||
|
||||
getword(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[BPB_NBYTE]), &pbpbarray->bpb_nbyte);
|
||||
getbyte(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[BPB_NSECTOR]), &pbpbarray->bpb_nsector);
|
||||
getword(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[BPB_NRESERVED]), &pbpbarray->bpb_nreserved);
|
||||
getbyte(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[BPB_NFAT]), &pbpbarray->bpb_nfat);
|
||||
getword(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[BPB_NDIRENT]), &pbpbarray->bpb_ndirent);
|
||||
getword(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[BPB_NSIZE]), &pbpbarray->bpb_nsize);
|
||||
getword(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[BPB_NSIZE]), &pbpbarray->bpb_nsize);
|
||||
getbyte(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[BPB_MDESC]), &pbpbarray->bpb_mdesc);
|
||||
getword(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[BPB_NFSECT]), &pbpbarray->bpb_nfsect);
|
||||
getword(&((((BYTE *) & DiskTransferBuffer[BT_BPB]))[BPB_NSECS]), &pbpbarray->bpb_nsecs);
|
||||
@ -466,10 +482,10 @@ STATIC WORD bldbpb(rqptr rp, struct media_info *pmiarray)
|
||||
|
||||
/* Needs fat32 offset code */
|
||||
|
||||
getlong(&((((BYTE *) & DiskTransferBuffer[0x27])[0])), &pmiarray->fs.serialno);
|
||||
getlong(&((((BYTE *) & DiskTransferBuffer[0x27])[0])), &pddt->ddt_serialno);
|
||||
|
||||
memcpy(pmiarray->fs.volume,&DiskTransferBuffer[0x2B], 11);
|
||||
memcpy(pmiarray->fs.fstype,&DiskTransferBuffer[0x36], 8);
|
||||
memcpy(pddt->ddt_volume,&DiskTransferBuffer[0x2B], 11);
|
||||
memcpy(pddt->ddt_fstype,&DiskTransferBuffer[0x36], 8);
|
||||
|
||||
|
||||
|
||||
@ -486,23 +502,19 @@ STATIC WORD bldbpb(rqptr rp, struct media_info *pmiarray)
|
||||
rp->r_bpptr = pbpbarray;
|
||||
|
||||
|
||||
count = pmiarray->mi_size =
|
||||
count =
|
||||
pbpbarray->bpb_nsize == 0 ?
|
||||
pbpbarray->bpb_huge :
|
||||
pbpbarray->bpb_nsize;
|
||||
getword((&(((BYTE *) & DiskTransferBuffer[BT_BPB])[BPB_NHEADS])), &pmiarray->drive.chs.Head);
|
||||
head = pmiarray->drive.chs.Head;
|
||||
getword((&(((BYTE *) & DiskTransferBuffer[BT_BPB])[BPB_NSECS])), &pmiarray->drive.chs.Sector);
|
||||
if (pmiarray->mi_size == 0)
|
||||
getlong(&((((BYTE *) & DiskTransferBuffer[BT_BPB])[BPB_HUGE])), &pmiarray->mi_size);
|
||||
sector = pmiarray->drive.chs.Sector;
|
||||
head = pbpbarray->bpb_nheads;
|
||||
sector = pbpbarray->bpb_nsecs;
|
||||
|
||||
if (head == 0 || sector == 0)
|
||||
{
|
||||
tmark();
|
||||
return failure(E_FAILURE);
|
||||
}
|
||||
pmiarray->drive.chs.Cylinder = count / (head * sector);
|
||||
pddt->ddt_ncyl = count / (head * sector);
|
||||
tmark();
|
||||
|
||||
#ifdef DSK_DEBUG
|
||||
@ -515,9 +527,9 @@ STATIC WORD bldbpb(rqptr rp, struct media_info *pmiarray)
|
||||
}
|
||||
|
||||
|
||||
static WORD IoctlQueblk(rqptr rp, struct media_info *pmiarray)
|
||||
static WORD IoctlQueblk(rqptr rp, ddt *pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pmiarray);
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
|
||||
switch(rp->r_count){
|
||||
case 0x0846:
|
||||
@ -533,9 +545,10 @@ static WORD IoctlQueblk(rqptr rp, struct media_info *pmiarray)
|
||||
|
||||
}
|
||||
|
||||
STATIC WORD Genblkdev(rqptr rp,struct media_info *pmiarray)
|
||||
STATIC WORD Genblkdev(rqptr rp,ddt *pddt)
|
||||
{
|
||||
int ret;
|
||||
bpb FAR *pbpb;
|
||||
|
||||
switch(rp->r_count){
|
||||
case 0x0860: /* get device parameters */
|
||||
@ -543,11 +556,10 @@ STATIC WORD Genblkdev(rqptr rp,struct media_info *pmiarray)
|
||||
struct gblkio FAR * gblp = (struct gblkio FAR *) rp->r_trans;
|
||||
REG COUNT x = 5,y = 1,z = 0;
|
||||
|
||||
if (!hd(pmiarray->drive.driveno)){
|
||||
if (!hd(pddt->ddt_driveno)){
|
||||
y = 2;
|
||||
x = 8; /* any odd ball drives return this */
|
||||
if (pmiarray->mi_size <= 0xffff)
|
||||
switch((UWORD)pmiarray->mi_size)
|
||||
switch(pddt->ddt_bpb.bpb_nsize)
|
||||
{
|
||||
case 640:
|
||||
case 720: /* 320-360 */
|
||||
@ -571,19 +583,30 @@ STATIC WORD Genblkdev(rqptr rp,struct media_info *pmiarray)
|
||||
gblp->gbio_devtype = (UBYTE) x;
|
||||
gblp->gbio_devattrib = (UWORD) y;
|
||||
gblp->gbio_media = (UBYTE) z;
|
||||
gblp->gbio_ncyl = pmiarray->drive.chs.Cylinder;
|
||||
fmemcpy(&gblp->gbio_bpb, &bpbarray[rp->r_unit], sizeof(gblp->gbio_bpb));
|
||||
gblp->gbio_nsecs = bpbarray[rp->r_unit].bpb_nsector;
|
||||
gblp->gbio_ncyl = pddt->ddt_ncyl;
|
||||
/* use default dpb or current bpb? */
|
||||
pbpb = (gblp->gbio_spcfunbit & 0x01) == 0 ? &pddt->ddt_defbpb : &pddt->ddt_bpb;
|
||||
fmemcpy(&gblp->gbio_bpb, pbpb, sizeof(gblp->gbio_bpb));
|
||||
gblp->gbio_spcfunbit |= 0x04; /* bit 2 set if all sectors in track same size (should be set) */
|
||||
gblp->gbio_nsecs = pbpb->bpb_nsector;
|
||||
break;
|
||||
}
|
||||
case 0x0866: /* get volume serial number */
|
||||
{
|
||||
struct Gioc_media FAR * gioc = (struct Gioc_media FAR *) rp->r_trans;
|
||||
struct FS_info FAR * fs = &pmiarray->fs;
|
||||
struct FS_info FAR * fs = (struct FS_info FAR *) &DiskTransferBuffer[0x27];
|
||||
|
||||
ret = RWzero( rp, 0);
|
||||
if (ret != 0)
|
||||
return (dskerr(ret));
|
||||
|
||||
gioc->ioc_serialno = fs->serialno;
|
||||
fmemcpy(gioc->ioc_volume,fs->volume,11);
|
||||
fmemcpy(gioc->ioc_fstype, fs->fstype,8);
|
||||
pddt->ddt_serialno = fs->serialno;
|
||||
|
||||
fmemcpy(pddt->ddt_volume, fs->volume,11);
|
||||
fmemcpy(pddt->ddt_volume, fs->fstype,8);
|
||||
fmemcpy(gioc->ioc_volume, pddt->ddt_volume,11);
|
||||
fmemcpy(gioc->ioc_fstype, pddt->ddt_fstype,8);
|
||||
}
|
||||
break;
|
||||
case 0x0846: /* set volume serial number */
|
||||
@ -596,20 +619,25 @@ STATIC WORD Genblkdev(rqptr rp,struct media_info *pmiarray)
|
||||
return (dskerr(ret));
|
||||
|
||||
fs->serialno = gioc->ioc_serialno;
|
||||
pmiarray->fs.serialno = fs->serialno;
|
||||
pddt->ddt_serialno = fs->serialno;
|
||||
|
||||
ret = RWzero( rp, 1);
|
||||
if (ret != 0)
|
||||
return (dskerr(ret));
|
||||
}
|
||||
break;
|
||||
case 0x0867: /* get access flag, always on*/
|
||||
case 0x0867: /* get access flag */
|
||||
{
|
||||
struct Access_info FAR * ai = (struct Access_info FAR *) rp->r_trans;
|
||||
ai->AI_Flag = 1;
|
||||
ai->AI_Flag = pddt->ddt_descflags & 0x200 ? 0 : 1; /* bit 9 */
|
||||
}
|
||||
break;
|
||||
case 0x0847: /* set access flag, no real use*/
|
||||
case 0x0847: /* set access flag */
|
||||
{
|
||||
struct Access_info FAR * ai = (struct Access_info FAR *) rp->r_trans;
|
||||
pddt->ddt_descflags &= ~0x200;
|
||||
pddt->ddt_descflags |= (ai->AI_Flag ? 0 : 0x200);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return failure(E_CMD);
|
||||
@ -617,12 +645,13 @@ STATIC WORD Genblkdev(rqptr rp,struct media_info *pmiarray)
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
WORD blockio(rqptr rp, struct media_info *pmiarray)
|
||||
WORD blockio(rqptr rp, ddt *pddt)
|
||||
{
|
||||
ULONG start;
|
||||
ULONG start, size;
|
||||
WORD ret;
|
||||
|
||||
int action;
|
||||
bpb *pbpb;
|
||||
|
||||
|
||||
switch (rp->r_command){
|
||||
@ -633,18 +662,22 @@ WORD blockio(rqptr rp, struct media_info *pmiarray)
|
||||
return failure(E_FAILURE);
|
||||
}
|
||||
|
||||
if (pddt->ddt_descflags & 0x200) /* drive inaccessible */
|
||||
return failure(E_FAILURE);
|
||||
|
||||
tmark();
|
||||
start = (rp->r_start != HUGECOUNT ? rp->r_start : rp->r_huge);
|
||||
pbpb = hd(pddt->ddt_driveno) ? &pddt->ddt_defbpb : &pddt->ddt_bpb;
|
||||
size = (pbpb->bpb_nsize ? pbpb->bpb_nsize : pbpb->bpb_huge);
|
||||
|
||||
if (start >= pmiarray->mi_size ||
|
||||
start + rp->r_count > pmiarray->mi_size)
|
||||
if (start >= size ||
|
||||
start + rp->r_count > size)
|
||||
{
|
||||
return 0x0408;
|
||||
}
|
||||
start += pmiarray->mi_offset;
|
||||
start += pddt->ddt_offset;
|
||||
|
||||
ret = LBA_Transfer(&pmiarray->drive ,action,
|
||||
ret = LBA_Transfer(pddt, action,
|
||||
rp->r_trans,
|
||||
start, rp->r_count,(UWORD*)&rp->r_count);
|
||||
|
||||
@ -655,19 +688,19 @@ WORD blockio(rqptr rp, struct media_info *pmiarray)
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
STATIC WORD blk_error(rqptr rp, struct media_info *pmiarray)
|
||||
STATIC WORD blk_error(rqptr rp, ddt *pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pmiarray);
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
|
||||
rp->r_count = 0;
|
||||
return failure(E_FAILURE); /* general failure */
|
||||
}
|
||||
|
||||
|
||||
STATIC WORD blk_noerr(rqptr rp, struct media_info *pmiarray)
|
||||
STATIC WORD blk_noerr(rqptr rp, ddt *pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
UNREFERENCED_PARAMETER(pmiarray);
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
|
||||
return S_DONE;
|
||||
}
|
||||
@ -710,14 +743,14 @@ STATIC WORD dskerr(COUNT code)
|
||||
translate LBA sectors into CHS addressing
|
||||
*/
|
||||
|
||||
void LBA_to_CHS(struct CHS *chs, ULONG LBA_address, struct DriveParamS *driveparam)
|
||||
void LBA_to_CHS(struct CHS *chs, ULONG LBA_address, ddt *pddt)
|
||||
{
|
||||
chs->Sector = LBA_address% driveparam->chs.Sector + 1;
|
||||
chs->Sector = LBA_address% pddt->ddt_bpb.bpb_nsecs + 1;
|
||||
|
||||
LBA_address /= driveparam->chs.Sector;
|
||||
LBA_address /= pddt->ddt_bpb.bpb_nsecs;
|
||||
|
||||
chs->Head = LBA_address % driveparam->chs.Head;
|
||||
chs->Cylinder = LBA_address / driveparam->chs.Head;
|
||||
chs->Head = LBA_address % pddt->ddt_bpb.bpb_nheads;
|
||||
chs->Cylinder = LBA_address / pddt->ddt_bpb.bpb_nheads;
|
||||
}
|
||||
|
||||
|
||||
@ -745,7 +778,7 @@ STATIC unsigned DMA_max_transfer(void FAR *buffer, unsigned count)
|
||||
|
||||
/*
|
||||
int LBA_Transfer(
|
||||
struct DriveParamS *driveParam, physical characteristics of drive
|
||||
ddt *pddt, physical characteristics of drive
|
||||
UWORD mode, LBA_READ/WRITE/WRITE_VERIFY
|
||||
VOID FAR *buffer, user buffer
|
||||
ULONG LBA_address, absolute sector address
|
||||
@ -771,7 +804,7 @@ STATIC unsigned DMA_max_transfer(void FAR *buffer, unsigned count)
|
||||
|
||||
*/
|
||||
|
||||
int LBA_Transfer(struct DriveParamS *driveParam ,UWORD mode, VOID FAR *buffer,
|
||||
int LBA_Transfer(ddt *pddt ,UWORD mode, VOID FAR *buffer,
|
||||
ULONG LBA_address,unsigned totaltodo, UWORD *transferred)
|
||||
{
|
||||
static struct _bios_LBA_address_packet dap = {
|
||||
@ -787,13 +820,13 @@ int LBA_Transfer(struct DriveParamS *driveParam ,UWORD mode, VOID FAR *buffer,
|
||||
|
||||
*transferred = 0;
|
||||
|
||||
|
||||
if (LBA_address+totaltodo > driveParam->total_sectors)
|
||||
/*
|
||||
if (LBA_address+totaltodo > pddt->total_sectors)
|
||||
{
|
||||
printf("LBA-Transfer error : address overflow = %lu > %lu max\n",LBA_address+totaltodo,driveParam->total_sectors);
|
||||
return 1;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
for ( ;totaltodo != 0; )
|
||||
{
|
||||
@ -824,7 +857,7 @@ int LBA_Transfer(struct DriveParamS *driveParam ,UWORD mode, VOID FAR *buffer,
|
||||
|
||||
for ( num_retries = 0; num_retries < N_RETRY; num_retries++)
|
||||
{
|
||||
if (driveParam->LBA_supported)
|
||||
if (pddt->ddt_LBASupported)
|
||||
{
|
||||
dap.number_of_blocks = count;
|
||||
|
||||
@ -836,31 +869,31 @@ int LBA_Transfer(struct DriveParamS *driveParam ,UWORD mode, VOID FAR *buffer,
|
||||
|
||||
/* Load the registers and call the interrupt. */
|
||||
|
||||
if (driveParam->WriteVerifySupported || mode != LBA_WRITE_VERIFY)
|
||||
if (pddt->ddt_WriteVerifySupported || mode != LBA_WRITE_VERIFY)
|
||||
{
|
||||
|
||||
error_code = fl_lba_ReadWrite(driveParam->driveno,mode, &dap);
|
||||
error_code = fl_lba_ReadWrite(pddt->ddt_driveno,mode, &dap);
|
||||
}
|
||||
else {
|
||||
/* verify requested, but not supported */
|
||||
error_code = fl_lba_ReadWrite(driveParam->driveno,LBA_WRITE, &dap);
|
||||
error_code = fl_lba_ReadWrite(pddt->ddt_driveno,LBA_WRITE, &dap);
|
||||
|
||||
if (error_code == 0)
|
||||
{
|
||||
error_code = fl_lba_ReadWrite(driveParam->driveno,LBA_VERIFY, &dap);
|
||||
error_code = fl_lba_ReadWrite(pddt->ddt_driveno,LBA_VERIFY, &dap);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* transfer data, using old bios functions */
|
||||
|
||||
LBA_to_CHS(&chs, LBA_address, driveParam);
|
||||
LBA_to_CHS(&chs, LBA_address, pddt);
|
||||
|
||||
/* avoid overflow at end of track */
|
||||
|
||||
if (chs.Sector + count > driveParam->chs.Sector + 1)
|
||||
if (chs.Sector + count > pddt->ddt_bpb.bpb_nsecs + 1)
|
||||
{
|
||||
count = driveParam->chs.Sector + 1 - chs.Sector;
|
||||
count = pddt->ddt_bpb.bpb_nsecs + 1 - chs.Sector;
|
||||
}
|
||||
|
||||
if (chs.Cylinder > 1023)
|
||||
@ -870,7 +903,7 @@ int LBA_Transfer(struct DriveParamS *driveParam ,UWORD mode, VOID FAR *buffer,
|
||||
}
|
||||
|
||||
error_code = (mode == LBA_READ ? fl_read : fl_write)(
|
||||
driveParam->driveno,
|
||||
pddt->ddt_driveno,
|
||||
chs.Head, chs.Cylinder, chs.Sector,
|
||||
count, transfer_address);
|
||||
|
||||
@ -878,7 +911,7 @@ int LBA_Transfer(struct DriveParamS *driveParam ,UWORD mode, VOID FAR *buffer,
|
||||
mode == LBA_WRITE_VERIFY)
|
||||
{
|
||||
error_code = fl_verify(
|
||||
driveParam->driveno,
|
||||
pddt->ddt_driveno,
|
||||
chs.Head, chs.Cylinder, chs.Sector,
|
||||
count, transfer_address);
|
||||
}
|
||||
@ -886,7 +919,7 @@ int LBA_Transfer(struct DriveParamS *driveParam ,UWORD mode, VOID FAR *buffer,
|
||||
if (error_code == 0)
|
||||
break;
|
||||
|
||||
fl_reset(driveParam->driveno);
|
||||
fl_reset(pddt->ddt_driveno);
|
||||
|
||||
} /* end of retries */
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
alll data herein goes to special segment
|
||||
DYN_DATA AFTER BSS, but immediately before HMA_TEXT
|
||||
*/
|
||||
#include "portab.h"
|
||||
#include "init-mod.h"
|
||||
#include "dyndata.h"
|
||||
|
||||
struct DynS Dyn;
|
||||
|
@ -9,7 +9,6 @@
|
||||
moveable and Dyn.Buffer resizable, but not before
|
||||
*/
|
||||
|
||||
|
||||
void *DynAlloc(char far *what, unsigned num, unsigned size);
|
||||
void DynFree(unsigned memory_needed);
|
||||
void far *DynLast(void);
|
||||
@ -18,7 +17,7 @@ struct DynS {
|
||||
unsigned Allocated;
|
||||
unsigned UsedByDiskInit;
|
||||
unsigned AllocMax;
|
||||
char Buffer[1000 /* for InitDisk - Miarray's */
|
||||
char Buffer[NDEV*sizeof(ddt) /* for InitDisk - Drive Data Table */
|
||||
+ 16 * 71 /* initial f_nodes */
|
||||
+200 /* give some extra bytes */
|
||||
];
|
||||
|
@ -36,6 +36,9 @@ static BYTE *fatdirRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.18 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.17 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -177,16 +180,14 @@ static BYTE *fatdirRcsId = "$Id$";
|
||||
|
||||
VOID pop_dmp(dmatch FAR *, f_node_ptr);
|
||||
|
||||
f_node_ptr dir_open(BYTE FAR * dirname)
|
||||
f_node_ptr dir_open(BYTE * dirname)
|
||||
{
|
||||
f_node_ptr fnp;
|
||||
COUNT drive;
|
||||
BYTE *p;
|
||||
WORD i;
|
||||
/*TEunused x; */
|
||||
/* BYTE *s;*/
|
||||
struct cds FAR *cdsp;
|
||||
BYTE *pszPath = &TempCDS.cdsCurrentPath[2];
|
||||
BYTE *pszPath = dirname + 2;
|
||||
|
||||
/* Allocate an fnode if possible - error return (0) if not. */
|
||||
if ((fnp = get_f_node()) == (f_node_ptr)0)
|
||||
@ -197,10 +198,7 @@ f_node_ptr dir_open(BYTE FAR * dirname)
|
||||
/* Force the fnode into read-write mode */
|
||||
fnp->f_mode = RDWR;
|
||||
|
||||
/* and initialize temporary CDS */
|
||||
TempCDS.cdsFlags = 0;
|
||||
/* determine what drive we are using... */
|
||||
dirname = adjust_far(dirname);
|
||||
if (ParseDosName(dirname, &drive, (BYTE *) 0, (BYTE *) 0, (BYTE *) 0, FALSE)
|
||||
!= SUCCESS)
|
||||
{
|
||||
@ -227,16 +225,10 @@ f_node_ptr dir_open(BYTE FAR * dirname)
|
||||
|
||||
cdsp = &CDSp->cds_table[drive];
|
||||
|
||||
TempCDS.cdsDpb = cdsp->cdsDpb;
|
||||
|
||||
TempCDS.cdsCurrentPath[0] = 'A' + drive;
|
||||
TempCDS.cdsCurrentPath[1] = ':';
|
||||
TempCDS.cdsJoinOffset = 2;
|
||||
|
||||
i = cdsp->cdsJoinOffset;
|
||||
|
||||
/* Generate full path name */
|
||||
ParseDosPath(dirname, (COUNT *) 0, pszPath, (BYTE FAR *) & cdsp->cdsCurrentPath[i]);
|
||||
/* not necessary anymore, since truename did that already
|
||||
i = cdsp->cdsJoinOffset;
|
||||
ParseDosPath(dirname, (COUNT *) 0, pszPath, (BYTE FAR *) & cdsp->cdsCurrentPath[i]); */
|
||||
|
||||
/* for testing only for now */
|
||||
#if 0
|
||||
@ -247,24 +239,24 @@ f_node_ptr dir_open(BYTE FAR * dirname)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (TempCDS.cdsDpb == 0)
|
||||
if (cdsp->cdsDpb == 0)
|
||||
{
|
||||
release_f_node(fnp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fnp->f_dpb = TempCDS.cdsDpb;
|
||||
fnp->f_dpb = cdsp->cdsDpb;
|
||||
|
||||
/* Perform all directory common handling after all special */
|
||||
/* handling has been performed. */
|
||||
|
||||
if (media_check(TempCDS.cdsDpb) < 0)
|
||||
if (media_check(fnp->f_dpb) < 0)
|
||||
{
|
||||
release_f_node(fnp);
|
||||
return (f_node_ptr)0;
|
||||
}
|
||||
|
||||
fnp->f_dsize = DIRENT_SIZE * TempCDS.cdsDpb->dpb_dirents;
|
||||
fnp->f_dsize = DIRENT_SIZE * fnp->f_dpb->dpb_dirents;
|
||||
|
||||
fnp->f_diroff = 0l;
|
||||
fnp->f_flags.f_dmod = FALSE; /* a brand new fnode */
|
||||
@ -323,7 +315,7 @@ f_node_ptr dir_open(BYTE FAR * dirname)
|
||||
{
|
||||
if (fnp->f_dir.dir_name[0] != '\0' && fnp->f_dir.dir_name[0] != DELETED)
|
||||
{
|
||||
if (fcmp((BYTE FAR *) TempBuffer, (BYTE FAR *) 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;
|
||||
@ -353,7 +345,7 @@ f_node_ptr dir_open(BYTE FAR * dirname)
|
||||
fnp->f_diroff = 0l;
|
||||
fnp->f_flags.f_dmod = FALSE;
|
||||
fnp->f_flags.f_dnew = TRUE;
|
||||
fnp->f_dsize = DIRENT_SIZE * TempCDS.cdsDpb->dpb_dirents;
|
||||
fnp->f_dsize = DIRENT_SIZE * fnp->f_dpb->dpb_dirents;
|
||||
|
||||
}
|
||||
}
|
||||
@ -594,15 +586,14 @@ VOID dir_close(REG f_node_ptr fnp)
|
||||
}
|
||||
|
||||
#ifndef IPL
|
||||
COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
|
||||
COUNT dos_findfirst(UCOUNT attr, BYTE *name)
|
||||
{
|
||||
REG f_node_ptr fnp;
|
||||
REG dmatch FAR *dmp = (dmatch FAR *) dta;
|
||||
REG COUNT i;
|
||||
COUNT nDrive;
|
||||
BYTE *p;
|
||||
|
||||
static BYTE local_name[FNAME_SIZE + 1],
|
||||
BYTE local_name[FNAME_SIZE + 1],
|
||||
local_ext[FEXT_SIZE + 1];
|
||||
|
||||
/* printf("ff %Fs\n", name);*/
|
||||
@ -616,15 +607,10 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
|
||||
|
||||
/* Start out by initializing the dirmatch structure. */
|
||||
|
||||
fmemset(dmp, sizeof(*dmp),0);
|
||||
dmp->dm_drive = default_drive;
|
||||
/* dmp->dm_entry = 0;
|
||||
dmp->dm_cluster = 0;
|
||||
*/
|
||||
dmp->dm_attr_srch = attr;
|
||||
|
||||
/* Parse out the drive, file name and file extension. */
|
||||
i = ParseDosName((BYTE FAR *)name, &nDrive, &LocalPath[2], local_name, local_ext, TRUE);
|
||||
i = ParseDosName(name, NULL, &szDirName[2], local_name, local_ext, TRUE);
|
||||
if (i != SUCCESS)
|
||||
return i;
|
||||
/*
|
||||
@ -632,22 +618,10 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
|
||||
printf("ff %s", local_name);
|
||||
printf("ff %s\n", local_ext);
|
||||
*/
|
||||
if (nDrive >= 0)
|
||||
{
|
||||
dmp->dm_drive = nDrive;
|
||||
}
|
||||
else
|
||||
nDrive = default_drive;
|
||||
|
||||
if (nDrive >= lastdrive) {
|
||||
return DE_INVLDDRV;
|
||||
}
|
||||
current_ldt = &CDSp->cds_table[nDrive];
|
||||
SAttr = (BYTE) attr;
|
||||
|
||||
/* Now build a directory. */
|
||||
if (!LocalPath[2])
|
||||
fstrcpy(&LocalPath[0], current_ldt->cdsCurrentPath);
|
||||
if (!szDirName[2])
|
||||
fstrcpy(&szDirName[0], current_ldt->cdsCurrentPath);
|
||||
|
||||
/* Build the match pattern out of the passed string */
|
||||
/* copy the part of the pattern which belongs to the filename and is fixed */
|
||||
@ -675,11 +649,8 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
|
||||
|
||||
/* Complete building the directory from the passed in */
|
||||
/* name */
|
||||
if (nDrive >= 0)
|
||||
LocalPath[0] = 'A' + nDrive;
|
||||
else
|
||||
LocalPath[0] = 'A' + default_drive;
|
||||
LocalPath[1] = ':';
|
||||
szDirName[0] = 'A' + dmp->dm_drive;
|
||||
szDirName[1] = ':';
|
||||
|
||||
/* Special handling - the volume id is only in the root */
|
||||
/* directory and only searched for once. So we need to open */
|
||||
@ -687,14 +658,14 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
|
||||
/* volume id bit set. */
|
||||
if ((attr & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID)
|
||||
{
|
||||
LocalPath[2] = '\\';
|
||||
LocalPath[3] = '\0';
|
||||
szDirName[2] = '\\';
|
||||
szDirName[3] = '\0';
|
||||
}
|
||||
/* Now open this directory so that we can read the */
|
||||
/* fnode entry and do a match on it. */
|
||||
|
||||
/* printf("dir_open %Fs\n",(BYTE FAR *) LocalPath);*/
|
||||
if ((fnp = dir_open((BYTE FAR *) LocalPath)) == NULL)
|
||||
/* printf("dir_open %s\n", szDirName);*/
|
||||
if ((fnp = dir_open(szDirName)) == NULL)
|
||||
return DE_PATHNOTFND;
|
||||
|
||||
if ((attr & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID)
|
||||
@ -806,7 +777,7 @@ COUNT dos_findnext(void)
|
||||
++dmp->dm_entry;
|
||||
if (fnp->f_dir.dir_name[0] != '\0' && fnp->f_dir.dir_name[0] != DELETED)
|
||||
{
|
||||
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.
|
||||
|
129
kernel/fatfs.c
129
kernel/fatfs.c
@ -47,6 +47,9 @@ BYTE *RcsId = "$Id$";
|
||||
* performance killer on large drives. (~0.5 sec /dos_mkdir) TE
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.20 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.19 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -244,7 +247,7 @@ BYTE *RcsId = "$Id$";
|
||||
/* */
|
||||
f_node_ptr xlt_fd(COUNT);
|
||||
COUNT xlt_fnp(f_node_ptr);
|
||||
f_node_ptr split_path(BYTE FAR *, BYTE *, BYTE *, BYTE *);
|
||||
f_node_ptr split_path(BYTE *, BYTE *, BYTE *);
|
||||
BOOL find_fname(f_node_ptr, BYTE *, BYTE *);
|
||||
/* /// Added - Ron Cemer */
|
||||
STATIC void merge_file_changes(f_node_ptr fnp, int collect);
|
||||
@ -274,7 +277,7 @@ STATIC VOID shrink_file(f_node_ptr fnp);
|
||||
/* for update. */
|
||||
/* Returns an integer file desriptor or a negative error code */
|
||||
|
||||
COUNT dos_open(BYTE FAR * path, COUNT flag)
|
||||
COUNT dos_open(BYTE * path, COUNT flag)
|
||||
{
|
||||
REG f_node_ptr fnp;
|
||||
|
||||
@ -285,7 +288,7 @@ COUNT dos_open(BYTE FAR * path, COUNT flag)
|
||||
|
||||
/* first split the passed dir into comopnents (i.e. - path to */
|
||||
/* new directory and name of new directory. */
|
||||
if ((fnp = split_path(path, szDirName, szFileName, szFileExt)) == NULL)
|
||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
@ -324,7 +327,7 @@ COUNT dos_open(BYTE FAR * path, COUNT flag)
|
||||
return xlt_fnp(fnp);
|
||||
}
|
||||
|
||||
BOOL fcmp(BYTE FAR * s1, BYTE FAR * s2, COUNT n)
|
||||
BOOL fcmp(BYTE * s1, BYTE * s2, COUNT n)
|
||||
{
|
||||
while (n--)
|
||||
if (*s1++ != *s2++)
|
||||
@ -386,21 +389,21 @@ COUNT dos_close(COUNT fd)
|
||||
/* split a path into it's component directory and file name */
|
||||
/* */
|
||||
f_node_ptr
|
||||
split_path(BYTE FAR * path, BYTE * dname, BYTE * fname, BYTE * fext)
|
||||
split_path(BYTE * path, BYTE * fname, BYTE * fext)
|
||||
{
|
||||
REG f_node_ptr fnp;
|
||||
COUNT nDrive;
|
||||
struct cds FAR *cdsp;
|
||||
|
||||
/* Start off by parsing out the components. */
|
||||
if (ParseDosName(adjust_far(path), &nDrive, &dname[2], fname, fext, FALSE)
|
||||
if (ParseDosName(path, &nDrive, &szDirName[2], fname, fext, FALSE)
|
||||
!= SUCCESS)
|
||||
return (f_node_ptr)0;
|
||||
if (nDrive < 0)
|
||||
nDrive = default_drive;
|
||||
|
||||
dname[0] = 'A' + nDrive;
|
||||
dname[1] = ':';
|
||||
szDirName[0] = 'A' + nDrive;
|
||||
szDirName[1] = ':';
|
||||
|
||||
/* Add trailing spaces to the file name and extension */
|
||||
SpacePad(fname, FNAME_SIZE);
|
||||
@ -413,9 +416,9 @@ f_node_ptr
|
||||
|
||||
/* If the path is null, we to default to the current */
|
||||
/* directory... */
|
||||
if (!dname[2])
|
||||
if (!szDirName[2])
|
||||
{
|
||||
fsncopy(cdsp->cdsCurrentPath, (BYTE FAR *) dname, PARSE_MAX);
|
||||
fsncopy(cdsp->cdsCurrentPath, (BYTE FAR *) szDirName, PARSE_MAX);
|
||||
}
|
||||
|
||||
/* 11/29/99 jt
|
||||
@ -438,7 +441,7 @@ f_node_ptr
|
||||
#endif
|
||||
|
||||
/* Translate the path into a useful pointer */
|
||||
fnp = dir_open((BYTE FAR *) dname);
|
||||
fnp = dir_open(szDirName);
|
||||
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit... */
|
||||
@ -450,7 +453,7 @@ f_node_ptr
|
||||
}
|
||||
|
||||
/* Convert the name into an absolute name for comparison... */
|
||||
DosUpFString((BYTE FAR *) dname);
|
||||
DosUpFString((BYTE FAR *) szDirName);
|
||||
DosUpFMem((BYTE FAR *) fname, FNAME_SIZE);
|
||||
DosUpFMem((BYTE FAR *) fext, FEXT_SIZE);
|
||||
|
||||
@ -468,8 +471,8 @@ STATIC BOOL find_fname(f_node_ptr fnp, BYTE * fname, BYTE * fext)
|
||||
if (fnp->f_dir.dir_name[0] == DELETED)
|
||||
continue;
|
||||
|
||||
if (fcmp((BYTE FAR *) fname, (BYTE FAR *) fnp->f_dir.dir_name, FNAME_SIZE)
|
||||
&& fcmp((BYTE FAR *) fext, (BYTE FAR *) fnp->f_dir.dir_ext, FEXT_SIZE)
|
||||
if (fcmp(fname, (BYTE *)fnp->f_dir.dir_name, FNAME_SIZE)
|
||||
&& fcmp(fext, (BYTE *)fnp->f_dir.dir_ext, FEXT_SIZE)
|
||||
&& ((fnp->f_dir.dir_attrib & D_VOLID) == 0))
|
||||
{
|
||||
found = TRUE;
|
||||
@ -526,11 +529,11 @@ STATIC int is_same_file(f_node_ptr fnp1, f_node_ptr fnp2) {
|
||||
(fnp1->f_dpb->dpb_unit == fnp2->f_dpb->dpb_unit)
|
||||
&& (fnp1->f_dpb->dpb_subunit == fnp2->f_dpb->dpb_subunit)
|
||||
&& (fcmp
|
||||
((BYTE FAR *)fnp1->f_dir.dir_name,
|
||||
(BYTE FAR *)fnp2->f_dir.dir_name, FNAME_SIZE))
|
||||
((BYTE *)fnp1->f_dir.dir_name,
|
||||
(BYTE *)fnp2->f_dir.dir_name, FNAME_SIZE))
|
||||
&& (fcmp
|
||||
((BYTE FAR *)fnp1->f_dir.dir_ext,
|
||||
(BYTE FAR *)fnp2->f_dir.dir_ext, FEXT_SIZE))
|
||||
((BYTE *)fnp1->f_dir.dir_ext,
|
||||
(BYTE *)fnp2->f_dir.dir_ext, FEXT_SIZE))
|
||||
&& ((fnp1->f_dir.dir_attrib & D_VOLID) == 0)
|
||||
&& ((fnp2->f_dir.dir_attrib & D_VOLID) == 0)
|
||||
&& (fnp1->f_flags.f_dremote == fnp2->f_flags.f_dremote)
|
||||
@ -548,7 +551,7 @@ STATIC void copy_file_changes(f_node_ptr src, f_node_ptr dst) {
|
||||
dst->f_dir.dir_time = src->f_dir.dir_time;
|
||||
}
|
||||
|
||||
COUNT dos_creat(BYTE FAR * path, COUNT attrib)
|
||||
COUNT dos_creat(BYTE * path, COUNT attrib)
|
||||
{
|
||||
REG f_node_ptr fnp;
|
||||
|
||||
@ -560,7 +563,7 @@ COUNT dos_creat(BYTE FAR * path, COUNT attrib)
|
||||
|
||||
/* first split the passed dir into comopnents (i.e. - */
|
||||
/* path to new directory and name of new directory */
|
||||
if ((fnp = split_path(path, szDirName, szFileName, szFileExt)) == NULL)
|
||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
@ -593,7 +596,7 @@ COUNT dos_creat(BYTE FAR * path, COUNT attrib)
|
||||
/* an open */
|
||||
fnp->f_flags.f_dmod = FALSE;
|
||||
dir_close(fnp);
|
||||
fnp = dir_open((BYTE FAR *) szDirName);
|
||||
fnp = split_path(path, szFileName, szFileExt);
|
||||
|
||||
/* Get a free f_node pointer so that we can use */
|
||||
/* it in building the new file. */
|
||||
@ -616,10 +619,8 @@ COUNT dos_creat(BYTE FAR * path, COUNT attrib)
|
||||
}
|
||||
|
||||
/* put the fnode's name into the directory. */
|
||||
fbcopy((BYTE FAR *) szFileName,
|
||||
(BYTE FAR *) fnp->f_dir.dir_name, FNAME_SIZE);
|
||||
fbcopy((BYTE FAR *) szFileExt,
|
||||
(BYTE FAR *) fnp->f_dir.dir_ext, FEXT_SIZE);
|
||||
bcopy(szFileName, fnp->f_dir.dir_name, FNAME_SIZE);
|
||||
bcopy(szFileExt, fnp->f_dir.dir_ext, FEXT_SIZE);
|
||||
}
|
||||
/* Set the fnode to the desired mode */
|
||||
/* Updating the directory entry first. */
|
||||
@ -656,13 +657,13 @@ COUNT dos_creat(BYTE FAR * path, COUNT attrib)
|
||||
return xlt_fnp(fnp);
|
||||
}
|
||||
|
||||
COUNT dos_delete(BYTE FAR * path)
|
||||
COUNT dos_delete(BYTE * path)
|
||||
{
|
||||
REG f_node_ptr fnp;
|
||||
|
||||
/* first split the passed dir into components (i.e. - */
|
||||
/* path to new directory and name of new directory */
|
||||
if ((fnp = split_path(path, szDirName, szFileName, szFileExt)) == NULL)
|
||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
@ -706,7 +707,7 @@ COUNT dos_delete(BYTE FAR * path)
|
||||
}
|
||||
}
|
||||
|
||||
COUNT dos_rmdir(BYTE FAR * path)
|
||||
COUNT dos_rmdir(BYTE * path)
|
||||
{
|
||||
REG f_node_ptr fnp;
|
||||
REG f_node_ptr fnp1;
|
||||
@ -714,7 +715,7 @@ COUNT dos_rmdir(BYTE FAR * path)
|
||||
|
||||
/* first split the passed dir into comopnents (i.e. - */
|
||||
/* path to new directory and name of new directory */
|
||||
if ((fnp = split_path(path, szDirName, szFileName, szFileExt)) == NULL)
|
||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
@ -749,7 +750,7 @@ COUNT dos_rmdir(BYTE FAR * path)
|
||||
/* Check that the directory is empty. Only the */
|
||||
/* "." and ".." are permissable. */
|
||||
fnp->f_flags.f_dmod = FALSE;
|
||||
fnp1 = dir_open((BYTE FAR *) path);
|
||||
fnp1 = dir_open(path);
|
||||
dir_read(fnp1);
|
||||
if (fnp1->f_dir.dir_name[0] != '.')
|
||||
{
|
||||
@ -812,7 +813,7 @@ COUNT dos_rmdir(BYTE FAR * path)
|
||||
}
|
||||
}
|
||||
|
||||
COUNT dos_rename(BYTE FAR * path1, BYTE FAR * path2)
|
||||
COUNT dos_rename(BYTE * path1, BYTE * path2)
|
||||
{
|
||||
REG f_node_ptr fnp1;
|
||||
REG f_node_ptr fnp2;
|
||||
@ -820,7 +821,7 @@ COUNT dos_rename(BYTE FAR * path1, BYTE FAR * path2)
|
||||
|
||||
/* first split the passed target into compnents (i.e. - path to */
|
||||
/* new file name and name of new file name */
|
||||
if ((fnp2 = split_path(path2, szSecDirName, szSecFileName, szSecFileExt)) == NULL)
|
||||
if ((fnp2 = split_path(path2, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp2);
|
||||
return DE_PATHNOTFND;
|
||||
@ -828,7 +829,7 @@ COUNT dos_rename(BYTE FAR * path1, BYTE FAR * path2)
|
||||
|
||||
/* Check that we don't have a duplicate name, so if we find */
|
||||
/* one, it's an error. */
|
||||
if (find_fname(fnp2, szSecFileName, szSecFileExt))
|
||||
if (find_fname(fnp2, szFileName, szFileExt))
|
||||
{
|
||||
dir_close(fnp2);
|
||||
return DE_ACCESS;
|
||||
@ -836,17 +837,25 @@ COUNT dos_rename(BYTE FAR * path1, BYTE FAR * path2)
|
||||
|
||||
/* next split the passed source into compnents (i.e. - path to */
|
||||
/* old file name and name of old file name */
|
||||
if ((fnp1 = split_path(path1, szPriDirName, szPriFileName, szPriFileExt)) == NULL)
|
||||
if ((fnp1 = split_path(path1, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp1);
|
||||
dir_close(fnp2);
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
|
||||
if (!find_fname(fnp1, szFileName, szFileExt))
|
||||
{
|
||||
/* No such file, return the error */
|
||||
dir_close(fnp1);
|
||||
dir_close(fnp2);
|
||||
return DE_FILENOTFND;
|
||||
}
|
||||
|
||||
/* Reset the directory by a close followed by an open */
|
||||
fnp2->f_flags.f_dmod = FALSE;
|
||||
dir_close(fnp2);
|
||||
fnp2 = dir_open((BYTE FAR *) szSecDirName);
|
||||
fnp2 = split_path(path2, szFileName, szFileExt);
|
||||
|
||||
/* Now find a free slot to put the file into. */
|
||||
/* If it's the root and we don't have room, return an error. */
|
||||
@ -870,19 +879,9 @@ COUNT dos_rename(BYTE FAR * path1, BYTE FAR * path2)
|
||||
}
|
||||
}
|
||||
|
||||
if (!find_fname(fnp1, szPriFileName, szPriFileExt))
|
||||
{
|
||||
/* No such file, return the error */
|
||||
dir_close(fnp1);
|
||||
dir_close(fnp2);
|
||||
return DE_FILENOTFND;
|
||||
}
|
||||
|
||||
/* put the fnode's name into the directory. */
|
||||
fbcopy((BYTE FAR *) szSecFileName,
|
||||
(BYTE FAR *) fnp2->f_dir.dir_name, FNAME_SIZE);
|
||||
fbcopy((BYTE FAR *) szSecFileExt,
|
||||
(BYTE FAR *) fnp2->f_dir.dir_ext, FEXT_SIZE);
|
||||
bcopy(szFileName, (BYTE *)fnp2->f_dir.dir_name, FNAME_SIZE);
|
||||
bcopy(szFileExt, (BYTE *)fnp2->f_dir.dir_ext, FEXT_SIZE);
|
||||
|
||||
/* Set the fnode to the desired mode */
|
||||
fnp2->f_dir.dir_size = fnp1->f_dir.dir_size;
|
||||
@ -1177,7 +1176,7 @@ STATIC UWORD find_fat_free(f_node_ptr fnp)
|
||||
/* create a directory - returns success or a negative error */
|
||||
/* number */
|
||||
/* */
|
||||
COUNT dos_mkdir(BYTE FAR * dir)
|
||||
COUNT dos_mkdir(BYTE * dir)
|
||||
{
|
||||
REG f_node_ptr fnp;
|
||||
REG COUNT idx;
|
||||
@ -1188,7 +1187,7 @@ COUNT dos_mkdir(BYTE FAR * dir)
|
||||
|
||||
/* first split the passed dir into comopnents (i.e. - */
|
||||
/* path to new directory and name of new directory */
|
||||
if ((fnp = split_path(dir, szDirName, szFileName, szFileExt)) == NULL)
|
||||
if ((fnp = split_path(dir, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
@ -1202,11 +1201,7 @@ COUNT dos_mkdir(BYTE FAR * dir)
|
||||
can create an unlimited amount of same dirs. this space
|
||||
is lost forever
|
||||
*/
|
||||
if (2 /* "C" */
|
||||
+ strlen(szDirName)
|
||||
+ 1 /* "\\" */
|
||||
+ FileName83Length(szFileName) /* the SZ is not SZ, of course */
|
||||
> PARSE_MAX+2)
|
||||
if (strlen(dir) > PARSE_MAX+2) /* dir is already output of "truename" */
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
@ -1230,7 +1225,7 @@ COUNT dos_mkdir(BYTE FAR * dir)
|
||||
fnp->f_flags.f_dmod = FALSE;
|
||||
parent = fnp->f_dirstart;
|
||||
dir_close(fnp);
|
||||
fnp = dir_open((BYTE FAR *) szDirName);
|
||||
fnp = split_path(dir, szFileName, szFileExt);
|
||||
|
||||
/* Get a free f_node pointer so that we can use */
|
||||
/* it in building the new file. */
|
||||
@ -1268,10 +1263,8 @@ COUNT dos_mkdir(BYTE FAR * dir)
|
||||
|
||||
|
||||
/* put the fnode's name into the directory. */
|
||||
fbcopy((BYTE FAR *) szFileName,
|
||||
(BYTE FAR *) fnp->f_dir.dir_name, FNAME_SIZE);
|
||||
fbcopy((BYTE FAR *) szFileExt,
|
||||
(BYTE FAR *) fnp->f_dir.dir_ext, FEXT_SIZE);
|
||||
bcopy(szFileName, (BYTE *) fnp->f_dir.dir_name, FNAME_SIZE);
|
||||
bcopy(szFileExt, (BYTE *) fnp->f_dir.dir_ext, FEXT_SIZE);
|
||||
|
||||
/* Set the fnode to the desired mode */
|
||||
fnp->f_mode = WRONLY;
|
||||
@ -2144,7 +2137,7 @@ UWORD dos_free(struct dpb FAR *dpbp)
|
||||
|
||||
|
||||
#ifndef IPL
|
||||
COUNT dos_cd(struct cds FAR * cdsp, BYTE FAR *PathName)
|
||||
COUNT dos_cd(struct cds FAR * cdsp, BYTE *PathName)
|
||||
{
|
||||
f_node_ptr fnp;
|
||||
|
||||
@ -2158,7 +2151,7 @@ COUNT dos_cd(struct cds FAR * cdsp, BYTE FAR *PathName)
|
||||
/* now test for its existance. If it doesn't, return an error. */
|
||||
/* If it does, copy the path to the current directory */
|
||||
/* structure. */
|
||||
if ((fnp = dir_open(PathName)) == NULL)
|
||||
if ((fnp = dir_open(PathName)) == NULL)
|
||||
return DE_PATHNOTFND;
|
||||
|
||||
cdsp->cdsStrtClst = fnp->f_dirstart;
|
||||
@ -2199,10 +2192,10 @@ VOID dos_setdta(BYTE FAR * newdta)
|
||||
dta = newdta;
|
||||
}
|
||||
|
||||
COUNT dos_getfattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
COUNT dos_getfattr(BYTE * name)
|
||||
{
|
||||
f_node_ptr fnp;
|
||||
COUNT fd;
|
||||
COUNT fd, result;
|
||||
|
||||
/* Translate the fd into an fnode pointer, since all internal */
|
||||
/* operations are achieved through fnodes. */
|
||||
@ -2222,12 +2215,12 @@ COUNT dos_getfattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
}
|
||||
|
||||
/* Get the attribute from the fnode and return */
|
||||
*attrp = fnp->f_dir.dir_attrib;
|
||||
result = fnp->f_dir.dir_attrib;
|
||||
dos_close(fd);
|
||||
return SUCCESS;
|
||||
return result;
|
||||
}
|
||||
|
||||
COUNT dos_setfattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
COUNT dos_setfattr(BYTE * name, UWORD attrp)
|
||||
{
|
||||
f_node_ptr fnp;
|
||||
COUNT fd;
|
||||
@ -2249,7 +2242,7 @@ COUNT dos_setfattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
return DE_FILENOTFND;
|
||||
}
|
||||
/* JPP-If user tries to set VOLID or DIR bits, return error */
|
||||
if ((*attrp & (D_VOLID | D_DIR | 0xC0)) != 0)
|
||||
if ((attrp & (D_VOLID | D_DIR | 0xC0)) != 0)
|
||||
{
|
||||
dos_close(fd);
|
||||
return DE_ACCESS;
|
||||
@ -2260,7 +2253,7 @@ COUNT dos_setfattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
fnp->f_dir.dir_attrib &= (D_VOLID | D_DIR); /* JPP */
|
||||
|
||||
/* set attributes that user requested */
|
||||
fnp->f_dir.dir_attrib |= *attrp; /* JPP */
|
||||
fnp->f_dir.dir_attrib |= attrp; /* JPP */
|
||||
fnp->f_flags.f_dmod = TRUE;
|
||||
dos_close(fd);
|
||||
return SUCCESS;
|
||||
|
@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.13 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.12 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -779,8 +782,7 @@ BOOL FcbOpen(xfcb FAR * lpXfcb)
|
||||
if (CDSp->cds_table[FcbDrive].cdsFlags & CDSNETWDRV) {
|
||||
COUNT result;
|
||||
lpCurSft = (sfttbl FAR *)sftp;
|
||||
result = int2f_Remote_call(REM_OPEN, 0, 0, 0, (VOID FAR *) sftp, 0, MK_FP(0, O_RDWR));
|
||||
result = -result;
|
||||
result = -int2f_Remote_call(REM_OPEN, 0, 0, 0, (VOID FAR *) sftp, 0, MK_FP(0, O_RDWR));
|
||||
sftp->sft_status = result;
|
||||
}
|
||||
else {
|
||||
|
@ -36,6 +36,9 @@ static BYTE *Globals_hRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.15 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.14 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -432,6 +435,7 @@ 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
|
||||
@ -442,8 +446,6 @@ extern UBYTE
|
||||
uppermem_link; /* UMB Link flag */
|
||||
extern struct dhdr
|
||||
nul_dev;
|
||||
extern BYTE
|
||||
LocalPath[PARSE_MAX + 3]; /* Room for drive spec */
|
||||
extern UBYTE
|
||||
mem_access_mode; /* memory allocation scheme */
|
||||
extern BYTE
|
||||
@ -474,42 +476,31 @@ extern struct
|
||||
}
|
||||
FcbSearchBuffer;
|
||||
|
||||
extern union /* Path name parsing buffer */
|
||||
extern struct /* Path name parsing buffer */
|
||||
{
|
||||
BYTE _PriPathName[128];
|
||||
struct
|
||||
{
|
||||
BYTE _dname[NAMEMAX];
|
||||
BYTE _fname[FNAME_SIZE];
|
||||
BYTE _fext[FEXT_SIZE];
|
||||
}
|
||||
_f;
|
||||
}
|
||||
_PriPathBuffer;
|
||||
#define PriPathName _PriPathBuffer._PriPathName
|
||||
#define szDirName _PriPathBuffer._f._dname
|
||||
#define szFileName _PriPathBuffer._f._fname
|
||||
#define szFileExt _PriPathBuffer._f._fext
|
||||
#define szPriDirName _PriPathBuffer._f._dname
|
||||
#define szPriFileName _PriPathBuffer._f._fname
|
||||
#define szPriFileExt _PriPathBuffer._f._fext
|
||||
|
||||
extern union /* Alternate path name parsing buffer */
|
||||
extern struct
|
||||
{
|
||||
BYTE _fname[FNAME_SIZE];
|
||||
BYTE _fext[FEXT_SIZE+1]; /* space for 0 */
|
||||
}
|
||||
szNames;
|
||||
|
||||
#define PriPathName _PriPathBuffer._PriPathName
|
||||
#define szDirName TempCDS.cdsCurrentPath
|
||||
#define szFileName szNames._fname
|
||||
#define szFileExt szNames._fext
|
||||
|
||||
extern struct /* Alternate path name parsing buffer */
|
||||
{
|
||||
BYTE _SecPathName[128];
|
||||
struct
|
||||
{
|
||||
BYTE _dname[NAMEMAX];
|
||||
BYTE _fname[FNAME_SIZE];
|
||||
BYTE _fext[FEXT_SIZE];
|
||||
}
|
||||
_f;
|
||||
}
|
||||
_SecPathBuffer;
|
||||
|
||||
#define SecPathName _SecPathBuffer._SecPathName
|
||||
#define szSecDirName _SecPathBuffer._f._dname
|
||||
#define szSecFileName _SecPathBuffer._f._fname
|
||||
#define szSecFileExt _SecPathBuffer._f._fext
|
||||
|
||||
extern UWORD
|
||||
wAttr;
|
||||
|
@ -72,6 +72,9 @@ extern fmemcmp(BYTE far *s1, BYTE FAR *s2, unsigned len);
|
||||
#define NLAST 5 /* last drive */
|
||||
#define NUMBUFF 6 /* Number of track buffers */
|
||||
/* -- must be at least 3 */
|
||||
#define MAX_HARD_DRIVE 8
|
||||
#define NDEV 20 /* only one for demo */
|
||||
|
||||
|
||||
|
||||
/* Start of configuration variables */
|
||||
@ -127,10 +130,11 @@ INIT BOOL isnum(BYTE * pszString);
|
||||
INIT BYTE *GetNumber(REG BYTE * pszString, REG COUNT * pnNum);
|
||||
INIT COUNT tolower(COUNT c);
|
||||
INIT COUNT toupper(COUNT c);
|
||||
INIT VOID mcb_init(mcb FAR * mcbp, UWORD size);
|
||||
INIT VOID mcb_init(UCOUNT seg, UWORD size);
|
||||
INIT VOID strcat(REG BYTE * d, REG BYTE * s);
|
||||
INIT BYTE FAR *KernelAlloc(WORD nBytes);
|
||||
INIT COUNT Umb_Test(void);
|
||||
INIT COUNT UMB_get_largest(UCOUNT *seg, UCOUNT *size);
|
||||
INIT BYTE *GetStringArg(BYTE * pLine, BYTE * pszString);
|
||||
|
||||
/* diskinit.c */
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include "portab.h"
|
||||
#include "init-mod.h"
|
||||
#include "disk.h"
|
||||
#include "dyndata.h"
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *dskRcsId = "$Id$";
|
||||
@ -35,7 +34,7 @@ static BYTE *dskRcsId = "$Id$";
|
||||
/*
|
||||
data shared between DSK.C and INITDISK.C
|
||||
*/
|
||||
extern struct media_info * FAR miarrayptr; /* Internal media info structs */
|
||||
extern ddt * FAR pddt0; /* Pointer to drive data tables */
|
||||
|
||||
extern UBYTE FAR DiskTransferBuffer[1 * SEC_SIZE];
|
||||
|
||||
@ -108,7 +107,7 @@ extern UWORD FAR LBA_WRITE_VERIFY;
|
||||
*/
|
||||
|
||||
|
||||
/*#define DEBUG*/
|
||||
/* #define DEBUG */
|
||||
|
||||
#define _BETA_ /* messages for initial phase only */
|
||||
|
||||
@ -128,88 +127,6 @@ extern UWORD FAR LBA_WRITE_VERIFY;
|
||||
|
||||
#define LBA_to_CHS init_LBA_to_CHS
|
||||
|
||||
/*
|
||||
internal global data
|
||||
*/
|
||||
|
||||
UBYTE GlobalEnableLBAsupport = 1; /* = 0 --> disable LBA support */
|
||||
|
||||
struct DriveParamS InitDriveParam[MAX_HARD_DRIVE];
|
||||
|
||||
/*
|
||||
translate LBA sectors into CHS addressing
|
||||
copied and pasted from dsk.c!
|
||||
*/
|
||||
|
||||
void init_LBA_to_CHS(struct CHS *chs, ULONG LBA_address, struct DriveParamS *driveparam)
|
||||
{
|
||||
chs->Sector = LBA_address% driveparam->chs.Sector + 1;
|
||||
|
||||
LBA_address /= driveparam->chs.Sector;
|
||||
|
||||
chs->Head = LBA_address % driveparam->chs.Head;
|
||||
chs->Cylinder = LBA_address / driveparam->chs.Head;
|
||||
}
|
||||
|
||||
void printCHS(char *title,struct CHS *chs)
|
||||
{
|
||||
printf("%s",title);
|
||||
printf("%4lu-%u-%u",chs->Cylinder, chs->Head, chs->Sector);
|
||||
}
|
||||
|
||||
/*
|
||||
reason for this modules existence:
|
||||
|
||||
we have found a partition, and add them to the global
|
||||
partition structure.
|
||||
|
||||
*/
|
||||
void DosDefinePartition(struct DriveParamS *driveParam,
|
||||
ULONG StartSector, ULONG NumSectors)
|
||||
{
|
||||
extern struct DynS FAR Dyn;
|
||||
struct media_info FAR *pmiarray = &((struct media_info FAR *)&Dyn.Buffer[0])[nUnits];
|
||||
struct CHS chs;
|
||||
|
||||
if ( nUnits >= NDEV)
|
||||
{
|
||||
printf("more Partitions detected then possible, max = %d\n", NDEV);
|
||||
return; /* we are done */
|
||||
}
|
||||
|
||||
|
||||
fmemcpy((BYTE FAR*)&pmiarray->drive, (BYTE FAR*)driveParam, sizeof(struct DriveParamS));
|
||||
|
||||
if (pmiarray->drive.LBA_supported)
|
||||
DebugPrintf(("LBA enabled for drive %c:\n", 'A'+nUnits));
|
||||
|
||||
pmiarray->mi_offset = StartSector;
|
||||
pmiarray->mi_size = NumSectors;
|
||||
|
||||
#ifdef _BETA_ /* Alain whishes to keep this in later versions, too */
|
||||
LBA_to_CHS(&chs,StartSector,driveParam);
|
||||
|
||||
printf("%c: disk %02x",
|
||||
'A' + nUnits,
|
||||
driveParam->driveno);
|
||||
|
||||
printCHS(" CHS= ",&chs);
|
||||
|
||||
printf(" start = %5luMB,size =%5lu",
|
||||
StartSector/2048,NumSectors/2048);
|
||||
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
|
||||
nUnits++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void __int__(int);
|
||||
|
||||
|
||||
/*
|
||||
interesting macros - used internally only
|
||||
*/
|
||||
@ -240,7 +157,10 @@ void __int__(int);
|
||||
(parttyp) == FAT16LARGE || \
|
||||
(parttyp) == FAT16_LBA )
|
||||
|
||||
|
||||
#define MSDOS_EXT_SIGN 0x29 /* extended boot sector signature */
|
||||
#define MSDOS_FAT12_SIGN "FAT12 " /* FAT12 filesystem signature */
|
||||
#define MSDOS_FAT16_SIGN "FAT16 " /* FAT16 filesystem signature */
|
||||
#define MSDOS_FAT32_SIGN "FAT32 " /* FAT32 filesystem signature */
|
||||
|
||||
/* local - returned and used for BIOS interface INT 13, AH=48*/
|
||||
struct _bios_LBA_disk_parameterS {
|
||||
@ -258,6 +178,267 @@ struct _bios_LBA_disk_parameterS {
|
||||
} ;
|
||||
|
||||
|
||||
/* physical characteristics of a drive */
|
||||
|
||||
struct DriveParamS
|
||||
{
|
||||
UBYTE driveno; /* = 0x8x */
|
||||
BITS LBA_supported:1; /* set, if INT13 extensions enabled */
|
||||
BITS WriteVerifySupported:1; /* */
|
||||
ULONG total_sectors;
|
||||
|
||||
struct CHS chs; /* for normal INT 13 */
|
||||
};
|
||||
|
||||
/*
|
||||
internal global data
|
||||
*/
|
||||
|
||||
UBYTE GlobalEnableLBAsupport = 1; /* = 0 --> disable LBA support */
|
||||
|
||||
/*
|
||||
translate LBA sectors into CHS addressing
|
||||
copied and pasted from dsk.c!
|
||||
*/
|
||||
|
||||
void init_LBA_to_CHS(struct CHS *chs, ULONG LBA_address, struct DriveParamS *driveparam)
|
||||
{
|
||||
chs->Sector = LBA_address% driveparam->chs.Sector + 1;
|
||||
|
||||
LBA_address /= driveparam->chs.Sector;
|
||||
|
||||
chs->Head = LBA_address % driveparam->chs.Head;
|
||||
chs->Cylinder = LBA_address / driveparam->chs.Head;
|
||||
}
|
||||
|
||||
void printCHS(char *title,struct CHS *chs)
|
||||
{
|
||||
printf("%s",title);
|
||||
printf("%4lu-%u-%u",chs->Cylinder, chs->Head, chs->Sector);
|
||||
}
|
||||
|
||||
/*
|
||||
reason for this modules existence:
|
||||
|
||||
we have found a partition, and add them to the global
|
||||
partition structure.
|
||||
|
||||
*/
|
||||
|
||||
/* Compute ceil(a/b) */
|
||||
#define cdiv(a, b) (((a) + (b) - 1) / (b))
|
||||
|
||||
/* calculates FAT data:
|
||||
code adapted by Bart Oldeman from mkdosfs from the Linux dosfstools:
|
||||
Author: Dave Hudson
|
||||
Updated by: Roman Hodek
|
||||
Portions copyright 1992, 1993 Remy Card
|
||||
and 1991 Linus Torvalds
|
||||
*/
|
||||
VOID CalculateFATData(ddt FAR *pddt, ULONG NumSectors, UBYTE FileSystem)
|
||||
{
|
||||
ULONG fatlength, maxclust, clust;
|
||||
UBYTE maxclustsize;
|
||||
ULONG fatdata;
|
||||
|
||||
bpb FAR *defbpb = &pddt->ddt_defbpb;
|
||||
|
||||
/* FAT related items */
|
||||
defbpb->bpb_nfat = 2;
|
||||
defbpb->bpb_ndirent = 512; /* normal value of number of entries in root dir
|
||||
should be 0 for FAT32 drives */
|
||||
defbpb->bpb_nreserved = 1; /* 0x20 for FAT32 */
|
||||
|
||||
fatdata = NumSectors - cdiv (defbpb->bpb_ndirent * 32, 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 ));
|
||||
#endif
|
||||
switch(FileSystem) {
|
||||
|
||||
case FAT12:
|
||||
/* in DOS, FAT12 defaults to 4096kb (8 sector) - clusters. */
|
||||
defbpb->bpb_nsector = 8;
|
||||
/* Force maximal fatdata=32696 sectors since with our only possible sector
|
||||
size (512 bytes) this is the maximum for 4k clusters.
|
||||
#clus*secperclus+#fats*fatlength= 4084 * 8 + 2 * 12 = 32696.
|
||||
max FAT12 size for FreeDOS = 16,728,064 bytes */
|
||||
if (fatdata > 32696)
|
||||
fatdata = 32696;
|
||||
/* 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);
|
||||
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;
|
||||
maxclust = (fatlength * 2 * defbpb->bpb_nbyte) / 3;
|
||||
if (maxclust > FAT_MAGIC)
|
||||
maxclust = FAT_MAGIC;
|
||||
DebugPrintf(( "FAT12: #clu=%lu, fatlen=%lu, maxclu=%lu, limit=%u\n",
|
||||
clust, fatlength, maxclust, FAT_MAGIC ));
|
||||
if (clust > maxclust-2) {
|
||||
clust = maxclust-2;
|
||||
DebugPrintf(( "FAT12: too many clusters: setting to maxclu-2\n" ));
|
||||
}
|
||||
defbpb->bpb_nfsect = fatlength;
|
||||
fmemcpy(pddt->ddt_fstype, MSDOS_FAT12_SIGN, 8);
|
||||
break;
|
||||
|
||||
case FAT16SMALL:
|
||||
case FAT16LARGE:
|
||||
case FAT16_LBA:
|
||||
/* FAT16: start at 4 sectors per cluster */
|
||||
defbpb->bpb_nsector = 4;
|
||||
/* Force maximal fatdata=8387584 sectors (NumSectors=8387617)
|
||||
since with our only possible sectorsize (512 bytes) this is the
|
||||
maximum we can address with 64k clusters
|
||||
#clus*secperclus+#fats*fatlength=65524 * 128 + 2 * 256=8387584.
|
||||
max FAT16 size for FreeDOS = 4,294,180,864 bytes = 4GiB-786,432 */
|
||||
if (fatdata > 8387584ul)
|
||||
fatdata = 8387584ul;
|
||||
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);
|
||||
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;
|
||||
maxclust = (fatlength * defbpb->bpb_nbyte) / 2;
|
||||
if (maxclust > FAT_MAGIC16)
|
||||
maxclust = FAT_MAGIC16;
|
||||
DebugPrintf(( "FAT16: #clu=%lu, fatlen=%lu, maxclu=%lu, limit=%u\n",
|
||||
clust, fatlength, maxclust, FAT_MAGIC16 ));
|
||||
if (clust > maxclust-2) {
|
||||
DebugPrintf(( "FAT16: too many clusters\n" ));
|
||||
clust = 0;
|
||||
} 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"));
|
||||
clust = 0;
|
||||
}
|
||||
if (clust)
|
||||
break;
|
||||
defbpb->bpb_nsector <<= 1;
|
||||
}
|
||||
while (defbpb->bpb_nsector && defbpb->bpb_nsector <= maxclustsize);
|
||||
defbpb->bpb_nfsect = fatlength;
|
||||
fmemcpy(pddt->ddt_fstype, MSDOS_FAT16_SIGN, 8);
|
||||
break;
|
||||
|
||||
/* FAT 32 code: commented out for now */
|
||||
#ifdef WITHFAT32
|
||||
case FAT32:
|
||||
/* For FAT32, use 4k clusters on sufficiently large file systems,
|
||||
* otherwise 1 sector per cluster. This is also what M$'s format
|
||||
* command does for FAT32. */
|
||||
defbpb->bpb_nsector = ((long long)blocks*SECTORS_PER_BLOCK >= 512*1024 ? 8 : 1);
|
||||
do {
|
||||
clust = ((long long) fatdata *defbpb->bpb_nbyte + defbpb->bpb_nfat*8) /
|
||||
((int) defbpb->bpb_nsector * defbpb->bpb_nbyte + defbpb->bpb_nfat*4);
|
||||
fatlength = cdiv ((clust+2) * 4, 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;
|
||||
maxclust = (fatlength * defbpb->bpb_nbyte) / 4;
|
||||
if (maxclust > MAX_CLUST_32)
|
||||
maxclust = MAX_CLUST_32;
|
||||
DebugPrintf(( "FAT32: #clu=%u, fatlen=%u, maxclu=%u, limit=%u\n",
|
||||
clust, fatlength, maxclust, FAT_MAGIC ));
|
||||
if (clust > maxclust)
|
||||
{
|
||||
clust = 0;
|
||||
DebugPrintf(( "FAT32: too many clusters\n" ));
|
||||
}
|
||||
if (clust)
|
||||
break;
|
||||
defbpb->bpb_nsector <<= 1;
|
||||
} while (defbpb->bpb_nsector && defbpb->bpb_nsector <= maxclustsize);
|
||||
bpb_nfsect = fatlength;
|
||||
defbpb->bpb_nfsect = 0;
|
||||
defbpb->fat32.fat32_length = fatlength;
|
||||
memcpy(pddt->ddt_fstype, MSDOS_FAT32_SIGN, 8);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
pddt->ddt_fstype[8] = '\0';
|
||||
}
|
||||
|
||||
|
||||
void DosDefinePartition(struct DriveParamS *driveParam,
|
||||
ULONG StartSector, ULONG NumSectors, UBYTE FileSystem)
|
||||
{
|
||||
extern struct DynS FAR Dyn;
|
||||
ddt FAR *pddt = &((ddt FAR *)&Dyn.Buffer[0])[nUnits];
|
||||
struct CHS chs;
|
||||
|
||||
if ( nUnits >= NDEV)
|
||||
{
|
||||
printf("more Partitions detected then possible, max = %d\n", NDEV);
|
||||
return; /* we are done */
|
||||
}
|
||||
|
||||
pddt->ddt_driveno = driveParam->driveno;
|
||||
pddt->ddt_LBASupported = driveParam->LBA_supported;
|
||||
pddt->ddt_WriteVerifySupported = driveParam->WriteVerifySupported;
|
||||
pddt->ddt_ncyl = driveParam->chs.Cylinder;
|
||||
|
||||
if (pddt->ddt_LBASupported)
|
||||
DebugPrintf(("LBA enabled for drive %c:\n", 'A'+nUnits));
|
||||
|
||||
pddt->ddt_offset = StartSector;
|
||||
|
||||
pddt->ddt_defbpb.bpb_nbyte = SEC_SIZE;
|
||||
pddt->ddt_defbpb.bpb_mdesc = 0xf8;
|
||||
pddt->ddt_defbpb.bpb_nheads = driveParam->chs.Head;
|
||||
pddt->ddt_defbpb.bpb_nsecs = driveParam->chs.Sector;
|
||||
pddt->ddt_defbpb.bpb_nsize = 0;
|
||||
if (NumSectors > 0xffff)
|
||||
pddt->ddt_defbpb.bpb_huge = NumSectors;
|
||||
else
|
||||
pddt->ddt_defbpb.bpb_nsize = (UWORD)NumSectors;
|
||||
|
||||
/* sectors per cluster, sectors per FAT etc. */
|
||||
CalculateFATData(pddt, NumSectors, FileSystem);
|
||||
|
||||
pddt->ddt_serialno = 0x12345678l;
|
||||
pddt->ddt_descflags = 0x200; /* drive inaccessible until bldbpb successful */
|
||||
fmemcpy(&pddt->ddt_bpb, &pddt->ddt_defbpb, sizeof(bpb));
|
||||
|
||||
#ifdef _BETA_ /* Alain whishes to keep this in later versions, too */
|
||||
LBA_to_CHS(&chs,StartSector,driveParam);
|
||||
|
||||
printf("%c: disk %02x",
|
||||
'A' + nUnits,
|
||||
driveParam->driveno);
|
||||
|
||||
printCHS(" CHS= ",&chs);
|
||||
|
||||
printf(" start = %5luMB,size =%5lu",
|
||||
StartSector/2048,NumSectors/2048);
|
||||
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
|
||||
nUnits++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void __int__(int);
|
||||
|
||||
|
||||
/* Get the parameters of the hard disk */
|
||||
int LBA_Get_Drive_Parameters(int drive,struct DriveParamS *driveParam)
|
||||
{
|
||||
@ -359,6 +540,7 @@ int LBA_Get_Drive_Parameters(int drive,struct DriveParamS *driveParam)
|
||||
|
||||
StandardBios: /* old way to get parameters */
|
||||
|
||||
|
||||
regs.a.b.h = 0x08;
|
||||
regs.d.b.l = drive;
|
||||
|
||||
@ -557,7 +739,7 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
|
||||
partitionsToIgnore |= 1 << i;
|
||||
|
||||
DosDefinePartition(driveParam,partitionStart, pEntry->NumSect);
|
||||
DosDefinePartition(driveParam,partitionStart, pEntry->NumSect, pEntry->FileSystem);
|
||||
|
||||
if (scan_type == SCAN_PRIMARYBOOT ||
|
||||
scan_type == SCAN_PRIMARY )
|
||||
@ -581,12 +763,16 @@ int Read1LBASector(struct DriveParamS *driveParam, unsigned drive, ULONG LBA_add
|
||||
iregs regs;
|
||||
int num_retries;
|
||||
|
||||
/* disabled because this should not happen and if it happens the BIOS
|
||||
should complain; also there are weird disks around with
|
||||
CMOS geometry < real geometry */
|
||||
#if 0
|
||||
if (LBA_address >= driveParam->total_sectors)
|
||||
{
|
||||
printf("LBA-Transfer error : address overflow = %lu > %lu max\n",LBA_address+1,driveParam->total_sectors);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
for ( num_retries = 0; num_retries < N_RETRY; num_retries++)
|
||||
{
|
||||
@ -599,7 +785,7 @@ int Read1LBASector(struct DriveParamS *driveParam, unsigned drive, ULONG LBA_add
|
||||
dap.block_address = LBA_address; /* clear high part */
|
||||
|
||||
/* Load the registers and call the interrupt. */
|
||||
regs.a.b.h = 0x42;
|
||||
regs.a.x = LBA_READ;
|
||||
regs.si = FP_OFF(&dap);
|
||||
regs.ds = FP_SEG(&dap);
|
||||
}
|
||||
@ -640,12 +826,14 @@ int ProcessDisk(int scanType, unsigned drive, int PartitionsToIgnore)
|
||||
|
||||
int num_extended_found = 0;
|
||||
|
||||
struct DriveParamS *driveParam = &InitDriveParam[drive&0x7f];
|
||||
struct DriveParamS driveParam;
|
||||
|
||||
/* Get the hard drive parameters and ensure that the drive exists. */
|
||||
/* If there was an error accessing the drive, skip that drive. */
|
||||
|
||||
if (!LBA_Get_Drive_Parameters(drive,driveParam))
|
||||
memset(&driveParam, 0, sizeof(driveParam));
|
||||
|
||||
if (!LBA_Get_Drive_Parameters(drive,&driveParam))
|
||||
{
|
||||
printf("can't get drive parameters for drive %02x\n",drive);
|
||||
return PartitionsToIgnore;
|
||||
@ -665,7 +853,7 @@ ReadNextPartitionTable:
|
||||
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);
|
||||
return PartitionsToIgnore;
|
||||
@ -691,7 +879,7 @@ strange_restart:
|
||||
num_extended_found !=0 )
|
||||
{
|
||||
|
||||
PartitionsToIgnore = ScanForPrimaryPartitions(driveParam,scanType,
|
||||
PartitionsToIgnore = ScanForPrimaryPartitions(&driveParam,scanType,
|
||||
PTable, RelSectorOffset,PartitionsToIgnore);
|
||||
}
|
||||
|
||||
@ -731,7 +919,7 @@ strange_restart:
|
||||
}
|
||||
|
||||
|
||||
BIOS_nrdrives(void)
|
||||
int BIOS_nrdrives(void)
|
||||
{
|
||||
iregs regs;
|
||||
|
||||
@ -863,36 +1051,56 @@ void ReadAllPartitionTables(void)
|
||||
|
||||
int HardDrive;
|
||||
int nHardDisk = BIOS_nrdrives();
|
||||
struct media_info FAR *pmiarray;
|
||||
ddt FAR *pddt;
|
||||
bpb FAR *pbpbarray;
|
||||
int Unit;
|
||||
|
||||
extern struct DynS FAR Dyn;
|
||||
/* struct media_info *miarrayptr; /* Internal media info structs */
|
||||
/* ddt *miarrayptr; /* Internal media info structs */
|
||||
|
||||
__int__(0x03);
|
||||
pddt0 = (ddt *)&Dyn.Buffer[0];
|
||||
|
||||
/* Setup media info and BPBs arrays for floppies (this is a 360kb flop) */
|
||||
for (Unit = 0; Unit < nUnits; Unit++)
|
||||
{
|
||||
pddt = &((ddt FAR *)&Dyn.Buffer[0])[Unit];
|
||||
pbpbarray = &pddt->ddt_defbpb;
|
||||
|
||||
pbpbarray->bpb_nbyte = SEC_SIZE;
|
||||
pbpbarray->bpb_nsector = 2;
|
||||
pbpbarray->bpb_nreserved = 1;
|
||||
pbpbarray->bpb_nfat = 2;
|
||||
pbpbarray->bpb_ndirent = 112;
|
||||
pbpbarray->bpb_nsize = 360*2;
|
||||
pbpbarray->bpb_mdesc = 0xfd;
|
||||
pbpbarray->bpb_nfsect = 2;
|
||||
pbpbarray->bpb_nheads = 2;
|
||||
pbpbarray->bpb_nsecs = 9;
|
||||
|
||||
pddt->ddt_driveno = 0;
|
||||
pddt->ddt_ncyl = 40;
|
||||
pddt->ddt_LBASupported = FALSE;
|
||||
|
||||
pddt->ddt_offset = 0l;
|
||||
|
||||
|
||||
miarrayptr = (struct media_info *)&Dyn.Buffer[0];
|
||||
|
||||
for (Unit = 0; Unit < NDEV; Unit++)
|
||||
{
|
||||
pmiarray = &((struct media_info FAR *)&Dyn.Buffer[0])[Unit];
|
||||
|
||||
pmiarray->drive.driveno = Unit;
|
||||
pmiarray->drive.total_sectors = 1440*2;
|
||||
pmiarray->drive.chs.Head = 2;
|
||||
pmiarray->drive.chs.Cylinder = 40;
|
||||
pmiarray->drive.chs.Sector = 9;
|
||||
pmiarray->drive.LBA_supported = FALSE;
|
||||
|
||||
pmiarray->mi_size = 1440*2;
|
||||
pmiarray->mi_offset = 0l;
|
||||
|
||||
|
||||
pmiarray->fs.serialno = 0x12345678l;
|
||||
}
|
||||
pddt->ddt_serialno = 0x12345678l;
|
||||
fmemcpy(&pddt->ddt_bpb, pbpbarray, sizeof(bpb));
|
||||
}
|
||||
|
||||
/*
|
||||
this is a quick patch - see if B: exists
|
||||
test for A: also, need not exist
|
||||
*/
|
||||
{
|
||||
iregs r;
|
||||
|
||||
init_call_intr(0x11,&r); /* get equipment list */
|
||||
if ((r.a.x & 1) && (r.a.x & 0xc0))
|
||||
pddt->ddt_driveno = 1;
|
||||
/* floppy drives installed and a B: drive */
|
||||
/*if ((r.a.x & 1)==0) */ /* no floppy drives installed */
|
||||
}
|
||||
|
||||
nHardDisk = min(nHardDisk,MAX_HARD_DRIVE-1);
|
||||
|
||||
@ -931,20 +1139,13 @@ void ReadAllPartitionTables(void)
|
||||
}
|
||||
|
||||
|
||||
Dyn.UsedByDiskInit = nUnits * sizeof(struct media_info);
|
||||
Dyn.UsedByDiskInit = nUnits * sizeof(ddt);
|
||||
|
||||
}
|
||||
|
||||
/*TE - array access functions */
|
||||
extern bpb FAR bpbarray[NDEV];
|
||||
bpb FAR *init_getPBpbarray(unsigned dev){ return &bpbarray[dev];}
|
||||
|
||||
/* disk initialization: returns number of units */
|
||||
COUNT dsk_init()
|
||||
{
|
||||
COUNT Unit;
|
||||
bpb FAR *pbpbarray;
|
||||
|
||||
printf(" - InitDisk\n");
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -963,22 +1164,6 @@ COUNT dsk_init()
|
||||
nUnits = 2;
|
||||
|
||||
|
||||
/* Setup media info and BPBs arrays */
|
||||
for (Unit = 0; Unit < NDEV; Unit++)
|
||||
{
|
||||
pbpbarray = init_getPBpbarray(Unit);
|
||||
|
||||
pbpbarray->bpb_nbyte = SEC_SIZE;
|
||||
pbpbarray->bpb_nsector = 2;
|
||||
pbpbarray->bpb_nreserved = 1;
|
||||
pbpbarray->bpb_nfat = 2;
|
||||
pbpbarray->bpb_ndirent = 112;
|
||||
pbpbarray->bpb_nsize = 720l;
|
||||
pbpbarray->bpb_mdesc = 0xfd;
|
||||
pbpbarray->bpb_nfsect = 2;
|
||||
|
||||
}
|
||||
|
||||
ReadAllPartitionTables();
|
||||
|
||||
return nUnits;
|
||||
|
159
kernel/int2f.asm
159
kernel/int2f.asm
@ -30,6 +30,9 @@
|
||||
; $Id$
|
||||
;
|
||||
; $Log$
|
||||
; Revision 1.10 2001/07/22 01:58:58 bartoldeman
|
||||
; Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
;
|
||||
; Revision 1.9 2001/07/09 22:19:33 bartoldeman
|
||||
; LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
;
|
||||
@ -99,8 +102,6 @@
|
||||
|
||||
segment HMA_TEXT
|
||||
extern _nul_dev:wrt DGROUP
|
||||
extern _umb_start:wrt DGROUP
|
||||
extern _UMB_top:wrt DGROUP
|
||||
extern _cu_psp:wrt DGROUP
|
||||
extern _syscall_MUX14:wrt HMA_TEXT
|
||||
|
||||
@ -113,6 +114,10 @@ Int2f1:
|
||||
or al,al ; Installation check?
|
||||
jz FarTabRetn ; yes, just return
|
||||
Int2f2:
|
||||
mov ax,1 ; TE 07/13/01
|
||||
; at least for redirected INT21/5F44
|
||||
; --> 2f/111e
|
||||
; the error code is AX=0001 = unknown function
|
||||
stc
|
||||
FarTabRetn:
|
||||
retf 2 ; Return far
|
||||
@ -327,8 +332,81 @@ int2f_call:
|
||||
pop bp
|
||||
pop bp
|
||||
ret
|
||||
|
||||
%if 0
|
||||
; int_2f_111e_call(iregs FAR *iregs)
|
||||
;
|
||||
; set up all registers to the int21 entry registers
|
||||
; call int2f/111e
|
||||
; copy returned registers into int21 entry registers back
|
||||
;
|
||||
; disabled: does not work better than previous implementation
|
||||
global _int_2f_111e_call
|
||||
_int_2f_111e_call:
|
||||
|
||||
push bp
|
||||
mov bp,sp
|
||||
push si
|
||||
push di
|
||||
push ds
|
||||
|
||||
lds si, [bp+4] ; ds:si -> iregs
|
||||
|
||||
mov ax, [si ]
|
||||
mov bx, [si+2]
|
||||
mov cx, [si+4]
|
||||
mov dx, [si+6]
|
||||
push word [si+8] ; si
|
||||
mov di, [si+10]
|
||||
mov bp, [si+12]
|
||||
mov es, [si+16]
|
||||
mov ds, [si+14]
|
||||
pop si
|
||||
|
||||
push ax
|
||||
mov ax, 111eh
|
||||
int 2fh
|
||||
jc fault
|
||||
pop ax ; restore orig value of ax if no errors
|
||||
push ax
|
||||
fault:
|
||||
|
||||
pushf
|
||||
push ds
|
||||
push si
|
||||
push bp
|
||||
|
||||
mov bp,sp
|
||||
lds si,[bp+4+6+10] ; 4=fun, 6=si,di,ds, 10 additional bytes on stack
|
||||
|
||||
pop word [si+12] ; bp
|
||||
pop word [si+ 8] ; si
|
||||
pop word [si+14] ; ds
|
||||
pop word [si+22] ; flags
|
||||
add sp,2 ; pushed function value
|
||||
|
||||
mov [si ],ax
|
||||
|
||||
cmp ax, 5f02h ; 5f02 is special: it manipulates the user stack directly
|
||||
je skip5f02
|
||||
mov [si+2],bx
|
||||
mov [si+4],cx
|
||||
skip5f02:
|
||||
|
||||
mov [si+6],dx
|
||||
mov [si+10],di
|
||||
mov [si+16],es
|
||||
|
||||
pop ds
|
||||
pop di
|
||||
pop si
|
||||
pop bp
|
||||
ret
|
||||
%endif
|
||||
|
||||
;
|
||||
; Test to see if a umb driver has been loaded.
|
||||
; if so, retrieve largest available block+size
|
||||
;
|
||||
; From RB list and Dosemu xms.c.
|
||||
;
|
||||
@ -353,18 +431,16 @@ int2f_call:
|
||||
;
|
||||
;
|
||||
|
||||
|
||||
segment INIT_TEXT
|
||||
global _Umb_Test
|
||||
_Umb_Test
|
||||
; int UMB_get_largest(UCOUNT *seg, UCOUNT *size);
|
||||
global _UMB_get_largest
|
||||
|
||||
_UMB_get_largest:
|
||||
push bp
|
||||
mov bp,sp
|
||||
push es
|
||||
push ds
|
||||
push dx
|
||||
push bx
|
||||
|
||||
mov ax, DGROUP
|
||||
mov ds, ax
|
||||
sub sp,4 ; for the far call
|
||||
|
||||
mov ax,4300h ; is there a xms driver installed?
|
||||
int 2fh
|
||||
@ -374,54 +450,41 @@ _Umb_Test
|
||||
mov ax,4310h
|
||||
int 2fh
|
||||
|
||||
push es ; save driver entry point
|
||||
push bx
|
||||
|
||||
push cs ; setup far return
|
||||
mov ax, umbt1
|
||||
push ax
|
||||
push es ; push the driver entry point
|
||||
push bx
|
||||
mov [bp-2],es ; save driver entry point
|
||||
mov [bp-4],bx
|
||||
|
||||
mov dx,0xffff ; go for broke!
|
||||
mov ax,1000h ; get the umb's
|
||||
retf ; Call the driver
|
||||
umbt1:
|
||||
call far [bp-4] ; Call the driver
|
||||
;
|
||||
; bl = 0xB0 and ax = 0 so do it again.
|
||||
;
|
||||
cmp bl,0xb0 ; fail safe
|
||||
je umbtb
|
||||
add sp,4
|
||||
jmp umbt_error
|
||||
umbtb:
|
||||
and dx,dx ; if it returns a size of zero.
|
||||
jne umbtc
|
||||
add sp,4
|
||||
jmp umbt_error
|
||||
|
||||
umbtc:
|
||||
pop bx ; restore driver entry
|
||||
pop es
|
||||
|
||||
push cs
|
||||
mov ax, umbt2
|
||||
push ax
|
||||
push es
|
||||
push bx
|
||||
mov ax,1000h ; dx set with largest size
|
||||
retf
|
||||
umbt2:
|
||||
cmp ax,1
|
||||
jne umbt_error
|
||||
|
||||
mov word [_umb_start], bx ; save the segment
|
||||
mov word [_UMB_top], dx ; and the true size
|
||||
and dx,dx ; if it returns a size of zero.
|
||||
je umbt_error
|
||||
|
||||
umbt_error: dec ax
|
||||
mov ax,1000h ; dx set with largest size
|
||||
call far [bp-4] ; Call the driver
|
||||
|
||||
pop bx
|
||||
pop dx
|
||||
pop ds
|
||||
pop es
|
||||
cmp ax,1
|
||||
jne umbt_error
|
||||
; now return the segment
|
||||
; and the size
|
||||
|
||||
mov cx,bx ; *seg = segment
|
||||
mov bx, [bp+4]
|
||||
mov [bx],cx
|
||||
|
||||
mov bx, [bp+6] ; *size = size
|
||||
mov [bx],dx
|
||||
|
||||
umbt_ret:
|
||||
mov sp,bp
|
||||
pop bp
|
||||
ret ; this was called NEAR!!
|
||||
|
||||
umbt_error: xor ax,ax
|
||||
jmp umbt_ret
|
||||
|
@ -37,6 +37,9 @@ BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.26 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.25 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -353,7 +356,6 @@ VOID int21_service(iregs FAR * r)
|
||||
{
|
||||
COUNT rc = 0,
|
||||
rc1;
|
||||
ULONG lrc;
|
||||
psp FAR *p = MK_FP(cu_psp, 0);
|
||||
void FAR *FP_DS_DX = MK_FP(r->DS, r->DX); /* this is saved so often,
|
||||
that this saves ~100 bytes */
|
||||
@ -478,12 +480,11 @@ dispatch:
|
||||
/* Display String */
|
||||
case 0x09:
|
||||
{
|
||||
static COUNT scratch;
|
||||
BYTE FAR * q;
|
||||
q = FP_DS_DX;
|
||||
while (*q != '$')
|
||||
++q;
|
||||
DosWrite(STDOUT, FP_OFF(q) - FP_OFF(FP_DS_DX), FP_DS_DX, (COUNT FAR *) & scratch);
|
||||
DosWrite(STDOUT, FP_OFF(q) - FP_OFF(FP_DS_DX), FP_DS_DX, (COUNT FAR *) & UnusedRetVal);
|
||||
}
|
||||
r->AL = '$';
|
||||
break;
|
||||
@ -663,26 +664,7 @@ dispatch:
|
||||
break;
|
||||
|
||||
/* Get default DPB */
|
||||
case 0x1f:
|
||||
if (default_drive < lastdrive)
|
||||
{
|
||||
struct dpb FAR *dpb = CDSp->cds_table[default_drive].cdsDpb;
|
||||
if (dpb == 0)
|
||||
{
|
||||
r->AL = 0xff;
|
||||
CritErrCode = 0x0f;
|
||||
break;
|
||||
}
|
||||
|
||||
r->DS = FP_SEG(dpb);
|
||||
r->BX = FP_OFF(dpb);
|
||||
r->AL = 0;
|
||||
}
|
||||
else{
|
||||
r->AL = 0xff;
|
||||
CritErrCode = 0x0f;
|
||||
}
|
||||
break;
|
||||
/* case 0x1f: see case 0x32 */
|
||||
|
||||
/* Random read using FCB */
|
||||
case 0x21:
|
||||
@ -870,6 +852,8 @@ dispatch:
|
||||
return_user();
|
||||
break;
|
||||
|
||||
/* Get default BPB */
|
||||
case 0x1f:
|
||||
/* Get DPB */
|
||||
case 0x32:
|
||||
/* r->DL is NOT changed by MS 6.22 */
|
||||
@ -878,7 +862,7 @@ dispatch:
|
||||
struct dpb FAR *dpb;
|
||||
UCOUNT drv = r->DL;
|
||||
|
||||
if (drv == 0) drv = default_drive;
|
||||
if (drv == 0 || r->AH == 0x1f) drv = default_drive;
|
||||
else drv--;
|
||||
|
||||
if (drv >= lastdrive)
|
||||
@ -1063,6 +1047,8 @@ dispatch:
|
||||
|
||||
/* Dos Seek */
|
||||
case 0x42:
|
||||
{
|
||||
ULONG lrc;
|
||||
if ((rc = DosSeek(r->BX, (LONG) ((((LONG) (r->CX)) << 16) + r->DX), r->AL, &lrc)) < 0)
|
||||
goto error_exit;
|
||||
else
|
||||
@ -1070,6 +1056,7 @@ dispatch:
|
||||
r->DX = (lrc >> 16);
|
||||
r->AX = (UWORD)lrc;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Get/Set File Attributes */
|
||||
@ -1077,17 +1064,19 @@ dispatch:
|
||||
switch (r->AL)
|
||||
{
|
||||
case 0x00:
|
||||
rc = DosGetFattr((BYTE FAR *) FP_DS_DX, (UWORD FAR *) & r->CX);
|
||||
rc = DosGetFattr((BYTE FAR *) FP_DS_DX);
|
||||
if (rc >= SUCCESS)
|
||||
r->CX = rc;
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
rc = DosSetFattr((BYTE FAR *) FP_DS_DX, (UWORD FAR *) & r->CX);
|
||||
rc = DosSetFattr((BYTE FAR *) FP_DS_DX, r->CX);
|
||||
break;
|
||||
|
||||
default:
|
||||
goto error_invalid;
|
||||
}
|
||||
if (rc != SUCCESS)
|
||||
if (rc < SUCCESS)
|
||||
goto error_exit;
|
||||
break;
|
||||
|
||||
@ -1493,6 +1482,11 @@ dispatch:
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
void int_2f_111e_call(iregs FAR *r);
|
||||
int_2f_111e_call(r);
|
||||
break;*/
|
||||
|
||||
rc = -int2f_Remote_call(REM_DOREDIRECT, r->BX, r->CX, r->DX,
|
||||
(MK_FP(r->ES, r->DI)), r->SI, (MK_FP(r->DS, Int21AX)));
|
||||
if (rc != SUCCESS)
|
||||
|
@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.11 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.10 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -193,10 +196,12 @@ COUNT DosDevIOctl(iregs FAR * r)
|
||||
{
|
||||
case 0x00:
|
||||
/* Get the flags from the SFT */
|
||||
r->AX = s->sft_dev->dh_attr;
|
||||
r->DH = r->AH;
|
||||
if (s->sft_flags & SFT_FDEVICE)
|
||||
r->AX = (s->sft_dev->dh_attr & 0xff00) | s->sft_flags_lo;
|
||||
else
|
||||
r->AX = s->sft_flags;
|
||||
/* Undocumented result, Ax = Dx seen using Pcwatch */
|
||||
r->DL = r->AL = s->sft_flags;
|
||||
r->DX = r->AX;
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
@ -273,10 +278,6 @@ COUNT DosDevIOctl(iregs FAR * r)
|
||||
{
|
||||
return DE_INVLDDRV;
|
||||
}
|
||||
if (media_check(dpbp) < 0)
|
||||
{
|
||||
return DE_INVLDDRV;
|
||||
}
|
||||
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))
|
||||
|
@ -28,6 +28,9 @@
|
||||
; $Id$
|
||||
;
|
||||
; $Log$
|
||||
; Revision 1.15 2001/07/22 01:58:58 bartoldeman
|
||||
; Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
;
|
||||
; Revision 1.14 2001/07/09 22:19:33 bartoldeman
|
||||
; LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
;
|
||||
@ -581,10 +584,15 @@ _lpFcb times 2 dw 0 ;286 - pointer to callers FCB
|
||||
global current_ifn
|
||||
current_ifn dw 0 ;28A - SFT index for next open
|
||||
|
||||
; Pad to 05b2h
|
||||
times (292h - ($ - _internal_data)) db 0
|
||||
dw __PriPathBuffer ; 292 - "sda_WFP_START" offset in DOS DS of first filename argument
|
||||
dw __SecPathBuffer ; 294 - "sda_REN_WFP" offset in DOS DS of second filename argument
|
||||
|
||||
; Pad to 05ceh
|
||||
times (2aeh - ($ - _internal_data)) db 0
|
||||
global current_filepos
|
||||
current_filepos times 2 dw 0 ;2AE - current offset in file
|
||||
global _current_filepos
|
||||
_current_filepos times 2 dw 0 ;2AE - current offset in file
|
||||
|
||||
; Pad to 05f0h
|
||||
times (2d0h - ($ - _internal_data)) db 0
|
||||
@ -597,13 +605,13 @@ prev_int21regs_seg dw 0
|
||||
|
||||
; Pad to 0620h
|
||||
times (300h - ($ - _internal_data)) db 0
|
||||
global _szNames
|
||||
_szNames:
|
||||
;; times 11 db 0
|
||||
|
||||
global _FcbSearchBuffer ; during FCB search 1st/next use bottom
|
||||
_FcbSearchBuffer: ; of error stack as scratch buffer
|
||||
; times 43 db 0 ; - only used during int 21 call
|
||||
global _LocalPath
|
||||
_LocalPath:
|
||||
; times 67 db 0
|
||||
; stacks are made to initialize to no-ops so that high-water
|
||||
; testing can be performed
|
||||
|
||||
@ -664,7 +672,7 @@ __ib_end:
|
||||
|
||||
; kernel startup stack
|
||||
global init_tos
|
||||
resw 384
|
||||
resw 512
|
||||
init_tos:
|
||||
; the last paragraph of conventional memory might become an MCB
|
||||
resb 16
|
||||
|
@ -5,6 +5,9 @@
|
||||
#
|
||||
|
||||
# $Log$
|
||||
# Revision 1.12 2001/07/22 01:58:58 bartoldeman
|
||||
# Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
#
|
||||
# Revision 1.11 2001/07/09 22:19:33 bartoldeman
|
||||
# LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
#
|
||||
@ -335,7 +338,7 @@ DynInit.obj: DynInit.c init-mod.h $(HDR)portab.h globals.h $(HDR)device.h \
|
||||
$(HDR)version.h proto.h turboc.cfg dyndata.h
|
||||
$(CC) $(INITCFLAGS) -c DynInit.c
|
||||
|
||||
initdisk.obj: initdisk.c disk.h $(HDR)portab.h globals.h $(HDR)device.h $(HDR)mcb.h \
|
||||
initdisk.obj: initdisk.c $(HDR)portab.h globals.h $(HDR)device.h $(HDR)mcb.h \
|
||||
$(HDR)pcb.h $(HDR)date.h $(HDR)time.h $(HDR)fat.h $(HDR)fcb.h \
|
||||
$(HDR)tail.h $(HDR)process.h $(HDR)dcb.h $(HDR)sft.h $(HDR)cds.h \
|
||||
$(HDR)exe.h $(HDR)fnode.h $(HDR)dirmatch.h $(HDR)file.h \
|
||||
@ -399,7 +402,7 @@ dosnames.obj: dosnames.c $(HDR)portab.h globals.h $(HDR)device.h \
|
||||
$(HDR)file.h $(HDR)clock.h $(HDR)kbd.h $(HDR)error.h \
|
||||
$(HDR)version.h proto.h turboc.cfg
|
||||
|
||||
dsk.obj: dsk.c disk.h $(HDR)portab.h globals.h $(HDR)device.h $(HDR)mcb.h \
|
||||
dsk.obj: dsk.c $(HDR)portab.h globals.h $(HDR)device.h $(HDR)mcb.h \
|
||||
$(HDR)pcb.h $(HDR)date.h $(HDR)time.h $(HDR)fat.h $(HDR)fcb.h \
|
||||
$(HDR)tail.h $(HDR)process.h $(HDR)dcb.h $(HDR)sft.h $(HDR)cds.h \
|
||||
$(HDR)exe.h $(HDR)fnode.h $(HDR)dirmatch.h $(HDR)file.h \
|
||||
|
@ -71,6 +71,9 @@ static BYTE *mainRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.19 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.18 2001/07/09 22:19:33 bartoldeman
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -409,20 +412,6 @@ INIT VOID FsConfig(VOID)
|
||||
pcds_table->cdsJoinOffset = 2;
|
||||
}
|
||||
|
||||
/*
|
||||
this is a quick patch - see if B: exists
|
||||
test for A: also, need not exist
|
||||
*/
|
||||
{
|
||||
iregs r;
|
||||
|
||||
init_call_intr(0x11,&r); /* get equipment list */
|
||||
if ((r.a.x & 1)==0 || ((r.a.x & 1) && (r.a.x & 0xc0)==0))
|
||||
/* no floppy drives installed or no B: drive */
|
||||
CDSp->cds_table[1].cdsFlags = 0;
|
||||
if ((r.a.x & 1)==0) /* no floppy drives installed */
|
||||
CDSp->cds_table[0].cdsFlags = 0;
|
||||
}
|
||||
/* Initialize the disk buffer management functions */
|
||||
/* init_call_init_buffers(); done from CONFIG.C */
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.13 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.12 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -117,6 +120,7 @@ UCOUNT Remote_RW(UWORD func, UCOUNT n, BYTE FAR * bp, sft FAR * s, COUNT FAR * e
|
||||
|
||||
save_dta = dta;
|
||||
lpCurSft = (sfttbl FAR *) s;
|
||||
current_filepos = s->sft_posit; /* needed for MSCDEX */
|
||||
dta = bp;
|
||||
rx = int2f_Remote_call(func, 0, n, 0, (VOID FAR *) s, 0, (VOID FAR *) & rc);
|
||||
dta = save_dta;
|
||||
@ -128,26 +132,17 @@ UCOUNT Remote_RW(UWORD func, UCOUNT n, BYTE FAR * bp, sft FAR * s, COUNT FAR * e
|
||||
/*
|
||||
|
||||
*/
|
||||
COUNT Remote_find(UWORD func, UCOUNT attr, BYTE FAR * name)
|
||||
COUNT Remote_find(UWORD func)
|
||||
{
|
||||
COUNT i;
|
||||
char FAR *p;
|
||||
|
||||
#if defined(FIND_DEBUG)
|
||||
if (func == REM_FINDFIRST)
|
||||
{
|
||||
SAttr = attr;
|
||||
i = truename(name, PriPathName, FALSE);
|
||||
if (i != SUCCESS) {
|
||||
return i;
|
||||
}
|
||||
#if defined(FIND_DEBUG)
|
||||
printf("Remote Find: n='");
|
||||
p = name; while(*p) printf("%c", *p++);
|
||||
printf("' p='");
|
||||
p = PriPathName; while(*p) printf("%c", *p++);
|
||||
printf("'\n");
|
||||
#endif
|
||||
printf("Remote Find: n='%Fs\n", PriPathName);
|
||||
}
|
||||
#endif
|
||||
|
||||
fmemcpy(TempBuffer, dta, 21);
|
||||
p = dta;
|
||||
|
29
kernel/prf.c
29
kernel/prf.c
@ -28,6 +28,8 @@
|
||||
|
||||
#include "portab.h"
|
||||
|
||||
/* #define DOSEMU */
|
||||
|
||||
#ifdef FORINIT
|
||||
#define fstrlen reloc_call_fstrlen
|
||||
#define put_console init_put_console
|
||||
@ -48,6 +50,9 @@ static BYTE *prfRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.11 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.10 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -70,6 +75,9 @@ static BYTE *prfRcsId = "$Id$";
|
||||
* recoded for smaller object footprint, added main() for testing+QA
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.11 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.10 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -238,19 +246,36 @@ BYTE *
|
||||
#define RIGHT 1
|
||||
|
||||
/* printf -- short version of printf to conserve space */
|
||||
#ifdef DOSEMU
|
||||
WORD printf(CONST BYTE * fmt, ...)
|
||||
{
|
||||
WORD ret;
|
||||
|
||||
static char buff[80]; /* adjust if necessary */
|
||||
charp = buff;
|
||||
ret = do_printf(fmt, (BYTE **)&fmt + 1);
|
||||
handle_char(NULL);
|
||||
_ES = FP_SEG(buff);
|
||||
_DX = FP_OFF(buff);
|
||||
_AX = 0x13;
|
||||
__int__(0xe6);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
WORD printf(CONST BYTE * fmt, ...)
|
||||
{
|
||||
charp = 0;
|
||||
return do_printf(fmt, (BYTE **)&fmt + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
WORD
|
||||
sprintf(BYTE * buff, CONST BYTE * fmt, BYTE * args,...)
|
||||
sprintf(BYTE * buff, CONST BYTE * fmt, ...)
|
||||
{
|
||||
WORD ret;
|
||||
|
||||
charp = buff;
|
||||
ret = do_printf(fmt, &args);
|
||||
ret = do_printf(fmt, (BYTE **)&fmt + 1);
|
||||
handle_char(NULL);
|
||||
return ret;
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ static BYTE *Proto_hRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.18 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.17 2001/06/03 14:16:18 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
@ -228,8 +231,8 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name);
|
||||
COUNT DosFindNext(void);
|
||||
COUNT DosGetFtime(COUNT hndl, date FAR * dp, time FAR * tp);
|
||||
COUNT DosSetFtime(COUNT hndl, date FAR * dp, time FAR * tp);
|
||||
COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp);
|
||||
COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp);
|
||||
COUNT DosGetFattr(BYTE FAR * name);
|
||||
COUNT DosSetFattr(BYTE FAR * name, UWORD attrp);
|
||||
UBYTE DosSelectDrv(UBYTE drv);
|
||||
COUNT DosDelete(BYTE FAR *path);
|
||||
COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2);
|
||||
@ -245,8 +248,8 @@ VOID DosIdle_int(void);
|
||||
|
||||
/* dosnames.c */
|
||||
VOID SpacePad(BYTE *, COUNT);
|
||||
COUNT ParseDosName(BYTE FAR *, COUNT *, BYTE *, BYTE *, BYTE *, BOOL);
|
||||
COUNT ParseDosPath(BYTE FAR *, COUNT *, BYTE *, BYTE FAR *);
|
||||
COUNT ParseDosName(BYTE *, COUNT *, BYTE *, BYTE *, BYTE *, BOOL);
|
||||
/* COUNT ParseDosPath(BYTE *, COUNT *, BYTE *, BYTE FAR *); */
|
||||
|
||||
/* dsk.c */
|
||||
COUNT FAR blk_driver(rqptr rp);
|
||||
@ -259,25 +262,25 @@ COUNT char_error(request * rq, struct dhdr FAR * lpDevice);
|
||||
COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice);
|
||||
|
||||
/* fatdir.c */
|
||||
f_node_ptr dir_open(BYTE FAR * dirname);
|
||||
f_node_ptr dir_open(BYTE * dirname);
|
||||
COUNT dir_read(REG f_node_ptr fnp);
|
||||
COUNT dir_write(REG f_node_ptr fnp);
|
||||
VOID dir_close(REG f_node_ptr fnp);
|
||||
COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name);
|
||||
COUNT dos_findfirst(UCOUNT attr, BYTE * name);
|
||||
COUNT dos_findnext(void);
|
||||
void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName);
|
||||
int FileName83Length(BYTE *filename83);
|
||||
|
||||
/* fatfs.c */
|
||||
COUNT dos_open(BYTE FAR * path, COUNT flag);
|
||||
BOOL fcmp(BYTE FAR * s1, BYTE FAR * s2, COUNT n);
|
||||
COUNT dos_open(BYTE * path, COUNT flag);
|
||||
BOOL fcmp(BYTE * s1, BYTE * s2, COUNT n);
|
||||
BOOL fcmp_wild(BYTE FAR * s1, BYTE FAR * s2, COUNT n);
|
||||
VOID touc(BYTE FAR * s, COUNT n);
|
||||
VOID touc(BYTE * s, COUNT n);
|
||||
COUNT dos_close(COUNT fd);
|
||||
COUNT dos_creat(BYTE FAR * path, COUNT attrib);
|
||||
COUNT dos_delete(BYTE FAR * path);
|
||||
COUNT dos_rmdir(BYTE FAR * path);
|
||||
COUNT dos_rename(BYTE FAR * path1, BYTE FAR * path2);
|
||||
COUNT dos_creat(BYTE * path, COUNT attrib);
|
||||
COUNT dos_delete(BYTE * path);
|
||||
COUNT dos_rmdir(BYTE * path);
|
||||
COUNT dos_rename(BYTE * path1, BYTE * path2);
|
||||
date dos_getdate(void);
|
||||
time dos_gettime(void);
|
||||
COUNT dos_getftime(COUNT fd, date FAR * dp, time FAR * tp);
|
||||
@ -285,7 +288,7 @@ COUNT dos_setftime(COUNT fd, date FAR * dp, time FAR * tp);
|
||||
LONG dos_getcufsize(COUNT fd);
|
||||
LONG dos_getfsize(COUNT fd);
|
||||
BOOL dos_setfsize(COUNT fd, LONG size);
|
||||
COUNT dos_mkdir(BYTE FAR * dir);
|
||||
COUNT dos_mkdir(BYTE * dir);
|
||||
BOOL last_link(f_node_ptr fnp);
|
||||
COUNT map_cluster(REG f_node_ptr fnp, COUNT mode);
|
||||
UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err);
|
||||
@ -297,13 +300,13 @@ UWORD dos_free(struct dpb FAR *dpbp);
|
||||
|
||||
VOID trim_path(BYTE FAR * s);
|
||||
|
||||
COUNT dos_cd(struct cds FAR * cdsp, BYTE FAR * PathName);
|
||||
COUNT dos_cd(struct cds FAR * cdsp, BYTE * PathName);
|
||||
|
||||
f_node_ptr get_f_node(void);
|
||||
VOID release_f_node(f_node_ptr fnp);
|
||||
VOID dos_setdta(BYTE FAR * newdta);
|
||||
COUNT dos_getfattr(BYTE FAR * name, UWORD FAR * attrp);
|
||||
COUNT dos_setfattr(BYTE FAR * name, UWORD FAR * attrp);
|
||||
COUNT dos_getfattr(BYTE * name);
|
||||
COUNT dos_setfattr(BYTE * name, UWORD attrp);
|
||||
COUNT media_check(REG struct dpb FAR *dpbp);
|
||||
f_node_ptr xlt_fd(COUNT fd);
|
||||
COUNT xlt_fnp(f_node_ptr fnp);
|
||||
@ -421,7 +424,7 @@ UWORD syscall_MUX14(DIRECT_IREGS);
|
||||
/* prf.c */
|
||||
VOID put_console(COUNT c);
|
||||
WORD printf(CONST BYTE * fmt,...);
|
||||
WORD sprintf(BYTE * buff, CONST BYTE * fmt,...);
|
||||
WORD sprintf(BYTE * buff, CONST BYTE * fmt, ...);
|
||||
VOID hexd(char *title,VOID FAR *p,COUNT numBytes);
|
||||
|
||||
/* strings.c */
|
||||
@ -488,7 +491,7 @@ COUNT QRemote_Fn(char FAR * s, char FAR * d);
|
||||
UWORD get_machine_name(BYTE FAR * netname);
|
||||
VOID set_machine_name(BYTE FAR * netname, UWORD name_num);
|
||||
UCOUNT Remote_RW(UWORD func, UCOUNT n, BYTE FAR * bp, sft FAR * s, COUNT FAR * err);
|
||||
COUNT Remote_find(UWORD func, UCOUNT attr, BYTE FAR * name);
|
||||
COUNT Remote_find(UWORD func);
|
||||
|
||||
/* procsupt.asm */
|
||||
VOID INRPT FAR exec_user(iregs FAR * irp);
|
||||
|
@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.7 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.6 2001/04/21 22:32:53 bartoldeman
|
||||
* Init DS=Init CS, fixed stack overflow problems and misc bugs.
|
||||
*
|
||||
@ -121,17 +124,19 @@ extern WORD days[2][13]; /* this is defined by SYSTIME.C */
|
||||
|
||||
static struct ClockRecord clk;
|
||||
|
||||
/*
|
||||
static BYTE bcdDays[4];
|
||||
static UWORD Month,
|
||||
Day,
|
||||
Year;
|
||||
static BYTE bcdMinutes;
|
||||
static BYTE bcdHours;
|
||||
/** static BYTE bcdHundredths;*/
|
||||
/ ** static BYTE bcdHundredths;* /
|
||||
static BYTE bcdSeconds;
|
||||
|
||||
static ULONG Ticks;
|
||||
UWORD DaysSinceEpoch = 0;
|
||||
*/
|
||||
|
||||
BOOL ReadATClock(BYTE *, BYTE *, BYTE *, BYTE *);
|
||||
|
||||
@ -149,7 +154,13 @@ WORD FAR clk_driver(rqptr rp)
|
||||
bcd_minutes,
|
||||
bcd_hours,
|
||||
bcd_seconds;
|
||||
ULONG ticks;
|
||||
ULONG Ticks;
|
||||
UWORD DaysSinceEpoch;
|
||||
UWORD Month,
|
||||
Day,
|
||||
Year;
|
||||
|
||||
|
||||
|
||||
switch (rp->r_command)
|
||||
{
|
||||
@ -170,10 +181,10 @@ WORD FAR clk_driver(rqptr rp)
|
||||
* so we can simply multiply the number of seconds by 19663 without
|
||||
* worrying about overflow. :) -- ror4
|
||||
*/
|
||||
ticks = (3600ul * BcdToByte(bcd_hours) +
|
||||
Ticks = (3600ul * BcdToByte(bcd_hours) +
|
||||
60ul * BcdToByte(bcd_minutes) +
|
||||
BcdToByte(bcd_seconds)) * 19663ul / 1080ul;
|
||||
WritePCClock(ticks);
|
||||
WritePCClock(Ticks);
|
||||
}
|
||||
rp->r_endaddr = device_end();
|
||||
rp->r_nunits = 0;
|
||||
@ -343,11 +354,11 @@ WORD FAR clk_driver(rqptr rp)
|
||||
}
|
||||
|
||||
|
||||
DayToBcd((BYTE *) bcdDays, &Month, &Day, &Year);
|
||||
bcdMinutes = ByteToBcd(clk.clkMinutes);
|
||||
bcdHours = ByteToBcd(clk.clkHours);
|
||||
bcdSeconds = ByteToBcd(clk.clkSeconds);
|
||||
WriteATClock(bcdDays, bcdHours, bcdMinutes, bcdSeconds);
|
||||
DayToBcd((BYTE *) bcd_days, &Month, &Day, &Year);
|
||||
bcd_minutes = ByteToBcd(clk.clkMinutes);
|
||||
bcd_hours = ByteToBcd(clk.clkHours);
|
||||
bcd_seconds = ByteToBcd(clk.clkSeconds);
|
||||
WriteATClock(bcd_days, bcd_hours, bcd_minutes, bcd_seconds);
|
||||
return S_DONE;
|
||||
|
||||
case C_OFLUSH:
|
||||
|
@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.15 2001/07/22 01:58:58 bartoldeman
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
* Revision 1.14 2001/06/03 14:16:18 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
@ -163,9 +166,6 @@ static BYTE *RcsId = "$Id$";
|
||||
* Rev 1.0 02 Jul 1995 8:34:06 patv
|
||||
* Initial revision.
|
||||
*/
|
||||
#if 0
|
||||
extern VOID ClaimINITDataSegment(VOID);
|
||||
#endif
|
||||
#define toupper(c) ((c) >= 'a' && (c) <= 'z' ? (c) + ('A' - 'a') : (c))
|
||||
|
||||
#define LOADNGO 0
|
||||
@ -185,6 +185,10 @@ static exe_header header;
|
||||
+ 1 byte: '\0'
|
||||
-- 1999/04/21 ska */
|
||||
|
||||
#ifdef __TURBOC__
|
||||
void __int__(int); /* TC 2.01 requires this. :( -- ror4 */
|
||||
#endif
|
||||
|
||||
#ifndef PROTO
|
||||
COUNT ChildEnv(exec_blk FAR *, UWORD *, char far *);
|
||||
#else
|
||||
@ -587,13 +591,6 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
cu_psp = mem;
|
||||
dta = p->ps_dta;
|
||||
|
||||
/* if that's the first time, we arrive here
|
||||
now we 1 microsecond from COMMAND.COM
|
||||
now we claim the ID = INIT_DATA segment,
|
||||
which should no longer be used
|
||||
ClaimINITDataSegment();
|
||||
*/
|
||||
|
||||
if (InDOS)
|
||||
--InDOS;
|
||||
exec_user(irp);
|
||||
@ -658,7 +655,7 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
/*err, */
|
||||
/*env_size,*/
|
||||
i;
|
||||
COUNT nBytesRead;
|
||||
UCOUNT nBytesRead;
|
||||
UWORD mem,
|
||||
env,
|
||||
asize,
|
||||
@ -722,6 +719,8 @@ 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))
|
||||
@ -745,6 +744,16 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
/* + long2para((LONG) sizeof(psp)); ?? -- 1999/04/21 ska */
|
||||
if (exe_size > asize)
|
||||
exe_size = asize;
|
||||
|
||||
/* TE if header.exMinAlloc == header.exMaxAlloc == 0,
|
||||
DOS will allocate the largest possible memory area
|
||||
and load the image as high as possible into it.
|
||||
discovered (and after that found in RBIL), when testing NET */
|
||||
|
||||
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.
|
||||
@ -848,26 +857,24 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
/* read in the image in 32K chunks */
|
||||
if (mode != OVERLAY)
|
||||
{
|
||||
exe_size = image_size - long2para((LONG) sizeof(psp));
|
||||
exe_size = image_size - sizeof(psp);
|
||||
}
|
||||
else
|
||||
exe_size = image_size;
|
||||
|
||||
if (exe_size > 0)
|
||||
{
|
||||
UCOUNT tmp = 16;
|
||||
|
||||
sp = MK_FP(start_seg, 0x0);
|
||||
|
||||
if (mode != OVERLAY)
|
||||
{
|
||||
if ((header.exMinAlloc == 0) && (header.exMaxAlloc == 0))
|
||||
{
|
||||
sp = MK_FP(start_seg + mp->m_size
|
||||
- (image_size + 15) / tmp, 0);
|
||||
/* then the image should be placed as high as possible */
|
||||
start_seg = start_seg + mp->m_size - (image_size + 15) / 16;
|
||||
}
|
||||
}
|
||||
|
||||
sp = MK_FP(start_seg, 0x0);
|
||||
|
||||
do
|
||||
{
|
||||
nBytesRead = DosRead((COUNT) rc, (COUNT) (exe_size < CHUNK ? exe_size : CHUNK), (VOID FAR *) sp, &UnusedRetVal);
|
||||
@ -942,14 +949,6 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||
cu_psp = mem;
|
||||
dta = p->ps_dta;
|
||||
|
||||
|
||||
/* if that's the first time, we arrive here
|
||||
now we 1 microsecond from COMMAND.COM
|
||||
now we claim the ID = INIT_DATA segment,
|
||||
which should no longer be used
|
||||
ClaimINITDataSegment();
|
||||
*/
|
||||
|
||||
if (InDOS)
|
||||
--InDOS;
|
||||
exec_user(irp);
|
||||
|
Loading…
Reference in New Issue
Block a user