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"
|
2003-06-20 21:54:18 +02:00
|
|
|
#include "lol.h"
|
|
|
|
|
|
|
|
#include "init-dat.h"
|
2001-04-22 00:32:53 +02:00
|
|
|
|
2002-08-03 04:17:27 +02:00
|
|
|
#include "kconfig.h"
|
2004-04-14 01:46:25 +02:00
|
|
|
|
|
|
|
/* MSC places uninitialized data into COMDEF records,
|
|
|
|
that end up in DATA segment. this can't be tolerated in INIT code.
|
|
|
|
please make sure, that ALL data in INIT is initialized !!
|
|
|
|
|
|
|
|
These guys are marked BSS_INIT to mark that they really should be BSS
|
|
|
|
but can't be because of MS
|
|
|
|
*/
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define BSS_INIT(x) = x
|
|
|
|
#else
|
|
|
|
#define BSS_INIT(x)
|
|
|
|
#endif
|
|
|
|
|
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
|
2004-04-10 17:11:16 +02:00
|
|
|
#ifndef __WATCOMC__
|
2002-02-09 01:40:33 +01:00
|
|
|
#define execrh init_execrh
|
2004-02-24 01:25:56 +01:00
|
|
|
#define memcpy init_memcpy
|
2002-02-09 01:40:33 +01:00
|
|
|
#define fmemcpy init_fmemcpy
|
|
|
|
#define fmemset init_fmemset
|
2002-08-03 04:17:27 +02:00
|
|
|
#define fmemcmp init_fmemcmp
|
2004-02-24 01:25:56 +01:00
|
|
|
#define memcmp init_memcmp
|
|
|
|
#define memset init_memset
|
2004-05-11 12:46:42 +02:00
|
|
|
#define strchr init_strchr
|
2004-02-24 01:25:56 +01:00
|
|
|
#define strcpy init_strcpy
|
|
|
|
#define strlen init_strlen
|
|
|
|
#define fstrlen init_fstrlen
|
2004-04-10 17:11:16 +02:00
|
|
|
#endif
|
2004-04-09 13:37:40 +02:00
|
|
|
#define open init_DosOpen
|
2001-04-22 00:32:53 +02:00
|
|
|
|
2004-02-24 01:25:56 +01:00
|
|
|
/* execrh.asm */
|
2004-04-09 13:16:03 +02:00
|
|
|
WORD ASMPASCAL execrh(request FAR *, struct dhdr FAR *);
|
2004-02-24 01:25:56 +01:00
|
|
|
|
|
|
|
/* asmsupt.asm */
|
|
|
|
VOID ASMPASCAL memset( void *s, int ch, size_t n);
|
|
|
|
VOID ASMPASCAL fmemset( void FAR *s, int ch, size_t n);
|
|
|
|
int ASMPASCAL memcmp(const void *m1, const void *m2, size_t n);
|
|
|
|
int ASMPASCAL fmemcmp(const void FAR *m1, const void FAR *m2, size_t n);
|
|
|
|
VOID ASMPASCAL memcpy( void *d, const void *s, size_t n);
|
|
|
|
VOID ASMPASCAL fmemcpy( void FAR *d, const void FAR *s, size_t n);
|
|
|
|
VOID ASMPASCAL strcpy(char *d, const char *s);
|
|
|
|
size_t ASMPASCAL strlen(const char *s);
|
|
|
|
size_t ASMPASCAL fstrlen(const char FAR *s);
|
2004-04-07 00:48:12 +02:00
|
|
|
char * ASMPASCAL strchr(const char *s, int ch);
|
2004-04-02 02:38:24 +02:00
|
|
|
|
|
|
|
#ifdef __WATCOMC__
|
2004-04-07 00:48:12 +02:00
|
|
|
/* bx, cx, dx and es not used or clobbered for all asmsupt.asm functions except
|
|
|
|
(f)memchr/(f)strchr (which clobber dx) */
|
2004-04-06 18:29:27 +02:00
|
|
|
#pragma aux (pascal) pascal_ax modify exact [ax]
|
2004-04-10 17:11:16 +02:00
|
|
|
#pragma aux (pascal_ax) memset
|
|
|
|
#pragma aux (pascal_ax) fmemset
|
|
|
|
#pragma aux (pascal_ax) memcpy
|
|
|
|
#pragma aux (pascal_ax) fmemcpy
|
|
|
|
#pragma aux (pascal_ax) memcmp modify nomemory
|
|
|
|
#pragma aux (pascal_ax) fmemcmp modify nomemory
|
|
|
|
#pragma aux (pascal_ax) strcpy
|
|
|
|
#pragma aux (pascal_ax) strlen modify nomemory
|
|
|
|
#pragma aux (pascal_ax) fstrlen modify nomemory
|
|
|
|
#pragma aux (pascal) strchr modify exact [ax dx] nomemory
|
2004-04-02 02:38:24 +02:00
|
|
|
#endif
|
|
|
|
|
2001-04-22 00:32:53 +02:00
|
|
|
#undef LINESIZE
|
|
|
|
#define LINESIZE KBD_MAXLENGTH
|
|
|
|
|
|
|
|
/*inithma.c*/
|
|
|
|
extern BYTE DosLoadedInHMA;
|
2003-06-20 21:54:18 +02:00
|
|
|
void MoveKernel(unsigned NewKernelSegment);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
2004-05-04 11:35:44 +02:00
|
|
|
void setvec(unsigned char intno, intvec vector);
|
2004-05-10 22:49:43 +02:00
|
|
|
#ifndef __WATCOMC__
|
|
|
|
#define getvec init_getvec
|
|
|
|
#endif
|
|
|
|
intvec getvec(unsigned char intno);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
|
|
|
#define GLOBAL extern
|
|
|
|
#define NAMEMAX MAX_CDSPATH /* Maximum path for CDS */
|
|
|
|
#define NFILES 16 /* number of files in table */
|
|
|
|
#define NFCBS 16 /* number of fcbs */
|
|
|
|
#define NSTACKS 8 /* number of stacks */
|
2004-03-27 00:15:23 +01:00
|
|
|
#define STACKSIZE 256 /* default stacksize */
|
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
|
|
|
|
2004-03-07 12:56:14 +01:00
|
|
|
#include "config.h" /* config structure */
|
2001-04-22 00:32:53 +02:00
|
|
|
|
|
|
|
/* config.c */
|
2004-03-07 12:56:14 +01:00
|
|
|
extern struct config Config;
|
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
|
|
|
BYTE * GetStringArg(BYTE * pLine, BYTE * pszString);
|
2003-03-13 00:06:48 +01:00
|
|
|
void DoInstall(void);
|
2003-06-20 21:54:18 +02:00
|
|
|
UWORD GetBiosKey(int timeout);
|
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 */
|
2004-04-09 17:43:01 +02:00
|
|
|
COUNT ASMPASCAL Umb_Test(void);
|
|
|
|
COUNT ASMPASCAL UMB_get_largest(void FAR * driverAddress,
|
|
|
|
UCOUNT * seg, UCOUNT * size);
|
|
|
|
#ifdef __WATCOMC__
|
|
|
|
#pragma aux (pascal) UMB_get_largest modify exact [ax bx cx dx]
|
|
|
|
#endif
|
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 */
|
2003-09-04 21:14:16 +02:00
|
|
|
unsigned init_oem(void);
|
2003-09-09 19:30:10 +02:00
|
|
|
void movebda(size_t bytes, unsigned new_seg);
|
2003-09-04 21:14:16 +02:00
|
|
|
unsigned ebdasize(void);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
|
|
|
/* intr.asm */
|
2001-04-29 19:34:41 +02:00
|
|
|
|
2004-04-09 13:37:40 +02:00
|
|
|
unsigned ASMPASCAL init_call_intr(int nr, iregs * rp);
|
|
|
|
unsigned ASMPASCAL read(int fd, void *buf, unsigned count);
|
|
|
|
int ASMPASCAL open(const char *pathname, int flags);
|
|
|
|
int ASMPASCAL close(int fd);
|
2004-05-23 22:01:30 +02:00
|
|
|
int ASMPASCAL dup2(int oldfd, int newfd);
|
|
|
|
seg ASMPASCAL allocmem(UWORD size);
|
2004-04-09 13:37:40 +02:00
|
|
|
void ASMPASCAL init_PSPSet(seg psp_seg);
|
|
|
|
int ASMPASCAL init_DosExec(int mode, exec_blk * ep, char * lp);
|
|
|
|
int ASMPASCAL init_setdrive(int drive);
|
|
|
|
int ASMPASCAL init_switchar(int chr);
|
|
|
|
void ASMPASCAL keycheck(void);
|
|
|
|
void ASMPASCAL set_DTA(void far *dta);
|
|
|
|
#ifdef __WATCOMC__
|
|
|
|
#pragma aux (pascal) init_call_intr modify exact [ax]
|
|
|
|
#pragma aux (pascal) read modify exact [ax bx cx dx]
|
|
|
|
#pragma aux (pascal) init_DosOpen modify exact [ax bx dx]
|
|
|
|
#pragma aux (pascal) close modify exact [ax bx]
|
|
|
|
#pragma aux (pascal) dup2 modify exact [ax bx cx]
|
2004-05-23 22:01:30 +02:00
|
|
|
#pragma aux (pascal) allocmem modify exact [ax bx]
|
2004-04-09 13:37:40 +02:00
|
|
|
#pragma aux (pascal) init_PSPSet modify exact [ax bx]
|
|
|
|
#pragma aux (pascal) init_DosExec modify exact [ax bx dx es]
|
|
|
|
#pragma aux (pascal) init_setdrive modify exact [ax bx dx]
|
|
|
|
#pragma aux (pascal) init_switchar modify exact [ax bx dx]
|
|
|
|
#pragma aux (pascal) keycheck modify exact [ax]
|
|
|
|
#pragma aux (pascal) set_DTA modify exact [ax bx dx]
|
|
|
|
#endif
|
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);
|
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);
|
2003-09-16 14:38:02 +02:00
|
|
|
VOID ASMCFUNC FAR cpm_entry(void);
|
2001-04-22 00:32:53 +02:00
|
|
|
|
2004-03-07 13:19:43 +01:00
|
|
|
/* kernel.asm */
|
|
|
|
VOID ASMCFUNC FAR init_call_p_0(struct config FAR *Config); /* P_0, actually */
|
|
|
|
|
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,
|
2003-10-30 13:22:06 +01: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 */
|
2004-04-07 18:13:23 +02:00
|
|
|
int VA_CDECL init_printf(const char * fmt, ...);
|
|
|
|
int VA_CDECL init_sprintf(char * buff, const char * fmt, ...);
|
2001-07-10 00:19:33 +02:00
|
|
|
|
2004-03-07 12:56:14 +01:00
|
|
|
/* procsupt.asm */
|
|
|
|
VOID ASMCFUNC FAR got_cbreak(void);
|
|
|
|
|
2003-06-20 21:54:18 +02:00
|
|
|
/* initclk.c */
|
|
|
|
extern void Init_clk_driver(void);
|
|
|
|
|
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;
|
2003-06-20 21:54:18 +02:00
|
|
|
extern struct _KernelConfig FAR ASM LowKernelConfig;
|
|
|
|
extern WORD days[2][13];
|
|
|
|
extern BYTE FAR *lpTop;
|
|
|
|
extern BYTE ASM _ib_start[], ASM _ib_end[], ASM _init_end[];
|
|
|
|
extern UWORD ram_top; /* How much ram in Kbytes */
|
|
|
|
extern char singleStep;
|
|
|
|
extern char SkipAllConfig;
|
2003-10-05 18:22:57 +02:00
|
|
|
extern char master_env[128];
|
2003-06-20 21:54:18 +02:00
|
|
|
|
|
|
|
extern struct lol FAR *LoL;
|
|
|
|
|
|
|
|
extern struct dhdr DOSTEXTFAR ASM blk_dev; /* Block device (Disk) driver */
|
|
|
|
|
|
|
|
extern struct buffer FAR *DOSFAR firstAvailableBuf; /* first 'available' buffer */
|
2004-04-14 10:51:46 +02:00
|
|
|
extern struct lol ASM FAR DATASTART;
|
2003-06-20 21:54:18 +02:00
|
|
|
|
|
|
|
extern BYTE DOSFAR ASM _HMATextAvailable, /* first byte of available CODE area */
|
|
|
|
FAR ASM _HMATextStart[], /* first byte of HMAable CODE area */
|
2003-08-03 12:44:29 +02:00
|
|
|
FAR ASM _HMATextEnd[], DOSFAR ASM break_ena; /* break enabled flag */
|
|
|
|
extern BYTE DOSFAR _InitTextStart, /* first available byte of ram */
|
2003-06-20 21:54:18 +02:00
|
|
|
DOSFAR ReturnAnyDosVersionExpected;
|
|
|
|
|
|
|
|
extern BYTE FAR ASM internal_data[];
|
2003-06-30 20:44:43 +02:00
|
|
|
extern unsigned char FAR ASM kbdType;
|
2003-06-20 21:54:18 +02:00
|
|
|
|
|
|
|
extern struct {
|
|
|
|
char ThisIsAConstantOne;
|
|
|
|
short TableSize;
|
|
|
|
|
|
|
|
struct CountrySpecificInfo C;
|
|
|
|
|
2003-06-30 20:44:43 +02:00
|
|
|
} FAR ASM nlsCountryInfoHardcoded;
|
2003-06-20 21:54:18 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
data shared between DSK.C and INITDISK.C
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern UWORD DOSFAR LBA_WRITE_VERIFY;
|
|
|
|
|
|
|
|
/* floppy parameter table, at 70:xxxx */
|
|
|
|
extern unsigned char DOSTEXTFAR ASM int1e_table[0xe];
|
|
|
|
|
2004-05-23 17:10:08 +02:00
|
|
|
extern char DOSTEXTFAR DiskTransferBuffer[SEC_SIZE]; /* in dsk.c */
|
|
|
|
|
2003-06-20 21:54:18 +02:00
|
|
|
struct RelocationTable {
|
|
|
|
UBYTE jmpFar;
|
|
|
|
UWORD jmpOffset;
|
|
|
|
UWORD jmpSegment;
|
|
|
|
UBYTE callNear;
|
|
|
|
UWORD callOffset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RelocatedEntry {
|
|
|
|
UBYTE callNear;
|
|
|
|
UWORD callOffset;
|
|
|
|
UBYTE jmpFar;
|
|
|
|
UWORD jmpOffset;
|
|
|
|
UWORD jmpSegment;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct RelocationTable
|
2004-04-11 19:22:18 +02:00
|
|
|
DOSFAR ASM _HMARelocationTableStart[],
|
|
|
|
DOSFAR ASM _HMARelocationTableEnd[];
|
2003-06-20 21:54:18 +02:00
|
|
|
|
2004-04-11 19:22:18 +02:00
|
|
|
extern void FAR *DOSFAR ASM XMSDriverAddress;
|
2004-04-09 15:13:06 +02:00
|
|
|
extern VOID ASMPASCAL FAR _EnableA20(VOID);
|
|
|
|
extern VOID ASMPASCAL FAR _DisableA20(VOID);
|
2003-06-20 21:54:18 +02:00
|
|
|
|
2004-04-09 15:13:06 +02:00
|
|
|
extern void FAR * ASMPASCAL DetectXMSDriver(VOID);
|
|
|
|
extern int ASMPASCAL init_call_XMScall(void FAR * driverAddress, UWORD ax,
|
2003-06-20 21:54:18 +02:00
|
|
|
UWORD dx);
|
2004-04-09 15:13:06 +02:00
|
|
|
#ifdef __WATCOMC__
|
|
|
|
#pragma aux (pascal) DetectXMSDriver modify exact [ax dx]
|
|
|
|
#pragma aux (pascal) _EnableA20 modify exact [ax]
|
|
|
|
#pragma aux (pascal) _DisableA20 modify exact [ax]
|
|
|
|
#endif
|
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
|
2003-06-15 17:53:58 +02:00
|
|
|
|