2000-05-06 21:34:20 +02:00
|
|
|
|
/****************************************************************/
|
|
|
|
|
/* */
|
|
|
|
|
/* config.c */
|
|
|
|
|
/* DOS-C */
|
|
|
|
|
/* */
|
|
|
|
|
/* config.sys Processing Functions */
|
|
|
|
|
/* */
|
|
|
|
|
/* Copyright (c) 1996 */
|
|
|
|
|
/* Pasquale J. Villani */
|
|
|
|
|
/* All Rights Reserved */
|
|
|
|
|
/* */
|
|
|
|
|
/* This file is part of DOS-C. */
|
|
|
|
|
/* */
|
|
|
|
|
/* DOS-C is free software; you can redistribute it and/or */
|
|
|
|
|
/* modify it under the terms of the GNU General Public License */
|
|
|
|
|
/* as published by the Free Software Foundation; either version */
|
|
|
|
|
/* 2, or (at your option) any later version. */
|
|
|
|
|
/* */
|
|
|
|
|
/* DOS-C is distributed in the hope that it will be useful, but */
|
|
|
|
|
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
|
|
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
|
|
|
|
|
/* the GNU General Public License for more details. */
|
|
|
|
|
/* */
|
|
|
|
|
/* You should have received a copy of the GNU General Public */
|
|
|
|
|
/* License along with DOS-C; see the file COPYING. If not, */
|
2003-06-30 20:50:38 +02:00
|
|
|
|
/* write to the Free Software Foundation, Inc., */
|
|
|
|
|
/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
2001-04-22 00:32:53 +02:00
|
|
|
|
#include "portab.h"
|
2000-05-06 21:34:20 +02:00
|
|
|
|
#include "init-mod.h"
|
2001-07-10 00:19:33 +02:00
|
|
|
|
#include "dyndata.h"
|
|
|
|
|
|
2001-11-18 00:26:45 +01:00
|
|
|
|
#ifdef VERSION_STRINGS
|
2001-11-18 15:01:12 +01:00
|
|
|
|
static BYTE *RcsId =
|
|
|
|
|
"$Id$";
|
2001-11-18 00:26:45 +01:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2001-11-18 15:01:12 +01:00
|
|
|
|
#define DebugPrintf(x) printf x
|
|
|
|
|
#else
|
|
|
|
|
#define DebugPrintf(x)
|
|
|
|
|
#endif
|
2003-06-15 15:24:53 +02:00
|
|
|
|
#define para2far(seg) ((mcb FAR *)MK_FP((seg), 0))
|
2001-07-10 00:19:33 +02:00
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
/**
|
|
|
|
|
Menu selection bar struct:
|
|
|
|
|
x pos, ypos, string
|
|
|
|
|
*/
|
|
|
|
|
#define MENULINEMAX 80
|
|
|
|
|
#define MENULINESMAX 10
|
|
|
|
|
struct MenuSelector
|
|
|
|
|
{
|
|
|
|
|
int x;
|
|
|
|
|
int y;
|
|
|
|
|
BYTE bSelected;
|
|
|
|
|
BYTE Text[MENULINEMAX];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** Structure below holds the menu-strings */
|
2004-04-14 01:46:25 +02:00
|
|
|
|
STATIC struct MenuSelector MenuStruct[MENULINESMAX] BSS_INIT({0});
|
2003-09-18 22:55:41 +02:00
|
|
|
|
|
2004-04-14 01:46:25 +02:00
|
|
|
|
int nMenuLine BSS_INIT(0);
|
2004-05-23 16:24:32 +02:00
|
|
|
|
int MenuColor = -1;
|
2003-09-18 22:55:41 +02:00
|
|
|
|
|
2004-05-23 16:24:32 +02:00
|
|
|
|
STATIC void WriteMenuLine(struct MenuSelector *menu)
|
2003-09-18 22:55:41 +02:00
|
|
|
|
{
|
|
|
|
|
iregs r;
|
|
|
|
|
unsigned char attr = (unsigned char)MenuColor;
|
2004-05-23 16:24:32 +02:00
|
|
|
|
char *pText = menu->Text;
|
2003-09-18 22:55:41 +02:00
|
|
|
|
|
|
|
|
|
if (pText[0] == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2004-05-23 16:24:32 +02:00
|
|
|
|
if(menu->bSelected)
|
2003-09-18 22:55:41 +02:00
|
|
|
|
attr = ((attr << 4) | (attr >> 4));
|
|
|
|
|
|
|
|
|
|
/* clear line */
|
|
|
|
|
r.a.x = 0x0600;
|
|
|
|
|
r.b.b.h = attr;
|
2004-05-23 16:24:32 +02:00
|
|
|
|
r.c.b.l = r.d.b.l = menu->x;
|
|
|
|
|
r.c.b.h = r.d.b.h = menu->y;
|
2004-04-07 00:48:12 +02:00
|
|
|
|
r.d.b.l += strlen(pText) - 1;
|
2003-09-18 22:55:41 +02:00
|
|
|
|
init_call_intr(0x10, &r);
|
|
|
|
|
|
|
|
|
|
/* set cursor position: */
|
|
|
|
|
r.a.b.h = 0x02;
|
|
|
|
|
r.b.b.h = 0;
|
2004-05-23 16:24:32 +02:00
|
|
|
|
r.d.b.l = menu->x;
|
|
|
|
|
r.d.b.h = menu->y;
|
2003-09-18 22:55:41 +02:00
|
|
|
|
init_call_intr(0x10, &r);
|
|
|
|
|
|
|
|
|
|
printf("%s", pText);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Deselect the previously selected line */
|
|
|
|
|
STATIC void DeselectLastLine(void)
|
|
|
|
|
{
|
2004-05-23 16:24:32 +02:00
|
|
|
|
struct MenuSelector *menu;
|
|
|
|
|
for (menu = MenuStruct; menu < &MenuStruct[MENULINESMAX]; menu++)
|
2003-09-18 22:55:41 +02:00
|
|
|
|
{
|
2004-05-23 16:24:32 +02:00
|
|
|
|
if (menu->bSelected)
|
2003-09-18 22:55:41 +02:00
|
|
|
|
{
|
|
|
|
|
/* deselect it: */
|
2004-05-23 16:24:32 +02:00
|
|
|
|
menu->bSelected = 0;
|
|
|
|
|
WriteMenuLine(menu);
|
2003-09-18 22:55:41 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
STATIC void SelectLine(int MenuSelected)
|
|
|
|
|
{
|
2004-05-23 16:24:32 +02:00
|
|
|
|
struct MenuSelector *menu;
|
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
DeselectLastLine(); /* clear previous selection */
|
2004-05-23 16:24:32 +02:00
|
|
|
|
menu = &MenuStruct[MenuSelected];
|
|
|
|
|
menu->bSelected = 1; /* set selection flag for this one */
|
|
|
|
|
WriteMenuLine(menu);
|
2003-09-18 22:55:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-04-14 01:46:25 +02:00
|
|
|
|
UWORD umb_start BSS_INIT(0), UMB_top BSS_INIT(0);
|
|
|
|
|
UWORD ram_top BSS_INIT(0); /* How much ram in Kbytes */
|
|
|
|
|
size_t ebda_size BSS_INIT(0);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2004-04-14 01:46:25 +02:00
|
|
|
|
static UBYTE ErrorAlreadyPrinted[128] BSS_INIT({0});
|
2002-11-09 20:10:11 +01:00
|
|
|
|
|
2004-04-14 01:46:25 +02:00
|
|
|
|
char master_env[128] BSS_INIT({0});
|
2004-01-31 12:39:50 +01:00
|
|
|
|
static char *envp = master_env;
|
2003-10-05 18:22:57 +02:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
struct config Config = {
|
2003-06-15 15:24:53 +02:00
|
|
|
|
0,
|
2001-11-18 15:01:12 +01:00
|
|
|
|
NUMBUFF,
|
|
|
|
|
NFILES,
|
2003-06-15 15:24:53 +02:00
|
|
|
|
0,
|
2001-11-18 15:01:12 +01:00
|
|
|
|
NFCBS,
|
|
|
|
|
0,
|
|
|
|
|
"command.com",
|
|
|
|
|
" /P /E:256\r\n",
|
|
|
|
|
NLAST,
|
2003-06-15 15:24:53 +02:00
|
|
|
|
0,
|
2001-11-18 15:01:12 +01:00
|
|
|
|
NSTACKS,
|
2003-06-15 15:24:53 +02:00
|
|
|
|
0,
|
2004-03-27 00:15:23 +01:00
|
|
|
|
STACKSIZE
|
2001-11-18 15:01:12 +01:00
|
|
|
|
/* COUNTRY= is initialized within DoConfig() */
|
|
|
|
|
, 0 /* country ID */
|
|
|
|
|
, 0 /* codepage */
|
|
|
|
|
, 0 /* amount required memory */
|
|
|
|
|
, 0 /* pointer to loaded data */
|
|
|
|
|
, 0 /* strategy for command.com is low by default */
|
2004-05-23 18:30:25 +02:00
|
|
|
|
, 0 /* default value for switches=/E:nnnn */
|
2001-11-18 15:01:12 +01:00
|
|
|
|
};
|
2004-04-13 13:54:09 +02:00
|
|
|
|
|
2004-04-14 01:46:25 +02:00
|
|
|
|
STATIC seg base_seg BSS_INIT(0);
|
|
|
|
|
STATIC seg umb_base_seg BSS_INIT(0);
|
|
|
|
|
BYTE FAR *lpTop BSS_INIT(0);
|
|
|
|
|
STATIC unsigned nCfgLine BSS_INIT(0);
|
|
|
|
|
COUNT UmbState BSS_INIT(0);
|
|
|
|
|
STATIC BYTE szLine[256] BSS_INIT({0});
|
|
|
|
|
STATIC BYTE szBuf[256] BSS_INIT({0});
|
2004-04-13 13:54:09 +02:00
|
|
|
|
|
2004-04-14 01:46:25 +02:00
|
|
|
|
BYTE singleStep BSS_INIT(FALSE); /* F8 processing */
|
|
|
|
|
BYTE SkipAllConfig BSS_INIT(FALSE); /* F5 processing */
|
|
|
|
|
BYTE askThisSingleCommand BSS_INIT(FALSE); /* ?device= device?= */
|
|
|
|
|
BYTE DontAskThisSingleCommand BSS_INIT(FALSE); /* !files= */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
|
|
|
|
COUNT MenuTimeout = -1;
|
2004-04-14 01:46:25 +02:00
|
|
|
|
BYTE MenuSelected BSS_INIT(0);
|
|
|
|
|
UCOUNT MenuLine BSS_INIT(0);
|
|
|
|
|
UCOUNT Menus BSS_INIT(0);
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
STATIC VOID CfgMenuColor(BYTE * pLine);
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID Config_Buffers(BYTE * pLine);
|
|
|
|
|
STATIC VOID sysScreenMode(BYTE * pLine);
|
|
|
|
|
STATIC VOID sysVersion(BYTE * pLine);
|
|
|
|
|
STATIC VOID CfgBreak(BYTE * pLine);
|
|
|
|
|
STATIC VOID Device(BYTE * pLine);
|
|
|
|
|
STATIC VOID DeviceHigh(BYTE * pLine);
|
|
|
|
|
STATIC VOID Files(BYTE * pLine);
|
2003-06-15 15:24:53 +02:00
|
|
|
|
STATIC VOID FilesHigh(BYTE * pLine);
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID Fcbs(BYTE * pLine);
|
|
|
|
|
STATIC VOID CfgLastdrive(BYTE * pLine);
|
2003-06-15 15:24:53 +02:00
|
|
|
|
STATIC VOID CfgLastdriveHigh(BYTE * pLine);
|
2002-10-22 04:40:19 +02:00
|
|
|
|
STATIC BOOL LoadDevice(BYTE * pLine, char FAR *top, COUNT mode);
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID Dosmem(BYTE * pLine);
|
2003-06-15 15:24:53 +02:00
|
|
|
|
STATIC VOID DosData(BYTE * pLine);
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID Country(BYTE * pLine);
|
|
|
|
|
STATIC VOID InitPgm(BYTE * pLine);
|
|
|
|
|
STATIC VOID InitPgmHigh(BYTE * pLine);
|
2003-03-13 00:06:48 +01:00
|
|
|
|
STATIC VOID CmdInstall(BYTE * pLine);
|
|
|
|
|
STATIC VOID CmdInstallHigh(BYTE * pLine);
|
2003-10-05 18:22:57 +02:00
|
|
|
|
STATIC VOID CmdSet(BYTE * pLine);
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID CfgSwitchar(BYTE * pLine);
|
2003-06-17 13:53:37 +02:00
|
|
|
|
STATIC VOID CfgSwitches(BYTE * pLine);
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID CfgFailure(BYTE * pLine);
|
|
|
|
|
STATIC VOID CfgIgnore(BYTE * pLine);
|
|
|
|
|
STATIC VOID CfgMenu(BYTE * pLine);
|
2003-06-15 21:26:49 +02:00
|
|
|
|
|
|
|
|
|
STATIC VOID CfgMenuEsc(BYTE * pLine);
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID DoMenu(void);
|
|
|
|
|
STATIC VOID CfgMenuDefault(BYTE * pLine);
|
2002-10-22 04:40:19 +02:00
|
|
|
|
STATIC BYTE * skipwh(BYTE * s);
|
|
|
|
|
STATIC BYTE * scan(BYTE * s, BYTE * d);
|
2003-06-30 20:50:38 +02:00
|
|
|
|
STATIC BOOL isnum(char ch);
|
2002-10-22 04:40:19 +02:00
|
|
|
|
#if 0
|
|
|
|
|
STATIC COUNT tolower(COUNT c);
|
|
|
|
|
#endif
|
2004-05-23 18:21:14 +02:00
|
|
|
|
STATIC char toupper(char c);
|
2003-10-05 18:22:57 +02:00
|
|
|
|
STATIC VOID strupr(char *s);
|
2003-06-30 20:50:38 +02:00
|
|
|
|
STATIC VOID mcb_init(UCOUNT seg, UWORD size, BYTE type);
|
2003-06-15 15:24:53 +02:00
|
|
|
|
STATIC VOID mumcb_init(UCOUNT seg, UWORD size);
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
|
|
|
|
STATIC VOID Stacks(BYTE * pLine);
|
2003-06-15 15:24:53 +02:00
|
|
|
|
STATIC VOID StacksHigh(BYTE * pLine);
|
2003-06-15 21:26:49 +02:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID SetAnyDos(BYTE * pLine);
|
|
|
|
|
STATIC VOID Numlock(BYTE * pLine);
|
|
|
|
|
STATIC BYTE * GetNumArg(BYTE * pLine, COUNT * pnArg);
|
|
|
|
|
BYTE *GetStringArg(BYTE * pLine, BYTE * pszString);
|
|
|
|
|
STATIC int SkipLine(char *pLine);
|
|
|
|
|
#if 0
|
|
|
|
|
STATIC char * stristr(char *s1, char *s2);
|
|
|
|
|
#endif
|
2004-05-24 20:06:04 +02:00
|
|
|
|
STATIC char strcaseequal(const char * d, const char * s);
|
2003-03-13 00:06:48 +01:00
|
|
|
|
STATIC int LoadCountryInfoHardCoded(char *filename, COUNT ctryCode, COUNT codePage);
|
2003-06-15 17:53:58 +02:00
|
|
|
|
STATIC void umb_init(void);
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
|
|
|
|
void HMAconfig(int finalize);
|
2004-03-27 00:27:18 +01:00
|
|
|
|
STATIC void config_init_buffers(int anzBuffers); /* from BLOCKIO.C */
|
|
|
|
|
STATIC void config_init_fnodes(int f_nodes_cnt);
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
2002-10-22 04:40:19 +02:00
|
|
|
|
#ifdef I86
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID FAR * AlignParagraph(VOID FAR * lpPtr);
|
2002-10-22 04:40:19 +02:00
|
|
|
|
#else
|
2002-08-03 04:13:51 +02:00
|
|
|
|
#define AlignParagraph(x) ((VOID *)x)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define EOF 0x1a
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC struct table * LookUp(struct table *p, BYTE * token);
|
|
|
|
|
|
|
|
|
|
typedef void config_sys_func_t(BYTE * pLine);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
struct table {
|
2000-05-06 21:34:20 +02:00
|
|
|
|
BYTE *entry;
|
2004-03-23 23:45:38 +01:00
|
|
|
|
signed char pass;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
config_sys_func_t *func;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
};
|
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
STATIC struct table commands[] = {
|
2003-06-17 13:53:37 +02:00
|
|
|
|
/* first = switches! this one is special since it is asked for but
|
|
|
|
|
also checked before F5/F8 */
|
|
|
|
|
{"SWITCHES", 0, CfgSwitches},
|
2003-09-18 22:55:41 +02:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
/* rem is never executed by locking out pass */
|
|
|
|
|
{"REM", 0, CfgIgnore},
|
|
|
|
|
{";", 0, CfgIgnore},
|
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
{"MENUCOLOR",0,CfgMenuColor},
|
|
|
|
|
|
|
|
|
|
{"MENUDEFAULT", 0, CfgMenuDefault},
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{"MENU", 0, CfgMenu}, /* lines to print in pass 0 */
|
2003-06-15 15:24:53 +02:00
|
|
|
|
{"ECHO", 2, CfgMenu}, /* lines to print in pass 2 - install(high) */
|
2003-06-17 13:53:37 +02:00
|
|
|
|
{"EECHO", 2, CfgMenuEsc}, /* modified ECHO (ea) */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2001-09-23 22:39:44 +02:00
|
|
|
|
{"BREAK", 1, CfgBreak},
|
2001-03-21 03:56:26 +01:00
|
|
|
|
{"BUFFERS", 1, Config_Buffers},
|
2001-03-19 05:50:56 +01:00
|
|
|
|
{"COMMAND", 1, InitPgm},
|
|
|
|
|
{"COUNTRY", 1, Country},
|
2001-03-21 03:56:26 +01:00
|
|
|
|
{"DOS", 1, Dosmem},
|
2003-06-15 15:24:53 +02:00
|
|
|
|
{"DOSDATA", 1, DosData},
|
2001-03-19 05:50:56 +01:00
|
|
|
|
{"FCBS", 1, Fcbs},
|
|
|
|
|
{"FILES", 1, Files},
|
2003-06-15 15:24:53 +02:00
|
|
|
|
{"FILESHIGH", 1, FilesHigh},
|
2001-09-23 22:39:44 +02:00
|
|
|
|
{"LASTDRIVE", 1, CfgLastdrive},
|
2003-06-15 15:24:53 +02:00
|
|
|
|
{"LASTDRIVEHIGH", 1, CfgLastdriveHigh},
|
2001-03-25 19:11:54 +02:00
|
|
|
|
{"NUMLOCK", 1, Numlock},
|
2001-03-19 05:50:56 +01:00
|
|
|
|
{"SHELL", 1, InitPgm},
|
2001-03-30 21:30:06 +02:00
|
|
|
|
{"SHELLHIGH", 1, InitPgmHigh},
|
2001-03-19 05:50:56 +01:00
|
|
|
|
{"STACKS", 1, Stacks},
|
2003-06-15 15:24:53 +02:00
|
|
|
|
{"STACKSHIGH", 1, StacksHigh},
|
2001-09-23 22:39:44 +02:00
|
|
|
|
{"SWITCHAR", 1, CfgSwitchar},
|
2003-06-15 21:26:49 +02:00
|
|
|
|
{"SCREEN", 1, sysScreenMode}, /* JPP */
|
|
|
|
|
{"VERSION", 1, sysVersion}, /* JPP */
|
|
|
|
|
{"ANYDOS", 1, SetAnyDos}, /* tom */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
|
|
|
|
{"DEVICE", 2, Device},
|
|
|
|
|
{"DEVICEHIGH", 2, DeviceHigh},
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{"INSTALL", 2, CmdInstall},
|
|
|
|
|
{"INSTALLHIGH", 2, CmdInstallHigh},
|
2003-10-05 18:22:57 +02:00
|
|
|
|
{"SET", 2, CmdSet},
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
/* default action */
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{"", -1, CfgFailure}
|
|
|
|
|
};
|
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
/* RE function for menu. */
|
|
|
|
|
int findend(BYTE * s)
|
|
|
|
|
{
|
|
|
|
|
int nLen = 0;
|
2003-09-19 04:13:35 +02:00
|
|
|
|
/* 'marks' end if at least ten spaces, 0, or newline is found. */
|
2003-09-18 22:55:41 +02:00
|
|
|
|
while (*s && (*s != 0x0d || *s != 0x0a) )
|
|
|
|
|
{
|
|
|
|
|
BYTE *p= skipwh(s);
|
2003-09-19 04:13:35 +02:00
|
|
|
|
/* ah, more than 9 whitespaces ? We're done here (hrmph!) */
|
|
|
|
|
if(p - s >= 10)
|
2003-09-18 22:55:41 +02:00
|
|
|
|
break;
|
|
|
|
|
nLen++;
|
|
|
|
|
++s;
|
|
|
|
|
}
|
|
|
|
|
return nLen;
|
|
|
|
|
}
|
|
|
|
|
|
2004-04-14 01:46:25 +02:00
|
|
|
|
BYTE *pLineStart BSS_INIT(0);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2004-04-14 01:46:25 +02:00
|
|
|
|
BYTE HMAState BSS_INIT(0);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
#define HMA_NONE 0 /* do nothing */
|
|
|
|
|
#define HMA_REQ 1 /* DOS = HIGH detected */
|
|
|
|
|
#define HMA_DONE 2 /* Moved kernel to HMA */
|
|
|
|
|
#define HMA_LOW 3 /* Definitely LOW */
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/* Do first time initialization. Store last so that we can reset it */
|
|
|
|
|
/* later. */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
void PreConfig(void)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
/* Initialize the base memory pointers */
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2000-05-08 06:30:00 +02:00
|
|
|
|
#ifdef DEBUG
|
2001-11-18 15:01:12 +01:00
|
|
|
|
{
|
|
|
|
|
printf("SDA located at 0x%p\n", internal_data);
|
|
|
|
|
}
|
2000-05-08 06:30:00 +02:00
|
|
|
|
#endif
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/* Begin by initializing our system buffers */
|
|
|
|
|
#ifdef DEBUG
|
2001-03-21 03:56:26 +01:00
|
|
|
|
/* printf("Preliminary %d buffers allocated at 0x%p\n", Config.cfgBuffers, buffers);*/
|
2000-05-06 21:34:20 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
2003-06-20 21:54:18 +02:00
|
|
|
|
LoL->DPBp =
|
|
|
|
|
DynAlloc("DPBp", blk_dev.dh_name[0], sizeof(struct dpb));
|
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/* Initialize the file table */
|
2004-03-27 00:10:13 +01:00
|
|
|
|
config_init_fnodes(Config.cfgFiles);
|
2001-03-30 21:30:06 +02:00
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->sfthead = MK_FP(FP_SEG(LoL), 0xcc); /* &(LoL->firstsftt) */
|
|
|
|
|
/* LoL->FCBp = (sfttbl FAR *)&FcbSft; */
|
|
|
|
|
/* LoL->FCBp = (sfttbl FAR *)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
KernelAlloc(sizeof(sftheader)
|
|
|
|
|
+ Config.cfgFiles * sizeof(sft)); */
|
2001-07-28 20:13:06 +02:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
config_init_buffers(Config.cfgBuffers);
|
2001-07-28 20:13:06 +02:00
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->CDSp = KernelAlloc(sizeof(struct cds) * LoL->lastdrive, 'L', 0);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2004-03-23 23:45:38 +01:00
|
|
|
|
printf("Preliminary:\n f_node 0x%p\n", LoL->f_nodes);
|
2003-06-15 17:53:58 +02:00
|
|
|
|
/* printf(" FCB table 0x%p\n",LoL->FCBp);*/
|
2003-06-20 21:54:18 +02:00
|
|
|
|
printf(" sft table 0x%p\n", LoL->sfthead);
|
2003-06-15 17:53:58 +02:00
|
|
|
|
printf(" CDS table 0x%p\n", LoL->CDSp);
|
|
|
|
|
printf(" DPB table 0x%p\n", LoL->DPBp);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Done. Now initialize the MCB structure */
|
|
|
|
|
/* This next line is 8086 and 80x86 real mode specific */
|
|
|
|
|
#ifdef DEBUG
|
2003-06-15 15:24:53 +02:00
|
|
|
|
printf("Preliminary allocation completed: top at %p\n", lpTop);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
/* Do second pass initialization: near allocation and MCBs */
|
|
|
|
|
void PreConfig2(void)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-06-30 20:50:38 +02:00
|
|
|
|
struct sfttbl FAR *sp;
|
2003-09-04 21:14:16 +02:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
/* initialize NEAR allocated things */
|
2001-07-10 00:19:33 +02:00
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/* Initialize the base memory pointers from last time. */
|
2001-07-10 00:19:33 +02:00
|
|
|
|
/*
|
2003-09-04 21:14:16 +02:00
|
|
|
|
if the kernel could be moved to HMA, everything behind the dynamic
|
2001-11-18 15:01:12 +01:00
|
|
|
|
near data is free.
|
|
|
|
|
otherwise, the kernel is moved down - behind the dynamic allocated data,
|
|
|
|
|
and allocation starts after the kernel.
|
|
|
|
|
*/
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
base_seg = LoL->first_mcb = FP_SEG(AlignParagraph((BYTE FAR *) DynLast() + 0x0f));
|
2003-06-15 15:24:53 +02:00
|
|
|
|
|
2003-09-09 19:30:10 +02:00
|
|
|
|
if (Config.ebda2move)
|
|
|
|
|
{
|
|
|
|
|
ebda_size = ebdasize();
|
|
|
|
|
ram_top += ebda_size / 1024;
|
|
|
|
|
if (ebda_size > Config.ebda2move)
|
|
|
|
|
ebda_size = Config.ebda2move;
|
|
|
|
|
}
|
2003-09-04 21:14:16 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
/* We expect ram_top as Kbytes, so convert to paragraphs */
|
2003-06-30 20:50:38 +02:00
|
|
|
|
mcb_init(base_seg, ram_top * 64 - LoL->first_mcb - 1, MCB_LAST);
|
2003-06-20 21:54:18 +02:00
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
sp = LoL->sfthead;
|
|
|
|
|
sp = sp->sftt_next = KernelAlloc(sizeof(sftheader) + 3 * sizeof(sft), 'F', 0);
|
|
|
|
|
sp->sftt_next = (sfttbl FAR *) - 1;
|
|
|
|
|
sp->sftt_count = 3;
|
2003-09-04 21:14:16 +02:00
|
|
|
|
|
|
|
|
|
if (ebda_size) /* move the Extended BIOS Data Area from top of RAM here */
|
|
|
|
|
movebda(ebda_size, FP_SEG(KernelAlloc(ebda_size, 'I', 0)));
|
|
|
|
|
|
|
|
|
|
if (UmbState == 2)
|
|
|
|
|
umb_init();
|
2003-06-15 15:24:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Do third pass initialization. */
|
|
|
|
|
/* Also, run config.sys to load drivers. */
|
|
|
|
|
void PostConfig(void)
|
|
|
|
|
{
|
2003-06-20 21:54:18 +02:00
|
|
|
|
sfttbl FAR *sp;
|
2003-06-20 02:05:44 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
/* We could just have loaded FDXMS or HIMEM */
|
|
|
|
|
if (HMAState == HMA_REQ && MoveKernelToHMA())
|
|
|
|
|
HMAState = HMA_DONE;
|
|
|
|
|
|
|
|
|
|
if (Config.cfgDosDataUmb)
|
|
|
|
|
{
|
|
|
|
|
Config.cfgFilesHigh = TRUE;
|
|
|
|
|
Config.cfgLastdriveHigh = TRUE;
|
|
|
|
|
Config.cfgStacksHigh = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* compute lastdrive ... */
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->lastdrive = Config.cfgLastdrive;
|
|
|
|
|
if (LoL->lastdrive < LoL->nblkdev)
|
|
|
|
|
LoL->lastdrive = LoL->nblkdev;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
DebugPrintf(("starting FAR allocations at %x\n", base_seg));
|
2001-07-10 00:19:33 +02:00
|
|
|
|
|
2004-03-27 00:10:13 +01:00
|
|
|
|
/* Initialize the file table */
|
|
|
|
|
config_init_fnodes(Config.cfgFiles);
|
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/* Begin by initializing our system buffers */
|
2001-03-21 03:56:26 +01:00
|
|
|
|
/* dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE); */
|
2000-05-06 21:34:20 +02:00
|
|
|
|
#ifdef DEBUG
|
2001-03-21 03:56:26 +01:00
|
|
|
|
/* printf("DMA scratchpad allocated at 0x%p\n", dma_scratch); */
|
2000-05-06 21:34:20 +02:00
|
|
|
|
#endif
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
2001-07-28 20:13:06 +02:00
|
|
|
|
config_init_buffers(Config.cfgBuffers);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
/* LoL->sfthead = (sfttbl FAR *)&basesft; */
|
|
|
|
|
/* LoL->FCBp = (sfttbl FAR *)&FcbSft; */
|
|
|
|
|
/* LoL->FCBp = KernelAlloc(sizeof(sftheader)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
+ Config.cfgFiles * sizeof(sft)); */
|
2003-06-20 21:54:18 +02:00
|
|
|
|
sp = LoL->sfthead->sftt_next;
|
|
|
|
|
sp = sp->sftt_next = (sfttbl FAR *)
|
|
|
|
|
KernelAlloc(sizeof(sftheader) + (Config.cfgFiles - 8) * sizeof(sft), 'F',
|
2003-06-15 15:24:53 +02:00
|
|
|
|
Config.cfgFilesHigh);
|
2003-06-20 21:54:18 +02:00
|
|
|
|
sp->sftt_next = (sfttbl FAR *) - 1;
|
|
|
|
|
sp->sftt_count = Config.cfgFiles - 8;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->CDSp = KernelAlloc(sizeof(struct cds) * LoL->lastdrive, 'L', Config.cfgLastdriveHigh);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2004-03-27 00:10:13 +01:00
|
|
|
|
printf("Final: \n f_node 0x%p\n", LoL->f_nodes);
|
2003-06-15 17:53:58 +02:00
|
|
|
|
/* printf(" FCB table 0x%p\n",LoL->FCBp);*/
|
|
|
|
|
printf(" sft table 0x%p\n", LoL->sfthead->sftt_next);
|
|
|
|
|
printf(" CDS table 0x%p\n", LoL->CDSp);
|
|
|
|
|
printf(" DPB table 0x%p\n", LoL->DPBp);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
#endif
|
2000-05-06 21:34:20 +02:00
|
|
|
|
if (Config.cfgStacks)
|
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
VOID FAR *stackBase =
|
2003-06-15 15:24:53 +02:00
|
|
|
|
KernelAlloc(Config.cfgStacks * Config.cfgStackSize, 'S',
|
|
|
|
|
Config.cfgStacksHigh);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
init_stacks(stackBase, Config.cfgStacks, Config.cfgStackSize);
|
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
DebugPrintf(("Stacks allocated at %p\n", stackBase));
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
2003-06-15 15:24:53 +02:00
|
|
|
|
DebugPrintf(("Allocation completed: top at 0x%x\n", base_seg));
|
2000-06-21 20:16:46 +02:00
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This code must be executed after device drivers has been loaded */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
VOID configDone(VOID)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-06-15 15:24:53 +02:00
|
|
|
|
if (UmbState == 1)
|
|
|
|
|
para2far(base_seg)->m_type = MCB_LAST;
|
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
if (HMAState != HMA_DONE)
|
|
|
|
|
{
|
2003-06-15 17:53:58 +02:00
|
|
|
|
mcb FAR *p;
|
|
|
|
|
unsigned short kernel_seg;
|
2003-06-30 20:50:38 +02:00
|
|
|
|
unsigned short hma_paras = (HMAFree+0xf)/16;
|
2003-06-15 17:53:58 +02:00
|
|
|
|
|
2004-05-23 22:01:30 +02:00
|
|
|
|
kernel_seg = allocmem(hma_paras);
|
2003-06-15 17:53:58 +02:00
|
|
|
|
p = para2far(kernel_seg - 1);
|
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
p->m_name[0] = 'S';
|
|
|
|
|
p->m_name[1] = 'C';
|
2003-06-30 20:50:38 +02:00
|
|
|
|
p->m_psp = 8;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
DebugPrintf(("HMA not available, moving text to %x\n", kernel_seg));
|
|
|
|
|
MoveKernel(kernel_seg);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
kernel_seg += hma_paras + 1;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
DebugPrintf(("kernel is low, start alloc at %x", kernel_seg));
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
/* The standard handles should be reopened here, because
|
|
|
|
|
we may have loaded new console or printer drivers in CONFIG.SYS */
|
|
|
|
|
}
|
2001-07-10 00:19:33 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
STATIC seg prev_mcb(seg cur_mcb, seg start)
|
|
|
|
|
{
|
|
|
|
|
/* determine prev mcb */
|
|
|
|
|
seg mcb_prev, mcb_next;
|
|
|
|
|
mcb_prev = mcb_next = start;
|
|
|
|
|
while (mcb_next < cur_mcb && para2far(mcb_next)->m_type == MCB_NORMAL)
|
|
|
|
|
{
|
|
|
|
|
mcb_prev = mcb_next;
|
|
|
|
|
mcb_next += para2far(mcb_prev)->m_size + 1;
|
2000-05-08 06:30:00 +02:00
|
|
|
|
}
|
2003-06-15 15:24:53 +02:00
|
|
|
|
return mcb_prev;
|
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
STATIC void umb_init(void)
|
|
|
|
|
{
|
|
|
|
|
UCOUNT umb_seg, umb_size;
|
|
|
|
|
seg umb_max;
|
2004-04-09 17:43:01 +02:00
|
|
|
|
void far *xms_addr;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2004-04-09 17:43:01 +02:00
|
|
|
|
if ((xms_addr = DetectXMSDriver()) == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (UMB_get_largest(xms_addr, &umb_seg, &umb_size))
|
2001-11-18 15:01:12 +01:00
|
|
|
|
{
|
2003-06-15 15:24:53 +02:00
|
|
|
|
UmbState = 1;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
/* reset root */
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->uppermem_root = ram_top * 64 - 1;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
/* create link mcb (below) */
|
|
|
|
|
para2far(base_seg)->m_type = MCB_NORMAL;
|
|
|
|
|
para2far(base_seg)->m_size--;
|
2003-06-15 17:53:58 +02:00
|
|
|
|
mumcb_init(LoL->uppermem_root, umb_seg - LoL->uppermem_root - 1);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
/* setup the real mcb for the devicehigh block */
|
2003-06-30 20:50:38 +02:00
|
|
|
|
mcb_init(umb_seg, umb_size - 2, MCB_NORMAL);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
umb_base_seg = umb_max = umb_start = umb_seg;
|
|
|
|
|
UMB_top = umb_size;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
/* there can be more UMB's !
|
|
|
|
|
this happens, if memory mapped devces are in between
|
|
|
|
|
like UMB memory c800..c8ff, d8ff..efff with device at d000..d7ff
|
|
|
|
|
However some of the xxxHIGH commands still only work with
|
|
|
|
|
the first UMB.
|
|
|
|
|
*/
|
2000-08-06 07:50:17 +02:00
|
|
|
|
|
2004-04-09 17:43:01 +02:00
|
|
|
|
while (UMB_get_largest(xms_addr, &umb_seg, &umb_size))
|
2003-06-15 15:24:53 +02:00
|
|
|
|
{
|
|
|
|
|
seg umb_prev, umb_next;
|
2001-07-22 03:58:58 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
/* setup the real mcb for the devicehigh block */
|
2003-06-30 20:50:38 +02:00
|
|
|
|
mcb_init(umb_seg, umb_size - 2, MCB_NORMAL);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
/* determine prev and next umbs */
|
2003-06-15 17:53:58 +02:00
|
|
|
|
umb_prev = prev_mcb(umb_seg, LoL->uppermem_root);
|
2003-06-15 15:24:53 +02:00
|
|
|
|
umb_next = umb_prev + para2far(umb_prev)->m_size + 1;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
if (umb_seg < umb_max)
|
|
|
|
|
{
|
|
|
|
|
if (umb_next - umb_seg - umb_size == 0)
|
|
|
|
|
{
|
|
|
|
|
/* should the UMB driver return
|
|
|
|
|
adjacent memory in several pieces */
|
|
|
|
|
umb_size += para2far(umb_next)->m_size + 1;
|
|
|
|
|
para2far(umb_seg)->m_size = umb_size;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* create link mcb (above) */
|
|
|
|
|
mumcb_init(umb_seg + umb_size - 1, umb_next - umb_seg - umb_size);
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-07-19 17:06:55 +02:00
|
|
|
|
else /* umb_seg >= umb_max */
|
|
|
|
|
{
|
|
|
|
|
umb_prev = umb_next;
|
|
|
|
|
}
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
if (umb_seg - umb_prev - 1 == 0)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
/* should the UMB driver return
|
|
|
|
|
adjacent memory in several pieces */
|
2003-07-19 17:06:55 +02:00
|
|
|
|
para2far(prev_mcb(umb_prev, LoL->uppermem_root))->m_size += umb_size;
|
2003-06-15 15:24:53 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* create link mcb (below) */
|
|
|
|
|
mumcb_init(umb_prev, umb_seg - umb_prev - 1);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
2003-06-15 15:24:53 +02:00
|
|
|
|
|
|
|
|
|
if (umb_seg > umb_max)
|
|
|
|
|
umb_max = umb_seg;
|
2000-08-07 05:03:12 +02:00
|
|
|
|
}
|
2003-06-15 15:24:53 +02:00
|
|
|
|
para2far(umb_max)->m_size++;
|
|
|
|
|
para2far(umb_max)->m_type = MCB_LAST;
|
|
|
|
|
DebugPrintf(("UMB Allocation completed: start at 0x%x\n", umb_base_seg));
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-04-09 17:43:01 +02:00
|
|
|
|
VOID DoConfig(int nPass)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
COUNT nFileDesc;
|
2001-06-03 16:16:18 +02:00
|
|
|
|
BYTE *pLine;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
BOOL bEof;
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/* Check to see if we have a config.sys file. If not, just */
|
|
|
|
|
/* exit since we don't force the user to have one. */
|
2001-07-10 00:19:33 +02:00
|
|
|
|
if ((nFileDesc = open("fdconfig.sys", 0)) >= 0)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
DebugPrintf(("Reading FDCONFIG.SYS...\n"));
|
2001-07-10 00:19:33 +02:00
|
|
|
|
}
|
2001-11-18 15:01:12 +01:00
|
|
|
|
else
|
2001-07-10 00:19:33 +02:00
|
|
|
|
{
|
|
|
|
|
DebugPrintf(("FDCONFIG.SYS not found\n"));
|
2001-04-22 00:32:53 +02:00
|
|
|
|
if ((nFileDesc = open("config.sys", 0)) < 0)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2001-07-10 00:19:33 +02:00
|
|
|
|
DebugPrintf(("CONFIG.SYS not found\n"));
|
2000-05-06 21:34:20 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
2001-07-10 00:19:33 +02:00
|
|
|
|
DebugPrintf(("Reading CONFIG.SYS...\n"));
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Have one -- initialize. */
|
|
|
|
|
nCfgLine = 0;
|
|
|
|
|
bEof = 0;
|
|
|
|
|
pLine = szLine;
|
|
|
|
|
|
|
|
|
|
/* Read each line into the buffer and then parse the line, */
|
|
|
|
|
/* do the table lookup and execute the handler for that */
|
|
|
|
|
/* function. */
|
2001-06-03 16:16:18 +02:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
for (; !bEof; nCfgLine++)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
struct table *pEntry;
|
|
|
|
|
|
2001-06-03 16:16:18 +02:00
|
|
|
|
pLineStart = szLine;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
|
|
|
|
/* read in a single line, \n or ^Z terminated */
|
|
|
|
|
|
2001-06-03 16:16:18 +02:00
|
|
|
|
for (pLine = szLine;;)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
{
|
2007-05-15 01:53:46 +02:00
|
|
|
|
if (read(nFileDesc, pLine, 1) == 0)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
{
|
|
|
|
|
bEof = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pLine >= szLine + sizeof(szLine) - 3)
|
|
|
|
|
{
|
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
printf("error - line overflow line %d \n", nCfgLine);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (*pLine == '\n' || *pLine == EOF) /* end of line */
|
|
|
|
|
break;
|
|
|
|
|
|
2004-05-24 20:06:04 +02:00
|
|
|
|
if (*pLine != '\r') /* ignore CR */
|
2001-11-18 15:01:12 +01:00
|
|
|
|
pLine++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*pLine = 0;
|
|
|
|
|
pLine = szLine;
|
|
|
|
|
|
|
|
|
|
/* Skip leading white space and get verb. */
|
|
|
|
|
pLine = scan(pLine, szBuf);
|
|
|
|
|
|
|
|
|
|
/* If the line was blank, skip it. Otherwise, look up */
|
|
|
|
|
/* the verb and execute the appropriate function. */
|
|
|
|
|
if (*szBuf == '\0')
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
pEntry = LookUp(commands, szBuf);
|
|
|
|
|
|
|
|
|
|
if (pEntry->pass >= 0 && pEntry->pass != nPass)
|
|
|
|
|
continue;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2003-06-17 13:53:37 +02:00
|
|
|
|
if (nPass == 0) /* pass 0 always executed (rem Menu prompt switches) */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
{
|
2003-09-18 22:55:41 +02:00
|
|
|
|
pEntry->func(pLine);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
continue;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2003-09-18 22:55:41 +02:00
|
|
|
|
{
|
2002-01-23 23:29:41 +01:00
|
|
|
|
if (SkipLine(pLineStart)) /* F5/F8 processing */
|
|
|
|
|
continue;
|
2003-03-13 00:06:48 +01:00
|
|
|
|
}
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 21:26:49 +02:00
|
|
|
|
if ((pEntry->func != CfgMenu) && (pEntry->func != CfgMenuEsc))
|
2003-09-18 22:55:41 +02:00
|
|
|
|
{
|
|
|
|
|
/* compatibility "device foo.sys" */
|
|
|
|
|
if (' ' != *pLine && '\t' != *pLine && '=' != *pLine)
|
|
|
|
|
{
|
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2002-02-09 01:40:33 +01:00
|
|
|
|
pLine = skipwh(pLine);
|
2003-09-18 22:55:41 +02:00
|
|
|
|
}
|
|
|
|
|
if ('=' == *pLine || pEntry->func == CfgMenu || pEntry->func == CfgMenuEsc)
|
|
|
|
|
pLine = skipwh(pLine+1);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
/* YES. DO IT */
|
|
|
|
|
pEntry->func(pLine);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
2002-01-23 23:29:41 +01:00
|
|
|
|
close(nFileDesc);
|
2002-05-09 00:49:35 +02:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
if (nPass == 0)
|
|
|
|
|
{
|
|
|
|
|
DoMenu();
|
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC struct table * LookUp(struct table *p, BYTE * token)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2004-05-24 20:06:04 +02:00
|
|
|
|
while (p->entry[0] != '\0' && !strcaseequal(p->entry, token))
|
|
|
|
|
++p;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-29 19:34:41 +02:00
|
|
|
|
/*
|
|
|
|
|
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
|
|
|
|
|
*/
|
|
|
|
|
|
2004-05-24 20:39:49 +02:00
|
|
|
|
#define GetBiosTime() peekl(0, 0x46c)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 16:38:13 +02:00
|
|
|
|
UWORD GetBiosKey(int timeout)
|
2001-04-29 19:34:41 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
iregs r;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
ULONG startTime = GetBiosTime();
|
|
|
|
|
|
2004-05-24 20:39:49 +02:00
|
|
|
|
if (timeout >= 0) do
|
2001-11-18 15:01:12 +01:00
|
|
|
|
{
|
|
|
|
|
r.a.x = 0x0100; /* are there keys available ? */
|
|
|
|
|
init_call_intr(0x16, &r);
|
2004-05-24 20:39:49 +02:00
|
|
|
|
if ((unsigned)(GetBiosTime() - startTime) >= timeout * 18u)
|
|
|
|
|
return 0xffff;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
2004-05-24 20:39:49 +02:00
|
|
|
|
while (r.flags & FLG_ZERO);
|
|
|
|
|
|
|
|
|
|
/* key available or blocking wait (timeout < 0): fetch it */
|
|
|
|
|
r.a.x = 0x0000;
|
|
|
|
|
init_call_intr(0x16, &r);
|
|
|
|
|
return r.a.x;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC BOOL SkipLine(char *pLine)
|
2001-04-29 19:34:41 +02:00
|
|
|
|
{
|
|
|
|
|
short key;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2002-05-09 00:49:35 +02:00
|
|
|
|
if (InitKernelConfig.SkipConfigSeconds >= 0)
|
2001-04-29 19:34:41 +02:00
|
|
|
|
{
|
2001-11-04 20:47:39 +01:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
if (InitKernelConfig.SkipConfigSeconds > 0)
|
|
|
|
|
printf("Press F8 to trace or F5 to skip CONFIG.SYS/AUTOEXEC.BAT");
|
|
|
|
|
|
|
|
|
|
key = GetBiosKey(InitKernelConfig.SkipConfigSeconds); /* wait 2 seconds */
|
2002-05-09 00:49:35 +02:00
|
|
|
|
|
|
|
|
|
InitKernelConfig.SkipConfigSeconds = -1;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
|
|
|
|
if (key == 0x3f00) /* F5 */
|
|
|
|
|
{
|
|
|
|
|
SkipAllConfig = TRUE;
|
|
|
|
|
}
|
2003-09-18 22:55:41 +02:00
|
|
|
|
else if (key == 0x4200) /* F8 */
|
2001-11-18 15:01:12 +01:00
|
|
|
|
{
|
|
|
|
|
singleStep = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("\r%79s\r", ""); /* clear line */
|
|
|
|
|
|
|
|
|
|
if (SkipAllConfig)
|
|
|
|
|
printf("Skipping CONFIG.SYS/AUTOEXEC.BAT\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SkipAllConfig)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
/* 1?device=CDROM.SYS */
|
2002-05-09 00:49:35 +02:00
|
|
|
|
/* 12?device=OAKROM.SYS */
|
|
|
|
|
/* 123?device=EMM386.EXE NOEMS */
|
2003-09-18 22:55:41 +02:00
|
|
|
|
if ( MenuLine != 0 &&
|
2002-05-09 00:49:35 +02:00
|
|
|
|
(MenuLine & (1 << MenuSelected)) == 0)
|
2002-01-23 23:29:41 +01:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
if (DontAskThisSingleCommand) /* !files=30 */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
2001-11-04 20:47:39 +01:00
|
|
|
|
if (!askThisSingleCommand && !singleStep)
|
2001-04-29 19:34:41 +02:00
|
|
|
|
return FALSE;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2001-04-29 19:34:41 +02:00
|
|
|
|
printf("%s[Y,N]?", pLine);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2001-04-29 19:34:41 +02:00
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
key = GetBiosKey(-1);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
|
|
|
|
switch (toupper(key & 0x00ff))
|
2001-04-29 19:34:41 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
case 'N':
|
|
|
|
|
case 'n':
|
|
|
|
|
printf("N\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\n");
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2001-04-29 19:34:41 +02:00
|
|
|
|
}
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
|
|
|
|
if (key == 0x3f00) /* YES, you may hit F5 here, too */
|
2001-04-29 19:34:41 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
printf("N\n");
|
|
|
|
|
SkipAllConfig = TRUE;
|
|
|
|
|
return TRUE;
|
2001-04-29 19:34:41 +02:00
|
|
|
|
}
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-05-23 18:21:14 +02:00
|
|
|
|
/* JPP - changed so will accept hex number. */
|
|
|
|
|
/* ea - changed to accept hex digits in hex numbers */
|
|
|
|
|
STATIC char *GetNumArg(char *p, int *num)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2004-05-23 18:21:14 +02:00
|
|
|
|
static char digits[] = "0123456789ABCDEF";
|
|
|
|
|
unsigned char base = 10;
|
|
|
|
|
int sign = 1;
|
|
|
|
|
int n = 0;
|
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/* look for NUMBER */
|
2004-05-23 18:21:14 +02:00
|
|
|
|
p = skipwh(p);
|
|
|
|
|
if (*p == '-')
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2004-05-23 18:21:14 +02:00
|
|
|
|
p++;
|
|
|
|
|
sign = -1;
|
|
|
|
|
}
|
|
|
|
|
else if (!isnum(*p))
|
|
|
|
|
{
|
|
|
|
|
CfgFailure(p);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for( ; *p; p++)
|
|
|
|
|
{
|
|
|
|
|
char ch = toupper(*p);
|
|
|
|
|
if (ch == 'X')
|
|
|
|
|
base = 16;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
char *q = strchr(digits, ch);
|
|
|
|
|
if (q == NULL)
|
|
|
|
|
break;
|
|
|
|
|
n = n * base + (q - digits);
|
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
2004-05-23 18:21:14 +02:00
|
|
|
|
*num = n * sign;
|
|
|
|
|
return p;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
BYTE *GetStringArg(BYTE * pLine, BYTE * pszString)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
/* look for STRING */
|
|
|
|
|
pLine = skipwh(pLine);
|
|
|
|
|
|
|
|
|
|
/* just return whatever string is there, including null */
|
|
|
|
|
return scan(pLine, pszString);
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC void Config_Buffers(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
COUNT nBuffers;
|
|
|
|
|
|
|
|
|
|
/* Get the argument */
|
2004-04-11 00:48:26 +02:00
|
|
|
|
if (GetNumArg(pLine, &nBuffers))
|
|
|
|
|
Config.cfgBuffers = nBuffers;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
/**
|
|
|
|
|
Set screen mode - rewritten to use init_call_intr() by RE / ICD
|
|
|
|
|
*/
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID sysScreenMode(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-09-18 22:55:41 +02:00
|
|
|
|
iregs r;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
COUNT nMode;
|
2003-09-18 22:55:41 +02:00
|
|
|
|
COUNT nFunc = 0x11;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
/* Get the argument */
|
|
|
|
|
if (GetNumArg(pLine, &nMode) == (BYTE *) 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
if(nMode<0x10)
|
|
|
|
|
nFunc = 0; /* set lower screenmode */
|
|
|
|
|
else if ((nMode != 0x11) && (nMode != 0x12) && (nMode != 0x14))
|
|
|
|
|
return; /* do nothing; invalid screenmode */
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
/* Modes
|
|
|
|
|
0x11 (17) 28 lines
|
|
|
|
|
0x12 (18) 43/50 lines
|
|
|
|
|
0x14 (20) 25 lines
|
|
|
|
|
*/
|
2003-09-18 22:55:41 +02:00
|
|
|
|
/* move cursor to pos 0,0: */
|
|
|
|
|
r.a.b.h = nFunc; /* set videomode */
|
|
|
|
|
r.a.b.l = nMode;
|
|
|
|
|
r.b.b.l = 0;
|
|
|
|
|
init_call_intr(0x10, &r);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID sysVersion(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
COUNT major, minor;
|
2004-04-07 00:48:12 +02:00
|
|
|
|
char *p = strchr(pLine, '.');
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2004-04-07 00:48:12 +02:00
|
|
|
|
if (p == NULL)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
return;
|
|
|
|
|
|
2004-04-07 00:48:12 +02:00
|
|
|
|
p++;
|
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/* Get major number */
|
|
|
|
|
if (GetNumArg(pLine, &major) == (BYTE *) 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Get minor number */
|
|
|
|
|
if (GetNumArg(p, &minor) == (BYTE *) 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
printf("Changing reported version to %d.%d\n", major, minor);
|
|
|
|
|
|
2006-05-21 20:50:30 +02:00
|
|
|
|
LoL->os_setver_major = major; /* not the internal os_major */
|
|
|
|
|
LoL->os_setver_minor = minor; /* not the internal os_minor */
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID Files(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
COUNT nFiles;
|
|
|
|
|
|
|
|
|
|
/* Get the argument */
|
|
|
|
|
if (GetNumArg(pLine, &nFiles) == (BYTE *) 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Got the value, assign either default or new value */
|
|
|
|
|
Config.cfgFiles = max(Config.cfgFiles, nFiles);
|
2003-06-15 15:24:53 +02:00
|
|
|
|
Config.cfgFilesHigh = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
STATIC VOID FilesHigh(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
Files(pLine);
|
|
|
|
|
Config.cfgFilesHigh = 1;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID CfgLastdrive(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
/* Format: LASTDRIVE = letter */
|
|
|
|
|
BYTE drv;
|
|
|
|
|
|
|
|
|
|
pLine = skipwh(pLine);
|
2004-05-23 18:21:14 +02:00
|
|
|
|
drv = toupper(*pLine);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
if (drv < 'A' || drv > 'Z')
|
|
|
|
|
{
|
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2004-05-23 18:21:14 +02:00
|
|
|
|
drv -= 'A' - 1; /* Make real number */
|
|
|
|
|
if (drv > Config.cfgLastdrive)
|
|
|
|
|
Config.cfgLastdrive = drv;
|
2003-06-15 15:24:53 +02:00
|
|
|
|
Config.cfgLastdriveHigh = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
STATIC VOID CfgLastdriveHigh(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
/* Format: LASTDRIVEHIGH = letter */
|
|
|
|
|
CfgLastdrive(pLine);
|
|
|
|
|
Config.cfgLastdriveHigh = 1;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-08-06 07:50:17 +02:00
|
|
|
|
/*
|
|
|
|
|
UmbState of confidence, 1 is sure, 2 maybe, 4 unknown and 0 no way.
|
|
|
|
|
*/
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID Dosmem(BYTE * pLine)
|
2000-06-21 20:16:46 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
BYTE *pTmp;
|
|
|
|
|
BYTE UMBwanted = FALSE;
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
pLine = GetStringArg(pLine, szBuf);
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
2003-10-05 18:22:57 +02:00
|
|
|
|
strupr(szBuf);
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
2002-05-09 00:49:35 +02:00
|
|
|
|
/* printf("DOS called with %s\n", szBuf); */
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
for (pTmp = szBuf;;)
|
|
|
|
|
{
|
2004-02-24 01:25:56 +01:00
|
|
|
|
if (memcmp(pTmp, "UMB", 3) == 0)
|
2001-03-21 03:56:26 +01:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
UMBwanted = TRUE;
|
|
|
|
|
pTmp += 3;
|
2001-03-21 03:56:26 +01:00
|
|
|
|
}
|
2004-02-24 01:25:56 +01:00
|
|
|
|
if (memcmp(pTmp, "HIGH", 4) == 0)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
{
|
|
|
|
|
HMAState = HMA_REQ;
|
|
|
|
|
pTmp += 4;
|
2000-06-21 20:16:46 +02:00
|
|
|
|
}
|
2004-02-24 01:25:56 +01:00
|
|
|
|
/* if (memcmp(pTmp, "CLAIMINIT",9) == 0) { INITDataSegmentClaimed = 0; pTmp += 9; }*/
|
2001-11-18 15:01:12 +01:00
|
|
|
|
pTmp = skipwh(pTmp);
|
|
|
|
|
|
|
|
|
|
if (*pTmp != ',')
|
|
|
|
|
break;
|
|
|
|
|
pTmp++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (UmbState == 0)
|
|
|
|
|
{
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->uppermem_link = 0;
|
|
|
|
|
LoL->uppermem_root = 0xffff;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
UmbState = UMBwanted ? 2 : 0;
|
|
|
|
|
}
|
|
|
|
|
/* Check if HMA is available straight away */
|
|
|
|
|
if (HMAState == HMA_REQ && MoveKernelToHMA())
|
|
|
|
|
{
|
|
|
|
|
HMAState = HMA_DONE;
|
|
|
|
|
}
|
2000-06-21 20:16:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
STATIC VOID DosData(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
pLine = GetStringArg(pLine, szBuf);
|
2003-10-05 18:22:57 +02:00
|
|
|
|
strupr(szBuf);
|
2003-06-15 15:24:53 +02:00
|
|
|
|
|
2004-02-24 01:25:56 +01:00
|
|
|
|
if (memcmp(szBuf, "UMB", 3) == 0)
|
2003-06-15 15:24:53 +02:00
|
|
|
|
Config.cfgDosDataUmb = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID CfgSwitchar(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
/* Format: SWITCHAR = character */
|
|
|
|
|
|
|
|
|
|
GetStringArg(pLine, szBuf);
|
2003-06-15 17:53:58 +02:00
|
|
|
|
init_switchar(*szBuf);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2003-06-17 13:53:37 +02:00
|
|
|
|
STATIC VOID CfgSwitches(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
pLine = skipwh(pLine);
|
2003-09-18 22:55:41 +02:00
|
|
|
|
if (*pLine == '=')
|
|
|
|
|
{
|
2003-06-17 13:53:37 +02:00
|
|
|
|
pLine = skipwh(pLine + 1);
|
|
|
|
|
}
|
|
|
|
|
while (*pLine)
|
|
|
|
|
{
|
|
|
|
|
if (*pLine == '/') {
|
|
|
|
|
pLine++;
|
|
|
|
|
switch(toupper(*pLine)) {
|
|
|
|
|
case 'K':
|
|
|
|
|
if (commands[0].pass == 1)
|
|
|
|
|
kbdType = 0; /* force conv keyb */
|
|
|
|
|
break;
|
|
|
|
|
case 'N':
|
|
|
|
|
InitKernelConfig.SkipConfigSeconds = -1;
|
|
|
|
|
break;
|
|
|
|
|
case 'F':
|
|
|
|
|
InitKernelConfig.SkipConfigSeconds = 0;
|
|
|
|
|
break;
|
2003-09-04 21:14:16 +02:00
|
|
|
|
case 'E': /* /E[[:]nnnn] Set the desired EBDA amount to move in bytes */
|
|
|
|
|
{ /* Note that if there is no EBDA, this will have no effect */
|
|
|
|
|
int n = 0;
|
|
|
|
|
if (*++pLine == ':')
|
|
|
|
|
pLine++; /* skip optional separator */
|
2003-09-18 22:55:41 +02:00
|
|
|
|
if (!isnum(*pLine))
|
|
|
|
|
{
|
2003-09-19 04:13:35 +02:00
|
|
|
|
pLine--;
|
2003-09-04 21:14:16 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2003-09-18 22:55:41 +02:00
|
|
|
|
pLine = GetNumArg(pLine, &n) - 1;
|
2003-09-09 19:30:10 +02:00
|
|
|
|
/* allowed values: [48..1024] bytes, multiples of 16
|
2003-09-04 21:14:16 +02:00
|
|
|
|
* e.g. AwardBIOS: 48, AMIBIOS: 1024
|
|
|
|
|
* (Phoenix, MRBIOS, Unicore = ????)
|
|
|
|
|
*/
|
2004-05-23 18:30:25 +02:00
|
|
|
|
if (n == -1)
|
|
|
|
|
{
|
|
|
|
|
Config.ebda2move = 0xffff;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (n >= 48 && n <= 1024)
|
2003-09-04 21:14:16 +02:00
|
|
|
|
{
|
|
|
|
|
Config.ebda2move = (n + 15) & 0xfff0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* else fall through (failure) */
|
|
|
|
|
}
|
2003-06-17 13:53:37 +02:00
|
|
|
|
default:
|
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
}
|
|
|
|
|
pLine = skipwh(pLine+1);
|
2003-09-04 21:14:16 +02:00
|
|
|
|
}
|
2003-06-17 13:53:37 +02:00
|
|
|
|
commands[0].pass = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID Fcbs(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
/* Format: FCBS = totalFcbs [,protectedFcbs] */
|
|
|
|
|
COUNT fcbs;
|
|
|
|
|
|
|
|
|
|
if ((pLine = GetNumArg(pLine, &fcbs)) == 0)
|
|
|
|
|
return;
|
|
|
|
|
Config.cfgFcbs = fcbs;
|
|
|
|
|
|
|
|
|
|
pLine = skipwh(pLine);
|
|
|
|
|
|
|
|
|
|
if (*pLine == ',')
|
|
|
|
|
{
|
|
|
|
|
GetNumArg(++pLine, &fcbs);
|
|
|
|
|
Config.cfgProtFcbs = fcbs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Config.cfgProtFcbs > Config.cfgFcbs)
|
|
|
|
|
Config.cfgProtFcbs = Config.cfgFcbs;
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-08 06:30:00 +02:00
|
|
|
|
/* LoadCountryInfo():
|
|
|
|
|
* Searches a file in the COUNTRY.SYS format for an entry
|
|
|
|
|
* matching the specified code page and country code, and loads
|
|
|
|
|
* the corresponding information into memory. If code page is 0,
|
|
|
|
|
* the default code page for the country will be used.
|
|
|
|
|
*
|
|
|
|
|
* Returns TRUE if successful, FALSE if not.
|
|
|
|
|
*/
|
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
#if 0
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC BOOL LoadCountryInfo(char *filename, UWORD ctryCode, UWORD codePage)
|
2000-05-08 06:30:00 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
printf("Sorry, the COUNTRY= statement has been temporarily disabled\n");
|
|
|
|
|
|
|
|
|
|
UNREFERENCED_PARAMETER(codePage);
|
|
|
|
|
UNREFERENCED_PARAMETER(ctryCode);
|
|
|
|
|
UNREFERENCED_PARAMETER(filename);
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
2003-03-13 00:06:48 +01:00
|
|
|
|
}
|
|
|
|
|
#endif
|
2000-05-08 06:30:00 +02:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID Country(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-03-13 00:06:48 +01:00
|
|
|
|
/* Format: COUNTRY = countryCode, [codePage], filename */
|
2000-05-06 21:34:20 +02:00
|
|
|
|
COUNT ctryCode;
|
2003-03-13 00:06:48 +01:00
|
|
|
|
COUNT codePage = NLS_DEFAULT;
|
|
|
|
|
char *filename = "";
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
if ((pLine = GetNumArg(pLine, &ctryCode)) == 0)
|
2003-03-13 00:06:48 +01:00
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* currently 'implemented'
|
|
|
|
|
COUNTRY=49 */
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
#if 0
|
2000-05-06 21:34:20 +02:00
|
|
|
|
pLine = skipwh(pLine);
|
|
|
|
|
if (*pLine == ',')
|
|
|
|
|
{
|
2000-05-08 06:30:00 +02:00
|
|
|
|
pLine = skipwh(pLine + 1);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
if (*pLine != ',')
|
2000-05-06 21:34:20 +02:00
|
|
|
|
if ((pLine = GetNumArg(pLine, &codePage)) == 0)
|
2003-03-13 00:06:48 +01:00
|
|
|
|
goto error;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
pLine = skipwh(pLine);
|
|
|
|
|
if (*pLine == ',')
|
|
|
|
|
{
|
|
|
|
|
GetStringArg(++pLine, szBuf);
|
2003-03-13 00:06:48 +01:00
|
|
|
|
filename = szBuf;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
2003-03-13 00:06:48 +01:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!LoadCountryInfoHardCoded(filename, ctryCode, codePage))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
error:
|
2000-05-06 21:34:20 +02:00
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID Stacks(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
COUNT stacks;
|
|
|
|
|
|
|
|
|
|
/* Format: STACKS = stacks [, stackSize] */
|
|
|
|
|
pLine = GetNumArg(pLine, &stacks);
|
|
|
|
|
Config.cfgStacks = stacks;
|
|
|
|
|
|
|
|
|
|
pLine = skipwh(pLine);
|
|
|
|
|
|
|
|
|
|
if (*pLine == ',')
|
|
|
|
|
{
|
|
|
|
|
GetNumArg(++pLine, &stacks);
|
|
|
|
|
Config.cfgStackSize = stacks;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Config.cfgStacks)
|
|
|
|
|
{
|
|
|
|
|
if (Config.cfgStackSize < 32)
|
|
|
|
|
Config.cfgStackSize = 32;
|
|
|
|
|
if (Config.cfgStackSize > 512)
|
|
|
|
|
Config.cfgStackSize = 512;
|
|
|
|
|
if (Config.cfgStacks > 64)
|
|
|
|
|
Config.cfgStacks = 64;
|
|
|
|
|
}
|
2003-06-15 15:24:53 +02:00
|
|
|
|
Config.cfgStacksHigh = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
STATIC VOID StacksHigh(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
Stacks(pLine);
|
|
|
|
|
Config.cfgStacksHigh = 1;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID InitPgmHigh(BYTE * pLine)
|
2001-03-30 21:30:06 +02:00
|
|
|
|
{
|
|
|
|
|
InitPgm(pLine);
|
|
|
|
|
Config.cfgP_0_startmode = 0x80;
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID InitPgm(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2004-04-13 13:54:09 +02:00
|
|
|
|
static char init[NAMEMAX];
|
|
|
|
|
static char inittail[NAMEMAX];
|
|
|
|
|
|
|
|
|
|
Config.cfgInit = init;
|
|
|
|
|
Config.cfgInitTail = inittail;
|
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/* Get the string argument that represents the new init pgm */
|
|
|
|
|
pLine = GetStringArg(pLine, Config.cfgInit);
|
|
|
|
|
|
|
|
|
|
/* Now take whatever tail is left and add it on as a single */
|
|
|
|
|
/* string. */
|
|
|
|
|
strcpy(Config.cfgInitTail, pLine);
|
|
|
|
|
|
|
|
|
|
/* and add a DOS new line just to be safe */
|
|
|
|
|
strcat(Config.cfgInitTail, "\r\n");
|
2001-03-30 21:30:06 +02:00
|
|
|
|
|
|
|
|
|
Config.cfgP_0_startmode = 0;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID CfgBreak(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
/* Format: BREAK = (ON | OFF) */
|
2001-03-25 19:11:54 +02:00
|
|
|
|
GetStringArg(pLine, szBuf);
|
2004-05-24 20:06:04 +02:00
|
|
|
|
break_ena = strcaseequal(szBuf, "OFF") ? 0 : 1;
|
2001-03-25 19:11:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID Numlock(BYTE * pLine)
|
2001-03-25 19:11:54 +02:00
|
|
|
|
{
|
|
|
|
|
/* Format: NUMLOCK = (ON | OFF) */
|
2001-11-18 15:01:12 +01:00
|
|
|
|
BYTE FAR *keyflags = (BYTE FAR *) MK_FP(0x40, 0x17);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
GetStringArg(pLine, szBuf);
|
2001-03-25 19:11:54 +02:00
|
|
|
|
|
|
|
|
|
*keyflags &= ~32;
|
2004-05-24 20:06:04 +02:00
|
|
|
|
if (!strcaseequal(szBuf, "OFF")) *keyflags |= 32;
|
2001-04-15 05:21:50 +02:00
|
|
|
|
keycheck();
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID DeviceHigh(BYTE * pLine)
|
2000-06-21 20:16:46 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
if (UmbState == 1)
|
|
|
|
|
{
|
2002-10-22 04:40:19 +02:00
|
|
|
|
if (LoadDevice(pLine, MK_FP(umb_start + UMB_top, 0), TRUE) == DE_NOMEM)
|
2000-06-21 20:16:46 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
printf("Not enough free memory in UMB's: loading low\n");
|
2002-10-22 04:40:19 +02:00
|
|
|
|
LoadDevice(pLine, lpTop, FALSE);
|
2000-06-21 20:16:46 +02:00
|
|
|
|
}
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("UMB's unavailable!\n");
|
2002-10-22 04:40:19 +02:00
|
|
|
|
LoadDevice(pLine, lpTop, FALSE);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
2000-06-21 20:16:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC void Device(BYTE * pLine)
|
2000-06-21 20:16:46 +02:00
|
|
|
|
{
|
2002-10-22 04:40:19 +02:00
|
|
|
|
LoadDevice(pLine, lpTop, FALSE);
|
2000-06-21 20:16:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-22 04:40:19 +02:00
|
|
|
|
STATIC BOOL LoadDevice(BYTE * pLine, char FAR *top, COUNT mode)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
exec_blk eb;
|
|
|
|
|
struct dhdr FAR *dhp;
|
|
|
|
|
struct dhdr FAR *next_dhp;
|
2001-03-21 03:56:26 +01:00
|
|
|
|
BOOL result;
|
2003-06-15 15:24:53 +02:00
|
|
|
|
seg base, start;
|
2000-06-21 20:16:46 +02:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
if (mode)
|
2003-06-15 15:24:53 +02:00
|
|
|
|
{
|
|
|
|
|
base = umb_base_seg;
|
|
|
|
|
start = umb_start;
|
|
|
|
|
}
|
2000-06-21 20:16:46 +02:00
|
|
|
|
else
|
2003-06-15 15:24:53 +02:00
|
|
|
|
{
|
|
|
|
|
base = base_seg;
|
2003-06-15 17:53:58 +02:00
|
|
|
|
start = LoL->first_mcb;
|
2003-06-15 15:24:53 +02:00
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
if (base == start)
|
|
|
|
|
base++;
|
|
|
|
|
base++;
|
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/* Get the device driver name */
|
|
|
|
|
GetStringArg(pLine, szBuf);
|
|
|
|
|
|
|
|
|
|
/* The driver is loaded at the top of allocated memory. */
|
|
|
|
|
/* The device driver is paragraph aligned. */
|
2003-06-15 15:24:53 +02:00
|
|
|
|
eb.load.reloc = eb.load.load_seg = base;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2003-06-15 15:24:53 +02:00
|
|
|
|
printf("Loading device driver %s at segment %04x\n", szBuf, base);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
2001-11-04 20:47:39 +01:00
|
|
|
|
if ((result = init_DosExec(3, &eb, szBuf)) != SUCCESS)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
{
|
2001-11-04 20:47:39 +01:00
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
return result;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
2001-04-16 16:28:32 +02:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
strcpy(szBuf, pLine);
|
2003-06-17 13:53:37 +02:00
|
|
|
|
/* uppercase the device driver command */
|
2003-10-05 18:22:57 +02:00
|
|
|
|
strupr(szBuf);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
|
|
|
|
/* TE this fixes the loading of devices drivers with
|
|
|
|
|
multiple devices in it. NUMEGA's SoftIce is such a beast
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* add \r\n to the command line */
|
2003-07-12 22:56:11 +02:00
|
|
|
|
strcat(szBuf, " \r\n");
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
dhp = MK_FP(base, 0);
|
|
|
|
|
|
2003-10-30 13:22:06 +01:00
|
|
|
|
/* NOTE - Modification for multisegmented device drivers: */
|
|
|
|
|
/* In order to emulate the functionallity experienced with other */
|
|
|
|
|
/* DOS operating systems, the original 'top' end address is */
|
|
|
|
|
/* updated with the end address returned from the INIT request. */
|
|
|
|
|
/* The updated end address is then used when issuing the next */
|
|
|
|
|
/* INIT request for the following device driver within the file */
|
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
for (next_dhp = NULL; FP_OFF(next_dhp) != 0xffff &&
|
2003-10-30 13:22:06 +01:00
|
|
|
|
(result = init_device(dhp, szBuf, mode, &top)) == SUCCESS;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
dhp = next_dhp)
|
|
|
|
|
{
|
2003-09-24 20:53:44 +02:00
|
|
|
|
next_dhp = MK_FP(FP_SEG(dhp), FP_OFF(dhp->dh_next));
|
2003-06-15 17:53:58 +02:00
|
|
|
|
/* Link in device driver and save LoL->nul_dev pointer to next */
|
|
|
|
|
dhp->dh_next = LoL->nul_dev.dh_next;
|
|
|
|
|
LoL->nul_dev.dh_next = dhp;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
2003-06-15 15:24:53 +02:00
|
|
|
|
|
|
|
|
|
/* might have been the UMB driver or DOS=UMB */
|
|
|
|
|
if (UmbState == 2)
|
|
|
|
|
umb_init();
|
2001-11-04 20:47:39 +01:00
|
|
|
|
|
2001-03-21 03:56:26 +01:00
|
|
|
|
return result;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID CfgFailure(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
BYTE *pTmp = pLineStart;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
|
|
|
|
/* suppress multiple printing of same unrecognized lines */
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
if (nCfgLine < sizeof(ErrorAlreadyPrinted)*8)
|
|
|
|
|
{
|
|
|
|
|
if (ErrorAlreadyPrinted[nCfgLine/8] & (1 << (nCfgLine%8)))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ErrorAlreadyPrinted[nCfgLine/8] |= (1 << (nCfgLine%8));
|
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
printf("CONFIG.SYS error in line %d\n", nCfgLine);
|
2000-05-08 06:30:00 +02:00
|
|
|
|
printf(">>>%s\n ", pTmp);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
while (++pTmp != pLine)
|
|
|
|
|
printf(" ");
|
|
|
|
|
printf("^\n");
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
struct submcb
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-06-15 15:24:53 +02:00
|
|
|
|
char type;
|
|
|
|
|
unsigned short start;
|
|
|
|
|
unsigned short size;
|
|
|
|
|
char unused[3];
|
|
|
|
|
char name[8];
|
|
|
|
|
};
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
void FAR * KernelAllocPara(size_t nPara, char type, char *name, int mode)
|
|
|
|
|
{
|
|
|
|
|
seg base, start;
|
|
|
|
|
struct submcb FAR *p;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
if (UmbState != 1)
|
|
|
|
|
mode = 0;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
if (mode)
|
|
|
|
|
{
|
|
|
|
|
base = umb_base_seg;
|
|
|
|
|
start = umb_start;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
2003-06-15 15:24:53 +02:00
|
|
|
|
{
|
|
|
|
|
base = base_seg;
|
2003-06-15 17:53:58 +02:00
|
|
|
|
start = LoL->first_mcb;
|
2003-06-15 15:24:53 +02:00
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
/* create the special DOS data MCB if it doesn't exist yet */
|
|
|
|
|
DebugPrintf(("kernelallocpara: %x %x %x %c %d\n", start, base, nPara, type, mode));
|
2001-03-30 21:30:06 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
if (base == start)
|
|
|
|
|
{
|
|
|
|
|
mcb FAR *p = para2far(base);
|
|
|
|
|
base++;
|
2003-06-30 20:50:38 +02:00
|
|
|
|
mcb_init(base, p->m_size - 1, p->m_type);
|
|
|
|
|
mumcb_init(FP_SEG(p), 0);
|
|
|
|
|
p->m_name[1] = 'D';
|
2003-06-15 15:24:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
nPara++;
|
|
|
|
|
mcb_init(base + nPara, para2far(base)->m_size - nPara, para2far(base)->m_type);
|
|
|
|
|
para2far(start)->m_size += nPara;
|
2003-06-15 15:24:53 +02:00
|
|
|
|
|
|
|
|
|
p = (struct submcb FAR *)para2far(base);
|
|
|
|
|
p->type = type;
|
|
|
|
|
p->start = FP_SEG(p)+1;
|
2003-06-30 20:50:38 +02:00
|
|
|
|
p->size = nPara-1;
|
2003-06-15 15:24:53 +02:00
|
|
|
|
if (name)
|
|
|
|
|
fmemcpy(p->name, name, 8);
|
2003-06-30 20:50:38 +02:00
|
|
|
|
base += nPara;
|
2003-06-15 15:24:53 +02:00
|
|
|
|
if (mode)
|
|
|
|
|
umb_base_seg = base;
|
|
|
|
|
else
|
|
|
|
|
base_seg = base;
|
|
|
|
|
return MK_FP(FP_SEG(p)+1, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FAR * KernelAlloc(size_t nBytes, char type, int mode)
|
|
|
|
|
{
|
|
|
|
|
void FAR *p;
|
|
|
|
|
size_t nPara = (nBytes + 15)/16;
|
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
if (LoL->first_mcb == 0)
|
2003-06-15 15:24:53 +02:00
|
|
|
|
{
|
|
|
|
|
/* prealloc */
|
|
|
|
|
lpTop = MK_FP(FP_SEG(lpTop) - nPara, FP_OFF(lpTop));
|
2005-01-29 05:59:31 +01:00
|
|
|
|
p=AlignParagraph(lpTop);
|
2003-06-15 15:24:53 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-06-30 20:50:38 +02:00
|
|
|
|
p = KernelAllocPara(nPara, type, NULL, mode);
|
2003-06-15 15:24:53 +02:00
|
|
|
|
}
|
|
|
|
|
fmemset(p, 0, nBytes);
|
|
|
|
|
return p;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef I86
|
2003-03-13 00:06:48 +01:00
|
|
|
|
#if 0
|
2003-06-15 15:24:53 +02:00
|
|
|
|
STATIC BYTE FAR * KernelAllocDma(WORD bytes, char type)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-06-15 15:24:53 +02:00
|
|
|
|
if ((base_seg & 0x0fff) + (bytes >> 4) > 0x1000) {
|
|
|
|
|
KernelAllocPara((base_seg + 0x0fff) & 0xf000 - base_seg, type, NULL, 0);
|
|
|
|
|
}
|
|
|
|
|
return KernelAlloc(bytes, type);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
2003-03-13 00:06:48 +01:00
|
|
|
|
#endif
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC void FAR * AlignParagraph(VOID FAR * lpPtr)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
UWORD uSegVal;
|
|
|
|
|
|
|
|
|
|
/* First, convert the segmented pointer to linear address */
|
2001-04-15 05:21:50 +02:00
|
|
|
|
uSegVal = FP_SEG(lpPtr);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
uSegVal += (FP_OFF(lpPtr) + 0xf) >> 4;
|
2001-04-15 05:21:50 +02:00
|
|
|
|
if (FP_OFF(lpPtr) > 0xfff0)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
uSegVal += 0x1000; /* handle overflow */
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
/* and return an adddress adjusted to the nearest paragraph */
|
|
|
|
|
/* boundary. */
|
|
|
|
|
return MK_FP(uSegVal, 0);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-03-26 12:26:55 +01:00
|
|
|
|
STATIC int iswh(unsigned char c)
|
|
|
|
|
{
|
|
|
|
|
return (c == '\r' || c == '\n' || c == '\t' || c == ' ');
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC BYTE * skipwh(BYTE * s)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2004-03-26 12:26:55 +01:00
|
|
|
|
while (iswh(*s))
|
2000-05-06 21:34:20 +02:00
|
|
|
|
++s;
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC BYTE * scan(BYTE * s, BYTE * d)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2001-11-04 20:47:39 +01:00
|
|
|
|
askThisSingleCommand = FALSE;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
DontAskThisSingleCommand = FALSE;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
s = skipwh(s);
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
|
|
|
|
MenuLine = 0;
|
|
|
|
|
|
2002-05-09 00:49:35 +02:00
|
|
|
|
/* does the line start with "123?" */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
if (isnum(*s))
|
2002-01-23 23:29:41 +01:00
|
|
|
|
{
|
2003-03-13 00:06:48 +01:00
|
|
|
|
unsigned numbers = 0;
|
2003-06-30 20:50:38 +02:00
|
|
|
|
for ( ; isnum(*s); s++)
|
2003-03-13 00:06:48 +01:00
|
|
|
|
numbers |= 1 << (*s -'0');
|
|
|
|
|
|
|
|
|
|
if (*s == '?')
|
|
|
|
|
{
|
|
|
|
|
MenuLine = numbers;
|
|
|
|
|
Menus |= numbers;
|
2002-05-09 00:49:35 +02:00
|
|
|
|
s = skipwh(s+1);
|
|
|
|
|
}
|
2002-01-23 23:29:41 +01:00
|
|
|
|
}
|
2002-05-09 00:49:35 +02:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
|
|
|
|
/* !dos=high,umb ?? */
|
|
|
|
|
if (*s == '!')
|
|
|
|
|
{
|
|
|
|
|
DontAskThisSingleCommand = TRUE;
|
|
|
|
|
s = skipwh(s+1);
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
if (*s == ';')
|
|
|
|
|
{
|
2001-11-14 00:36:45 +01:00
|
|
|
|
/* semicolon is a synonym for rem */
|
|
|
|
|
*d++ = *s++;
|
|
|
|
|
}
|
2001-11-18 15:01:12 +01:00
|
|
|
|
else
|
2004-03-26 12:26:55 +01:00
|
|
|
|
while (*s && !iswh(*s) && *s != '=')
|
2001-11-18 15:01:12 +01:00
|
|
|
|
{
|
|
|
|
|
if (*s == '?')
|
|
|
|
|
askThisSingleCommand = TRUE;
|
|
|
|
|
else
|
2004-03-26 12:26:55 +01:00
|
|
|
|
*d++ = *s;
|
|
|
|
|
s++;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
*d = '\0';
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
STATIC BOOL isnum(char ch)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-06-30 20:50:38 +02:00
|
|
|
|
return (ch >= '0' && ch <= '9');
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Yet another change for true portability (PJV) */
|
2004-05-23 18:21:14 +02:00
|
|
|
|
STATIC char toupper(char c)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
if (c >= 'a' && c <= 'z')
|
2004-05-23 18:21:14 +02:00
|
|
|
|
c -= 'a' - 'A';
|
|
|
|
|
return c;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2003-10-05 18:22:57 +02:00
|
|
|
|
/* Convert string s to uppercase */
|
|
|
|
|
STATIC VOID strupr(char *s)
|
|
|
|
|
{
|
2004-01-26 01:47:56 +01:00
|
|
|
|
while (*s) {
|
|
|
|
|
*s = toupper(*s);
|
|
|
|
|
s++;
|
|
|
|
|
}
|
2003-10-05 18:22:57 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
/* The following code is 8086 dependant */
|
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
#if 1 /* ifdef KERNEL */
|
2003-06-30 20:50:38 +02:00
|
|
|
|
STATIC VOID mcb_init_copy(UCOUNT seg, UWORD size, mcb *near_mcb)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-06-30 20:50:38 +02:00
|
|
|
|
near_mcb->m_size = size;
|
|
|
|
|
fmemcpy(MK_FP(seg, 0), near_mcb, sizeof(mcb));
|
|
|
|
|
}
|
2000-08-06 07:50:17 +02:00
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
STATIC VOID mcb_init(UCOUNT seg, UWORD size, BYTE type)
|
|
|
|
|
{
|
2004-04-14 01:46:25 +02:00
|
|
|
|
static mcb near_mcb BSS_INIT({0});
|
2003-06-30 20:50:38 +02:00
|
|
|
|
near_mcb.m_type = type;
|
|
|
|
|
mcb_init_copy(seg, size, &near_mcb);
|
2000-06-21 20:16:46 +02:00
|
|
|
|
}
|
2000-08-06 07:50:17 +02:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID mumcb_init(UCOUNT seg, UWORD size)
|
2000-08-06 07:50:17 +02:00
|
|
|
|
{
|
2003-06-30 20:50:38 +02:00
|
|
|
|
static mcb near_mcb = {
|
|
|
|
|
MCB_NORMAL,
|
|
|
|
|
8, 0,
|
|
|
|
|
{0,0,0},
|
|
|
|
|
{"SC"}
|
|
|
|
|
};
|
|
|
|
|
mcb_init_copy(seg, size, &near_mcb);
|
2000-08-06 07:50:17 +02:00
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
2002-08-03 04:13:51 +02:00
|
|
|
|
char *strcat(register char * d, register const char * s)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-10-05 18:22:57 +02:00
|
|
|
|
strcpy(d + strlen(d), s);
|
|
|
|
|
return d;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-25 19:11:54 +02:00
|
|
|
|
/* compare two ASCII strings ignoring case */
|
2004-05-24 20:06:04 +02:00
|
|
|
|
STATIC char strcaseequal(const char * d, const char * s)
|
2001-03-25 19:11:54 +02:00
|
|
|
|
{
|
2004-05-24 20:06:04 +02:00
|
|
|
|
char ch;
|
|
|
|
|
while ((ch = toupper(*s++)) == toupper(*d++))
|
|
|
|
|
if (ch == '\0')
|
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
2001-03-25 19:11:54 +02:00
|
|
|
|
}
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
moved from BLOCKIO.C here.
|
|
|
|
|
that saves some relocation problems
|
|
|
|
|
*/
|
|
|
|
|
|
2004-04-11 00:48:26 +02:00
|
|
|
|
STATIC void config_init_buffers(int wantedbuffers)
|
2001-03-21 03:56:26 +01:00
|
|
|
|
{
|
|
|
|
|
struct buffer FAR *pbuffer;
|
2004-04-11 00:48:26 +02:00
|
|
|
|
unsigned buffers = 0;
|
2001-11-04 20:47:39 +01:00
|
|
|
|
|
2004-04-11 00:48:26 +02:00
|
|
|
|
/* fill HMA with buffers if BUFFERS count >=0 and DOS in HMA */
|
|
|
|
|
if (wantedbuffers < 0)
|
|
|
|
|
wantedbuffers = -wantedbuffers;
|
2002-12-09 01:17:15 +01:00
|
|
|
|
else if (HMAState == HMA_DONE)
|
2004-04-11 00:48:26 +02:00
|
|
|
|
buffers = (0xfff0 - HMAFree) / sizeof(struct buffer);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2004-04-11 00:48:26 +02:00
|
|
|
|
if (wantedbuffers < 6) /* min 6 buffers */
|
|
|
|
|
wantedbuffers = 6;
|
|
|
|
|
if (wantedbuffers > 99) /* max 99 buffers */
|
2001-11-18 15:01:12 +01:00
|
|
|
|
{
|
2004-04-11 00:48:26 +02:00
|
|
|
|
printf("BUFFERS=%u not supported, reducing to 99\n", wantedbuffers);
|
|
|
|
|
wantedbuffers = 99;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
2004-04-11 00:48:26 +02:00
|
|
|
|
if (wantedbuffers > buffers) /* more specified than available -> get em */
|
|
|
|
|
buffers = wantedbuffers;
|
2001-07-28 20:13:06 +02:00
|
|
|
|
|
2004-04-11 00:48:26 +02:00
|
|
|
|
LoL->nbuffers = buffers;
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->inforecptr = &LoL->firstbuf;
|
2003-07-12 22:56:11 +02:00
|
|
|
|
{
|
2004-04-11 00:48:26 +02:00
|
|
|
|
size_t bytes = sizeof(struct buffer) * buffers;
|
2003-07-12 22:56:11 +02:00
|
|
|
|
pbuffer = HMAalloc(bytes);
|
|
|
|
|
|
|
|
|
|
if (pbuffer == NULL)
|
|
|
|
|
{
|
|
|
|
|
pbuffer = KernelAlloc(bytes, 'B', 0);
|
2004-04-11 00:48:26 +02:00
|
|
|
|
if (HMAState == HMA_DONE)
|
|
|
|
|
firstAvailableBuf = MK_FP(0xffff, HMAFree);
|
2003-07-12 22:56:11 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LoL->bufloc = LOC_HMA;
|
2004-04-11 00:48:26 +02:00
|
|
|
|
/* space in HMA beyond requested buffers available as user space */
|
|
|
|
|
firstAvailableBuf = pbuffer + wantedbuffers;
|
2003-07-12 22:56:11 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2004-05-23 17:10:08 +02:00
|
|
|
|
LoL->deblock_buf = DiskTransferBuffer;
|
2003-07-12 22:56:11 +02:00
|
|
|
|
LoL->firstbuf = pbuffer;
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
2002-08-03 04:13:51 +02:00
|
|
|
|
DebugPrintf(("init_buffers (size %u) at", sizeof(struct buffer)));
|
2003-06-15 17:53:58 +02:00
|
|
|
|
DebugPrintf((" (%p)", LoL->firstbuf));
|
2001-09-23 22:39:44 +02:00
|
|
|
|
|
2004-04-11 00:48:26 +02:00
|
|
|
|
buffers--;
|
|
|
|
|
pbuffer->b_prev = FP_OFF(pbuffer + buffers);
|
2001-03-21 03:56:26 +01:00
|
|
|
|
{
|
2004-04-11 00:48:26 +02:00
|
|
|
|
int i = buffers;
|
|
|
|
|
do
|
2002-12-09 01:17:15 +01:00
|
|
|
|
{
|
2004-04-11 00:48:26 +02:00
|
|
|
|
pbuffer->b_next = FP_OFF(pbuffer + 1);
|
|
|
|
|
pbuffer++;
|
|
|
|
|
pbuffer->b_prev = FP_OFF(pbuffer - 1);
|
|
|
|
|
}
|
|
|
|
|
while (--i);
|
2002-12-09 01:17:15 +01:00
|
|
|
|
}
|
2004-04-11 00:48:26 +02:00
|
|
|
|
pbuffer->b_next = FP_OFF(pbuffer - buffers);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
|
|
|
|
/* now, we can have quite some buffers in HMA
|
2002-12-09 01:17:15 +01:00
|
|
|
|
-- up to 50 for KE38616.
|
2001-11-18 15:01:12 +01:00
|
|
|
|
so we fill the HMA with buffers
|
|
|
|
|
but not if the BUFFERS count is negative ;-)
|
|
|
|
|
*/
|
|
|
|
|
|
2001-09-23 22:39:44 +02:00
|
|
|
|
DebugPrintf((" done\n"));
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2002-12-09 01:17:15 +01:00
|
|
|
|
if (FP_SEG(pbuffer) == 0xffff)
|
2004-04-11 00:48:26 +02:00
|
|
|
|
{
|
|
|
|
|
buffers++;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
printf("Kernel: allocated %d Diskbuffers = %u Bytes in HMA\n",
|
2004-04-11 00:48:26 +02:00
|
|
|
|
buffers, buffers * sizeof(struct buffer));
|
|
|
|
|
}
|
2001-03-21 03:56:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
2004-03-27 00:27:18 +01:00
|
|
|
|
STATIC void config_init_fnodes(int f_nodes_cnt)
|
2004-03-27 00:10:13 +01:00
|
|
|
|
{
|
|
|
|
|
struct f_node FAR *p;
|
|
|
|
|
size_t bytes;
|
|
|
|
|
|
|
|
|
|
/* number of allocated files */
|
|
|
|
|
LoL->f_nodes_cnt = f_nodes_cnt;
|
|
|
|
|
bytes = f_nodes_cnt * sizeof(struct f_node);
|
|
|
|
|
|
|
|
|
|
p = HMAalloc(bytes);
|
|
|
|
|
if (p == NULL)
|
|
|
|
|
p = KernelAlloc(bytes, 'F', 0);
|
|
|
|
|
LoL->f_nodes = p;
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-21 03:56:26 +01:00
|
|
|
|
/*
|
|
|
|
|
Undocumented feature:
|
|
|
|
|
|
|
|
|
|
ANYDOS
|
|
|
|
|
will report to MSDOS programs just the version number
|
|
|
|
|
they expect. be careful with it!
|
2001-11-18 15:01:12 +01:00
|
|
|
|
*/
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID SetAnyDos(BYTE * pLine)
|
2001-03-21 03:56:26 +01:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
UNREFERENCED_PARAMETER(pLine);
|
|
|
|
|
ReturnAnyDosVersionExpected = TRUE;
|
2001-03-21 03:56:26 +01:00
|
|
|
|
}
|
2001-07-10 00:19:33 +02:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID CfgIgnore(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
UNREFERENCED_PARAMETER(pLine);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
'MENU'ing stuff
|
|
|
|
|
|
|
|
|
|
although it's worse then MSDOS's , its better then nothing
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
STATIC void ClearScreen(unsigned char attr);
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID CfgMenu(BYTE * pLine)
|
|
|
|
|
{
|
2003-09-18 22:55:41 +02:00
|
|
|
|
int nLen;
|
|
|
|
|
BYTE *pNumber = pLine;
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
printf("%s\n",pLine);
|
2003-09-18 22:55:41 +02:00
|
|
|
|
if (MenuColor == -1)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
pLine = skipwh(pLine);
|
|
|
|
|
|
|
|
|
|
/* skip drawing characters in cp437, which is what we'll have
|
|
|
|
|
just after booting! */
|
|
|
|
|
while ((unsigned char)*pLine >= 0xb0 && (unsigned char)*pLine < 0xe0)
|
|
|
|
|
pLine++;
|
|
|
|
|
|
|
|
|
|
pLine = skipwh(pLine); /* skip more whitespaces... */
|
|
|
|
|
|
|
|
|
|
/* now I'm expecting a number here if this is a menu-choice line. */
|
2004-05-10 03:36:09 +02:00
|
|
|
|
if (isnum(pLine[0]))
|
2003-09-18 22:55:41 +02:00
|
|
|
|
{
|
2004-05-23 16:24:32 +02:00
|
|
|
|
struct MenuSelector *menu = &MenuStruct[pLine[0]-'0'];
|
2003-09-18 22:55:41 +02:00
|
|
|
|
|
2004-05-23 16:24:32 +02:00
|
|
|
|
menu->x = (pLine-pNumber); /* xpos is at start of number */
|
|
|
|
|
menu->y = nMenuLine;
|
2003-09-18 22:55:41 +02:00
|
|
|
|
/* copy menu text: */
|
|
|
|
|
nLen = findend(pLine); /* length is until cr/lf, null or three spaces */
|
|
|
|
|
|
|
|
|
|
/* max 40 chars including nullterminator
|
|
|
|
|
(change struct at top of file if you want more...) */
|
|
|
|
|
if (nLen > MENULINEMAX-1)
|
|
|
|
|
nLen = MENULINEMAX-1;
|
2004-05-23 16:24:32 +02:00
|
|
|
|
memcpy(menu->Text, pLine, nLen);
|
|
|
|
|
menu->Text[nLen] = 0; /* nullTerminate */
|
2003-09-18 22:55:41 +02:00
|
|
|
|
}
|
|
|
|
|
nMenuLine++;
|
|
|
|
|
}
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2003-06-15 21:26:49 +02:00
|
|
|
|
STATIC VOID CfgMenuEsc(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
BYTE * check;
|
|
|
|
|
for (check = pLine; check[0]; check++)
|
|
|
|
|
if (check[0] == '$') check[0] = 27; /* translate $ to ESC */
|
|
|
|
|
printf("%s\n",pLine);
|
2003-09-18 22:55:41 +02:00
|
|
|
|
}
|
2003-06-15 21:26:49 +02:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID DoMenu(void)
|
2003-09-18 22:55:41 +02:00
|
|
|
|
{
|
|
|
|
|
iregs r;
|
|
|
|
|
int key = -1;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
if (Menus == 0)
|
2003-09-18 22:55:41 +02:00
|
|
|
|
return;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
InitKernelConfig.SkipConfigSeconds = -1;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
if (MenuColor == -1)
|
|
|
|
|
Menus |= 1 << 0; /* '0' Menu always allowed */
|
|
|
|
|
|
|
|
|
|
nMenuLine+=2; /* use this to position "select menu" text (ypos): */
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
for (;;)
|
|
|
|
|
{
|
2004-05-23 16:24:32 +02:00
|
|
|
|
int i, j;
|
2003-09-18 22:55:41 +02:00
|
|
|
|
|
|
|
|
|
RestartInput:
|
|
|
|
|
|
|
|
|
|
if (MenuColor != -1)
|
|
|
|
|
{
|
|
|
|
|
SelectLine(MenuSelected); /* select current line. */
|
|
|
|
|
|
|
|
|
|
/* set new cursor position: */
|
|
|
|
|
r.a.b.h = 0x02;
|
|
|
|
|
r.b.b.h = 0;
|
|
|
|
|
r.d.b.l = 3;
|
|
|
|
|
r.d.b.h = nMenuLine;
|
|
|
|
|
|
|
|
|
|
init_call_intr(0x10, &r); /* set cursor pos */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("Select from Menu [");
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
2004-05-23 16:24:32 +02:00
|
|
|
|
for (i = 0, j = 1; i <= 9; i++, j<<=1)
|
|
|
|
|
if (Menus & j)
|
2002-01-23 23:29:41 +01:00
|
|
|
|
printf("%c", '0' + i);
|
2003-09-18 22:55:41 +02:00
|
|
|
|
printf("], or press [ENTER]");
|
|
|
|
|
|
|
|
|
|
if (MenuColor != -1)
|
2004-05-23 16:24:32 +02:00
|
|
|
|
printf(" (Selection=%d) ", MenuSelected);
|
2003-09-18 22:55:41 +02:00
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
if (MenuTimeout >= 0)
|
2004-05-23 16:24:32 +02:00
|
|
|
|
printf("- %d \b", MenuTimeout);
|
2003-09-18 22:55:41 +02:00
|
|
|
|
else
|
2004-05-23 16:24:32 +02:00
|
|
|
|
printf(" \b\b\b\b\b");
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
if (MenuColor != -1)
|
|
|
|
|
printf("\r\n\n ");
|
|
|
|
|
else
|
|
|
|
|
printf(" -");
|
|
|
|
|
|
|
|
|
|
printf(" Singlestepping (F8) is: %s \r", singleStep ? "ON " : "OFF");
|
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
key = GetBiosKey(MenuTimeout >= 0 ? 1 : -1);
|
|
|
|
|
|
|
|
|
|
if (key == -1) /* timeout, take default */
|
|
|
|
|
{
|
|
|
|
|
if (MenuTimeout > 0)
|
|
|
|
|
{
|
|
|
|
|
MenuTimeout--;
|
|
|
|
|
goto RestartInput;
|
|
|
|
|
}
|
2003-09-18 22:55:41 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
2003-03-13 00:06:48 +01:00
|
|
|
|
MenuTimeout = -1;
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
if (key == 0x3f00) /* F5 */
|
|
|
|
|
{
|
|
|
|
|
SkipAllConfig = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (key == 0x4200) /* F8 */
|
|
|
|
|
{
|
|
|
|
|
singleStep = !singleStep;
|
|
|
|
|
}
|
2003-09-18 22:55:41 +02:00
|
|
|
|
else if(key == 0x4800 && MenuColor != -1) /* arrow up */
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{
|
2004-01-31 16:06:36 +01:00
|
|
|
|
if(MenuSelected>=1 && (Menus & (1 << (MenuSelected-1))) )
|
2003-09-18 22:55:41 +02:00
|
|
|
|
{
|
|
|
|
|
MenuSelected--;
|
|
|
|
|
}
|
2002-01-23 23:29:41 +01:00
|
|
|
|
}
|
2003-09-18 22:55:41 +02:00
|
|
|
|
else if(key == 0x5000 && MenuColor != -1) /* arrow down */
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{
|
2004-01-31 16:06:36 +01:00
|
|
|
|
if(MenuSelected<MENULINESMAX-1 && (Menus & (1 << (MenuSelected+1))) )
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{
|
2003-09-18 22:55:41 +02:00
|
|
|
|
MenuSelected++;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
}
|
2003-09-18 22:55:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
key &= 0xff;
|
|
|
|
|
|
|
|
|
|
if (key == '\r' || key == 0x1b) /* CR/ESC - use default */
|
|
|
|
|
break;
|
|
|
|
|
|
2004-05-10 03:36:09 +02:00
|
|
|
|
if (isnum(key) && (Menus & (1 << (key - '0'))))
|
2003-09-18 22:55:41 +02:00
|
|
|
|
{
|
|
|
|
|
MenuSelected = key - '0';
|
|
|
|
|
break;
|
|
|
|
|
}
|
2003-03-13 00:06:48 +01:00
|
|
|
|
}
|
2002-01-23 23:29:41 +01:00
|
|
|
|
printf("\n");
|
2003-09-18 22:55:41 +02:00
|
|
|
|
|
2003-10-05 18:22:57 +02:00
|
|
|
|
/* export the current selected config menu */
|
|
|
|
|
sprintf(envp, "CONFIG=%c", MenuSelected+'0');
|
|
|
|
|
envp += 9;
|
2003-09-18 22:55:41 +02:00
|
|
|
|
if (MenuColor != -1)
|
|
|
|
|
ClearScreen(0x7);
|
2002-01-23 23:29:41 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
STATIC VOID CfgMenuDefault(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
COUNT num = 0;
|
|
|
|
|
|
|
|
|
|
pLine = skipwh(pLine);
|
|
|
|
|
|
|
|
|
|
if ('=' != *pLine)
|
|
|
|
|
{
|
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
pLine = skipwh(pLine + 1);
|
|
|
|
|
|
|
|
|
|
/* Format: STACKS = stacks [, stackSize] */
|
|
|
|
|
pLine = GetNumArg(pLine, &num);
|
2002-05-09 00:49:35 +02:00
|
|
|
|
MenuSelected = num;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
pLine = skipwh(pLine);
|
|
|
|
|
|
|
|
|
|
if (*pLine == ',')
|
|
|
|
|
{
|
|
|
|
|
GetNumArg(++pLine, &MenuTimeout);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-18 22:55:41 +02:00
|
|
|
|
STATIC void ClearScreen(unsigned char attr)
|
|
|
|
|
{
|
|
|
|
|
/* scroll down (newlines): */
|
|
|
|
|
iregs r;
|
2004-05-23 16:24:32 +02:00
|
|
|
|
unsigned char rows;
|
2003-09-18 22:55:41 +02:00
|
|
|
|
|
|
|
|
|
/* clear */
|
|
|
|
|
r.a.x = 0x0600;
|
|
|
|
|
r.b.b.h = attr;
|
|
|
|
|
r.c.x = 0;
|
2004-05-23 16:24:32 +02:00
|
|
|
|
r.d.b.l = peekb(0x40, 0x4a) - 1; /* columns */
|
2003-09-18 22:55:41 +02:00
|
|
|
|
rows = peekb(0x40, 0x84);
|
|
|
|
|
if (rows == 0) rows = 24;
|
2004-05-23 16:24:32 +02:00
|
|
|
|
r.d.b.h = rows;
|
2003-09-18 22:55:41 +02:00
|
|
|
|
init_call_intr(0x10, &r);
|
|
|
|
|
|
|
|
|
|
/* move cursor to pos 0,0: */
|
|
|
|
|
r.a.b.h = 0x02; /* set cursorpos */
|
|
|
|
|
r.b.b.h = 0; /* displaypage: */
|
|
|
|
|
r.d.x = 0; /* pos 0,0 */
|
|
|
|
|
init_call_intr(0x10, &r);
|
|
|
|
|
MenuColor = attr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
MENUCOLOR[=] fg[, bg]
|
|
|
|
|
*/
|
|
|
|
|
STATIC void CfgMenuColor(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
int num = 0;
|
|
|
|
|
unsigned char fg, bg = 0;
|
|
|
|
|
|
|
|
|
|
pLine = skipwh(pLine);
|
|
|
|
|
|
|
|
|
|
if ('=' == *pLine)
|
|
|
|
|
pLine = skipwh(pLine + 1);
|
|
|
|
|
|
|
|
|
|
pLine = GetNumArg(pLine, &num);
|
|
|
|
|
if (pLine == 0)
|
|
|
|
|
return;
|
|
|
|
|
fg = (unsigned char)num;
|
|
|
|
|
|
|
|
|
|
pLine = skipwh(pLine);
|
|
|
|
|
|
|
|
|
|
if (*pLine == ',')
|
|
|
|
|
{
|
|
|
|
|
pLine = GetNumArg(skipwh(pLine+1), &num);
|
|
|
|
|
if (pLine == 0)
|
|
|
|
|
return;
|
|
|
|
|
bg = (unsigned char)num;
|
|
|
|
|
}
|
|
|
|
|
ClearScreen((bg << 4) | fg);
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
/*********************************************************************************
|
|
|
|
|
National specific things.
|
|
|
|
|
this handles only Date/Time/Currency, and NOT codepage things.
|
|
|
|
|
Some may consider this a hack, but I like to see 24 Hour support. tom.
|
|
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
|
|
#define _DATE_MDY 0 /* mm/dd/yy */
|
|
|
|
|
#define _DATE_DMY 1 /* dd.mm.yy */
|
|
|
|
|
#define _DATE_YMD 2 /* yy/mm/dd */
|
|
|
|
|
|
|
|
|
|
#define _TIME_12 0
|
|
|
|
|
#define _TIME_24 1
|
|
|
|
|
|
|
|
|
|
struct CountrySpecificInfo specificCountriesSupported[] = {
|
|
|
|
|
|
|
|
|
|
/* US */ {
|
|
|
|
|
1, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
437,
|
|
|
|
|
_DATE_MDY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"$", /* '$' ,'EUR' */
|
|
|
|
|
",", /* ',' # Thousand's separator */
|
|
|
|
|
".", /* '.' # Decimal point */
|
|
|
|
|
"/", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_12 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Canadian French */ ,{
|
|
|
|
|
2, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
863,
|
|
|
|
|
_DATE_YMD, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"$", /* '$' ,'EUR' */
|
|
|
|
|
",", /* ',' # Thousand's separator */
|
|
|
|
|
".", /* '.' # Decimal point */
|
|
|
|
|
"-", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Latin America */ ,{
|
|
|
|
|
3, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_MDY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"$", /* '$' ,'EUR' */
|
|
|
|
|
",", /* ',' # Thousand's separator */
|
|
|
|
|
".", /* '.' # Decimal point */
|
|
|
|
|
"/", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_12 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Russia - by arkady */ ,{
|
|
|
|
|
7, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
866,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"RUB", /* '$' ,'EUR' */
|
|
|
|
|
/* should be "\xE0", but as no codepage
|
|
|
|
|
support exists (yet), better to leave it as 'Rubels'
|
|
|
|
|
*/
|
|
|
|
|
" ", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
".", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
3, /* Currency format : currency follows, after blank */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* DUTCH */ ,{
|
|
|
|
|
31, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"EUR", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"-", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Belgium */ ,{
|
|
|
|
|
32, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"EUR", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"-", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* France */ ,{
|
|
|
|
|
33, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"EUR", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"-", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Spain */ ,{
|
2005-09-09 01:48:25 +02:00
|
|
|
|
34, /* = W1 W437 # Country ID & Codepage */
|
2003-03-13 00:06:48 +01:00
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"EUR", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
"'", /* Decimal point - by aitor */
|
|
|
|
|
"-", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Hungary */ ,{
|
|
|
|
|
36, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"$HU", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"-", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Yugoslavia */ ,{
|
|
|
|
|
38, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"$YU", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"-", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Italy */ ,{
|
|
|
|
|
39, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"EUR", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"-", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Switzerland */ ,{
|
|
|
|
|
41, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"SF", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
".", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Czechoslovakia */ ,{
|
|
|
|
|
42, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_YMD, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"$YU", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
".", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* UK */ ,{
|
|
|
|
|
44, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"\x9c", /* Pound sign */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"/", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Denmark */ ,{
|
|
|
|
|
45, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"DKK", /* */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"-", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
/* Sweden */ ,{
|
|
|
|
|
46, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_YMD, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"SEK", /* */
|
|
|
|
|
",", /* ',' # Thousand's separator */
|
|
|
|
|
".", /* '.' # Decimal point */
|
|
|
|
|
"-", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Norway */ ,{
|
|
|
|
|
47, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"NOK", /* */
|
|
|
|
|
",", /* ',' # Thousand's separator */
|
|
|
|
|
".", /* '.' # Decimal point */
|
|
|
|
|
".", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Poland */ ,{
|
|
|
|
|
48, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_YMD, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"PLN", /* michael tyc: PLN means PoLish New zloty, I think) */
|
|
|
|
|
",", /* ',' # Thousand's separator */
|
|
|
|
|
".", /* '.' # Decimal point */
|
|
|
|
|
".", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* GERMAN */ ,{
|
|
|
|
|
49, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"EUR", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
".", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
1, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Argentina */ ,{
|
|
|
|
|
54, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"$ar", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"/", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
1, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_12 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Brazil */ ,{
|
|
|
|
|
55, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"$ar", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"/", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
1, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* International English */ ,{
|
|
|
|
|
61, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_MDY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"$", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"/", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Japan - Yuki Mitsui */ ,{
|
|
|
|
|
81, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
932,
|
|
|
|
|
_DATE_YMD, /* Date format: 0/1/2:U.S.A./Europe/Japan */
|
|
|
|
|
"\x81\x8f", /* '$' ,'EUR' */
|
|
|
|
|
",", /* ',' # Thousand's separator */
|
|
|
|
|
".", /* '.' # Decimal point */
|
|
|
|
|
"/", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_12 /* = 0 # time format: 0/1: 12/24 houres
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Portugal */ ,{
|
|
|
|
|
351, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"EUR", /* '$' ,'EUR' */
|
|
|
|
|
".", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
"-", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0, /* = 0 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Finland - by wolf */ ,{
|
|
|
|
|
358, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
850,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"EUR", /* '$' ,'EUR' */
|
|
|
|
|
" ", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
".", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
0x3, /* # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 hours */
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-17 17:19:29 +02:00
|
|
|
|
/* Bulgaria - by Luchezar Georgiev */ ,{
|
|
|
|
|
359, /* = W1 W437 # Country ID & Codepage */
|
|
|
|
|
855,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"BGL", /* '$' ,'EUR' */
|
|
|
|
|
" ", /* ',' # Thousand's separator */
|
|
|
|
|
",", /* '.' # Decimal point */
|
|
|
|
|
".", /* '-' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
3, /* # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 0 # time format: 0/1: 12/24 hours */
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
/* Ukraine - by Oleg Deribas */ ,{
|
|
|
|
|
380, /* = W380 W848 # Country ID & Codepage */
|
|
|
|
|
848,
|
|
|
|
|
_DATE_DMY, /* Date format: 0/1/2: U.S.A./Europe/Japan */
|
|
|
|
|
"UAH", /* Currency */
|
|
|
|
|
" ", /* ' ' # Thousand's separator */
|
|
|
|
|
",", /* ',' # Decimal point */
|
|
|
|
|
".", /* '.' DateSeparator */
|
|
|
|
|
":", /* ':' TimeSeparator */
|
|
|
|
|
3, /* = 3 # Currency format (bit array) */
|
|
|
|
|
2, /* = 2 # Currency precision */
|
|
|
|
|
_TIME_24 /* = 1 # time format: 0/1: 12/24 houres */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* contributors to above table:
|
|
|
|
|
|
|
|
|
|
tom ehlert (GER)
|
|
|
|
|
bart oldeman (NL)
|
|
|
|
|
wolf (FIN)
|
|
|
|
|
Michael H.Tyc (POL)
|
|
|
|
|
Oleg Deribas (UKR)
|
|
|
|
|
Arkady Belousov (RUS)
|
2003-06-17 17:19:29 +02:00
|
|
|
|
Luchezar Georgiev (BUL)
|
2003-03-13 00:06:48 +01:00
|
|
|
|
Yuki Mitsui (JAP)
|
|
|
|
|
Aitor Santamar<EFBFBD>a Merino (SP)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
STATIC int LoadCountryInfoHardCoded(char *filename, COUNT ctryCode, COUNT codePage)
|
|
|
|
|
{
|
2004-05-25 01:34:22 +02:00
|
|
|
|
struct CountrySpecificInfo *country;
|
2003-03-13 00:06:48 +01:00
|
|
|
|
UNREFERENCED_PARAMETER(codePage);
|
|
|
|
|
UNREFERENCED_PARAMETER(filename);
|
|
|
|
|
|
|
|
|
|
/* printf("cntry: %u, CP%u, file=\"%s\"\n", ctryCode, codePage, filename); */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-05-25 01:34:22 +02:00
|
|
|
|
for (country = specificCountriesSupported;
|
|
|
|
|
country < specificCountriesSupported + LENGTH(specificCountriesSupported);
|
|
|
|
|
country++)
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{
|
2004-05-25 01:34:22 +02:00
|
|
|
|
if (country->CountryID == ctryCode)
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{
|
|
|
|
|
int codepagesaved = nlsCountryInfoHardcoded.C.CodePage;
|
|
|
|
|
|
2004-05-25 01:34:22 +02:00
|
|
|
|
fmemcpy(&nlsCountryInfoHardcoded.C.CountryID,
|
|
|
|
|
country,
|
|
|
|
|
min(nlsCountryInfoHardcoded.TableSize, sizeof *country));
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
|
|
|
|
nlsCountryInfoHardcoded.C.CodePage = codepagesaved;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-05-25 01:34:22 +02:00
|
|
|
|
|
2004-05-10 03:36:09 +02:00
|
|
|
|
printf("could not find country info for country ID %u\n"
|
|
|
|
|
"current supported countries are ", ctryCode);
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
2004-05-25 01:34:22 +02:00
|
|
|
|
for (country = specificCountriesSupported;
|
|
|
|
|
country < specificCountriesSupported + LENGTH(specificCountriesSupported);
|
|
|
|
|
country++)
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{
|
2004-05-25 01:34:22 +02:00
|
|
|
|
printf("%u ", country->CountryID);
|
2003-03-13 00:06:48 +01:00
|
|
|
|
}
|
2004-05-25 01:34:22 +02:00
|
|
|
|
printf("\n");
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ****************************************************************
|
|
|
|
|
** implementation of INSTALL=NANSI.COM /P /X /BLA
|
|
|
|
|
*/
|
|
|
|
|
|
2004-04-14 16:04:04 +02:00
|
|
|
|
int numInstallCmds BSS_INIT(0);
|
2003-06-30 20:50:38 +02:00
|
|
|
|
struct instCmds {
|
2003-03-13 00:06:48 +01:00
|
|
|
|
char buffer[128];
|
|
|
|
|
int mode;
|
2004-04-14 16:04:04 +02:00
|
|
|
|
} InstallCommands[10] BSS_INIT({0});
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
#define InstallPrintf(x) printf x
|
|
|
|
|
#else
|
2003-03-13 00:06:48 +01:00
|
|
|
|
#define InstallPrintf(x)
|
2003-06-15 15:24:53 +02:00
|
|
|
|
#endif
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
|
|
|
|
STATIC VOID _CmdInstall(BYTE * pLine,int mode)
|
|
|
|
|
{
|
2004-05-23 16:24:32 +02:00
|
|
|
|
struct instCmds *cmd;
|
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
InstallPrintf(("Installcmd %d:%s\n",numInstallCmds,pLine));
|
|
|
|
|
|
|
|
|
|
if (numInstallCmds > LENGTH(InstallCommands))
|
|
|
|
|
{
|
|
|
|
|
printf("Too many Install commands given (%d max)\n",LENGTH(InstallCommands));
|
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
return;
|
2003-06-15 15:24:53 +02:00
|
|
|
|
}
|
2004-05-23 16:24:32 +02:00
|
|
|
|
cmd = &InstallCommands[numInstallCmds];
|
|
|
|
|
memcpy(cmd->buffer,pLine,127);
|
|
|
|
|
cmd->buffer[127] = 0;
|
|
|
|
|
cmd->mode = mode;
|
2003-03-13 00:06:48 +01:00
|
|
|
|
numInstallCmds++;
|
2003-06-15 15:24:53 +02:00
|
|
|
|
}
|
2003-03-13 00:06:48 +01:00
|
|
|
|
STATIC VOID CmdInstall(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
_CmdInstall(pLine,0);
|
|
|
|
|
}
|
|
|
|
|
STATIC VOID CmdInstallHigh(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
_CmdInstall(pLine,0x80); /* load high, if possible */
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
STATIC VOID InstallExec(struct instCmds *icmd)
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{
|
2003-06-30 20:52:43 +02:00
|
|
|
|
BYTE filename[128], *args, *d, *cmd = icmd->buffer;
|
2003-03-13 00:06:48 +01:00
|
|
|
|
exec_blk exb;
|
|
|
|
|
|
|
|
|
|
InstallPrintf(("installing %s\n",cmd));
|
|
|
|
|
|
|
|
|
|
cmd=skipwh(cmd);
|
|
|
|
|
|
|
|
|
|
for (args = cmd, d = filename; ;args++,d++)
|
|
|
|
|
{
|
|
|
|
|
*d = *args;
|
|
|
|
|
if (*d <= 0x020 || *d == '/')
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
*d = 0;
|
|
|
|
|
|
|
|
|
|
args--;
|
2004-04-07 00:48:12 +02:00
|
|
|
|
*args = strlen(&args[1]);
|
|
|
|
|
args[*args+1] = '\r';
|
2003-03-13 00:06:48 +01:00
|
|
|
|
args[*args+2] = 0;
|
|
|
|
|
|
|
|
|
|
exb.exec.env_seg = 0;
|
|
|
|
|
exb.exec.cmd_line = (CommandTail FAR *) args;
|
|
|
|
|
exb.exec.fcb_1 = exb.exec.fcb_2 = (fcb FAR *) 0xfffffffful;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InstallPrintf(("cmd[%s] args [%u,%s]\n",filename,*args,args+1));
|
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
if (init_DosExec(icmd->mode, &exb, filename) != SUCCESS)
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{
|
|
|
|
|
CfgFailure(cmd);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
STATIC void free(seg segment)
|
|
|
|
|
{
|
|
|
|
|
iregs r;
|
|
|
|
|
|
|
|
|
|
r.a.b.h = 0x49; /* free memory */
|
|
|
|
|
r.es = segment;
|
|
|
|
|
init_call_intr(0x21, &r);
|
|
|
|
|
}
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
2004-05-10 03:36:09 +02:00
|
|
|
|
/* set memory allocation strategy */
|
|
|
|
|
STATIC void set_strategy(unsigned char strat)
|
|
|
|
|
{
|
|
|
|
|
iregs r;
|
|
|
|
|
|
|
|
|
|
r.a.x = 0x5801;
|
|
|
|
|
r.b.b.l = strat;
|
|
|
|
|
init_call_intr(0x21, &r);
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
VOID DoInstall(void)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
unsigned short installMemory;
|
2004-05-23 16:24:32 +02:00
|
|
|
|
struct instCmds *cmd;
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
|
|
|
|
if (numInstallCmds == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
InstallPrintf(("Installing commands now\n"));
|
|
|
|
|
|
|
|
|
|
/* grab memory for this install code
|
|
|
|
|
we KNOW, that we are executing somewhere at top of memory
|
|
|
|
|
we need to protect the INIT_CODE from other programs
|
|
|
|
|
that will be executing soon
|
|
|
|
|
*/
|
|
|
|
|
|
2004-05-10 03:36:09 +02:00
|
|
|
|
set_strategy(LAST_FIT);
|
2004-05-23 22:01:30 +02:00
|
|
|
|
installMemory = allocmem(((unsigned)_init_end + ebda_size + 15) / 16);
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
|
|
|
|
InstallPrintf(("allocated memory at %x\n",installMemory));
|
|
|
|
|
|
2004-05-23 16:24:32 +02:00
|
|
|
|
for (i = 0, cmd = InstallCommands; i < numInstallCmds; i++, cmd++)
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{
|
2004-05-23 16:24:32 +02:00
|
|
|
|
InstallPrintf(("%d:%s\n",i,cmd->buffer));
|
|
|
|
|
set_strategy(cmd->mode);
|
|
|
|
|
InstallExec(cmd);
|
2004-05-10 03:36:09 +02:00
|
|
|
|
}
|
|
|
|
|
set_strategy(FIRST_FIT);
|
2003-06-15 15:24:53 +02:00
|
|
|
|
free(installMemory);
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
|
|
|
|
InstallPrintf(("Done with installing commands\n"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2003-10-05 18:22:57 +02:00
|
|
|
|
|
|
|
|
|
STATIC VOID CmdSet(BYTE *pLine)
|
|
|
|
|
{
|
|
|
|
|
pLine = GetStringArg(pLine, szBuf);
|
|
|
|
|
pLine = skipwh(pLine); /* scan() stops at the equal sign or space */
|
|
|
|
|
if (*pLine == '=') /* equal sign is required */
|
|
|
|
|
{
|
|
|
|
|
int size;
|
|
|
|
|
strupr(szBuf); /* all environment variables must be uppercase */
|
|
|
|
|
strcat(szBuf, "=");
|
|
|
|
|
pLine = skipwh(++pLine);
|
|
|
|
|
strcat(szBuf, pLine); /* append the variable value (may include spaces) */
|
|
|
|
|
size = strlen(szBuf);
|
|
|
|
|
if (size < master_env + sizeof(master_env) - envp - 1)
|
|
|
|
|
{ /* must end with two consequtive zeros */
|
|
|
|
|
strcpy(envp, szBuf);
|
|
|
|
|
envp += size + 1; /* add next variables starting at the second zero */
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf("Master environment is full - can't add \"%s\"\n", szBuf);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf("Invalid SET command: \"%s\"\n", szBuf);
|
|
|
|
|
}
|