A new SYS.COM/config.sys single stepping/console output/misc fixes.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@216 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2001-04-29 17:34:41 +00:00
parent 081222031a
commit 64474e1dd4
22 changed files with 683 additions and 486 deletions

View File

@ -27,6 +27,9 @@
; ;
; ;
; $Log$ ; $Log$
; Revision 1.4 2001/04/29 17:34:39 bartoldeman
; A new SYS.COM/config.sys single stepping/console output/misc fixes.
;
; Revision 1.3 2000/05/25 20:56:19 jimtabor ; Revision 1.3 2000/05/25 20:56:19 jimtabor
; Fixed project history ; Fixed project history
; ;
@ -300,6 +303,7 @@ cont: mov ds, ax
mov dx, word [root_dir_start+2] mov dx, word [root_dir_start+2]
mov di, word [RootDirSecs] mov di, word [RootDirSecs]
xor bx, bx xor bx, bx
mov word [tempbuf], LOADSEG
mov es, [tempbuf] mov es, [tempbuf]
call readDisk call readDisk
jc jmp_boot_error jc jmp_boot_error

View File

@ -1,4 +1,26 @@
2001 Apr 21 - Build 2024 2001 Apr 29 - Build 2024
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
+ Fixes Bart:
* fixed the "TYPE > FOO.TXT" poor man's editor.
* use "fast console output" (int 29) when applicable.
* moved 5 FILES to DOS DS:00CC and fixed the SFT linked list.
* cleaned up findfirst/findnext for redirected drives.
Tom:
* more VDISK changes (changed slightly by Bart)
* check for presence of A:/B: (changed by Bart to use the BIOS equipment flag
from INT11 instead of INT13).
* added F5/F8 stepping through config.sys; default SHELL=COMMAND.COM /P/E:256
Use ESC to stop single stepping, F5 to skip remaining config.sys/autoexec.bat.
* new sys: uses INT25/26 instead of the low level INT13 related kernel code from
floppy.asm (see also comments in sys.c) + a few fixes (also boot.asm related)
from Bart.
* Hopefully fixed DateTime Changed + ATTRIB |= ARCHIVE bug.
* cleaned up dsk.c and saved more bytes.
Przemyslaw Czerpak:
* Default lastdrive should be 5 (E) not 6 (F).
* fixed not ignoring whitespace after '=' in config.sys
* noted INT21/AX=3800 bug for getting the country. Put in a workaround for now.
2001 Apr 21 - Build 2024
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk) -------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
+ Fixes Tom: + Fixes Tom:
* fixed a missing close_dir in fatfs.c. * fixed a missing close_dir in fatfs.c.

View File

@ -36,6 +36,9 @@ static BYTE *fnode_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.5 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.4 2001/04/15 03:21:50 bartoldeman * Revision 1.4 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -97,12 +100,12 @@ struct f_node
struct struct
{ {
BOOL f_dmod:1; /* directory has been modified */ BITS f_dmod:1; /* directory has been modified */
BOOL f_droot:1; /* directory is the root */ BITS f_droot:1; /* directory is the root */
BOOL f_dnew:1; /* fnode is new and needs fill */ BITS f_dnew:1; /* fnode is new and needs fill */
BOOL f_ddir:1; /* fnode is assigned to dir */ BITS f_ddir:1; /* fnode is assigned to dir */
BOOL f_dfull:1; /* directory is full */ BITS f_dfull:1; /* directory is full */
BOOL f_dremote:1; /* Remote Fake FNode */ BITS f_dremote:1; /* Remote Fake FNode */
} }
f_flags; /* file flags */ f_flags; /* file flags */

View File

@ -44,4 +44,4 @@ static BYTE *date_hRcsId = "$Id$";
#define REVISION_MINOR 1 #define REVISION_MINOR 1
#define REVISION_SEQ 24 #define REVISION_SEQ 24
#define BUILD 2024 #define BUILD 2024
#define SUB_BUILD "a" #define SUB_BUILD "b"

View File

@ -36,6 +36,9 @@ static BYTE *charioRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.8 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.7 2001/04/21 22:32:53 bartoldeman * Revision 1.7 2001/04/21 22:32:53 bartoldeman
* Init DS=Init CS, fixed stack overflow problems and misc bugs. * Init DS=Init CS, fixed stack overflow problems and misc bugs.
* *
@ -135,10 +138,15 @@ static VOID kbfill();
struct dhdr FAR *finddev(); struct dhdr FAR *finddev();
#endif #endif
#ifdef __TURBOC__
void __int__(int); /* TC 2.01 requires this. :( -- ror4 */
#endif
/* Return a pointer to the first driver in the chain that /* Return a pointer to the first driver in the chain that
* matches the attributes. * matches the attributes.
* not necessary because we have the syscon pointer.
*/ */
#if 0
struct dhdr FAR *finddev(UWORD attr_mask) struct dhdr FAR *finddev(UWORD attr_mask)
{ {
struct dhdr far *dh; struct dhdr far *dh;
@ -152,24 +160,24 @@ struct dhdr FAR *finddev(UWORD attr_mask)
/* return dev/null if no matching driver found */ /* return dev/null if no matching driver found */
return &nul_dev; return &nul_dev;
} }
#endif
#if 0
VOID cso(COUNT c) VOID cso(COUNT c)
{ {
BYTE buf = c; if (syscon->dh_attr & ATTR_FASTCON) {
struct dhdr FAR *lpDevice; _AL = c;
__int__(0x29);
return;
}
CharReqHdr.r_length = sizeof(request); CharReqHdr.r_length = sizeof(request);
CharReqHdr.r_command = C_OUTPUT; CharReqHdr.r_command = C_OUTPUT;
CharReqHdr.r_count = 1; CharReqHdr.r_count = 1;
CharReqHdr.r_trans = (BYTE FAR *) (&buf); CharReqHdr.r_trans = (BYTE FAR *) (&c);
CharReqHdr.r_status = 0; CharReqHdr.r_status = 0;
execrh((request FAR *) & CharReqHdr, execrh((request FAR *) & CharReqHdr, syscon);
lpDevice = (struct dhdr FAR *)finddev(ATTR_CONOUT));
if (CharReqHdr.r_status & S_ERROR) if (CharReqHdr.r_status & S_ERROR)
char_error(&CharReqHdr, lpDevice); char_error(&CharReqHdr, syscon);
} }
#endif
VOID sto(COUNT c) VOID sto(COUNT c)
@ -183,18 +191,18 @@ VOID mod_sto(REG UCOUNT c)
{ {
if (c < ' ' && c != HT) if (c < ' ' && c != HT)
{ {
sto('^'); cso('^');
sto(c + '@'); cso(c + '@');
} }
else else
sto(c); cso(c);
} }
VOID destr_bs(void) VOID destr_bs(void)
{ {
sto(BS); cso(BS);
sto(' '); cso(' ');
sto(BS); cso(BS);
} }
VOID Do_DosIdle_loop(void) VOID Do_DosIdle_loop(void)
@ -230,7 +238,7 @@ BOOL con_break(void)
CharReqHdr.r_status = 0; CharReqHdr.r_status = 0;
CharReqHdr.r_command = C_NDREAD; CharReqHdr.r_command = C_NDREAD;
CharReqHdr.r_length = sizeof(request); CharReqHdr.r_length = sizeof(request);
execrh((request FAR *) & CharReqHdr, (struct dhdr FAR *)finddev(ATTR_CONIN)); execrh((request FAR *) & CharReqHdr, syscon);
if (CharReqHdr.r_status & S_BUSY) if (CharReqHdr.r_status & S_BUSY)
return FALSE; return FALSE;
if (CharReqHdr.r_ndbyte == CTL_C) if (CharReqHdr.r_ndbyte == CTL_C)
@ -272,14 +280,14 @@ VOID KbdFlush(void)
CharReqHdr.r_status = 0; CharReqHdr.r_status = 0;
CharReqHdr.r_command = C_IFLUSH; CharReqHdr.r_command = C_IFLUSH;
CharReqHdr.r_length = sizeof(request); CharReqHdr.r_length = sizeof(request);
execrh((request FAR *) & CharReqHdr, (struct dhdr FAR *)finddev(ATTR_CONIN)); execrh((request FAR *) & CharReqHdr, syscon);
} }
static VOID kbfill(keyboard FAR * kp, UCOUNT c, BOOL ctlf, UWORD * vp) static VOID kbfill(keyboard FAR * kp, UCOUNT c, BOOL ctlf, UWORD * vp)
{ {
if (kp->kb_count > kp->kb_size) if (kp->kb_count > kp->kb_size)
{ {
sto(BELL); cso(BELL);
return; return;
} }
kp->kb_buf[kp->kb_count++] = c; kp->kb_buf[kp->kb_count++] = c;
@ -290,7 +298,7 @@ static VOID kbfill(keyboard FAR * kp, UCOUNT c, BOOL ctlf, UWORD * vp)
} }
else else
{ {
sto(c); cso(c);
if (c != HT) if (c != HT)
++ * vp; ++ * vp;
else else
@ -402,16 +410,16 @@ UCOUNT sti(keyboard FAR * kp)
return kp->kb_count; return kp->kb_count;
case LF: case LF:
sto(CR); cso(CR);
sto(LF); cso(LF);
break; break;
case ESC: case ESC:
sto('\\'); cso('\\');
sto(CR); cso(CR);
sto(LF); cso(LF);
for (c = 0; c < cu_pos; c++) for (c = 0; c < cu_pos; c++)
sto(' '); cso(' ');
kp->kb_count = init_count; kp->kb_count = init_count;
eof = FALSE; eof = FALSE;
break; break;

View File

@ -80,6 +80,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.22 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.21 2001/04/21 22:32:53 bartoldeman * Revision 1.21 2001/04/21 22:32:53 bartoldeman
* Init DS=Init CS, fixed stack overflow problems and misc bugs. * Init DS=Init CS, fixed stack overflow problems and misc bugs.
* *
@ -235,7 +238,7 @@ struct config Config
NFCBS, NFCBS,
0, 0,
"command.com", "command.com",
" /P\r\n", " /P /E:256\r\n",
NLAST, NLAST,
NSTACKS, NSTACKS,
128 128
@ -258,7 +261,8 @@ static COUNT nPass;
static BYTE szLine[256]; static BYTE szLine[256];
static BYTE szBuf[256]; static BYTE szBuf[256];
int singleStep; int singleStep = FALSE;
int SkipAllConfig = FALSE;
INIT VOID zumcb_init(mcb FAR * mcbp, UWORD size); INIT VOID zumcb_init(mcb FAR * mcbp, UWORD size);
INIT VOID mumcb_init(mcb FAR * mcbp, UWORD size); INIT VOID mumcb_init(mcb FAR * mcbp, UWORD size);
@ -407,9 +411,11 @@ INIT void PreConfig(void)
/* FCBp = (sfttbl FAR *) /* FCBp = (sfttbl FAR *)
KernelAlloc(sizeof(sftheader) KernelAlloc(sizeof(sftheader)
+ Config.cfgFiles * sizeof(sft));*/ + Config.cfgFiles * sizeof(sft));*/
sfthead = (sfttbl FAR *) sfthead->sftt_next = (sfttbl FAR *)
KernelAlloc(sizeof(sftheader) KernelAlloc(sizeof(sftheader)
+ Config.cfgFiles * sizeof(sft)); + (Config.cfgFiles-5) * sizeof(sft));
sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1;
sfthead->sftt_next->sftt_count = Config.cfgFiles-5;
CDSp = (cdstbl FAR *) CDSp = (cdstbl FAR *)
KernelAlloc(0x58 * lastdrive); KernelAlloc(0x58 * lastdrive);
@ -420,7 +426,7 @@ INIT void PreConfig(void)
#ifdef DEBUG #ifdef DEBUG
printf("Preliminary f_node allocated at at 0x%p\n",f_nodes); printf("Preliminary f_node allocated at at 0x%p\n",f_nodes);
printf("Preliminary FCB table allocated at 0x%p\n",FCBp); printf("Preliminary FCB table allocated at 0x%p\n",FCBp);
printf("Preliminary sft table allocated at 0x%p\n",sfthead); printf("Preliminary sft table allocated at 0x%p\n",sfthead->sftt_next);
printf("Preliminary CDS table allocated at 0x%p\n",CDSp); printf("Preliminary CDS table allocated at 0x%p\n",CDSp);
printf("Preliminary DPB table allocated at 0x%p\n",DPBp); printf("Preliminary DPB table allocated at 0x%p\n",DPBp);
#endif #endif
@ -493,9 +499,11 @@ INIT void PostConfig(void)
/* FCBp = (sfttbl FAR *) /* FCBp = (sfttbl FAR *)
KernelAlloc(sizeof(sftheader) KernelAlloc(sizeof(sftheader)
+ Config.cfgFiles * sizeof(sft));*/ + Config.cfgFiles * sizeof(sft));*/
sfthead = (sfttbl FAR *) sfthead->sftt_next = (sfttbl FAR *)
KernelAlloc(sizeof(sftheader) KernelAlloc(sizeof(sftheader)
+ Config.cfgFiles * sizeof(sft)); + (Config.cfgFiles-5) * sizeof(sft));
sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1;
sfthead->sftt_next->sftt_count = Config.cfgFiles-5;
CDSp = (cdstbl FAR *) CDSp = (cdstbl FAR *)
KernelAlloc(0x58 * lastdrive); KernelAlloc(0x58 * lastdrive);
@ -507,7 +515,7 @@ INIT void PostConfig(void)
#ifdef DEBUG #ifdef DEBUG
printf("f_node allocated at 0x%p\n",f_nodes); printf("f_node allocated at 0x%p\n",f_nodes);
printf("FCB table allocated at 0x%p\n",FCBp); printf("FCB table allocated at 0x%p\n",FCBp);
printf("sft table allocated at 0x%p\n",sfthead); printf("sft table allocated at 0x%p\n",sfthead->sftt_next);
printf("CDS table allocated at 0x%p\n",CDSp); printf("CDS table allocated at 0x%p\n",CDSp);
printf("DPB table allocated at 0x%p\n",DPBp); printf("DPB table allocated at 0x%p\n",DPBp);
#endif #endif
@ -695,18 +703,18 @@ INIT VOID DoConfig(VOID)
if (pEntry->pass < 0 || pEntry->pass == nPass) if (pEntry->pass < 0 || pEntry->pass == nPass)
{ {
if (!singleStep || !SkipLine(pLineStart)) if ( !SkipLine(pLineStart))
{ {
skipwh(pLine); pLine = skipwh(pLine);
if ('=' != *pLine) if ('=' != *pLine)
CfgFailure(pLine); CfgFailure(pLine);
else else
(*(pEntry->func)) (++pLine); (*(pEntry->func)) (skipwh(pLine+1));
} }
} }
} }
skipLine:nCfgLine++; nCfgLine++;
pLine += strlen(pLine) + 1; pLine += strlen(pLine) + 1;
} }
} }
@ -725,20 +733,124 @@ INIT struct table *LookUp(struct table *p, BYTE * token)
return p; return p;
} }
/*
get BIOS key with timeout:
timeout < 0: no timeout
timeout = 0: poll only once
timeout > 0: timeout in seconds
return
0xffff : no key hit
0xHH.. : scancode in upper half
0x..LL : asciicode in lower half
*/
ULONG GetBiosTime(VOID)
{
return *(ULONG FAR *)(MK_FP(0x40,0x6c));
}
GetBiosKey(int timeout)
{
iregs r;
ULONG startTime = GetBiosTime();
for (;;)
{
r.a.x = 0x0100; /* are there keys available ? */
init_call_intr(0x16,&r);
if ((r.flags & 0x40) == 0) /* yes - fetch and return */
{
r.a.x = 0x0000;
init_call_intr(0x16,&r);
return r.a.x;
}
if (timeout < 0)
continue;
if (GetBiosTime() - startTime >= timeout*18)
break;
}
return 0xffff;
}
INIT BOOL SkipLine(char *pLine) INIT BOOL SkipLine(char *pLine)
{ {
char kbdbuf[16]; short key;
char *pKbd = kbdbuf;
printf("%s [Y,N]?", pLine); static char initialized = FALSE;
read(STDIN, kbdbuf, 12);
pKbd = skipwh(pKbd); if (!initialized)
{
if (*pKbd == 'n' || *pKbd == 'N') initialized = TRUE;
printf("Press F8 to trace or F5 to skip CONFIG.SYS/AUTOEXEC.BAT");
key = GetBiosKey(2); /* wait 2 seconds */
if (key == 0x3f00) /* F5 */
{
SkipAllConfig = TRUE;
}
if (key == 0x4200) /* F8 */
{
singleStep = TRUE;
}
printf("\r%79s\r",""); /* clear line */
if (SkipAllConfig)
printf("Skipping CONFIG.SYS/AUTOEXEC.BAT\n");
}
if (SkipAllConfig)
return TRUE; return TRUE;
return FALSE; if (!singleStep)
return FALSE;
printf("%s[Y,N]?", pLine);
for (;;)
{
key = GetBiosKey(-1);
switch(toupper(key & 0x00ff))
{
case 'N':
case 'n':
printf("N");
return TRUE;
case 0x1b: /* don't know where documented
ESCAPE answers all following questions
with YES
*/
singleStep = FALSE; /* and fall through */
case '\r':
case '\n':
case 'Y':
case 'y':
printf("Y");
return FALSE;
}
if (key == 0x3f00) /* YES, you may hit F5 here, too */
{
printf("N");
SkipAllConfig = TRUE;
return TRUE;
}
}
} }
INIT BYTE *GetNumArg(BYTE * pLine, COUNT * pnArg) INIT BYTE *GetNumArg(BYTE * pLine, COUNT * pnArg)
@ -1103,12 +1215,35 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
{ {
strcpy(szBuf, pLine); strcpy(szBuf, pLine);
/* add \r\n to the command line */
strcat(szBuf, "\r\n");
/* TE this fixes the loading of devices drivers with /* TE this fixes the loading of devices drivers with
multiple devices in it. NUMEGA's SoftIce is such a beast multiple devices in it. NUMEGA's SoftIce is such a beast
*/ */
/* that's a nice hack >:-)
although we don't want HIMEM.SYS,(it's not free), other people
might load HIMEM.SYS to see if they are compatible to it.
if it's HIMEM.SYS, we won't survive TESTMEM:ON
so simply add TESTMEM:OFF to the commandline
*/
if (DosLoadedInHMA)
if (stristr(szBuf, "HIMEM.SYS") != NULL)
{
if (stristr(szBuf, "/TESTMEM:OFF") == NULL)
{
strcat(szBuf, " /TESTMEM:OFF");
}
}
/* end of HIMEM.SYS HACK */
/* add \r\n to the command line */
strcat(szBuf, "\r\n");
for (next_dhp=NULL; FP_OFF(next_dhp) != 0xffff && for (next_dhp=NULL; FP_OFF(next_dhp) != 0xffff &&
(result=init_device(dhp, szBuf, mode, top))==SUCCESS (result=init_device(dhp, szBuf, mode, top))==SUCCESS
; dhp = next_dhp) ; dhp = next_dhp)

View File

@ -37,6 +37,9 @@ static BYTE *dosfnsRcsId = "$Id$";
* /// Added SHARE support. 2000/09/04 Ron Cemer * /// Added SHARE support. 2000/09/04 Ron Cemer
* *
* $Log$ * $Log$
* Revision 1.17 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.16 2001/04/21 22:32:53 bartoldeman * Revision 1.16 2001/04/21 22:32:53 bartoldeman
* Init DS=Init CS, fixed stack overflow problems and misc bugs. * Init DS=Init CS, fixed stack overflow problems and misc bugs.
* *
@ -510,72 +513,49 @@ UCOUNT DosWrite(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err)
else else
{ {
REG WORD /*c,*/ REG WORD /*c,*/
cnt = n, cnt = n,
spaces_left = 0, xfer = 0;
next_pos,
xfer = 0;
static BYTE space = ' ';
start: while(cnt-- != 0 && *bp != CTL_Z){
if (cnt-- == 0) if (s->sft_flags & SFT_FCONOUT)
goto end;
if (*bp == CTL_Z)
goto end;
if (s->sft_flags & SFT_FCONOUT)
{
switch (*bp)
{ {
case CR: switch (*bp)
next_pos = 0; {
break; case CR:
case LF: scr_pos = 0;
case BELL: break;
next_pos = scr_pos; case LF:
break; case BELL:
case BS: break;
next_pos = scr_pos ? scr_pos - 1 : 0; case BS:
break; scr_pos = scr_pos ? scr_pos - 1 : 0;
case HT: break;
spaces_left = 8 - (scr_pos & 7); case HT:
next_pos = scr_pos + spaces_left; do cso(' '); while ((++scr_pos) & 7);
goto output_space; default:
default: scr_pos++;
next_pos = scr_pos + 1; }
if (*bp != HT) cso(*bp);
}
else
{
rq.r_length = sizeof(request);
rq.r_command = C_OUTPUT;
rq.r_count = 1;
rq.r_trans = bp;
rq.r_status = 0;
execrh((request FAR *) & rq, s->sft_dev);
if (rq.r_status & S_ERROR)
char_error(&rq, s->sft_dev);
}
++bp;
++xfer;
if (break_ena && control_break())
{
handle_break();
break;
} }
} }
rq.r_length = sizeof(request);
rq.r_command = C_OUTPUT;
rq.r_count = 1;
rq.r_trans = bp;
rq.r_status = 0;
execrh((request FAR *) & rq, s->sft_dev);
if (rq.r_status & S_ERROR)
char_error(&rq, s->sft_dev);
goto post;
output_space:
rq.r_length = sizeof(request);
rq.r_command = C_OUTPUT;
rq.r_count = 1;
rq.r_trans = &space;
rq.r_status = 0;
execrh((request FAR *) & rq, s->sft_dev);
if (rq.r_status & S_ERROR)
char_error(&rq, s->sft_dev);
--spaces_left;
post:
if (spaces_left)
goto output_space;
++bp;
++xfer;
if (s->sft_flags & SFT_FCONOUT)
scr_pos = next_pos;
if (break_ena && control_break())
{
handle_break();
goto end;
}
goto start;
end:
*err = SUCCESS; *err = SUCCESS;
return xfer; return xfer;
} }
@ -724,17 +704,17 @@ sft FAR *get_free_sft(WORD FAR * sft_idx)
/* Get the SFT block that contains the SFT */ /* Get the SFT block that contains the SFT */
for (sp = sfthead; sp != (sfttbl FAR *) - 1; sp = sp->sftt_next) for (sp = sfthead; sp != (sfttbl FAR *) - 1; sp = sp->sftt_next)
{ {
REG WORD i; REG COUNT i = sp->sftt_count;
sft FAR *sfti = sp->sftt_table;
for (i = 0; i < sp->sftt_count; i++) for(sys_idx += i; i >= 1 ; sfti++, i--)
{ {
if (sp->sftt_table[i].sft_count == 0) if (sfti->sft_count == 0)
{ {
*sft_idx = sys_idx + i; *sft_idx = sys_idx - i;
return (sft FAR *) & sp->sftt_table[sys_idx + i]; return sfti;
} }
} }
sys_idx += i;
} }
/* If not found, return an error */ /* If not found, return an error */
return (sft FAR *) - 1; return (sft FAR *) - 1;
@ -1251,12 +1231,75 @@ COUNT DosChangeDir(BYTE FAR * s)
COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name) COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
{ {
COUNT nDrive;
REG dmatch FAR *dmp = (dmatch FAR *) dta;
/* /// Added code here to do matching against device names.
DOS findfirst will match exact device names if the
filename portion (excluding the extension) contains
a valid device name.
Credits: some of this code was ripped off from truename()
in newstuff.c.
- 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. */
dmp->dm_attr_fnd = D_DEVICE;
dmp->dm_time = dos_gettime();
dmp->dm_date = dos_getdate();
fstrncpy(dmp->dm_name, get_root(name), FNAME_SIZE+FEXT_SIZE+1);
return SUCCESS;
}
/* /// End of additions. - Ron Cemer ; heavily edited - Bart Oldeman */
return dos_findfirst(attr, name); return dos_findfirst(attr, name);
} }
COUNT DosFindNext(void) COUNT DosFindNext(void)
{ {
return dos_findnext();
/* /// findnext will always fail on a device name. - Ron Cemer */
if (((dmatch FAR *)dta)->dm_attr_fnd == D_DEVICE)
return DE_NFILES;
/*
* The new version of SHSUCDX 1.0 looks at the dm_drive byte to
* test 40h. I used RamView to see location MSD 116:04be and
* FD f??:04be, the byte set with 0xc4 = Remote/Network drive 4.
* Ralf Brown docs for dos 4eh say bit 7 set == remote so what is
* bit 6 for?
* SHSUCDX Mod info say "test redir not network bit".
* Just to confuse the rest, MSCDEX sets bit 5 too.
*
* So, assume bit 6 is redirector and bit 7 is network.
* jt
* Bart: dm_drive can be the drive _letter_.
* but better just stay independent of it: we only use
* bit 7 to detect a network drive; the rest untouched.
* RBIL says that findnext can only return one error type anyway
* (12h, DE_NFILES)
*/
#if 0
printf("findnext: %d\n",
((dmatch FAR *)dta)->dm_drive);
#endif
return (((dmatch FAR *)dta)->dm_drive & 0x80) ?
-Remote_find(REM_FINDNEXT, 0, NULL) :
dos_findnext();
} }
COUNT DosGetFtime(COUNT hndl, date FAR * dp, time FAR * tp) COUNT DosGetFtime(COUNT hndl, date FAR * dp, time FAR * tp)

View File

@ -32,6 +32,9 @@ static BYTE *dskRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.16 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.15 2001/04/16 01:45:26 bartoldeman * Revision 1.15 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs * Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
* *
@ -172,18 +175,17 @@ BOOL fl_format();
extern BYTE FAR nblk_rel; extern BYTE FAR nblk_rel;
/* this buffer must not overlap a 64K boundary
due to DMA transfers
this is certainly true, if located somewhere
at 0xf+1000 and must hold already during BOOT time
*/
union union
{ {
BYTE bytes[1 * SEC_SIZE]; BYTE bytes[1 * SEC_SIZE];
boot boot_sector; boot boot_sector;
} buffer; } DiskTransferBuffer;
/* if the buffer above is good enough for booting
it's also good enough for DMA input */
BYTE /* scratchpad used for working around */
FAR * dma_scratch_buffer = (BYTE FAR *)&buffer; /* DMA transfers during disk I/O */
STATIC struct media_info STATIC struct media_info
@ -194,16 +196,21 @@ STATIC struct media_info
UWORD mi_sectors; /* number of sectors/cyl */ UWORD mi_sectors; /* number of sectors/cyl */
ULONG mi_offset; /* relative partition offset */ ULONG mi_offset; /* relative partition offset */
BYTE mi_drive; /* BIOS drive number */ BYTE mi_drive; /* BIOS drive number */
COUNT mi_partidx; /* Index to partition array */
ULONG mi_FileOC; /* Count of Open files on Drv */ ULONG mi_FileOC; /* Count of Open files on Drv */
UWORD mi_BeginCylinder;
BYTE mi_BeginHead;
BYTE mi_BeginSector;
struct FS_info
{
ULONG serialno;
BYTE volume[11];
BYTE fstype[8];
}fs;
}; };
static struct FS_info
{
ULONG fs_serialno;
BYTE fs_volume[11];
BYTE fs_fstype[8];
};
static struct Access_info static struct Access_info
{ {
@ -212,7 +219,6 @@ static struct Access_info
}; };
STATIC struct media_info miarray[NDEV]; /* Internal media info structs */ 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 bpbarray[NDEV]; /* BIOS parameter blocks */
STATIC bpb *bpbptrs[NDEV]; /* pointers to bpbs */ STATIC bpb *bpbptrs[NDEV]; /* pointers to bpbs */
@ -224,26 +230,9 @@ struct media_info *getPMiarray(int dev) { return &miarray[dev];}
table partition */ table partition */
STATIC COUNT nUnits; /* number of returned units */ STATIC COUNT nUnits; /* number of returned units */
STATIC COUNT nPartitions; /* number of DOS partitions */
#define PARTOFF 0x1be #define PARTOFF 0x1be
STATIC struct dos_partitionS
{
BYTE peDrive; /* BIOS drive number */
BYTE peBootable;
BYTE peBeginHead;
BYTE peBeginSector;
UWORD peBeginCylinder;
BYTE peFileSystem;
BYTE peEndHead;
BYTE peEndSector;
UWORD peEndCylinder;
LONG peStartSector;
LONG peSectors;
LONG peAbsStart; /* Absolute sector start */
}
dos_partition[NDEV - 2];
#ifdef PROTO #ifdef PROTO
WORD _dsk_init(rqptr), WORD _dsk_init(rqptr),
@ -376,12 +365,12 @@ ULONG StartSector(WORD ptDrive, unsigned BeginCylinder,
if (startPos != oldStartPos) if (startPos != oldStartPos)
{ {
printf("PART TABLE mismatch for drive %x, CHS=%d %d %d, startsec %d, offset %ld\n", PartCodePrintf(("PART TABLE mismatch for drive %x, CHS=%d %d %d, startsec %d, offset %ld\n",
ptDrive, BeginCylinder, BeginHead,BeginSector, ptDrive, BeginCylinder, BeginHead,BeginSector,
peStartSector, ptAccuOff); peStartSector, ptAccuOff));
printf(" old startpos = %ld, new startpos = %ld, using new\n", PartCodePrintf((" old startpos = %ld, new startpos = %ld, using new\n",
oldStartPos, startPos); oldStartPos, startPos));
} }
return startPos; return startPos;
@ -516,7 +505,7 @@ restart: /* yes, it's a GOTO >:-) */
for ( retry = N_RETRY; --retry >= 0; ) for ( retry = N_RETRY; --retry >= 0; )
{ {
ret = fl_read((WORD) ptDrive, (WORD) ptHead, (WORD) ptCylinder, ret = fl_read((WORD) ptDrive, (WORD) ptHead, (WORD) ptCylinder,
(WORD) ptSector, (WORD) 1, (byteptr) & buffer); (WORD) ptSector, (WORD) 1, (byteptr) & DiskTransferBuffer);
if (ret == 0) if (ret == 0)
break; break;
} }
@ -525,7 +514,7 @@ restart: /* yes, it's a GOTO >:-) */
/* Read each partition into temporary array */ /* Read each partition into temporary array */
p = (BYTE *) & buffer.bytes[PARTOFF]; p = (BYTE *) & DiskTransferBuffer.bytes[PARTOFF];
for (ptemp_part = &temp_part[0]; for (ptemp_part = &temp_part[0];
ptemp_part < &temp_part[N_PART]; ptemp_part++) ptemp_part < &temp_part[N_PART]; ptemp_part++)
@ -585,12 +574,10 @@ restart: /* yes, it's a GOTO >:-) */
ptemp_part->peFileSystem == FAT16SMALL || ptemp_part->peFileSystem == FAT16SMALL ||
ptemp_part->peFileSystem == FAT16LARGE ) ptemp_part->peFileSystem == FAT16LARGE )
{ {
struct dos_partitionS *pdos_partition;
struct media_info *pmiarray = getPMiarray(nUnits); struct media_info *pmiarray = getPMiarray(nUnits);
pmiarray->mi_drive = ptDrive; pmiarray->mi_drive = ptDrive;
pmiarray->mi_partidx = nPartitions;
pmiarray->mi_offset = StartSector(ptDrive, pmiarray->mi_offset = StartSector(ptDrive,
ptemp_part->peBeginCylinder, ptemp_part->peBeginCylinder,
@ -599,34 +586,13 @@ restart: /* yes, it's a GOTO >:-) */
ptemp_part->peStartSector, ptemp_part->peStartSector,
ptAccuOff); ptAccuOff);
pmiarray->mi_BeginCylinder = ptemp_part->peBeginCylinder;
pmiarray->mi_BeginHead = ptemp_part->peBeginHead;
pmiarray->mi_BeginSector = ptemp_part->peBeginSector;
nUnits++; nUnits++;
pdos_partition = &dos_partition[nPartitions];
pdos_partition->peDrive = ptDrive;
pdos_partition->peBootable = ptemp_part->peBootable;
pdos_partition->peBeginHead = ptemp_part->peBeginHead;
pdos_partition->peBeginSector = ptemp_part->peBeginSector;
pdos_partition->peBeginCylinder=ptemp_part->peBeginCylinder;
pdos_partition->peFileSystem =ptemp_part->peFileSystem;
pdos_partition->peEndHead =ptemp_part->peEndHead;
pdos_partition->peEndSector =ptemp_part->peEndSector;
pdos_partition->peEndCylinder =ptemp_part->peEndCylinder;
pdos_partition->peStartSector =ptemp_part->peStartSector;
pdos_partition->peSectors =ptemp_part->peSectors;
pdos_partition->peAbsStart =ptemp_part->peStartSector + ptAccuOff;
PartCodePrintf(("DOS PARTITION drive %x CHS %x-%x-%x %x-%x-%x %lx %lx %lx FS %x\n",
pdos_partition->peDrive,
pdos_partition->peBeginCylinder,pdos_partition->peBeginHead ,pdos_partition->peBeginSector ,
pdos_partition->peEndCylinder ,pdos_partition->peEndHead ,pdos_partition->peEndSector ,
pdos_partition->peStartSector ,
pdos_partition->peSectors ,
pdos_partition->peAbsStart ,
pdos_partition->peFileSystem
));
nPartitions++;
PartitionDone |= partMask; PartitionDone |= partMask;
@ -695,8 +661,6 @@ WORD _dsk_init(rqptr rp)
/* Initial number of disk units */ /* Initial number of disk units */
nUnits = 2; nUnits = 2;
/* Initial number of DOS partitions */
nPartitions = 0;
/* Setup media info and BPBs arrays */ /* Setup media info and BPBs arrays */
for (Unit = 0; Unit < NDEV; Unit++) for (Unit = 0; Unit < NDEV; Unit++)
@ -710,7 +674,12 @@ WORD _dsk_init(rqptr rp)
pmiarray->mi_offset = 0l; pmiarray->mi_offset = 0l;
pmiarray->mi_drive = Unit; pmiarray->mi_drive = Unit;
fsarray[Unit].fs_serialno = 0x12345678l; pmiarray->mi_BeginCylinder = 0; /* initialize for floppies */
pmiarray->mi_BeginHead = 0;
pmiarray->mi_BeginSector = 1;
pmiarray->fs.serialno = 0x12345678l;
pbpbarray = getPBpbarray(Unit); pbpbarray = getPBpbarray(Unit);
@ -802,35 +771,17 @@ static WORD mediachk(rqptr rp)
STATIC WORD RWzero(rqptr rp, WORD t) STATIC WORD RWzero(rqptr rp, WORD t)
{ {
REG retry = N_RETRY; REG retry = N_RETRY;
WORD head,track,sector,ret; WORD ret;
struct media_info *pmiarray = getPMiarray(rp->r_unit);
if (hd(miarray[rp->r_unit].mi_drive))
{
COUNT partidx = miarray[rp->r_unit].mi_partidx;
head = dos_partition[partidx].peBeginHead;
track = dos_partition[partidx].peBeginCylinder;
sector = dos_partition[partidx].peBeginSector;
}
else
{
head = 0;
sector = 1;
track = 0;
}
do do
{ {
if (!t) /* 0 == Read */ ret = (t == 0 ? fl_read : fl_write)(
{ (WORD) pmiarray->mi_drive,
ret = fl_read((WORD) miarray[rp->r_unit].mi_drive, (WORD) pmiarray->mi_BeginHead,
(WORD) head, (WORD) track, (WORD) sector, (WORD) 1, (byteptr) & buffer); (WORD) pmiarray->mi_BeginCylinder,
} (WORD) pmiarray->mi_BeginSector,
else (WORD) 1, (byteptr) & DiskTransferBuffer);
{
ret = fl_write((WORD) miarray[rp->r_unit].mi_drive,
(WORD) head, (WORD) track, (WORD) sector, (WORD) 1, (byteptr) & buffer);
}
} }
while (ret != 0 && --retry > 0); while (ret != 0 && --retry > 0);
return ret; return ret;
@ -885,10 +836,7 @@ static WORD blk_Media(rqptr rp)
STATIC WORD bldbpb(rqptr rp) STATIC WORD bldbpb(rqptr rp)
{ {
ULONG count/*, i*/; ULONG count;
/* byteptr trans;*/
/* WORD local_word;*/
/*TE*/
bpb *pbpbarray; bpb *pbpbarray;
struct media_info *pmiarray; struct media_info *pmiarray;
WORD head,/*track,*/sector,ret; WORD head,/*track,*/sector,ret;
@ -901,31 +849,29 @@ STATIC WORD bldbpb(rqptr rp)
/*TE ~ 200 bytes*/ /*TE ~ 200 bytes*/
pbpbarray = getPBpbarray(rp->r_unit); pbpbarray = getPBpbarray(rp->r_unit);
getword(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_NBYTE]), &pbpbarray->bpb_nbyte); getword(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB]))[BPB_NBYTE]), &pbpbarray->bpb_nbyte);
getbyte(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_NSECTOR]), &pbpbarray->bpb_nsector); getbyte(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB]))[BPB_NSECTOR]), &pbpbarray->bpb_nsector);
getword(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_NRESERVED]), &pbpbarray->bpb_nreserved); getword(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB]))[BPB_NRESERVED]), &pbpbarray->bpb_nreserved);
getbyte(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_NFAT]), &pbpbarray->bpb_nfat); getbyte(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB]))[BPB_NFAT]), &pbpbarray->bpb_nfat);
getword(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_NDIRENT]), &pbpbarray->bpb_ndirent); getword(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB]))[BPB_NDIRENT]), &pbpbarray->bpb_ndirent);
getword(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_NSIZE]), &pbpbarray->bpb_nsize); getword(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB]))[BPB_NSIZE]), &pbpbarray->bpb_nsize);
getword(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_NSIZE]), &pbpbarray->bpb_nsize); getword(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB]))[BPB_NSIZE]), &pbpbarray->bpb_nsize);
getbyte(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_MDESC]), &pbpbarray->bpb_mdesc); getbyte(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB]))[BPB_MDESC]), &pbpbarray->bpb_mdesc);
getword(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_NFSECT]), &pbpbarray->bpb_nfsect); getword(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB]))[BPB_NFSECT]), &pbpbarray->bpb_nfsect);
getword(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_NSECS]), &pbpbarray->bpb_nsecs); getword(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB]))[BPB_NSECS]), &pbpbarray->bpb_nsecs);
getword(&((((BYTE *) & buffer.bytes[BT_BPB]))[BPB_NHEADS]), &pbpbarray->bpb_nheads); getword(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB]))[BPB_NHEADS]), &pbpbarray->bpb_nheads);
getlong(&((((BYTE *) & buffer.bytes[BT_BPB])[BPB_HIDDEN])), &pbpbarray->bpb_hidden); getlong(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB])[BPB_HIDDEN])), &pbpbarray->bpb_hidden);
getlong(&((((BYTE *) & buffer.bytes[BT_BPB])[BPB_HUGE])), &pbpbarray->bpb_huge); getlong(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB])[BPB_HUGE])), &pbpbarray->bpb_huge);
pmiarray = getPMiarray(rp->r_unit);
/* Needs fat32 offset code */ /* Needs fat32 offset code */
getlong(&((((BYTE *) & buffer.bytes[0x27])[0])), &fsarray[rp->r_unit].fs_serialno); getlong(&((((BYTE *) & DiskTransferBuffer.bytes[0x27])[0])), &pmiarray->fs.serialno);
/*TE
for(i = 0; i < 11 ;i++ ) memcpy(pmiarray->fs.volume,&DiskTransferBuffer.bytes[0x2B], 11);
fsarray[rp->r_unit].fs_volume[i] = buffer.bytes[0x2B + i]; memcpy(pmiarray->fs.fstype,&DiskTransferBuffer.bytes[0x36], 8);
for(i = 0; i < 8; i++ )
fsarray[rp->r_unit].fs_fstype[i] = buffer.bytes[0x36 + i];
*/
memcpy(fsarray[rp->r_unit].fs_volume,&buffer.bytes[0x2B], 11);
memcpy(fsarray[rp->r_unit].fs_fstype,&buffer.bytes[0x36], 8);
@ -941,17 +887,16 @@ STATIC WORD bldbpb(rqptr rp)
#endif #endif
rp->r_bpptr = pbpbarray; rp->r_bpptr = pbpbarray;
pmiarray = getPMiarray(rp->r_unit);
count = pmiarray->mi_size = count = pmiarray->mi_size =
pbpbarray->bpb_nsize == 0 ? pbpbarray->bpb_nsize == 0 ?
pbpbarray->bpb_huge : pbpbarray->bpb_huge :
pbpbarray->bpb_nsize; pbpbarray->bpb_nsize;
getword((&(((BYTE *) & buffer.bytes[BT_BPB])[BPB_NHEADS])), &pmiarray->mi_heads); getword((&(((BYTE *) & DiskTransferBuffer.bytes[BT_BPB])[BPB_NHEADS])), &pmiarray->mi_heads);
head = pmiarray->mi_heads; head = pmiarray->mi_heads;
getword((&(((BYTE *) & buffer.bytes[BT_BPB])[BPB_NSECS])), &pmiarray->mi_sectors); getword((&(((BYTE *) & DiskTransferBuffer.bytes[BT_BPB])[BPB_NSECS])), &pmiarray->mi_sectors);
if (pmiarray->mi_size == 0) if (pmiarray->mi_size == 0)
getlong(&((((BYTE *) & buffer.bytes[BT_BPB])[BPB_HUGE])), &pmiarray->mi_size); getlong(&((((BYTE *) & DiskTransferBuffer.bytes[BT_BPB])[BPB_HUGE])), &pmiarray->mi_size);
sector = pmiarray->mi_sectors; sector = pmiarray->mi_sectors;
if (head == 0 || sector == 0) if (head == 0 || sector == 0)
@ -1001,17 +946,19 @@ static WORD IoctlQueblk(rqptr rp)
static WORD Genblkdev(rqptr rp) static WORD Genblkdev(rqptr rp)
{ {
int ret; int ret;
struct media_info *pmiarray = getPMiarray(rp->r_unit);
switch(rp->r_count){ switch(rp->r_count){
case 0x0860: /* get device parameters */ case 0x0860: /* get device parameters */
{ {
struct gblkio FAR * gblp = (struct gblkio FAR *) rp->r_trans; struct gblkio FAR * gblp = (struct gblkio FAR *) rp->r_trans;
REG COUNT x = 5,y = 1,z = 0; REG COUNT x = 5,y = 1,z = 0;
if (!hd(miarray[rp->r_unit].mi_drive)){ if (!hd(pmiarray->mi_drive)){
y = 2; y = 2;
x = 8; /* any odd ball drives return this */ x = 8; /* any odd ball drives return this */
if (miarray[rp->r_unit].mi_size <= 0xffff) if (pmiarray->mi_size <= 0xffff)
switch((UWORD)miarray[rp->r_unit].mi_size) switch((UWORD)pmiarray->mi_size)
{ {
case 640: case 640:
case 720: /* 320-360 */ case 720: /* 320-360 */
@ -1035,7 +982,7 @@ static WORD Genblkdev(rqptr rp)
gblp->gbio_devtype = (UBYTE) x; gblp->gbio_devtype = (UBYTE) x;
gblp->gbio_devattrib = (UWORD) y; gblp->gbio_devattrib = (UWORD) y;
gblp->gbio_media = (UBYTE) z; gblp->gbio_media = (UBYTE) z;
gblp->gbio_ncyl = miarray[rp->r_unit].mi_cyls; gblp->gbio_ncyl = pmiarray->mi_cyls;
fmemcpy(&gblp->gbio_bpb, &bpbarray[rp->r_unit], sizeof(gblp->gbio_bpb)); fmemcpy(&gblp->gbio_bpb, &bpbarray[rp->r_unit], sizeof(gblp->gbio_bpb));
gblp->gbio_nsecs = bpbarray[rp->r_unit].bpb_nsector; gblp->gbio_nsecs = bpbarray[rp->r_unit].bpb_nsector;
break; break;
@ -1043,24 +990,24 @@ static WORD Genblkdev(rqptr rp)
case 0x0866: /* get volume serial number */ case 0x0866: /* get volume serial number */
{ {
struct Gioc_media FAR * gioc = (struct Gioc_media FAR *) rp->r_trans; struct Gioc_media FAR * gioc = (struct Gioc_media FAR *) rp->r_trans;
struct FS_info FAR * fs = &fsarray[rp->r_unit]; struct FS_info FAR * fs = &pmiarray->fs;
gioc->ioc_serialno = fs->fs_serialno; gioc->ioc_serialno = fs->serialno;
fmemcpy(gioc->ioc_volume,fs->fs_volume,11); fmemcpy(gioc->ioc_volume,fs->volume,11);
fmemcpy(gioc->ioc_fstype, fs->fs_fstype,8); fmemcpy(gioc->ioc_fstype, fs->fstype,8);
} }
break; break;
case 0x0846: /* set volume serial number */ case 0x0846: /* set volume serial number */
{ {
struct Gioc_media FAR * gioc = (struct Gioc_media FAR *) rp->r_trans; struct Gioc_media FAR * gioc = (struct Gioc_media FAR *) rp->r_trans;
struct FS_info FAR * fs = (struct FS_info FAR *) &buffer.bytes[0x27]; struct FS_info FAR * fs = (struct FS_info FAR *) &DiskTransferBuffer.bytes[0x27];
ret = RWzero( rp, 0); ret = RWzero( rp, 0);
if (ret != 0) if (ret != 0)
return (dskerr(ret)); return (dskerr(ret));
fs->fs_serialno = gioc->ioc_serialno; fs->serialno = gioc->ioc_serialno;
fsarray[rp->r_unit].fs_serialno = fs->fs_serialno; pmiarray->fs.serialno = fs->serialno;
ret = RWzero( rp, 1); ret = RWzero( rp, 1);
if (ret != 0) if (ret != 0)
@ -1093,13 +1040,16 @@ WORD blockio(rqptr rp)
COUNT(*action) (WORD, WORD, WORD, WORD, WORD, BYTE FAR *); COUNT(*action) (WORD, WORD, WORD, WORD, WORD, BYTE FAR *);
struct media_info *pmiarray = getPMiarray(rp->r_unit);
cmd = rp->r_command; cmd = rp->r_command;
total = 0; total = 0;
trans = rp->r_trans; trans = rp->r_trans;
tmark(); tmark();
remaining = rp->r_count; remaining = rp->r_count;
start = (rp->r_start != HUGECOUNT ? rp->r_start : rp->r_huge) start = (rp->r_start != HUGECOUNT ? rp->r_start : rp->r_huge)
+ miarray[rp->r_unit].mi_offset; + pmiarray->mi_offset;
while(remaining > 0) while(remaining > 0)
{ {
count = ltop(&track, &sector, &head, rp->r_unit, remaining, start, trans); count = ltop(&track, &sector, &head, rp->r_unit, remaining, start, trans);
@ -1127,7 +1077,7 @@ WORD blockio(rqptr rp)
if (count && FP_SEG(trans) != 0xffff) if (count && FP_SEG(trans) != 0xffff)
{ {
ret = action((WORD) miarray[rp->r_unit].mi_drive, head, track, sector, ret = action((WORD) pmiarray->mi_drive, head, track, sector,
count, trans); count, trans);
} }
else else
@ -1137,14 +1087,14 @@ WORD blockio(rqptr rp)
/* use scratchpad also, if going to HIGH memory */ /* use scratchpad also, if going to HIGH memory */
if (cmd != C_INPUT) if (cmd != C_INPUT)
fbcopy(trans, dma_scratch_buffer, SEC_SIZE); fbcopy(trans, &DiskTransferBuffer, SEC_SIZE);
ret = action((WORD) miarray[rp->r_unit].mi_drive, head, track, sector, ret = action((WORD) pmiarray->mi_drive, head, track, sector,
1, dma_scratch_buffer); 1, (byteptr)&DiskTransferBuffer);
if (cmd == C_INPUT) if (cmd == C_INPUT)
fbcopy(dma_scratch_buffer, trans, SEC_SIZE); fbcopy(&DiskTransferBuffer, trans, SEC_SIZE);
} }
if (ret != 0) if (ret != 0)
fl_reset((WORD) miarray[rp->r_unit].mi_drive); fl_reset((WORD) pmiarray->mi_drive);
} }
while (ret != 0 && --retry > 0); while (ret != 0 && --retry > 0);
if (ret != 0) if (ret != 0)

View File

@ -36,6 +36,9 @@ static BYTE *fatdirRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.15 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.14 2001/04/15 03:21:50 bartoldeman * Revision 1.14 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -549,7 +552,7 @@ COUNT dir_write(REG struct f_node FAR * fnp)
#endif #endif
} }
/* Now that we have a block, transfer the diectory */ /* Now that we have a block, transfer the directory */
/* entry into the block. */ /* entry into the block. */
if (bp == NULL) if (bp == NULL)
{ {
@ -660,54 +663,6 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
fbcopy((BYTE FAR *) SearchDir.dir_name, dmp->dm_name_pat, fbcopy((BYTE FAR *) SearchDir.dir_name, dmp->dm_name_pat,
FNAME_SIZE + FEXT_SIZE); FNAME_SIZE + FEXT_SIZE);
if (current_ldt->cdsFlags & CDSNETWDRV)
{
dmp->dm_drive |= 0x80;
return -Remote_find(REM_FINDFIRST, name, dmp);
}
/* /// Added code here to do matching against device names.
DOS findfirst will match exact device names if the
filename portion (excluding the extension) contains
a valid device name.
Credits: some of this code was ripped off from truename()
in newstuff.c.
- Ron Cemer */
if (!(attr & D_VOLID)) {
char Name[FNAME_SIZE];
int d, wild = 0;
for (d = 0; d < FNAME_SIZE; d++) {
if ((Name[d] = SearchDir.dir_name[d]) == '?') {
wild = 1;
break;
}
}
if (!wild) {
if (IsDevice(Name)) {
/* Found a matching device. */
dmp->dm_entry = 0;
dmp->dm_cluster = 0;
dmp->dm_flags.f_dmod = 0;
dmp->dm_flags.f_droot = 0;
dmp->dm_flags.f_dnew = 0;
dmp->dm_flags.f_ddir = 0;
dmp->dm_flags.f_dfull = 0;
dmp->dm_dirstart = 0;
dmp->dm_attr_fnd = D_DEVICE;
dmp->dm_time = dos_gettime();
dmp->dm_date = dos_getdate();
dmp->dm_size = 0L;
for (d = 0; ( (d < FNAME_SIZE) && (Name[d] != ' ') ); d++)
dmp->dm_name[d] = Name[d];
dmp->dm_name[d] = '\0';
return SUCCESS;
}
}
}
/* /// End of additions. - Ron Cemer */
/* Now search through the directory to find the entry... */ /* Now search through the directory to find the entry... */
/* Complete building the directory from the passed in */ /* Complete building the directory from the passed in */
@ -777,38 +732,6 @@ COUNT dos_findnext(void)
REG struct f_node FAR *fnp; REG struct f_node FAR *fnp;
BOOL found = FALSE; BOOL found = FALSE;
/* assign our match parameters pointer. */
dmp = (dmatch FAR *) dta;
/* /// findnext will always fail on a device name. - Ron Cemer */
if (dmp->dm_attr_fnd == D_DEVICE) return DE_FILENOTFND;
/*
* The new version of SHSUCDX 1.0 looks at the dm_drive byte to
* test 40h. I used RamView to see location MSD 116:04be and
* FD f??:04be, the byte set with 0xc4 = Remote/Network drive 4.
* Ralf Brown docs for dos 4eh say bit 7 set == remote so what is
* bit 6 for?
* SHSUCDX Mod info say "test redir not network bit".
* Just to confuse the rest, MSCDEX sets bit 5 too.
*
* So, assume bit 6 is redirector and bit 7 is network.
* jt
* Bart: dm_drive can be the drive _letter_.
* but better just stay independent of it: we only use
* bit 7 to detect a network drive; the rest untouched.
* RBIL says that findnext can only return one error type anyway
* (12h, DE_NFILES)
*/
#if 0
printf("findnext: %d\n",
dmp->dm_drive);
#endif
if (dmp->dm_drive & 0x80)
return -Remote_find(REM_FINDNEXT, 0, dmp);
/* Allocate an fnode if possible - error return (0) if not. */ /* Allocate an fnode if possible - error return (0) if not. */
if ((fnp = get_f_node()) == (struct f_node FAR *)0) if ((fnp = get_f_node()) == (struct f_node FAR *)0)
{ {

View File

@ -36,6 +36,9 @@ BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.17 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.16 2001/04/21 22:32:53 bartoldeman * Revision 1.16 2001/04/21 22:32:53 bartoldeman
* Init DS=Init CS, fixed stack overflow problems and misc bugs. * Init DS=Init CS, fixed stack overflow problems and misc bugs.
* *
@ -341,6 +344,14 @@ COUNT dos_close(COUNT fd)
if (fnp->f_mode != RDONLY) if (fnp->f_mode != RDONLY)
{ {
/*TE experimental */
if (fnp->f_flags.f_dmod)
{
fnp->f_dir.dir_attrib |= D_ARCHIVE;
fnp->f_dir.dir_time = dos_gettime();
fnp->f_dir.dir_date = dos_getdate();
}
fnp->f_dir.dir_size = fnp->f_highwater; fnp->f_dir.dir_size = fnp->f_highwater;
fnp->f_flags.f_dmod = TRUE; fnp->f_flags.f_dmod = TRUE;
merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */ merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */
@ -1888,6 +1899,9 @@ UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
fbcopy(buffer, (BYTE FAR *) & bp->b_buffer[fnp->f_boff], xfr_cnt); fbcopy(buffer, (BYTE FAR *) & bp->b_buffer[fnp->f_boff], xfr_cnt);
bp->b_flag |= BFR_DIRTY | BFR_VALID; bp->b_flag |= BFR_DIRTY | BFR_VALID;
fnp->f_flags.f_dmod = TRUE; /* mark file as modified */
/* update pointers and counters */ /* update pointers and counters */
ret_cnt += xfr_cnt; ret_cnt += xfr_cnt;
to_xfer -= xfr_cnt; to_xfer -= xfr_cnt;

View File

@ -69,7 +69,7 @@ extern fmemcmp(BYTE far *s1, BYTE FAR *s2, unsigned len);
#define NFILES 16 /* number of files in table */ #define NFILES 16 /* number of files in table */
#define NFCBS 16 /* number of fcbs */ #define NFCBS 16 /* number of fcbs */
#define NSTACKS 8 /* number of stacks */ #define NSTACKS 8 /* number of stacks */
#define NLAST 6 /* last drive */ #define NLAST 5 /* last drive */
#define NUMBUFF 6 /* Number of track buffers */ #define NUMBUFF 6 /* Number of track buffers */
/* -- must be at least 3 */ /* -- must be at least 3 */
@ -144,7 +144,8 @@ VOID FAR *HMAalloc(COUNT bytesToAllocate);
UWORD init_oem(void); UWORD init_oem(void);
/* intr.asm */ /* intr.asm */
/* void init_call_intr(int nr, iregs *rp); */
void init_call_intr(int nr, iregs *rp);
UCOUNT read(int fd, void *buf, UCOUNT count); UCOUNT read(int fd, void *buf, UCOUNT count);
int open(const char *pathname, int flags); int open(const char *pathname, int flags);
int close(int fd); int close(int fd);

View File

@ -80,6 +80,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.6 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.5 2001/04/21 22:32:53 bartoldeman * Revision 1.5 2001/04/21 22:32:53 bartoldeman
* Init DS=Init CS, fixed stack overflow problems and misc bugs. * Init DS=Init CS, fixed stack overflow problems and misc bugs.
* *
@ -494,6 +497,7 @@ void InstallVDISK(VOID)
setvec(0x19, MK_FP(0xffff,0x0010)); /* let INT 19 point to VDISK */ setvec(0x19, MK_FP(0xffff,0x0010)); /* let INT 19 point to VDISK */
*(WORD FAR *)MK_FP(0xffff,0x002e) = 1024+64;
} }

View File

@ -37,6 +37,9 @@ BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.23 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.22 2001/04/21 22:32:53 bartoldeman * Revision 1.22 2001/04/21 22:32:53 bartoldeman
* Init DS=Init CS, fixed stack overflow problems and misc bugs. * Init DS=Init CS, fixed stack overflow problems and misc bugs.
* *
@ -961,7 +964,11 @@ dispatch:
/* Get Country Information */ /* Get Country Information */
if((rc = DosGetCountryInformation(cntry, FP_DS_DX)) < 0) if((rc = DosGetCountryInformation(cntry, FP_DS_DX)) < 0)
goto error_invalid; goto error_invalid;
r->AX = r->BX = cntry; /* HACK FIXME */
if(cntry == (UWORD)-1)
cntry = 1;
/* END OF HACK */
r->AX = r->BX = cntry;
} }
} }
break; break;

View File

@ -97,7 +97,6 @@ _int3:
segment INIT_TEXT segment INIT_TEXT
%if 0
; ;
; void init_call_intr(nr, rp) ; void init_call_intr(nr, rp)
; REG int nr ; REG int nr
@ -159,7 +158,6 @@ init_intr?1:
ret ret
%endif
; ;
; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX) ; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX)
; ;

View File

@ -28,6 +28,9 @@
; $Header$ ; $Header$
; ;
; $Log$ ; $Log$
; Revision 1.9 2001/04/29 17:34:40 bartoldeman
; A new SYS.COM/config.sys single stepping/console output/misc fixes.
;
; Revision 1.8 2001/04/21 22:32:53 bartoldeman ; Revision 1.8 2001/04/21 22:32:53 bartoldeman
; Init DS=Init CS, fixed stack overflow problems and misc bugs. ; Init DS=Init CS, fixed stack overflow problems and misc bugs.
; ;
@ -81,6 +84,8 @@
extern _reloc_call_blk_driver extern _reloc_call_blk_driver
extern _reloc_call_clk_driver extern _reloc_call_clk_driver
extern _TEXT_DGROUP:wrt TGROUP
;--------------------------------------------------- ;---------------------------------------------------
; ;
; Device entry points ; Device entry points
@ -223,12 +228,13 @@ DiskTable db 0
; ;
; Local storage ; Local storage
; ;
%if 0
segment _BSS segment _BSS
blk_dos_stk resw 1 blk_dos_stk resw 1
blk_dos_seg resw 1 blk_dos_seg resw 1
clk_dos_stk resw 1 clk_dos_stk resw 1
clk_dos_seg resw 1 clk_dos_seg resw 1
%endif
segment _IO_TEXT segment _IO_TEXT
global _ReqPktPtr global _ReqPktPtr
@ -539,38 +545,71 @@ GetUnitNum:
; NOTE: This code is not standard device driver handlers ; NOTE: This code is not standard device driver handlers
; It is written for sperate code and data space. ; It is written for sperate code and data space.
; ;
blk_driver_params:
dw blk_stk_top
dw _reloc_call_blk_driver
dw seg _reloc_call_blk_driver
clk_driver_params:
dw clk_stk_top
dw _reloc_call_clk_driver
dw seg _reloc_call_clk_driver
; clock device interrupt
clk_entry:
pushf
push bx
mov bx, clk_driver_params
jmp short clk_and_blk_common
; block device interrupt
blk_entry: blk_entry:
pushf pushf
push ax
push bx push bx
push ds
mov bx, blk_driver_params
clk_and_blk_common:
push ax
push cx
push dx
; small model ; small model
mov ax,DGROUP ; correct for segments mov ax,sp ; use internal stack
mov ds,ax ; ax to carry segment mov dx,ss
mov word [blk_dos_stk],sp ; use internal stack pushf ; put flags in cx
mov word [blk_dos_seg],ss pop cx
pushf ; put flags in bx
pop bx
cli ; no interrupts cli ; no interrupts
mov ss,ax mov ss,[cs:_TEXT_DGROUP]
mov sp,blk_stk_top mov sp,[cs:bx]
push bx
push cx
popf ; restore interrupt flag popf ; restore interrupt flag
push cx ; push these registers on
push dx ; BLK_STACK push ax ; save old SS/SP
push dx
; push these registers on
push ds ; BLK_STACK
push bp ; to save stack space push bp ; to save stack space
push si push si
push di push di
push es push es
mov ds,[cs:_TEXT_DGROUP] ;
push word [cs:_ReqPktPtr+2] push word [cs:_ReqPktPtr+2]
push word [cs:_ReqPktPtr] push word [cs:_ReqPktPtr]
call far _reloc_call_blk_driver call far [cs:bx+2]
pop cx pop cx
pop cx pop cx
@ -582,74 +621,21 @@ blk_entry:
pop di pop di
pop si pop si
pop bp pop bp
pop dx pop ds
pop cx
pop dx ; get back old SS/SP
pop ax
cli ; no interrupts cli ; no interrupts
mov sp,[blk_dos_stk] ; use dos stack mov ss,dx ; use dos stack
mov ss,[blk_dos_seg] mov sp,ax
pop ds
pop bx
pop ax
popf
retf
;
; clock device interrupt
;
; NOTE: This code is not standard device driver handlers
; It is written for sperate code and data space.
;
clk_entry:
pushf
push ax
push bx
push cx
push dx
push bp
push si
push di
push ds
push es
; small model
mov ax,DGROUP ; correct for segments
mov ds,ax ; ax to carry segment
mov word [clk_dos_stk],sp ; use internal stack
mov word [clk_dos_seg],ss
pushf ; put flags in bx
pop bx
cli ; no interrupts
mov ss,ax
mov sp,clk_stk_top
push bx
popf ; restore interrupt flag
mov bp,sp ; make a c frame
push word [cs:_ReqPktPtr+2]
push word [cs:_ReqPktPtr]
call far _reloc_call_clk_driver
pop cx
pop cx
les bx,[cs:_ReqPktPtr] ; now return completion code
mov word [es:bx+status],ax ; mark operation complete
cli ; no interrupts
mov sp,[clk_dos_stk] ; use dos stack
mov ss,[clk_dos_seg]
pop es
pop ds
pop di
pop si
pop bp
pop dx pop dx
pop cx pop cx
pop bx
pop ax pop ax
pop bx
popf popf
retf retf

View File

@ -28,6 +28,9 @@
; $Id$ ; $Id$
; ;
; $Log$ ; $Log$
; Revision 1.12 2001/04/29 17:34:40 bartoldeman
; A new SYS.COM/config.sys single stepping/console output/misc fixes.
;
; Revision 1.11 2001/04/22 01:19:34 bartoldeman ; Revision 1.11 2001/04/22 01:19:34 bartoldeman
; Avoid sys warning and have a VDISK signature in the HMA ; Avoid sys warning and have a VDISK signature in the HMA
; ;
@ -270,7 +273,8 @@ _first_mcb dw 0 ;-0002 Start of user memory
MARK0026H equ $ MARK0026H equ $
_DPBp dd 0 ; 0000 First drive Parameter Block _DPBp dd 0 ; 0000 First drive Parameter Block
global _sfthead global _sfthead
_sfthead dd 0 ; 0004 System File Table head _sfthead dw _firstsftt ; 0004 System File Table head
dw seg _firstsftt
global _clock global _clock
_clock dd 0 ; 0008 CLOCK$ device _clock dd 0 ; 0008 CLOCK$ device
global _syscon global _syscon
@ -333,7 +337,12 @@ _uppermem_root dw 0 ; 0066 dmd_upper_root
_umb_start dw 0 ; 0068 para of last mem search _umb_start dw 0 ; 0068 para of last mem search
SysVarEnd: SysVarEnd:
; We've got (01fb-006a) some room here: don't use all zeros! ;; The first 5 sft entries appear to have to be at DS:00cc
times (0cch - ($ - DATASTART)) db 0
global _firstsftt
_firstsftt:
dd -1 ; link to next
dw 5 ; count
; Some references seem to indicate that this data should start at 01fbh in ; Some references seem to indicate that this data should start at 01fbh in
; order to maintain 100% MS-DOS compatibility. ; order to maintain 100% MS-DOS compatibility.
@ -670,10 +679,8 @@ __HMATextStart:
; ;
segment HMA_TEXT segment HMA_TEXT
begin_hma: begin_hma:
times 13h db 0 ; filler [ffff:0..ffff:12] times 10h db 0 ; filler [ffff:0..ffff:10]
db 'VDISK',0 ; VDISK3.3 signature at ffff:0013 times 20h db 0
times (2eh-($-begin_hma)) db 0
dw 1088 ; 0x2e: first free kb position for extended memory
db 0 db 0
init_ret_np: push ds init_ret_np: push ds
@ -1006,7 +1013,16 @@ FAIL equ 03h
_int24_handler: mov al,FAIL _int24_handler: mov al,FAIL
iret iret
;
; this makes some things easier
;
segment _TEXT
global _TEXT_DGROUP
_TEXT_DGROUP dw DGROUP
segment INIT_TEXT
global _INIT_DGROUP
_INIT_DGROUP dw DGROUP

View File

@ -41,9 +41,6 @@
extern UBYTE FAR nblkdev, extern UBYTE FAR nblkdev,
FAR lastdrive; /* value of last drive */ FAR lastdrive; /* value of last drive */
GLOBAL struct f_node FAR
* FAR f_nodes; /* pointer to the array */
GLOBAL BYTE GLOBAL BYTE
FAR os_major, /* major version number */ FAR os_major, /* major version number */
FAR os_minor, /* minor version number */ FAR os_minor, /* minor version number */
@ -55,10 +52,8 @@ GLOBAL BYTE FAR os_release[];
GLOBAL BYTE FAR copyright[]; GLOBAL BYTE FAR copyright[];
GLOBAL seg FAR RootPsp; /* Root process -- do not abort */ GLOBAL seg FAR RootPsp; /* Root process -- do not abort */
GLOBAL struct f_node * FAR pDirFileNode;
extern struct dpb FAR * FAR DPBp; /* First drive Parameter Block */ extern struct dpb FAR * FAR DPBp; /* First drive Parameter Block */
extern cdstbl FAR * FAR CDSp; /* Current Directory Structure */ extern cdstbl FAR * FAR CDSp; /* Current Directory Structure */
extern sfttbl FAR * FAR sfthead; /* System File Table head */
extern struct dhdr FAR * FAR clock, /* CLOCK$ device */ extern struct dhdr FAR * FAR clock, /* CLOCK$ device */
FAR * FAR syscon; /* console device */ FAR * FAR syscon; /* console device */
@ -76,6 +71,9 @@ static BYTE *mainRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.16 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.15 2001/04/21 22:32:53 bartoldeman * Revision 1.15 2001/04/21 22:32:53 bartoldeman
* Init DS=Init CS, fixed stack overflow problems and misc bugs. * Init DS=Init CS, fixed stack overflow problems and misc bugs.
* *
@ -351,15 +349,7 @@ INIT VOID FsConfig(VOID)
/* The system file tables need special handling and are "hand */ /* The system file tables need special handling and are "hand */
/* built. Included is the stdin, stdout, stdaux and stdprn. */ /* built. Included is the stdin, stdout, stdaux and stdprn. */
sfthead->sftt_next = (sfttbl FAR *) - 1;
sfthead->sftt_count = Config.cfgFiles;
for (i = 0; i < Config.cfgFiles; i++)
{
/* Initialize the file tables */
f_nodes[i].f_count = 0;
sfthead->sftt_table[i].sft_count = 0;
sfthead->sftt_table[i].sft_status = -1;
}
/* 0 is /dev/con (stdin) */ /* 0 is /dev/con (stdin) */
open("CON", O_RDWR); open("CON", O_RDWR);
@ -406,6 +396,20 @@ INIT VOID FsConfig(VOID)
pcds_table->cdsJoinOffset = 2; 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 */ /* Initialize the disk buffer management functions */
/* init_call_init_buffers(); done from CONFIG.C */ /* init_call_init_buffers(); done from CONFIG.C */
} }
@ -463,16 +467,62 @@ INIT void kernel()
#endif #endif
#endif #endif
RootPsp = ~0; RootPsp = ~0;
/* process 0 */ /* process 0 */
/* Execute command.com /P from the drive we just booted from */ /* Execute command.com /P from the drive we just booted from */
fstrncpy(Cmd.ctBuffer, Config.cfgInitTail, sizeof(Config.cfgInitTail)-1); fstrncpy(Cmd.ctBuffer, Config.cfgInitTail,
sizeof(Config.cfgInitTail)-1);
for (Cmd.ctCount = 0; Cmd.ctCount < 127; Cmd.ctCount++) for (Cmd.ctCount = 0; Cmd.ctCount < 127; Cmd.ctCount++)
if (Cmd.ctBuffer[Cmd.ctCount] == '\r') if (Cmd.ctBuffer[Cmd.ctCount] == '\r')
break; break;
/* if stepping CONFIG.SYS (F5/F8), tell COMMAND.COM about it */
if (Cmd.ctCount < 127 - 3)
{
extern int singleStep ;
extern int SkipAllConfig;
char *insertString = NULL;
if (singleStep) insertString = " /Y"; /* single step AUTOEXEC */
if (SkipAllConfig) insertString = " /D"; /* disable AUTOEXEC */
if (insertString)
{
/* insert /D, /Y as first argument */
int cmdEnd,i,slen = strlen(insertString);
for (cmdEnd = 0;cmdEnd < 127; cmdEnd++)
{
if (Cmd.ctBuffer[cmdEnd] == ' ' ||
Cmd.ctBuffer[cmdEnd] == '\t' ||
Cmd.ctBuffer[cmdEnd] == '\r')
{
for (i = 127 - slen; i >= cmdEnd; i--)
Cmd.ctBuffer[i+slen] = Cmd.ctBuffer[i];
fmemcpy(&Cmd.ctBuffer[cmdEnd], insertString,slen);
Cmd.ctCount += slen;
break;
}
}
}
}
exb.exec.cmd_line = (CommandTail FAR *) & Cmd; exb.exec.cmd_line = (CommandTail FAR *) & Cmd;
exb.exec.fcb_1 = exb.exec.fcb_2 = (fcb FAR *) 0; exb.exec.fcb_1 = exb.exec.fcb_2 = (fcb FAR *) 0;
@ -483,7 +533,7 @@ INIT void kernel()
while ((rc = init_DosExec(Config.cfgP_0_startmode, &exb, Config.cfgInit)) != SUCCESS) while ((rc = init_DosExec(Config.cfgP_0_startmode, &exb, Config.cfgInit)) != SUCCESS)
{ {
BYTE *pLine; BYTE *pLine;
printf("\nBad or missing Command Interpreter: %d\n", rc); printf("\nBad or missing Command Interpreter: %d - %s\n", rc, Cmd.ctBuffer);
printf("\nPlease enter the correct location (for example C:\\COMMAND.COM):\n"); printf("\nPlease enter the correct location (for example C:\\COMMAND.COM):\n");
rc = read(STDIN, Cmd.ctBuffer, sizeof(Cmd.ctBuffer)-1); rc = read(STDIN, Cmd.ctBuffer, sizeof(Cmd.ctBuffer)-1);
Cmd.ctBuffer[rc]='\0'; Cmd.ctBuffer[rc]='\0';

View File

@ -36,6 +36,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.12 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.11 2001/04/15 03:21:50 bartoldeman * Revision 1.11 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -125,16 +128,14 @@ UCOUNT Remote_RW(UWORD func, UCOUNT n, BYTE FAR * bp, sft FAR * s, COUNT FAR * e
/* /*
*/ */
COUNT Remote_find(UWORD func, BYTE FAR * name, REG dmatch FAR * dmp ) COUNT Remote_find(UWORD func, UCOUNT attr, BYTE FAR * name)
{ {
COUNT i; COUNT i;
char FAR *p; char FAR *p;
VOID FAR * test;
struct dirent FAR *SDp = (struct dirent FAR *) &SearchDir;
if (func == REM_FINDFIRST) if (func == REM_FINDFIRST)
{ {
test = (VOID FAR *) current_ldt; SAttr = attr;
i = truename(name, PriPathName, FALSE); i = truename(name, PriPathName, FALSE);
if (i != SUCCESS) { if (i != SUCCESS) {
return i; return i;
@ -147,25 +148,23 @@ COUNT Remote_find(UWORD func, BYTE FAR * name, REG dmatch FAR * dmp )
printf("'\n"); printf("'\n");
#endif #endif
} }
else
test = (VOID FAR *) &TempBuffer;
fmemcpy((BYTE FAR *) &TempBuffer, dta, 21); fmemcpy(TempBuffer, dta, 21);
p = dta; p = dta;
dta = (BYTE FAR *) &TempBuffer; dta = (BYTE FAR *)TempBuffer;
i = int2f_Remote_call(func, 0, 0, 0, test, 0, 0); i = int2f_Remote_call(func, 0, 0, 0, (VOID FAR *)current_ldt, 0, 0);
dta = p; dta = p;
fmemcpy(dta, (BYTE FAR *) &TempBuffer, 21); fmemcpy(dta, TempBuffer, 21);
if (i != 0) if (i != 0)
return i; return i;
dmp->dm_attr_fnd = (BYTE) SDp->dir_attrib; ((dmatch FAR *)dta)->dm_attr_fnd = (BYTE) SearchDir.dir_attrib;
dmp->dm_time = SDp->dir_time; ((dmatch FAR *)dta)->dm_time = SearchDir.dir_time;
dmp->dm_date = SDp->dir_date; ((dmatch FAR *)dta)->dm_date = SearchDir.dir_date;
dmp->dm_size = (LONG) SDp->dir_size; ((dmatch FAR *)dta)->dm_size = (LONG) SearchDir.dir_size;
ConvertName83ToNameSZ((BYTE FAR *) dmp->dm_name, (BYTE FAR *) SDp->dir_name); ConvertName83ToNameSZ(((dmatch FAR *)dta)->dm_name, (BYTE *)SearchDir.dir_name);
return i; return i;
} }

View File

@ -48,6 +48,9 @@ static BYTE *prfRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.10 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.9 2001/04/21 22:32:53 bartoldeman * Revision 1.9 2001/04/21 22:32:53 bartoldeman
* Init DS=Init CS, fixed stack overflow problems and misc bugs. * Init DS=Init CS, fixed stack overflow problems and misc bugs.
* *
@ -67,6 +70,9 @@ static BYTE *prfRcsId = "$Id$";
* recoded for smaller object footprint, added main() for testing+QA * recoded for smaller object footprint, added main() for testing+QA
* *
* $Log$ * $Log$
* Revision 1.10 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.9 2001/04/21 22:32:53 bartoldeman * Revision 1.9 2001/04/21 22:32:53 bartoldeman
* Init DS=Init CS, fixed stack overflow problems and misc bugs. * Init DS=Init CS, fixed stack overflow problems and misc bugs.
* *
@ -152,6 +158,17 @@ VOID cso();
void __int__(int); /* TC 2.01 requires this. :( -- ror4 */ void __int__(int); /* TC 2.01 requires this. :( -- ror4 */
#endif #endif
#ifdef FORSYS
COUNT fstrlen (BYTE FAR * s) /* don't want globals.h, sorry */
{
int i = 0;
while (*s++)
i++;
return i;
}
#endif
/* special console output routine */ /* special console output routine */
VOID VOID
@ -160,9 +177,13 @@ put_console(COUNT c)
if (c == '\n') if (c == '\n')
put_console('\r'); put_console('\r');
#ifdef FORSYS
write(1,&c,1); /* write character to stdout */
#else
_AX = 0x0e00 | c; _AX = 0x0e00 | c;
_BX = 0x0070; _BX = 0x0070;
__int__(0x10); __int__(0x10);
#endif
} }
/* special handler to switch between sprintf and printf */ /* special handler to switch between sprintf and printf */
@ -336,6 +357,7 @@ COUNT
p = *((BYTE FAR **) arg)++; p = *((BYTE FAR **) arg)++;
goto do_outputstring; goto do_outputstring;
case 'i':
case 'd': case 'd':
base = -10; base = -10;
goto lprt; goto lprt;
@ -348,6 +370,7 @@ COUNT
base = 10; base = 10;
goto lprt; goto lprt;
case 'X':
case 'x': case 'x':
base = 16; base = 16;

View File

@ -34,6 +34,9 @@ static BYTE *Proto_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.16 2001/04/29 17:34:40 bartoldeman
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
*
* Revision 1.15 2001/04/21 22:32:53 bartoldeman * Revision 1.15 2001/04/21 22:32:53 bartoldeman
* Init DS=Init CS, fixed stack overflow problems and misc bugs. * Init DS=Init CS, fixed stack overflow problems and misc bugs.
* *
@ -184,7 +187,7 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mod
/* *** End of change /* *** End of change
/* chario.c */ /* chario.c */
/* VOID cso(COUNT c);*/ VOID cso(COUNT c);
VOID sto(COUNT c); VOID sto(COUNT c);
VOID mod_sto(REG UCOUNT c); VOID mod_sto(REG UCOUNT c);
VOID destr_bs(void); VOID destr_bs(void);
@ -481,7 +484,7 @@ COUNT QRemote_Fn(char FAR * s, char FAR * d);
UWORD get_machine_name(BYTE FAR * netname); UWORD get_machine_name(BYTE FAR * netname);
VOID set_machine_name(BYTE FAR * netname, UWORD name_num); 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); UCOUNT Remote_RW(UWORD func, UCOUNT n, BYTE FAR * bp, sft FAR * s, COUNT FAR * err);
COUNT Remote_find(UWORD func, BYTE FAR * name, REG dmatch FAR * dmp); COUNT Remote_find(UWORD func, UCOUNT attr, BYTE FAR * name);
/* procsupt.asm */ /* procsupt.asm */
VOID INRPT FAR exec_user(iregs FAR * irp); VOID INRPT FAR exec_user(iregs FAR * irp);

View File

@ -29,6 +29,9 @@
; $Header$ ; $Header$
; ;
; $Log$ ; $Log$
; Revision 1.7 2001/04/29 17:34:40 bartoldeman
; A new SYS.COM/config.sys single stepping/console output/misc fixes.
;
; Revision 1.6 2001/04/21 22:32:53 bartoldeman ; Revision 1.6 2001/04/21 22:32:53 bartoldeman
; Init DS=Init CS, fixed stack overflow problems and misc bugs. ; Init DS=Init CS, fixed stack overflow problems and misc bugs.
; ;
@ -78,7 +81,7 @@ segment _DATA class=DATA align=2
segment _BSSSTART class=BSS align=2 segment _BSSSTART class=BSS align=2
segment _BSS class=BSS align=2 segment _BSS class=BSS align=2
segment _BSSEND class=BSS segment _BSSEND class=BSS
segment HMA_TEXT_START class=HMA segment HMA_TEXT_START class=HMA align=16
segment HMA_TEXT class=HMA segment HMA_TEXT class=HMA
segment HMA_TEXT_END class=HMA segment HMA_TEXT_END class=HMA
segment INIT_TEXT_START class=INIT align=16 segment INIT_TEXT_START class=INIT align=16

View File

@ -4,6 +4,9 @@
# $Id$ # $Id$
# #
# $Log$ # $Log$
# Revision 1.8 2001/04/29 17:34:41 bartoldeman
# A new SYS.COM/config.sys single stepping/console output/misc fixes.
#
# Revision 1.7 2001/04/15 03:21:50 bartoldeman # Revision 1.7 2001/04/15 03:21:50 bartoldeman
# See history.txt for the list of fixes. # See history.txt for the list of fixes.
# #
@ -46,7 +49,7 @@
!include "..\config.mak" !include "..\config.mak"
CFLAGS = -mt -1- -v -vi- -k- -f- -ff- -O -Z -d -I$(INCLUDEPATH);..\hdr \ CFLAGS = -mt -1- -v -vi- -k- -f- -ff- -O -Z -d -I$(INCLUDEPATH);..\hdr \
-DI86;PROTO -DI86;PROTO;FORSYS
# *Implicit Rules* # *Implicit Rules*
.c.obj: .c.obj:
@ -57,11 +60,10 @@ CFLAGS = -mt -1- -v -vi- -k- -f- -ff- -O -Z -d -I$(INCLUDEPATH);..\hdr \
# *List Macros* # *List Macros*
LIBS = floppy.obj
EXE_dependencies = \ EXE_dependencies = \
sys.obj \ sys.obj \
floppy.obj prf.obj
# *Explicit Rules* # *Explicit Rules*
production: ..\bin\sys.com production: ..\bin\sys.com
@ -75,11 +77,14 @@ b_fat12.h: ..\boot\b_fat12.bin bin2c.com
b_fat16.h: ..\boot\b_fat16.bin bin2c.com b_fat16.h: ..\boot\b_fat16.bin bin2c.com
bin2c ..\boot\b_fat16.bin b_fat16.h b_fat16 bin2c ..\boot\b_fat16.bin b_fat16.h b_fat16
floppy.obj: ..\drivers\floppy.asm #floppy.obj: ..\drivers\floppy.asm
$(NASM) -fobj -DSYS=1 ..\drivers\floppy.asm -o floppy.obj # $(NASM) -fobj -DSYS=1 ..\drivers\floppy.asm -o floppy.obj
prf.obj: ..\kernel\prf.c
$(CC) $(CFLAGS) -c ..\kernel\prf.c
sys.com: $(EXE_dependencies) sys.com: $(EXE_dependencies)
$(LINK) /m/t/c $(LIBPATH)\c0t.obj+sys.obj+$(LIBS),sys,,\ $(LINK) /m/t/c $(LIBPATH)\c0t.obj+$(EXE_dependencies),sys,,\
$(CLIB); $(CLIB);
clobber: clean clobber: clean