2001-04-22 00:32:53 +02:00
|
|
|
/* Included by initialisation functions */
|
2000-05-06 21:34:20 +02:00
|
|
|
#define IN_INIT_MOD
|
2001-04-22 00:32:53 +02:00
|
|
|
|
|
|
|
#include "version.h"
|
|
|
|
#include "date.h"
|
|
|
|
#include "time.h"
|
|
|
|
#include "mcb.h"
|
|
|
|
#include "sft.h"
|
|
|
|
#include "fat.h"
|
|
|
|
#include "fnode.h"
|
|
|
|
#include "file.h"
|
|
|
|
#include "cds.h"
|
|
|
|
#include "device.h"
|
|
|
|
#include "kbd.h"
|
|
|
|
#include "error.h"
|
|
|
|
#include "fcb.h"
|
|
|
|
#include "tail.h"
|
|
|
|
#include "process.h"
|
|
|
|
#include "pcb.h"
|
|
|
|
#include "nls.h"
|
|
|
|
#include "buffer.h"
|
2002-01-23 23:29:41 +01:00
|
|
|
#include "dcb.h"
|
2001-04-22 00:32:53 +02:00
|
|
|
|
2002-08-03 04:17:27 +02:00
|
|
|
#include "kconfig.h"
|
2001-11-18 15:01:12 +01:00
|
|
|
extern struct _KernelConfig InitKernelConfig;
|
2001-11-04 20:47:39 +01:00
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
/*
|
|
|
|
* Functions in `INIT_TEXT' may need to call functions in `_TEXT'. The entry
|
|
|
|
* calls for the latter functions therefore need to be wrapped up with far
|
|
|
|
* entry points.
|
|
|
|
*/
|
2001-04-22 00:32:53 +02:00
|
|
|
#define printf init_printf
|
2001-11-14 00:36:45 +01:00
|
|
|
#define sprintf init_sprintf
|
2002-02-09 01:40:33 +01:00
|
|
|
#define execrh init_execrh
|
|
|
|
#define fmemcpy init_fmemcpy
|
|
|
|
#define fmemset init_fmemset
|
2002-08-03 04:17:27 +02:00
|
|
|
#define fmemcmp init_fmemcmp
|
2002-02-09 01:40:33 +01:00
|
|
|
#define memset init_memset
|
|
|
|
#define strcpy init_strcpy
|
2001-09-23 22:39:44 +02:00
|
|
|
WORD ASMCFUNC execrh(request FAR *, struct dhdr FAR *);
|
2002-02-09 01:40:33 +01:00
|
|
|
void fmemcpy(void far *d, const void far *s, unsigned n);
|
|
|
|
void fmemset(void far *s, int ch, unsigned n);
|
|
|
|
void memset(void *s, int ch, unsigned n);
|
|
|
|
void strcpy(char *dest, const char *src);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
|
|
|
#undef LINESIZE
|
|
|
|
#define LINESIZE KBD_MAXLENGTH
|
|
|
|
|
|
|
|
/*inithma.c*/
|
|
|
|
extern BYTE DosLoadedInHMA;
|
2002-01-23 23:29:41 +01:00
|
|
|
int fmemcmp(BYTE far * s1, BYTE FAR * s2, unsigned len);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
#define setvec(n, isr) (void)(*(intvec FAR *)MK_FP(0,4 * (n)) = (isr))
|
2001-04-22 00:32:53 +02:00
|
|
|
|
|
|
|
#define GLOBAL extern
|
|
|
|
#define NAMEMAX MAX_CDSPATH /* Maximum path for CDS */
|
|
|
|
#define PARSE_MAX MAX_CDSPATH /* maximum # of bytes in path */
|
|
|
|
#define NFILES 16 /* number of files in table */
|
|
|
|
#define NFCBS 16 /* number of fcbs */
|
|
|
|
#define NSTACKS 8 /* number of stacks */
|
2001-04-29 19:34:41 +02:00
|
|
|
#define NLAST 5 /* last drive */
|
2002-01-23 23:29:41 +01:00
|
|
|
#define NUMBUFF 20 /* Number of track buffers at INIT time */
|
2001-04-22 00:32:53 +02:00
|
|
|
/* -- must be at least 3 */
|
2001-07-22 03:58:58 +02:00
|
|
|
#define MAX_HARD_DRIVE 8
|
2001-07-28 20:13:06 +02:00
|
|
|
#define NDEV 26 /* up to Z: */
|
2001-07-22 03:58:58 +02:00
|
|
|
|
2001-04-22 00:32:53 +02:00
|
|
|
/* Start of configuration variables */
|
2001-11-18 15:01:12 +01:00
|
|
|
struct config {
|
2003-06-15 15:24:53 +02:00
|
|
|
UBYTE cfgDosDataUmb;
|
2001-11-18 15:01:12 +01:00
|
|
|
BYTE cfgBuffers;
|
|
|
|
/* number of buffers in the system */
|
|
|
|
UBYTE cfgFiles;
|
2003-06-15 15:24:53 +02:00
|
|
|
UBYTE cfgFilesHigh;
|
2001-11-18 15:01:12 +01:00
|
|
|
/* number of available files */
|
|
|
|
UBYTE cfgFcbs;
|
|
|
|
/* number of available FCBs */
|
|
|
|
UBYTE cfgProtFcbs;
|
|
|
|
/* number of protected FCBs */
|
|
|
|
BYTE cfgInit[NAMEMAX];
|
|
|
|
/* init of command.com */
|
|
|
|
BYTE cfgInitTail[NAMEMAX];
|
|
|
|
/* command.com's tail */
|
|
|
|
UBYTE cfgLastdrive;
|
2003-06-15 15:24:53 +02:00
|
|
|
UBYTE cfgLastdriveHigh;
|
2001-11-18 15:01:12 +01:00
|
|
|
/* last drive */
|
|
|
|
BYTE cfgStacks;
|
2003-06-15 15:24:53 +02:00
|
|
|
BYTE cfgStacksHigh;
|
2001-11-18 15:01:12 +01:00
|
|
|
/* number of stacks */
|
|
|
|
UWORD cfgStackSize;
|
|
|
|
/* stacks size for each stack */
|
|
|
|
/* COUNTRY=
|
|
|
|
In Pass #1 these information is collected and in PostConfig()
|
|
|
|
the NLS package is loaded into memory.
|
|
|
|
-- 2000/06/11 ska */
|
|
|
|
WORD cfgCSYS_cntry;
|
|
|
|
/* country ID to be loaded */
|
2002-08-03 04:17:27 +02:00
|
|
|
UWORD cfgCSYS_cp;
|
2001-11-18 15:01:12 +01:00
|
|
|
/* requested codepage; NLS_DEFAULT if default */
|
|
|
|
BYTE cfgCSYS_fnam[NAMEMAX];
|
|
|
|
/* filename of COUNTRY= */
|
|
|
|
WORD cfgCSYS_memory;
|
|
|
|
/* number of bytes required for the NLS pkg;
|
|
|
|
0 if none */
|
|
|
|
VOID FAR *cfgCSYS_data;
|
|
|
|
/* where the loaded data is for PostConfig() */
|
|
|
|
UBYTE cfgP_0_startmode;
|
|
|
|
/* load command.com high or not */
|
2001-04-22 00:32:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct config Config;
|
|
|
|
|
|
|
|
/* config.c */
|
2002-01-23 23:29:41 +01:00
|
|
|
VOID PreConfig(VOID);
|
2003-06-15 15:24:53 +02:00
|
|
|
VOID PreConfig2(VOID);
|
2002-01-23 23:29:41 +01:00
|
|
|
VOID DoConfig(int pass);
|
|
|
|
VOID PostConfig(VOID);
|
2002-10-22 04:40:19 +02:00
|
|
|
VOID configDone(VOID);
|
2003-06-15 15:24:53 +02:00
|
|
|
VOID FAR * KernelAlloc(size_t nBytes, char type, int mode);
|
|
|
|
void FAR * KernelAllocPara(size_t nPara, char type, char *name, int mode);
|
2002-08-03 04:17:27 +02:00
|
|
|
char *strcat(char * d, const char * s);
|
2002-01-23 23:29:41 +01:00
|
|
|
COUNT ASMCFUNC Umb_Test(void);
|
|
|
|
COUNT ASMCFUNC UMB_get_largest(UCOUNT * seg, UCOUNT * size);
|
|
|
|
BYTE * GetStringArg(BYTE * pLine, BYTE * pszString);
|
2003-03-13 00:06:48 +01:00
|
|
|
void DoInstall(void);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
2001-07-10 00:19:33 +02:00
|
|
|
/* diskinit.c */
|
|
|
|
COUNT dsk_init(VOID);
|
|
|
|
|
2001-04-22 00:32:53 +02:00
|
|
|
/* int2f.asm */
|
2001-09-23 22:39:44 +02:00
|
|
|
COUNT ASMCFUNC Umb_Test(void);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
|
|
|
/* inithma.c */
|
|
|
|
int MoveKernelToHMA(void);
|
2002-01-23 23:29:41 +01:00
|
|
|
VOID FAR * HMAalloc(COUNT bytesToAllocate);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
|
|
|
/* initoem.c */
|
|
|
|
UWORD init_oem(void);
|
|
|
|
|
|
|
|
/* intr.asm */
|
2001-04-29 19:34:41 +02:00
|
|
|
|
2001-11-18 15:01:12 +01:00
|
|
|
void ASMCFUNC init_call_intr(int nr, iregs * rp);
|
|
|
|
UCOUNT ASMCFUNC read(int fd, void *buf, UCOUNT count);
|
2001-09-23 22:39:44 +02:00
|
|
|
int ASMCFUNC open(const char *pathname, int flags);
|
|
|
|
int ASMCFUNC close(int fd);
|
2001-11-04 20:47:39 +01:00
|
|
|
int ASMCFUNC dup2(int oldfd, int newfd);
|
2001-11-18 15:01:12 +01:00
|
|
|
int ASMCFUNC allocmem(UWORD size, seg * segp);
|
2002-01-23 23:29:41 +01:00
|
|
|
VOID ASMCFUNC init_PSPInit(seg psp_seg);
|
|
|
|
VOID ASMCFUNC init_PSPSet(seg psp_seg);
|
|
|
|
COUNT ASMCFUNC init_DosExec(COUNT mode, exec_blk * ep, BYTE * lp);
|
|
|
|
VOID ASMCFUNC keycheck(VOID);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
|
|
|
/* irqstack.asm */
|
2001-11-18 15:01:12 +01:00
|
|
|
VOID ASMCFUNC init_stacks(VOID FAR * stack_base, COUNT nStacks,
|
|
|
|
WORD stackSize);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
|
|
|
/* inthndlr.c */
|
2002-01-23 23:29:41 +01:00
|
|
|
VOID ASMCFUNC FAR int21_entry(iregs UserRegs);
|
2001-11-18 15:01:12 +01:00
|
|
|
VOID ASMCFUNC int21_service(iregs far * r);
|
2002-02-03 23:40:24 +01:00
|
|
|
VOID ASMCFUNC FAR int0_handler(void);
|
2002-01-23 23:29:41 +01:00
|
|
|
VOID ASMCFUNC FAR int6_handler(void);
|
|
|
|
VOID ASMCFUNC FAR empty_handler(void);
|
|
|
|
VOID ASMCFUNC FAR got_cbreak(void); /* procsupt.asm */
|
2002-08-03 04:17:27 +02:00
|
|
|
VOID ASMCFUNC FAR int20_handler(void);
|
|
|
|
VOID ASMCFUNC FAR int21_handler(void);
|
2002-01-23 23:29:41 +01:00
|
|
|
VOID ASMCFUNC FAR int22_handler(void);
|
|
|
|
VOID ASMCFUNC FAR int24_handler(void);
|
|
|
|
VOID ASMCFUNC FAR low_int25_handler(void);
|
|
|
|
VOID ASMCFUNC FAR low_int26_handler(void);
|
|
|
|
VOID ASMCFUNC FAR int27_handler(void);
|
|
|
|
VOID ASMCFUNC FAR int28_handler(void);
|
|
|
|
VOID ASMCFUNC FAR int29_handler(void);
|
|
|
|
VOID ASMCFUNC FAR int2a_handler(void);
|
|
|
|
VOID ASMCFUNC FAR int2f_handler(void);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
|
|
|
/* main.c */
|
2002-01-23 23:29:41 +01:00
|
|
|
VOID ASMCFUNC FreeDOSmain(void);
|
2003-06-15 15:24:53 +02:00
|
|
|
BOOL init_device(struct dhdr FAR * dhp, char * cmdLine,
|
2002-10-22 04:40:19 +02:00
|
|
|
COUNT mode, char FAR *top);
|
2002-01-23 23:29:41 +01:00
|
|
|
VOID init_fatal(BYTE * err_msg);
|
2001-04-15 05:21:50 +02:00
|
|
|
|
2001-04-22 00:32:53 +02:00
|
|
|
/* prf.c */
|
2002-02-03 23:40:24 +01:00
|
|
|
WORD CDECL init_printf(CONST BYTE * fmt, ...);
|
|
|
|
WORD CDECL init_sprintf(BYTE * buff, CONST BYTE * fmt, ...);
|
2001-07-10 00:19:33 +02:00
|
|
|
|
|
|
|
void MoveKernel(unsigned NewKernelSegment);
|
2003-06-15 15:24:53 +02:00
|
|
|
extern UWORD HMAFree; /* first byte in HMA not yet used */
|
2001-07-10 00:19:33 +02:00
|
|
|
|
|
|
|
extern unsigned CurrentKernelSegment;
|
2001-09-23 22:39:44 +02:00
|
|
|
|
|
|
|
#if defined(WATCOM) && 0
|
2002-01-23 23:29:41 +01:00
|
|
|
ULONG ASMCFUNC FAR MULULUS(ULONG mul1, UWORD mul2); /* MULtiply ULong by UShort */
|
|
|
|
ULONG ASMCFUNC FAR MULULUL(ULONG mul1, ULONG mul2); /* MULtiply ULong by ULong */
|
|
|
|
ULONG ASMCFUNC FAR DIVULUS(ULONG mul1, UWORD mul2); /* DIVide ULong by UShort */
|
|
|
|
ULONG ASMCFUNC FAR DIVMODULUS(ULONG mul1, UWORD mul2, UWORD * rem); /* DIVide ULong by UShort */
|
2001-09-23 22:39:44 +02:00
|
|
|
#endif
|