C source code changes so the kernel can compile with ia16-elf-gcc.
Use "make all COMPILER=gcc". Linking does not work yet with these changes.
This commit is contained in:
parent
705268267c
commit
fbdbc4c25c
12
hdr/nls.h
12
hdr/nls.h
@ -403,7 +403,7 @@ struct nlsExtCntryInfo {
|
|||||||
0: 12 hours (append AM/PM)
|
0: 12 hours (append AM/PM)
|
||||||
1: 24 houres
|
1: 24 houres
|
||||||
*/
|
*/
|
||||||
VOID(FAR * upCaseFct) (VOID); /* far call to a function upcasing the
|
intvec upCaseFct; /* far call to a function upcasing the
|
||||||
character in register AL */
|
character in register AL */
|
||||||
char dataSep[2]; /* ASCIZ of separator in data records */
|
char dataSep[2]; /* ASCIZ of separator in data records */
|
||||||
};
|
};
|
||||||
@ -474,9 +474,19 @@ struct nlsInfoBlock { /* This block contains all information
|
|||||||
maybe tweaked by NLSFUNC */
|
maybe tweaked by NLSFUNC */
|
||||||
UWORD sysCodePage; /* system code page */
|
UWORD sysCodePage; /* system code page */
|
||||||
unsigned flags; /* implementation flags */
|
unsigned flags; /* implementation flags */
|
||||||
|
#ifdef __GNUC__
|
||||||
|
/* need to initialize using explicit segment/offset */
|
||||||
|
union {
|
||||||
|
struct { struct nlsPackage *off; char *seg; };
|
||||||
|
struct nlsPackage FAR *p;
|
||||||
|
} actPkg, chain;
|
||||||
|
#define actPkg actPkg.p
|
||||||
|
#define chain chain.p
|
||||||
|
#else
|
||||||
struct nlsPackage FAR *actPkg; /* current NLS package */
|
struct nlsPackage FAR *actPkg; /* current NLS package */
|
||||||
struct nlsPackage FAR *chain; /* first item of info chain --
|
struct nlsPackage FAR *chain; /* first item of info chain --
|
||||||
hardcoded U.S.A./CP437 */
|
hardcoded U.S.A./CP437 */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct nlsInfoBlock ASM nlsInfo;
|
extern struct nlsInfoBlock ASM nlsInfo;
|
||||||
|
30
hdr/portab.h
30
hdr/portab.h
@ -140,8 +140,34 @@ unsigned short getSS(void);
|
|||||||
#define MC68K
|
#define MC68K
|
||||||
|
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
|
||||||
|
#ifdef __FAR
|
||||||
|
#define I86
|
||||||
|
#define far __far
|
||||||
|
#define CDECL
|
||||||
|
#define VA_CDECL
|
||||||
|
#define PASCAL
|
||||||
|
|
||||||
|
#define _CS getCS()
|
||||||
|
static inline unsigned short getCS(void)
|
||||||
|
{
|
||||||
|
unsigned short ret;
|
||||||
|
asm volatile("mov %%cs, %0" : "=r"(ret));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _SS getSS()
|
||||||
|
static inline unsigned short getSS(void)
|
||||||
|
{
|
||||||
|
unsigned short ret;
|
||||||
|
asm volatile("mov %%ss, %0" : "=r"(ret));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
extern char DosDataSeg[];
|
||||||
|
#else
|
||||||
/* for warnings only ! */
|
/* for warnings only ! */
|
||||||
#define MC68K
|
#define MC68K
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error Unknown compiler
|
#error Unknown compiler
|
||||||
@ -313,7 +339,11 @@ typedef signed long LONG;
|
|||||||
#define FP_OFF(fp) ((size_t)(fp))
|
#define FP_OFF(fp) ((size_t)(fp))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && defined(__FAR)
|
||||||
|
typedef VOID FAR *intvec;
|
||||||
|
#else
|
||||||
typedef VOID (FAR ASMCFUNC * intvec) (void);
|
typedef VOID (FAR ASMCFUNC * intvec) (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MK_PTR(type,seg,ofs) ((type FAR*) MK_FP (seg, ofs))
|
#define MK_PTR(type,seg,ofs) ((type FAR*) MK_FP (seg, ofs))
|
||||||
#if __TURBOC__ > 0x202
|
#if __TURBOC__ > 0x202
|
||||||
|
@ -67,7 +67,7 @@ typedef struct {
|
|||||||
for compatiblity with CP/M apps that do a near call to psp:5
|
for compatiblity with CP/M apps that do a near call to psp:5
|
||||||
and expect size (KB) of allocated segment in word at offset 6 */
|
and expect size (KB) of allocated segment in word at offset 6 */
|
||||||
UBYTE ps_farcall; /* 05 far call opcode */
|
UBYTE ps_farcall; /* 05 far call opcode */
|
||||||
VOID(FAR ASMCFUNC * ps_reentry) (void); /* 06 re-entry point */
|
intvec ps_reentry; /* 06 re-entry point */
|
||||||
|
|
||||||
intvec ps_isv22, /* 0a terminate address */
|
intvec ps_isv22, /* 0a terminate address */
|
||||||
ps_isv23, /* 0e ctrl-break address */
|
ps_isv23, /* 0e ctrl-break address */
|
||||||
|
@ -149,6 +149,8 @@ STATIC void fast_put_char(unsigned char chr)
|
|||||||
#if defined(__TURBOC__)
|
#if defined(__TURBOC__)
|
||||||
_AL = chr;
|
_AL = chr;
|
||||||
__int__(0x29);
|
__int__(0x29);
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
asm volatile("int $0x29":: "a"(chr):"bx");
|
||||||
#elif defined(I86)
|
#elif defined(I86)
|
||||||
asm
|
asm
|
||||||
{
|
{
|
||||||
|
@ -226,7 +226,7 @@ CLUSTER link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
|||||||
|
|
||||||
if (ISFAT12(dpbp))
|
if (ISFAT12(dpbp))
|
||||||
{
|
{
|
||||||
REG UBYTE FAR *fbp0, FAR * fbp1;
|
REG UBYTE FAR *fbp0; REG UBYTE FAR * fbp1;
|
||||||
struct buffer FAR * bp1;
|
struct buffer FAR * bp1;
|
||||||
unsigned cluster, cluster2;
|
unsigned cluster, cluster2;
|
||||||
|
|
||||||
|
@ -156,18 +156,17 @@ typedef BYTE *UPMAP;
|
|||||||
/* */
|
/* */
|
||||||
/* External Assembly variables */
|
/* External Assembly variables */
|
||||||
/* */
|
/* */
|
||||||
extern struct dhdr
|
extern struct dhdr FAR ASM clk_dev; /* Clock device driver */
|
||||||
FAR ASM clk_dev, /* Clock device driver */
|
extern struct dhdr FAR ASM con_dev; /* Console device driver */
|
||||||
FAR ASM con_dev, /* Console device driver */
|
extern struct dhdr FAR ASM prn_dev; /* Generic printer device driver */
|
||||||
FAR ASM prn_dev, /* Generic printer device driver */
|
extern struct dhdr FAR ASM aux_dev; /* Generic aux device driver */
|
||||||
FAR ASM aux_dev, /* Generic aux device driver */
|
extern struct dhdr FAR ASM blk_dev; /* Block device (Disk) driver */
|
||||||
FAR ASM blk_dev; /* Block device (Disk) driver */
|
|
||||||
extern COUNT *error_tos, /* error stack */
|
extern COUNT *error_tos, /* error stack */
|
||||||
disk_api_tos, /* API handler stack - disk fns */
|
disk_api_tos, /* API handler stack - disk fns */
|
||||||
char_api_tos; /* API handler stack - char fns */
|
char_api_tos; /* API handler stack - char fns */
|
||||||
extern BYTE FAR _HMATextAvailable, /* first byte of available CODE area */
|
extern BYTE FAR _HMATextAvailable; /* first byte of available CODE area */
|
||||||
FAR _HMATextStart[], /* first byte of HMAable CODE area */
|
extern BYTE FAR _HMATextStart[]; /* first byte of HMAable CODE area */
|
||||||
FAR _HMATextEnd[]; /* and the last byte of it */
|
extern BYTE FAR _HMATextEnd[]; /* and the last byte of it */
|
||||||
extern
|
extern
|
||||||
BYTE DosLoadedInHMA; /* if InitHMA has moved DOS up */
|
BYTE DosLoadedInHMA; /* if InitHMA has moved DOS up */
|
||||||
|
|
||||||
@ -236,9 +235,8 @@ extern UWORD ASM first_mcb, /* Start of user memory */
|
|||||||
ASM uppermem_root; /* Start of umb chain (usually 9fff) */
|
ASM uppermem_root; /* Start of umb chain (usually 9fff) */
|
||||||
extern char * ASM inputptr; /* pointer to unread CON input */
|
extern char * ASM inputptr; /* pointer to unread CON input */
|
||||||
extern sfttbl FAR * ASM sfthead; /* System File Table head */
|
extern sfttbl FAR * ASM sfthead; /* System File Table head */
|
||||||
extern struct dhdr
|
extern struct dhdr FAR * ASM clock; /* CLOCK$ device */
|
||||||
FAR * ASM clock, /* CLOCK$ device */
|
extern struct dhdr FAR * ASM syscon;/* console device */
|
||||||
FAR * ASM syscon; /* console device */
|
|
||||||
extern WORD ASM maxsecsize; /* largest sector size in use (can use) */
|
extern WORD ASM maxsecsize; /* largest sector size in use (can use) */
|
||||||
extern struct buffer
|
extern struct buffer
|
||||||
FAR *ASM firstbuf; /* head of buffers linked list */
|
FAR *ASM firstbuf; /* head of buffers linked list */
|
||||||
|
@ -23,7 +23,7 @@ extern __segment DosTextSeg;
|
|||||||
#define DOSFAR FAR
|
#define DOSFAR FAR
|
||||||
#define DOSTEXTFAR FAR
|
#define DOSTEXTFAR FAR
|
||||||
|
|
||||||
#elif !defined(I86)
|
#elif !defined(I86) || defined(__GNUC__)
|
||||||
|
|
||||||
#define DOSFAR
|
#define DOSFAR
|
||||||
#define DOSTEXTFAR
|
#define DOSTEXTFAR
|
||||||
|
@ -242,7 +242,11 @@ extern void Init_clk_driver(void);
|
|||||||
extern UWORD HMAFree; /* first byte in HMA not yet used */
|
extern UWORD HMAFree; /* first byte in HMA not yet used */
|
||||||
|
|
||||||
extern unsigned CurrentKernelSegment;
|
extern unsigned CurrentKernelSegment;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
extern struct _KernelConfig ASM LowKernelConfig;
|
||||||
|
#else
|
||||||
extern struct _KernelConfig FAR ASM LowKernelConfig;
|
extern struct _KernelConfig FAR ASM LowKernelConfig;
|
||||||
|
#endif
|
||||||
extern WORD days[2][13];
|
extern WORD days[2][13];
|
||||||
extern BYTE FAR *lpTop;
|
extern BYTE FAR *lpTop;
|
||||||
extern BYTE ASM _ib_start[], ASM _ib_end[], ASM _init_end[];
|
extern BYTE ASM _ib_start[], ASM _ib_end[], ASM _init_end[];
|
||||||
@ -256,11 +260,21 @@ extern struct lol FAR *LoL;
|
|||||||
extern struct dhdr DOSTEXTFAR ASM blk_dev; /* Block device (Disk) driver */
|
extern struct dhdr DOSTEXTFAR ASM blk_dev; /* Block device (Disk) driver */
|
||||||
|
|
||||||
extern struct buffer FAR *DOSFAR firstAvailableBuf; /* first 'available' buffer */
|
extern struct buffer FAR *DOSFAR firstAvailableBuf; /* first 'available' buffer */
|
||||||
|
#ifdef __GNUC__
|
||||||
|
extern struct lol ASM DATASTART;
|
||||||
|
#else
|
||||||
extern struct lol ASM FAR DATASTART;
|
extern struct lol ASM FAR DATASTART;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern BYTE DOSFAR ASM _HMATextAvailable, /* first byte of available CODE area */
|
extern BYTE DOSFAR ASM _HMATextAvailable; /* first byte of available CODE area */
|
||||||
FAR ASM _HMATextStart[], /* first byte of HMAable CODE area */
|
#ifdef __GNUC__
|
||||||
FAR ASM _HMATextEnd[], DOSFAR ASM break_ena; /* break enabled flag */
|
extern BYTE ASM _HMATextStart[]; /* first byte of HMAable CODE area */
|
||||||
|
extern BYTE ASM _HMATextEnd[];
|
||||||
|
#else
|
||||||
|
extern BYTE FAR ASM _HMATextStart[]; /* first byte of HMAable CODE area */
|
||||||
|
extern BYTE FAR ASM _HMATextEnd[];
|
||||||
|
#endif
|
||||||
|
extern BYTE DOSFAR ASM break_ena; /* break enabled flag */
|
||||||
extern BYTE DOSFAR ASM _InitTextStart[], /* first available byte of ram */
|
extern BYTE DOSFAR ASM _InitTextStart[], /* first available byte of ram */
|
||||||
DOSFAR ASM _InitTextEnd[],
|
DOSFAR ASM _InitTextEnd[],
|
||||||
DOSFAR ASM ReturnAnyDosVersionExpected,
|
DOSFAR ASM ReturnAnyDosVersionExpected,
|
||||||
|
@ -352,7 +352,8 @@ void MoveKernel(unsigned NewKernelSegment)
|
|||||||
style table
|
style table
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct RelocationTable FAR *rp, rtemp;
|
struct RelocationTable FAR *rp;
|
||||||
|
struct RelocationTable rtemp;
|
||||||
|
|
||||||
/* verify, that all entries are valid */
|
/* verify, that all entries are valid */
|
||||||
|
|
||||||
|
@ -68,7 +68,12 @@ __segment DosTextSeg = 0;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct lol FAR *LoL = &DATASTART;
|
struct lol FAR *LoL
|
||||||
|
#ifndef __GNUC__
|
||||||
|
/* cannot initialize from far data with GCC */
|
||||||
|
= &DATASTART;
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
VOID ASMCFUNC FreeDOSmain(void)
|
VOID ASMCFUNC FreeDOSmain(void)
|
||||||
{
|
{
|
||||||
@ -90,6 +95,9 @@ VOID ASMCFUNC FreeDOSmain(void)
|
|||||||
at 50:e0
|
at 50:e0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
LoL = &DATASTART;
|
||||||
|
#endif
|
||||||
drv = LoL->BootDrive + 1;
|
drv = LoL->BootDrive + 1;
|
||||||
p = MK_FP(0, 0x5e0);
|
p = MK_FP(0, 0x5e0);
|
||||||
if (fmemcmp(p+2,"CONFIG",6) == 0) /* UPX */
|
if (fmemcmp(p+2,"CONFIG",6) == 0) /* UPX */
|
||||||
@ -775,8 +783,12 @@ STATIC void CheckContinueBootFromHarddisk(void)
|
|||||||
init_call_intr(0x13, &r);
|
init_call_intr(0x13, &r);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#if __GNUC__
|
||||||
|
asm volatile("jmp $0,$0x7c00");
|
||||||
|
#else
|
||||||
void (far *reboot)(void) = (void (far*)(void)) MK_FP(0x0,0x7c00);
|
void (far *reboot)(void) = (void (far*)(void)) MK_FP(0x0,0x7c00);
|
||||||
|
|
||||||
(*reboot)();
|
(*reboot)();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ COUNT DosMemFree(UWORD para)
|
|||||||
*/
|
*/
|
||||||
COUNT DosMemChange(UWORD para, UWORD size, UWORD * maxSize)
|
COUNT DosMemChange(UWORD para, UWORD size, UWORD * maxSize)
|
||||||
{
|
{
|
||||||
REG mcb FAR *p, FAR * q;
|
REG mcb FAR *p; mcb FAR * q;
|
||||||
|
|
||||||
/* Initialize */
|
/* Initialize */
|
||||||
p = para2far(para - 1); /* pointer to MCB */
|
p = para2far(para - 1); /* pointer to MCB */
|
||||||
|
@ -66,8 +66,13 @@ struct nlsInfoBlock ASM nlsInfo = {
|
|||||||
#ifdef NLS_REORDER_POINTERS
|
#ifdef NLS_REORDER_POINTERS
|
||||||
| NLS_CODE_REORDER_POINTERS
|
| NLS_CODE_REORDER_POINTERS
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __GNUC__
|
||||||
|
, {.seg=DosDataSeg, .off=&nlsPackageHardcoded} /* hardcoded first package */
|
||||||
|
, {.seg=DosDataSeg, .off=&nlsPackageHardcoded} /* first item in chain */
|
||||||
|
#else
|
||||||
, &nlsPackageHardcoded /* hardcoded first package */
|
, &nlsPackageHardcoded /* hardcoded first package */
|
||||||
, &nlsPackageHardcoded /* first item in chain */
|
, &nlsPackageHardcoded /* first item in chain */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* getTableX return the pointer to the X'th table; X==subfct */
|
/* getTableX return the pointer to the X'th table; X==subfct */
|
||||||
|
@ -29,7 +29,11 @@
|
|||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
#ifdef FORSYS
|
#ifdef FORSYS
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#include <unistd.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#endif
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -105,6 +109,8 @@ void put_console(int c)
|
|||||||
__int__(0x29);
|
__int__(0x29);
|
||||||
#elif defined(__WATCOMC__)
|
#elif defined(__WATCOMC__)
|
||||||
int29(c);
|
int29(c);
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
asm volatile("int $0x29" : : "a"(c) : "bx");
|
||||||
#elif defined(I86)
|
#elif defined(I86)
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
@ -227,7 +233,8 @@ int VA_CDECL sprintf(char * buff, CONST char * fmt, ...)
|
|||||||
STATIC void do_printf(CONST BYTE * fmt, va_list arg)
|
STATIC void do_printf(CONST BYTE * fmt, va_list arg)
|
||||||
{
|
{
|
||||||
int base;
|
int base;
|
||||||
BYTE s[11], FAR * p;
|
BYTE s[11];
|
||||||
|
BYTE FAR * p;
|
||||||
int size;
|
int size;
|
||||||
unsigned char flags;
|
unsigned char flags;
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd)
|
|||||||
|
|
||||||
VOID return_user(void)
|
VOID return_user(void)
|
||||||
{
|
{
|
||||||
psp FAR *p, FAR * q;
|
psp FAR *p; psp FAR * q;
|
||||||
REG COUNT i;
|
REG COUNT i;
|
||||||
iregs FAR *irp;
|
iregs FAR *irp;
|
||||||
/* long j;*/
|
/* long j;*/
|
||||||
|
50
mkfiles/gcc.mak
Normal file
50
mkfiles/gcc.mak
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#
|
||||||
|
# GCC.MAK - kernel compiler options for ia16-elf-gcc
|
||||||
|
#
|
||||||
|
|
||||||
|
CC=ia16-elf-gcc -c
|
||||||
|
CL=echo ia16-elf-gcc
|
||||||
|
INCLUDEPATH=.
|
||||||
|
|
||||||
|
!if $(XCPU) != 186
|
||||||
|
!if $(XCPU) != 386
|
||||||
|
TARGETOPT=-march=i8086
|
||||||
|
!endif
|
||||||
|
!endif
|
||||||
|
|
||||||
|
LIBUTIL=wlib -q
|
||||||
|
LIBPLUS=
|
||||||
|
LIBTERM=
|
||||||
|
|
||||||
|
TINY=-mcmodel=tiny
|
||||||
|
CFLAGST=-w -o $@
|
||||||
|
CFLAGSC=
|
||||||
|
|
||||||
|
TARGET=KGC
|
||||||
|
|
||||||
|
#
|
||||||
|
# heavy stuff - building
|
||||||
|
#
|
||||||
|
# -mcmodel=small small memory model (small code/small data)
|
||||||
|
# -fleading-underscore underscores leading field for DOS compiler compat
|
||||||
|
# -fno-common no "common" variables, just BSS for uninitialized data
|
||||||
|
# -fpack-struct pack structure members
|
||||||
|
# -ffreestanding don't assume any headers
|
||||||
|
# -fcall-used-es es clobbered in function calls
|
||||||
|
# -mrtd use stdcall calling convention
|
||||||
|
# -w disable warnings for now
|
||||||
|
# -Werror treat all warnings as errors
|
||||||
|
|
||||||
|
ALLCFLAGS=-I../hdr $(TARGETOPT) $(ALLCFLAGS) -mcmodel=small -fleading-underscore -fno-common -fpack-struct -ffreestanding -fcall-used-es -mrtd -w -Werror
|
||||||
|
INITCFLAGS=$(ALLCFLAGS) -o $@
|
||||||
|
CFLAGS=$(ALLCFLAGS) -o $@
|
||||||
|
|
||||||
|
DIRSEP=/
|
||||||
|
RM=rm -f
|
||||||
|
CP=echo cp
|
||||||
|
ECHOTO=echo>>
|
||||||
|
INITPATCH=@echo > /dev/null
|
||||||
|
CLDEF=1
|
||||||
|
CLT=gcc -DDOSC_TIME_H -I../hdr -o $@
|
||||||
|
CLC=$(CLT)
|
||||||
|
XLINK=echo $(XLINK) debug all op symfile format dos option map,statics,verbose F { $(OBJS) } L ../lib/device.lib N kernel.exe $#
|
@ -19,7 +19,9 @@ char KERNEL[] = "KERNEL.SYS";
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifndef __GNUC__
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
/* These definitions deliberately put here instead of
|
/* These definitions deliberately put here instead of
|
||||||
@ -29,7 +31,7 @@ char KERNEL[] = "KERNEL.SYS";
|
|||||||
extern int VA_CDECL printf(CONST char * fmt, ...);
|
extern int VA_CDECL printf(CONST char * fmt, ...);
|
||||||
extern int VA_CDECL sprintf(char * buff, CONST char * fmt, ...);
|
extern int VA_CDECL sprintf(char * buff, CONST char * fmt, ...);
|
||||||
|
|
||||||
#ifdef __WATCOMC__
|
#if defined(__WATCOMC__)
|
||||||
unsigned _dos_close(int handle);
|
unsigned _dos_close(int handle);
|
||||||
#define close _dos_close
|
#define close _dos_close
|
||||||
#define SEEK_SET 0
|
#define SEEK_SET 0
|
||||||
@ -44,6 +46,11 @@ unsigned long lseek(int fildes, unsigned long offset, int whence);
|
|||||||
parm [bx] [dx cx] [ax] \
|
parm [bx] [dx cx] [ax] \
|
||||||
value [dx ax];
|
value [dx ax];
|
||||||
|
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#define memicmp strncasecmp
|
||||||
|
#define O_BINARY 0
|
||||||
#else
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#ifndef SEEK_SET
|
#ifndef SEEK_SET
|
||||||
|
32
sys/sys.c
32
sys/sys.c
@ -48,8 +48,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifndef __GNUC__
|
||||||
#include <dos.h>
|
#include <dos.h>
|
||||||
|
#endif
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#ifndef __GNUC__
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#ifdef __TURBOC__
|
#ifdef __TURBOC__
|
||||||
@ -57,6 +60,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef __TURBOC__
|
#ifdef __TURBOC__
|
||||||
#include <dir.h>
|
#include <dir.h>
|
||||||
@ -91,7 +95,31 @@ extern int VA_CDECL sprintf(char * buff, CONST char * fmt, ...);
|
|||||||
|
|
||||||
#ifndef __WATCOMC__
|
#ifndef __WATCOMC__
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#define O_BINARY 0
|
||||||
|
#define stricmp strcasecmp
|
||||||
|
#define memicmp strncasecmp
|
||||||
|
union REGS {
|
||||||
|
struct {
|
||||||
|
unsigned char al, ah, bl, bh, cl, ch, dl, dh;
|
||||||
|
} h;
|
||||||
|
struct {
|
||||||
|
unsigned short ax, bx, cx, dx, si, di, cflag;
|
||||||
|
} x;
|
||||||
|
};
|
||||||
|
struct SREGS {
|
||||||
|
unsigned short ds, es;
|
||||||
|
};
|
||||||
|
struct _diskfree_t {
|
||||||
|
unsigned short avail_clusters, sectors_per_cluster, bytes_per_sector;
|
||||||
|
};
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* returns current DOS drive, A=0, B=1,C=2, ... */
|
/* returns current DOS drive, A=0, B=1,C=2, ... */
|
||||||
#ifdef __TURBOC__
|
#ifdef __TURBOC__
|
||||||
@ -973,7 +1001,7 @@ void reset_drive(int DosDrive);
|
|||||||
#pragma aux reset_drive = \
|
#pragma aux reset_drive = \
|
||||||
"push ds" \
|
"push ds" \
|
||||||
"inc dx" \
|
"inc dx" \
|
||||||
"mov ah, 0xd" \
|
"mov ah, 0xd" \
|
||||||
"int 0x21" \
|
"int 0x21" \
|
||||||
"mov ah,0x32" \
|
"mov ah,0x32" \
|
||||||
"int 0x21" \
|
"int 0x21" \
|
||||||
@ -1798,7 +1826,7 @@ BOOL copy(const BYTE *source, COUNT drive, const BYTE * filename)
|
|||||||
{
|
{
|
||||||
ULONG filesize;
|
ULONG filesize;
|
||||||
UWORD theseg;
|
UWORD theseg;
|
||||||
BYTE far *buffer, far *bufptr;
|
BYTE far *buffer; BYTE far *bufptr;
|
||||||
UWORD offs;
|
UWORD offs;
|
||||||
unsigned chunk_size;
|
unsigned chunk_size;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user