Added code for DOS FN 69 & 6C

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@13 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Jim Tabor 2000-05-11 04:26:26 +00:00
parent c0a44e269f
commit e4835de11e
5 changed files with 224 additions and 56 deletions

View File

@ -37,9 +37,16 @@ static BYTE *blockioRcsId = "$Id$";
/*
* $Log$
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
* Revision 1.2 2000/05/08 04:29:59 jimtabor
* Update CVS to 2020
*
* $Log$
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
* Revision 1.15 2000/04/29 05:13:16 jtabor
* Added new functions and clean up code
*
@ -547,7 +554,7 @@ BOOL dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mode
{
/* REG struct dpb *dpbp = &blk_devices[dsk]; */
REG struct dpb *dpbp = CDSp->cds_table[dsk].cdsDpb;
REG struct dpb *dpbp = (struct dpb *)CDSp->cds_table[dsk].cdsDpb;
for (;;)
{

View File

@ -33,9 +33,16 @@ static BYTE *dskRcsId = "$Id$";
/*
* $Log$
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
* Revision 1.2 2000/05/08 04:29:59 jimtabor
* Update CVS to 2020
*
* $Log$
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
* Revision 1.6 2000/04/29 05:13:16 jtabor
* Added new functions and clean up code
*
@ -118,7 +125,9 @@ BOOL fl_format();
#define NDEV 8 /* only one for demo */
#define SEC_SIZE 512 /* size of sector in bytes */
#define N_RETRY 5 /* number of retries permitted */
#define NENTRY 25 /* total size of dispatch table */
#define NENTRY 26 /* total size of dispatch table */
extern BYTE FAR nblk_rel;
union
{
@ -138,7 +147,15 @@ static struct media_info
COUNT mi_partidx; /* Index to partition array */
};
static struct media_info miarray[NDEV]; /* Internal media info structs */
static struct FS_info
{
ULONG fs_serialno;
BYTE fs_volume[11];
BYTE fs_fstype[8];
};
static struct media_info miarray[NDEV]; /* Internal media info structs */
static struct FS_info fsarray[NDEV];
static bpb bpbarray[NDEV]; /* BIOS parameter blocks */
static bpb *bpbptrs[NDEV]; /* pointers to bpbs */
@ -177,6 +194,7 @@ WORD init(rqptr),
mediachk(rqptr),
bldbpb(rqptr),
blockio(rqptr),
IoctlQueblk(rqptr),
Genblkdev(rqptr),
blk_error(rqptr);
COUNT ltop(WORD *, WORD *, WORD *, COUNT, COUNT, LONG, byteptr);
@ -221,12 +239,13 @@ static WORD(*dispatch[NENTRY]) () =
blk_error, /* Output till busy */
blk_error, /* undefined */
blk_error, /* undefined */
Genblkdev, /* Generic Ioctl */
Genblkdev, /* Generic Ioctl Call */
blk_error, /* undefined */
blk_error, /* undefined */
blk_error, /* undefined */
blk_error, /* Get Logical Device */
blk_error /* Set Logical Device */
blk_error, /* Set Logical Device */
IoctlQueblk /* Ioctl Query */
};
#define SIZEOF_PARTENT 16
@ -391,6 +410,9 @@ static WORD init(rqptr rp)
miarray[Unit].mi_offset = 0l;
miarray[Unit].mi_drive = Unit;
fsarray[Unit].fs_serialno = 0x12345678;
bpbarray[Unit].bpb_nbyte = SEC_SIZE;
bpbarray[Unit].bpb_nsector = 2;
bpbarray[Unit].bpb_nreserved = 1;
@ -415,6 +437,7 @@ static WORD init(rqptr rp)
rp->r_nunits = nUnits;
rp->r_bpbptr = bpbptrs;
rp->r_endaddr = device_end();
nblk_rel = nUnits; /* make device header reflect units */
return S_DONE;
}
@ -490,6 +513,10 @@ static WORD bldbpb(rqptr rp)
getword(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_NHEADS]), &bpbarray[rp->r_unit].bpb_nheads);
getlong(&((((BYTE *) & buffer.bytes[BT_BPB])[BPB_HIDDEN])), &bpbarray[rp->r_unit].bpb_hidden);
getlong(&((((BYTE *) & buffer.bytes[BT_BPB])[BPB_HUGE])), &bpbarray[rp->r_unit].bpb_huge);
getlong(&((((BYTE *) & buffer.bytes[0x27])[0])), &fsarray[rp->r_unit].fs_serialno);
#ifdef DSK_DEBUG
printf("BPB_NBYTE = %04x\n", bpbarray[rp->r_unit].bpb_nbyte);
printf("BPB_NSECTOR = %02x\n", bpbarray[rp->r_unit].bpb_nsector);
@ -511,6 +538,7 @@ static WORD bldbpb(rqptr rp)
if (miarray[rp->r_unit].mi_size == 0)
getlong(&((((BYTE *) & buffer.bytes[BT_BPB])[BPB_HUGE])), &miarray[rp->r_unit].mi_size);
sector = miarray[rp->r_unit].mi_sectors;
if (head == 0 || sector == 0)
{
tmark();
@ -518,6 +546,7 @@ static WORD bldbpb(rqptr rp)
}
miarray[rp->r_unit].mi_cyls = count / (head * sector);
tmark();
#ifdef DSK_DEBUG
printf("BPB_NSECS = %04x\n", sector);
printf("BPB_NHEADS = %04x\n", head);
@ -538,35 +567,87 @@ static COUNT write_and_verify(WORD drive, WORD head, WORD track, WORD sector,
return fl_verify(drive, head, track, sector, count, buffer);
}
static WORD IoctlQueblk(rqptr rp)
{
switch(rp->r_count){
case 0x0860:
case 0x0866:
break;
default:
return S_ERROR;
}
return S_DONE;
}
static WORD Genblkdev(rqptr rp)
{
UWORD cmd = rp->r_count;
switch(cmd){
case 0x0860:
switch(rp->r_count){
case 0x0860: /* get device parameters */
{
struct gblkio FAR * gblp = rp->r_trans;
struct gblkio FAR * gblp = (struct gblkio FAR *) rp->r_trans;
REG COUNT x = 5,y = 1,z = 0;
gblp->gbio_devtype = 0x05;
gblp->gbio_devattrib = 0x01;
if (!hd(miarray[rp->r_unit].mi_drive)){
y = 2;
switch(miarray[rp->r_unit].mi_size)
{
case 640l:
case 720l: /* 320-360 */
x = 0;
z = 1;
break;
case 1440l: /* 720 */
x = 2;
break;
case 2400l: /* 1.2 */
x = 1;
break;
case 2880l: /* 1.44 */
x = 7;
break;
case 5760l: /* 2.88 almost forgot this one*/
x = 9;
break;
default:
x = 8; /* any odd ball drives return this */
}
}
gblp->gbio_devtype = (UBYTE) x;
gblp->gbio_devattrib = (UWORD) y;
gblp->gbio_media = (UBYTE) z;
gblp->gbio_ncyl = miarray[rp->r_unit].mi_cyls;
gblp->gbio_media = 0;
gblp->gbio_bpb = bpbarray[rp->r_unit];
gblp->gbio_nsecs = bpbarray[rp->r_unit].bpb_nsector;
printf("GenBlkIO = %08lx\n", rp->r_trans);
printf("GenBlkIO = %08lx\n", gblp);
break;
}
case 0x0866:
case 0x0866: /* get volume serial number */
{
REG COUNT i;
struct Gioc_media FAR * gioc = (struct Gioc_media FAR *) rp->r_trans;
struct FS_info FAR * fs = &fsarray[rp->r_unit];
gioc->ioc_serialno = fs->fs_serialno;
for(i = 0; i < 12 ;i++ )
gioc->ioc_volume[i] = fs->fs_volume[i];
for(i = 0; i < 9; i++ )
gioc->ioc_fstype[i] = fs->fs_fstype[i];
printf("DSK_IOCTL SN %lx \n" , &fs->fs_serialno);
printf("DSK_IOCTL SN %lx \n" , &fs->fs_volume);
printf("DSK_IOCTL SN %lx \n" , &gioc->ioc_serialno);
printf("DSK_IOCTL SN %lx \n" , &gioc->ioc_volume);
}
break;
default:
return S_ERROR;
}
return S_DONE;
}
static WORD blockio(rqptr rp)
{
REG retry = N_RETRY,

View File

@ -36,9 +36,16 @@ BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
* Revision 1.2 2000/05/08 04:30:00 jimtabor
* Update CVS to 2020
*
* $Log$
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
* Revision 1.23 2000/04/29 05:13:16 jtabor
* Added new functions and clean up code
*
@ -2140,7 +2147,7 @@ struct dhdr FAR *select_unit(COUNT drive)
/* Just get the header from the dhdr array */
/* return blk_devices[drive].dpb_device; */
return CDSp->cds_table[drive].cdsDpb;
return (struct dhdr FAR *)CDSp->cds_table[drive].cdsDpb;
}

View File

@ -36,21 +36,22 @@ BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.4 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
* Revision 1.3 2000/05/09 00:30:11 jimtabor
* Clean up and Release
*
* Revision 1.2 2000/05/08 04:30:00 jimtabor
* Update CVS to 2020
*
* Revision 1.25 2000/04/29 05:31:47 jtabor
* fix history
* $Log$
* Revision 1.4 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
* Revision 1.24 2000/04/29 05:13:16 jtabor
* Added new functions and clean up code
*
* Revision 1.23 2000/03/31 05:40:09 jtabor
* Added Eric W. Biederman Patches
*
* Revision 1.22 2000/03/17 22:59:04 kernel
* Steffen Kaiser's NLS changes
*
@ -1021,11 +1022,9 @@ dispatch:
}
else
{
if(r->AL == 0x02)
if((r->AL == 0x02) || (r->AL == 0x03) || (r->AL == 0x04) || (r->AL == 0x05))
r->AX = r->CX;
r->FLAGS &= ~FLG_CARRY;
r->FLAGS &= ~FLG_CARRY;
}
}
break;
@ -1133,8 +1132,8 @@ dispatch:
|| ((psp FAR *) (MK_FP(cu_psp, 0)))->ps_parent == cu_psp)
break;
tsr = FALSE;
int2f_Remote_call(REM_PROCESS_END, 0, 0, 0, 0, 0, 0);
int2f_Remote_call(REM_CLOSEALL, 0, 0, 0, 0, 0, 0);
int2f_Remote_call(REM_PROCESS_END, 0, 0, 0, 0, 0, 0);
int2f_Remote_call(REM_CLOSEALL, 0, 0, 0, 0, 0, 0);
if (ErrorMode)
{
ErrorMode = FALSE;
@ -1556,25 +1555,34 @@ dispatch:
/* Get/Set Serial Number */
case 0x69:
r->BL = ( r->BL == 0 ? default_drive : r->BL - 1);
if (r->BL <= lastdrive)
rc = ( r->BL == 0 ? default_drive : r->BL - 1);
if (rc <= lastdrive)
{
if (CDSp->cds_table[r->BL].cdsFlags & CDSNETWDRV) {
r->AX = 0x01;
goto error_out;
if (CDSp->cds_table[rc].cdsFlags & CDSNETWDRV) {
goto error_invalid;
}
switch(r->AL){
case 0x00:
r->AL = 0x0d;
r->CX = 0x0866;
rc = DosDevIOctl(r, (COUNT FAR *) & rc1);
break;
case 0x01:
r->AL = 0x0d;
r->CX = 0x0846;
rc = DosDevIOctl(r, (COUNT FAR *) & rc1);
break;
}
r->FLAGS &= ~FLG_CARRY;
if (rc1 != SUCCESS)
{
r->FLAGS |= FLG_CARRY;
r->AX = -rc1;
}
else
{
r->FLAGS &= ~FLG_CARRY;
}
break;
}
else
@ -1582,11 +1590,37 @@ dispatch:
break;
#if 0
/* Extended Open-Creat, not fully functional.*/
case 0x6c:
switch(r->DL) {
case 0x01:
case 0x12:
{
COUNT x = 0;
if ((rc = DosOpen(MK_FP(r->DS, r->SI), 0)) >= 0)
{
DosClose(rc);
x = 1;
}
if ((rc = DosCreat(MK_FP(r->DS, r->SI), r->CX )) < 0 )
goto error_exit;
else
{
x += 2;
r->CX = x;
r->AX = rc;
r->FLAGS &= ~FLG_CARRY;
}
}
break;
case 0x10:
if ((rc = DosOpen(MK_FP(r->DS, r->SI), 0)) >= 0)
{
DosClose(rc);
r->AX = 80;
r->FLAGS |= FLG_CARRY;
}
else
{
if ((rc = DosCreat(MK_FP(r->DS, r->SI), r->CX )) < 0 )
goto error_exit;
else
@ -1595,9 +1629,42 @@ dispatch:
r->AX = rc;
r->FLAGS &= ~FLG_CARRY;
}
}
break;
case 0x02:
if ((rc = DosOpen(MK_FP(r->DS, r->SI), 0)) < 0)
goto error_exit;
DosClose(rc);
if ((rc = DosCreat(MK_FP(r->DS, r->SI), r->CX )) < 0 )
goto error_exit;
else
{
r->CX = 0x03;
r->AX = rc;
r->FLAGS &= ~FLG_CARRY;
}
break;
case 0x10:
case 0x11:
if ((rc = DosOpen(MK_FP(r->DS, r->SI), 0)) >= 0)
{
r->CX = 0x01;
r->AX = rc;
r->FLAGS &= ~FLG_CARRY;
}
else{
if ((rc = DosCreat(MK_FP(r->DS, r->SI), r->CX )) < 0 )
goto error_exit;
else
{
r->CX = 0x02;
r->AX = rc;
r->FLAGS &= ~FLG_CARRY;
}
}
break;
case 0x01:
if ((rc = DosOpen(MK_FP(r->DS, r->SI), r->BL )) < 0 )
goto error_exit;
else

View File

@ -35,9 +35,16 @@ static BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
* Revision 1.2 2000/05/08 04:30:00 jimtabor
* Update CVS to 2020
*
* $Log$
* Revision 1.3 2000/05/11 04:26:26 jimtabor
* Added code for DOS FN 69 & 6C
*
* Revision 1.4 2000/04/29 05:13:16 jtabor
* Added new functions and clean up code
*
@ -147,17 +154,19 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
/* JT Fixed it */
r->BL = ( r->BL == 0 ? default_drive : r->BL - 1);
printf("IOCTL bl = %04x\n", r->BL);
if (r->BL > lastdrive)
{
*err = DE_INVLDDRV;
return 0;
}
else
{
{
cdsp = &CDSp->cds_table[r->BL];
dpbp = cdsp->cdsDpb;
}
}
break;
case 0x0b:
@ -186,7 +195,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
case 0x01:
/* sft_flags is a file, return an error because you */
/* can't set the status of a file. */
if ((s->sft_flags & SFT_FDEVICE)) /* !*/
if (!(s->sft_flags & SFT_FDEVICE))
{
*err = DE_INVLDFUNC;
return 0;
@ -209,14 +218,12 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
case 0x03:
nMode = C_IOCTLOUT;
IoCharCommon:
if ((s->sft_flags & SFT_FDEVICE)
|| ((r->AL == 0x10) && (s->sft_dev->dh_attr & ATTR_QRYIOCTL))
|| ((r->AL == 0x0c) && (s->sft_dev->dh_attr & ATTR_GENIOCTL)))
/* ! ! */
|| ((r->AL == 0x02 ) && (s->sft_dev->dh_attr & SFT_FIOCTL))
|| ((r->AL == 0x03 ) && (s->sft_dev->dh_attr & SFT_FIOCTL))
|| ((r->AL == 0x10) && (s->sft_dev->dh_attr & ATTR_QRYIOCTL))
|| ((r->AL == 0x0c) && (s->sft_dev->dh_attr & ATTR_GENIOCTL)))
{
if (s->sft_dev->dh_attr & SFT_FIOCTL)
{
CharReqHdr.r_unit = 0;
CharReqHdr.r_length = sizeof(request);
CharReqHdr.r_command = nMode;
@ -234,7 +241,6 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
00 : 0xff;
}
break;
}
}
*err = DE_INVLDFUNC;
return 0;
@ -251,10 +257,10 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
case 0x05:
nMode = C_IOCTLOUT;
IoBlockCommon:
if ((dpbp->dpb_device->dh_attr & ATTR_IOCTL)
|| ((r->AL == 0x11) && (dpbp->dpb_device->dh_attr & ATTR_QRYIOCTL))
|| ((r->AL == 0x0d) && (dpbp->dpb_device->dh_attr & ATTR_GENIOCTL)))
/* ! ! */
if ( ((r->AL == 0x04 ) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL))
|| ((r->AL == 0x05 ) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL))
|| ((r->AL == 0x11) && !(dpbp->dpb_device->dh_attr & ATTR_QRYIOCTL))
|| ((r->AL == 0x0d) && !(dpbp->dpb_device->dh_attr & ATTR_GENIOCTL)))
{
*err = DE_INVLDFUNC;
return 0;
@ -315,7 +321,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
case 0x09:
if(cdsp->cdsFlags & CDSNETWDRV)
r->DX = 0x1000;
r->DX = ATTR_REMOTE;
else
r->DX = dpbp->dpb_device->dh_attr;
break;