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
|
|
|
|
|
2002-02-03 23:40:24 +01:00
|
|
|
|
UWORD umb_start = 0, UMB_top = 0;
|
|
|
|
|
UWORD ram_top = 0; /* How much ram in Kbytes */
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2002-11-09 20:10:11 +01:00
|
|
|
|
static UBYTE ErrorAlreadyPrinted[128];
|
|
|
|
|
|
|
|
|
|
|
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,
|
2001-11-18 15:01:12 +01:00
|
|
|
|
128
|
|
|
|
|
/* COUNTRY= is initialized within DoConfig() */
|
|
|
|
|
, 0 /* country ID */
|
|
|
|
|
, 0 /* codepage */
|
|
|
|
|
, "" /* filename */
|
|
|
|
|
, 0 /* amount required memory */
|
|
|
|
|
, 0 /* pointer to loaded data */
|
|
|
|
|
, 0 /* strategy for command.com is low by default */
|
2003-09-04 21:14:16 +02:00
|
|
|
|
, 0xFFFF /* default value for switches=/E:nnnn */
|
2001-11-18 15:01:12 +01:00
|
|
|
|
};
|
|
|
|
|
/* MSC places uninitialized data into COMDEF records,
|
2003-09-04 21:14:16 +02:00
|
|
|
|
that end up in DATA segment. this can't be tolerated
|
2001-11-18 15:01:12 +01:00
|
|
|
|
in INIT code.
|
2003-09-04 21:14:16 +02:00
|
|
|
|
please make sure, that ALL data in INIT is initialized !!
|
2001-11-18 15:01:12 +01:00
|
|
|
|
*/
|
2003-06-15 15:24:53 +02:00
|
|
|
|
STATIC seg base_seg = 0;
|
|
|
|
|
STATIC seg umb_base_seg = 0;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
BYTE FAR *lpTop = 0;
|
2001-09-23 22:39:44 +02:00
|
|
|
|
BYTE FAR *lpOldTop = 0;
|
2002-08-03 04:13:51 +02:00
|
|
|
|
STATIC unsigned nCfgLine = 0;
|
2001-09-23 22:39:44 +02:00
|
|
|
|
STATIC COUNT nPass = 0;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
COUNT UmbState = 0;
|
|
|
|
|
STATIC BYTE szLine[256] = { 0 };
|
|
|
|
|
STATIC BYTE szBuf[256] = { 0 };
|
2001-11-04 20:47:39 +01:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
BYTE singleStep = FALSE; /* F8 processing */
|
|
|
|
|
BYTE SkipAllConfig = FALSE; /* F5 processing */
|
2003-03-13 00:06:48 +01:00
|
|
|
|
BYTE askThisSingleCommand = FALSE; /* ?device= device?= */
|
|
|
|
|
BYTE DontAskThisSingleCommand = FALSE; /* !files= */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
|
|
|
|
COUNT MenuTimeout = -1;
|
2002-05-09 00:49:35 +02:00
|
|
|
|
BYTE MenuSelected = 0;
|
|
|
|
|
UCOUNT MenuLine = 0;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
UCOUNT Menus = 0;
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
STATIC char * GetNumber(REG const char *p, int *num);
|
2002-10-22 04:40:19 +02:00
|
|
|
|
#if 0
|
|
|
|
|
STATIC COUNT tolower(COUNT c);
|
|
|
|
|
#endif
|
|
|
|
|
STATIC COUNT toupper(COUNT c);
|
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
|
|
|
|
|
STATIC COUNT strcasecmp(REG BYTE * d, REG BYTE * 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);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
VOID config_init_buffers(COUNT anzBuffers); /* from BLOCKIO.C */
|
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;
|
|
|
|
|
BYTE 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},
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
/* rem is never executed by locking out pass */
|
|
|
|
|
{"REM", 0, CfgIgnore},
|
|
|
|
|
{";", 0, CfgIgnore},
|
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{"MENUDEFAULT", 0, CfgMenuDefault},
|
|
|
|
|
{"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},
|
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}
|
|
|
|
|
};
|
|
|
|
|
|
2001-09-23 22:39:44 +02:00
|
|
|
|
BYTE *pLineStart = 0;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2001-09-23 22:39:44 +02:00
|
|
|
|
BYTE HMAState = 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
|
|
|
|
{
|
2002-11-09 20:10:11 +01:00
|
|
|
|
memset(ErrorAlreadyPrinted,0,sizeof(ErrorAlreadyPrinted));
|
|
|
|
|
|
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 */
|
2001-07-10 00:19:33 +02:00
|
|
|
|
/* f_nodes = (f_node_ptr)
|
|
|
|
|
KernelAlloc(Config.cfgFiles * sizeof(struct f_node));*/
|
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->f_nodes = (f_node_ptr)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
DynAlloc("f_nodes", Config.cfgFiles, sizeof(struct f_node));
|
2001-03-30 21:30:06 +02:00
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->f_nodes_cnt = Config.cfgFiles;
|
|
|
|
|
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
|
|
|
|
|
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', 0);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2003-06-15 17:53:58 +02:00
|
|
|
|
printf("Preliminary:\n f_node 0x%x", LoL->f_nodes);
|
|
|
|
|
/* 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
|
|
|
|
unsigned ebda_size;
|
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
/* initialize NEAR allocated things */
|
2001-07-10 00:19:33 +02:00
|
|
|
|
|
|
|
|
|
/* Initialize the file table */
|
2003-06-15 17:53:58 +02:00
|
|
|
|
DynFree(LoL->f_nodes);
|
|
|
|
|
LoL->f_nodes = (f_node_ptr)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
DynAlloc("f_nodes", Config.cfgFiles, sizeof(struct f_node));
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->f_nodes_cnt = Config.cfgFiles; /* and the number of allocated files */
|
2001-03-21 03:56:26 +01: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-04 21:14:16 +02:00
|
|
|
|
ebda_size = ebdasize();
|
|
|
|
|
if (ebda_size > Config.ebda2move)
|
|
|
|
|
ebda_size = Config.ebda2move;
|
|
|
|
|
ram_top += ebda_size / 1024;
|
|
|
|
|
|
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
|
|
|
|
|
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
|
2003-06-15 17:53:58 +02:00
|
|
|
|
printf("Final: \n f_node 0x%x\n", LoL->f_nodes);
|
|
|
|
|
/* 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
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
allocmem(hma_paras, &kernel_seg);
|
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;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
if (UMB_get_largest(&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
|
|
|
|
|
2003-06-15 15:24:53 +02:00
|
|
|
|
while (UMB_get_largest(&umb_seg, &umb_size))
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
VOID DoConfig(int pass)
|
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
|
|
|
|
|
|
|
|
|
/* Set pass number */
|
|
|
|
|
nPass = pass;
|
2003-03-13 00:06:48 +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
|
|
|
|
{
|
|
|
|
|
if (read(nFileDesc, pLine, 1) <= 0)
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
if (*pLine == '\r') /* ignore */
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
|
(*(pEntry->func)) (pLine);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
continue;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
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))
|
2002-02-09 01:40:33 +01:00
|
|
|
|
pLine = skipwh(pLine);
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-15 21:26:49 +02:00
|
|
|
|
if ('=' != *pLine && pEntry->func != CfgMenu && pEntry->func != CfgMenuEsc)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
else /* YES. DO IT */
|
|
|
|
|
(*(pEntry->func)) (skipwh(pLine + 1));
|
|
|
|
|
}
|
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
|
|
|
|
{
|
|
|
|
|
while (*(p->entry) != '\0')
|
|
|
|
|
{
|
2001-03-25 19:11:54 +02:00
|
|
|
|
if (strcasecmp(p->entry, token) == 0)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
break;
|
|
|
|
|
else
|
|
|
|
|
++p;
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
*/
|
|
|
|
|
|
2002-10-22 04:40:19 +02:00
|
|
|
|
STATIC ULONG GetBiosTime(VOID)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
return *(ULONG FAR *) (MK_FP(0x40, 0x6c));
|
|
|
|
|
}
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
r.a.x = 0x0100; /* are there keys available ? */
|
|
|
|
|
init_call_intr(0x16, &r);
|
|
|
|
|
|
|
|
|
|
if ((r.flags & 0x40) == 0) /* yes - fetch and return */
|
2001-04-29 19:34:41 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
r.a.x = 0x0000;
|
|
|
|
|
init_call_intr(0x16, &r);
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
return r.a.x;
|
|
|
|
|
}
|
2001-04-29 19:34:41 +02:00
|
|
|
|
|
|
|
|
|
if (timeout < 0)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
continue;
|
|
|
|
|
|
2002-08-03 04:13:51 +02:00
|
|
|
|
if (GetBiosTime() - startTime >= (unsigned)timeout * 18)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return 0xffff;
|
|
|
|
|
}
|
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;
|
|
|
|
|
}
|
|
|
|
|
if (key == 0x4200) /* F8 */
|
|
|
|
|
{
|
|
|
|
|
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 */
|
|
|
|
|
if ( MenuLine != 0 &&
|
|
|
|
|
(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
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC BYTE * GetNumArg(BYTE * pLine, COUNT * pnArg)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
/* look for NUMBER */
|
|
|
|
|
pLine = skipwh(pLine);
|
2003-06-30 20:50:38 +02:00
|
|
|
|
if (!isnum(*pLine) && *pLine != '-')
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
return (BYTE *) 0;
|
|
|
|
|
}
|
2003-06-30 20:50:38 +02:00
|
|
|
|
return (BYTE *)GetNumber(pLine, pnArg);
|
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 */
|
|
|
|
|
if (GetNumArg(pLine, &nBuffers) == (BYTE *) 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Got the value, assign either default or new value */
|
2001-11-18 15:01:12 +01:00
|
|
|
|
Config.cfgBuffers =
|
|
|
|
|
(nBuffers < 0 ? nBuffers : max(Config.cfgBuffers, nBuffers));
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID sysScreenMode(BYTE * pLine)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
COUNT nMode;
|
|
|
|
|
|
|
|
|
|
/* Get the argument */
|
|
|
|
|
if (GetNumArg(pLine, &nMode) == (BYTE *) 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if ((nMode != 0x11) && (nMode != 0x12) && (nMode != 0x14))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Modes
|
|
|
|
|
0x11 (17) 28 lines
|
|
|
|
|
0x12 (18) 43/50 lines
|
|
|
|
|
0x14 (20) 25 lines
|
|
|
|
|
*/
|
2001-11-18 15:01:12 +01:00
|
|
|
|
#if defined(__TURBOC__)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
_AX = (0x11 << 8) + nMode;
|
|
|
|
|
_BL = 0;
|
|
|
|
|
__int__(0x10);
|
2002-08-03 04:13:51 +02:00
|
|
|
|
#elif defined(I86)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
asm
|
|
|
|
|
{
|
|
|
|
|
mov al, byte ptr nMode;
|
|
|
|
|
mov ah, 0x11;
|
|
|
|
|
mov bl, 0;
|
|
|
|
|
int 0x10;
|
|
|
|
|
}
|
2001-09-23 22:39:44 +02:00
|
|
|
|
#endif
|
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;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
|
|
p = pLine;
|
|
|
|
|
while (*p && *p != '.')
|
|
|
|
|
p++;
|
|
|
|
|
|
|
|
|
|
if (*p++ == '\0')
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->os_major = major;
|
|
|
|
|
LoL->os_minor = 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);
|
|
|
|
|
drv = *pLine & ~0x20;
|
|
|
|
|
|
|
|
|
|
if (drv < 'A' || drv > 'Z')
|
|
|
|
|
{
|
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
drv -= 'A';
|
2001-11-18 15:01:12 +01:00
|
|
|
|
drv++; /* Make real number */
|
2000-05-06 21:34:20 +02:00
|
|
|
|
Config.cfgLastdrive = max(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
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
for (pTmp = szBuf; *pTmp != '\0'; pTmp++)
|
|
|
|
|
*pTmp = toupper(*pTmp);
|
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;;)
|
|
|
|
|
{
|
|
|
|
|
if (fmemcmp(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
|
|
|
|
}
|
2001-11-18 15:01:12 +01:00
|
|
|
|
if (fmemcmp(pTmp, "HIGH", 4) == 0)
|
|
|
|
|
{
|
|
|
|
|
HMAState = HMA_REQ;
|
|
|
|
|
pTmp += 4;
|
2000-06-21 20:16:46 +02:00
|
|
|
|
}
|
2001-11-18 15:01:12 +01:00
|
|
|
|
/* if (fmemcmp(pTmp, "CLAIMINIT",9) == 0) { INITDataSegmentClaimed = 0; pTmp += 9; }*/
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
BYTE *pTmp;
|
|
|
|
|
|
|
|
|
|
pLine = GetStringArg(pLine, szBuf);
|
|
|
|
|
|
|
|
|
|
for (pTmp = szBuf; *pTmp != '\0'; pTmp++)
|
|
|
|
|
*pTmp = toupper(*pTmp);
|
|
|
|
|
|
|
|
|
|
if (fmemcmp(szBuf, "UMB", 3) == 0)
|
|
|
|
|
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);
|
|
|
|
|
if (commands[0].pass == 0) {
|
2003-06-30 20:50:38 +02:00
|
|
|
|
/* compatibility "device foo.sys" */
|
|
|
|
|
if ('=' != *pLine && ' ' != *pLine && '\t' != *pLine)
|
2003-06-17 13:53:37 +02:00
|
|
|
|
{
|
|
|
|
|
CfgFailure(pLine);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
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 */
|
|
|
|
|
char *p;
|
|
|
|
|
int n = 0;
|
|
|
|
|
if (*++pLine == ':')
|
|
|
|
|
pLine++; /* skip optional separator */
|
|
|
|
|
if ((p = GetNumArg(pLine, &n)) == 0) {
|
|
|
|
|
Config.ebda2move = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
pLine = p - 1; /* p points past number */
|
|
|
|
|
/* allowed values: [0..1024] bytes, multiples of 16
|
|
|
|
|
* e.g. AwardBIOS: 48, AMIBIOS: 1024
|
|
|
|
|
* (Phoenix, MRBIOS, Unicore = ????)
|
|
|
|
|
*/
|
|
|
|
|
if (n >= 48 && n <= 1024)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
|
/* 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);
|
|
|
|
|
break_ena = strcasecmp(szBuf, "OFF") ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
*keyflags |= strcasecmp(szBuf, "OFF") ? 32 : 0;
|
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;
|
2003-06-17 13:53:37 +02:00
|
|
|
|
char *p;
|
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 */
|
|
|
|
|
for (p = szBuf; *p != '\0'; p++)
|
|
|
|
|
*p = toupper(*p);
|
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);
|
|
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
|
for (next_dhp = NULL; FP_OFF(next_dhp) != 0xffff &&
|
|
|
|
|
(result = init_device(dhp, szBuf, mode, top)) == SUCCESS;
|
|
|
|
|
dhp = next_dhp)
|
|
|
|
|
{
|
|
|
|
|
next_dhp = dhp->dh_next;
|
|
|
|
|
if (FP_SEG(next_dhp) == 0xffff)
|
|
|
|
|
/* Does this ever occur with FP_OFF(next_dhp) != 0xffff ??? */
|
2001-04-15 05:21:50 +02:00
|
|
|
|
next_dhp = MK_FP(FP_SEG(dhp), FP_OFF(next_dhp));
|
2001-11-18 15:01:12 +01:00
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
else if (FP_OFF(next_dhp) != 0xffff) /* end of internal chain */
|
|
|
|
|
printf("multisegmented device driver found, next %p\n", next_dhp);
|
|
|
|
|
/* give warning message */
|
|
|
|
|
#endif
|
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));
|
|
|
|
|
return AlignParagraph(lpTop);
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC BYTE * skipwh(BYTE * s)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
while (*s && (*s == 0x0d || *s == 0x0a || *s == ' ' || *s == '\t'))
|
|
|
|
|
++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
|
|
|
|
|
while (*s &&
|
|
|
|
|
!(*s == 0x0d
|
|
|
|
|
|| *s == 0x0a || *s == ' ' || *s == '\t' || *s == '='))
|
|
|
|
|
{
|
|
|
|
|
if (*s == '?')
|
|
|
|
|
{
|
|
|
|
|
askThisSingleCommand = TRUE;
|
|
|
|
|
s++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
*d++ = *s++;
|
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
*d = '\0';
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
#if 0
|
2002-01-23 23:29:41 +01:00
|
|
|
|
BYTE *scan_seperator(BYTE * s, BYTE * d)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
s = skipwh(s);
|
|
|
|
|
if (*s)
|
|
|
|
|
*d++ = *s++;
|
|
|
|
|
*d = '\0';
|
|
|
|
|
return s;
|
|
|
|
|
}
|
2003-03-13 00:06:48 +01:00
|
|
|
|
#endif
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* JPP - changed so will accept hex number. */
|
2003-06-15 21:26:49 +02:00
|
|
|
|
/* ea - changed to accept hex digits in hex numbers */
|
2003-06-30 20:50:38 +02:00
|
|
|
|
STATIC char * GetNumber(REG const char *p, int *num)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-06-30 20:50:38 +02:00
|
|
|
|
unsigned char base = 10;
|
|
|
|
|
int sign = 1;
|
|
|
|
|
int n = 0;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
if (*p == '-')
|
2001-11-04 20:47:39 +01:00
|
|
|
|
{
|
2003-06-30 20:50:38 +02:00
|
|
|
|
p++;
|
|
|
|
|
sign = -1;
|
2001-11-04 20:47:39 +01:00
|
|
|
|
}
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
for(;;p++)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-06-30 20:50:38 +02:00
|
|
|
|
unsigned char ch = toupper((unsigned char)*p);
|
|
|
|
|
if (ch == 'X')
|
|
|
|
|
{
|
|
|
|
|
base = 16;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (isnum(ch))
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
2003-06-30 20:50:38 +02:00
|
|
|
|
n = n * base + ch - '0';
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
2003-06-30 20:50:38 +02:00
|
|
|
|
else if (base == 16 && (ch<='F') && (ch>='A'))
|
|
|
|
|
{
|
|
|
|
|
n = n * base + 10 + ch - 'A';
|
2003-06-15 21:26:49 +02:00
|
|
|
|
}
|
2003-06-30 20:50:38 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
break;
|
2003-06-15 21:26:49 +02:00
|
|
|
|
}
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
2003-06-30 20:50:38 +02:00
|
|
|
|
*num = n * sign;
|
|
|
|
|
return (char *)p;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Yet another change for true portability (WDL) */
|
2001-03-19 05:50:56 +01:00
|
|
|
|
#if 0
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC COUNT tolower(COUNT c)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
if (c >= 'A' && c <= 'Z')
|
|
|
|
|
return (c + ('a' - 'A'));
|
|
|
|
|
else
|
|
|
|
|
return c;
|
|
|
|
|
}
|
2001-03-19 05:50:56 +01:00
|
|
|
|
#endif
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
/* Yet another change for true portability (PJV) */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC COUNT toupper(COUNT c)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
{
|
|
|
|
|
if (c >= 'a' && c <= 'z')
|
|
|
|
|
return (c - ('a' - 'A'));
|
|
|
|
|
else
|
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 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)
|
|
|
|
|
{
|
|
|
|
|
static mcb near_mcb = {0};
|
|
|
|
|
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
|
|
|
|
{
|
2002-08-03 04:13:51 +02:00
|
|
|
|
char *tmp = d;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
while (*d != 0)
|
|
|
|
|
++d;
|
|
|
|
|
strcpy(d, s);
|
2002-08-03 04:13:51 +02:00
|
|
|
|
return tmp;
|
2000-05-06 21:34:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
#if 0
|
2001-03-21 03:56:26 +01:00
|
|
|
|
/* see if the second string is contained in the first one, ignoring case */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC char * stristr(char *s1, char *s2)
|
2001-03-21 03:56:26 +01:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
int loop;
|
|
|
|
|
|
|
|
|
|
for (; *s1; s1++)
|
|
|
|
|
for (loop = 0;; loop++)
|
|
|
|
|
{
|
|
|
|
|
if (s2[loop] == 0) /* found end of string 2 -> success */
|
|
|
|
|
{
|
|
|
|
|
return s1; /* position where s2 was found */
|
|
|
|
|
}
|
|
|
|
|
if (toupper(s1[loop]) != toupper(s2[loop]))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
2001-03-25 19:11:54 +02:00
|
|
|
|
}
|
2002-01-23 23:29:41 +01:00
|
|
|
|
#endif
|
2000-08-06 07:50:17 +02:00
|
|
|
|
|
2001-03-25 19:11:54 +02:00
|
|
|
|
/* compare two ASCII strings ignoring case */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC COUNT strcasecmp(REG BYTE * d, REG BYTE * s)
|
2001-03-25 19:11:54 +02:00
|
|
|
|
{
|
2001-11-18 15:01:12 +01:00
|
|
|
|
while (*s != '\0' && *d != '\0')
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (toupper(*d) == toupper(*s))
|
|
|
|
|
++s, ++d;
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
return toupper(*d) - toupper(*s);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return toupper(*d) - toupper(*s);
|
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
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
VOID config_init_buffers(COUNT anzBuffers)
|
|
|
|
|
{
|
|
|
|
|
REG WORD i;
|
|
|
|
|
struct buffer FAR *pbuffer;
|
2002-12-09 01:17:15 +01:00
|
|
|
|
unsigned wantedbuffers = anzBuffers;
|
2001-11-04 20:47:39 +01:00
|
|
|
|
|
|
|
|
|
if (anzBuffers < 0)
|
|
|
|
|
{
|
2002-12-09 01:17:15 +01:00
|
|
|
|
wantedbuffers = anzBuffers = -anzBuffers;
|
|
|
|
|
}
|
|
|
|
|
else if (HMAState == HMA_DONE)
|
|
|
|
|
{
|
|
|
|
|
anzBuffers = (0xfff0 - HMAFree) / sizeof(struct buffer);
|
2001-11-04 20:47:39 +01:00
|
|
|
|
}
|
2001-11-18 15:01:12 +01:00
|
|
|
|
|
|
|
|
|
anzBuffers = max(anzBuffers, 6);
|
2001-06-03 16:16:18 +02:00
|
|
|
|
if (anzBuffers > 99)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
{
|
|
|
|
|
printf("BUFFERS=%u not supported, reducing to 99\n", anzBuffers);
|
2001-06-03 16:16:18 +02:00
|
|
|
|
anzBuffers = 99;
|
2001-11-18 15:01:12 +01:00
|
|
|
|
}
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->nbuffers = anzBuffers;
|
2002-12-09 01:17:15 +01:00
|
|
|
|
|
2001-07-28 20:13:06 +02:00
|
|
|
|
lpTop = lpOldTop;
|
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
LoL->inforecptr = &LoL->firstbuf;
|
2003-07-12 22:56:11 +02:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
size_t bytes = sizeof(struct buffer) * anzBuffers;
|
|
|
|
|
pbuffer = HMAalloc(bytes);
|
|
|
|
|
|
|
|
|
|
if (pbuffer == NULL)
|
|
|
|
|
{
|
|
|
|
|
pbuffer = KernelAlloc(bytes, 'B', 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LoL->bufloc = LOC_HMA;
|
|
|
|
|
LoL->deblock_buf = KernelAlloc(SEC_SIZE, 'B', 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-06-15 15:24:53 +02:00
|
|
|
|
|
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
|
|
|
|
|
2002-12-09 01:17:15 +01:00
|
|
|
|
pbuffer->b_prev = FP_OFF(pbuffer + (anzBuffers-1));
|
|
|
|
|
for (i = 1; i < anzBuffers; ++i)
|
2001-03-21 03:56:26 +01:00
|
|
|
|
{
|
2002-12-09 01:17:15 +01:00
|
|
|
|
if (i == wantedbuffers)
|
|
|
|
|
{
|
|
|
|
|
firstAvailableBuf = pbuffer;
|
|
|
|
|
}
|
|
|
|
|
pbuffer->b_next = FP_OFF(pbuffer + 1);
|
|
|
|
|
pbuffer++;
|
|
|
|
|
pbuffer->b_prev = FP_OFF(pbuffer - 1);
|
|
|
|
|
}
|
|
|
|
|
pbuffer->b_next = FP_OFF(pbuffer - (anzBuffers-1));
|
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)
|
2001-11-18 15:01:12 +01:00
|
|
|
|
printf("Kernel: allocated %d Diskbuffers = %u Bytes in HMA\n",
|
2002-12-09 01:17:15 +01:00
|
|
|
|
anzBuffers, anzBuffers * sizeof(struct buffer));
|
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
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
STATIC VOID CfgMenu(BYTE * pLine)
|
|
|
|
|
{
|
|
|
|
|
printf("%s\n",pLine);
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
STATIC VOID DoMenu(void)
|
|
|
|
|
{
|
|
|
|
|
if (Menus == 0)
|
2002-05-09 00:49:35 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
InitKernelConfig.SkipConfigSeconds = -1;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
Menus |= 1 << 0; /* '0' Menu always allowed */
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
|
|
|
|
printf("\n\n");
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
int key,i;
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
|
|
|
|
RestartInput:
|
2002-01-23 23:29:41 +01:00
|
|
|
|
printf("\rSinglestepping (F8) is :%s - ", singleStep ? "ON " : "OFF");
|
|
|
|
|
|
|
|
|
|
printf("please select a Menu[");
|
|
|
|
|
|
|
|
|
|
for (i = 0; i <= 9; i++)
|
|
|
|
|
if (Menus & (1 << i))
|
|
|
|
|
printf("%c", '0' + i);
|
2003-03-13 00:06:48 +01:00
|
|
|
|
printf("]");
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
printf(" (default=%d)", MenuSelected);
|
2002-01-23 23:29:41 +01:00
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
if (MenuTimeout >= 0)
|
|
|
|
|
printf(" - %d \b", MenuTimeout);
|
|
|
|
|
else
|
|
|
|
|
printf(" \b\b\b\b\b");
|
|
|
|
|
|
|
|
|
|
key = GetBiosKey(MenuTimeout >= 0 ? 1 : -1);
|
|
|
|
|
|
|
|
|
|
if (key == -1) /* timeout, take default */
|
|
|
|
|
{
|
|
|
|
|
if (MenuTimeout > 0)
|
|
|
|
|
{
|
|
|
|
|
MenuTimeout--;
|
|
|
|
|
goto RestartInput;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
MenuTimeout = -1;
|
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
if (key == 0x3f00) /* F5 */
|
|
|
|
|
{
|
|
|
|
|
SkipAllConfig = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (key == 0x4200) /* F8 */
|
|
|
|
|
{
|
|
|
|
|
singleStep = !singleStep;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
key &= 0xff;
|
|
|
|
|
|
2003-03-13 00:06:48 +01:00
|
|
|
|
if (key == '\r') /* CR - use default */
|
|
|
|
|
{
|
|
|
|
|
break;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
}
|
2003-03-13 00:06:48 +01:00
|
|
|
|
if (key == 0x1b) /* ESC - use default */
|
|
|
|
|
{
|
|
|
|
|
break;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("%c", key);
|
|
|
|
|
|
|
|
|
|
if (key >= '0' && key <= '9')
|
|
|
|
|
if (Menus & (1 << (key - '0')))
|
2003-03-13 00:06:48 +01:00
|
|
|
|
{
|
|
|
|
|
MenuSelected = key - '0'; break;
|
2002-01-23 23:29:41 +01:00
|
|
|
|
}
|
2003-03-13 00:06:48 +01:00
|
|
|
|
}
|
2002-01-23 23:29:41 +01:00
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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-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 */ ,{
|
|
|
|
|
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 - 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)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
UNREFERENCED_PARAMETER(codePage);
|
|
|
|
|
UNREFERENCED_PARAMETER(filename);
|
|
|
|
|
|
|
|
|
|
/* printf("cntry: %u, CP%u, file=\"%s\"\n", ctryCode, codePage, filename); */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < sizeof(specificCountriesSupported)/sizeof(specificCountriesSupported[0]); i++)
|
|
|
|
|
{
|
|
|
|
|
if (specificCountriesSupported[i].CountryID == ctryCode)
|
|
|
|
|
{
|
|
|
|
|
int codepagesaved = nlsCountryInfoHardcoded.C.CodePage;
|
|
|
|
|
|
|
|
|
|
fmemcpy(&nlsCountryInfoHardcoded.C.CountryID,
|
|
|
|
|
&specificCountriesSupported[i],
|
|
|
|
|
min(nlsCountryInfoHardcoded.TableSize, sizeof(struct CountrySpecificInfo)));
|
|
|
|
|
|
|
|
|
|
nlsCountryInfoHardcoded.C.CodePage = codepagesaved;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("could not find country info for country ID %u\n", ctryCode);
|
|
|
|
|
printf("current supported countries are ");
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < sizeof(specificCountriesSupported)/sizeof(specificCountriesSupported[0]); i++)
|
|
|
|
|
{
|
|
|
|
|
printf("%u ",specificCountriesSupported[i].CountryID);
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ****************************************************************
|
|
|
|
|
** implementation of INSTALL=NANSI.COM /P /X /BLA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int numInstallCmds = 0;
|
2003-06-30 20:50:38 +02:00
|
|
|
|
struct instCmds {
|
2003-03-13 00:06:48 +01:00
|
|
|
|
char buffer[128];
|
|
|
|
|
int mode;
|
|
|
|
|
} InstallCommands[10];
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
}
|
2003-03-13 00:06:48 +01:00
|
|
|
|
fmemcpy(InstallCommands[numInstallCmds].buffer,pLine,127);
|
|
|
|
|
InstallCommands[numInstallCmds].buffer[127] = 0;
|
|
|
|
|
InstallCommands[numInstallCmds].mode = mode;
|
|
|
|
|
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--;
|
|
|
|
|
*args = 0;
|
|
|
|
|
while (args[*args+1])
|
|
|
|
|
++*args;
|
|
|
|
|
args[*args+1] = '\r';
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
VOID DoInstall(void)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
iregs r;
|
|
|
|
|
unsigned short installMemory;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
r.a.x = 0x5801; /* set memory allocation strategy */
|
|
|
|
|
r.b.b.l = 0x02; /*low memory, last fit */
|
|
|
|
|
init_call_intr(0x21, &r);
|
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
|
allocmem(((unsigned)_init_end+15)/16, &installMemory);
|
2003-03-13 00:06:48 +01:00
|
|
|
|
|
|
|
|
|
InstallPrintf(("allocated memory at %x\n",installMemory));
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < numInstallCmds; i++)
|
|
|
|
|
{
|
|
|
|
|
InstallPrintf(("%d:%s\n",i,InstallCommands[i].buffer));
|
|
|
|
|
|
|
|
|
|
r.a.x = 0x5801; /* set memory allocation strategy */
|
|
|
|
|
r.b.b.l = InstallCommands[i].mode;
|
|
|
|
|
init_call_intr(0x21, &r);
|
|
|
|
|
|
2003-06-30 20:50:38 +02:00
|
|
|
|
InstallExec(&InstallCommands[i]);
|
2003-03-13 00:06:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r.a.x = 0x5801; /* set memory allocation strategy */
|
|
|
|
|
r.b.b.l = 0x00; /*low memory, high */
|
|
|
|
|
init_call_intr(0x21, &r);
|
|
|
|
|
|
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;
|
|
|
|
|
}
|