Merge pull request #1 from lpproj/prototype

Cross-build on Windows and DBCS fix
This commit is contained in:
PerditionC 2014-11-21 22:34:40 -05:00
commit 7f649868f9
8 changed files with 78 additions and 29 deletions

View File

@ -435,7 +435,10 @@ struct nlsPackage { /* the contents of one chain item of the
struct nlsDBCS { /* The internal structure is unknown to me */ struct nlsDBCS { /* The internal structure is unknown to me */
UWORD numEntries; UWORD numEntries;
UWORD dbcsTbl[1]; UWORD dbcsTbl[4]; /* I don't know max size but it should need
at least 3 words (6 bytes)
({0x81,0x9f,0xe0,0xfc,0,0} for CP932-Japan)
-- lpproj 2014/10/27 */
}; };
struct nlsCharTbl { struct nlsCharTbl {

View File

@ -100,9 +100,14 @@ static unsigned short __inline getSS(void)
asm mov ax, ss; asm mov ax, ss;
} }
#elif defined(__WATCOMC__) && defined(BUILD_UTILS)
/* workaround for building some utils with OpenWatcom (owcc) */
#define MC68K
#elif defined(__WATCOMC__) /* don't know a better way */ #elif defined(__WATCOMC__) /* don't know a better way */
#if defined(_M_I86)
#define I86 #define I86
#endif
#define __int__(intno) asm int intno; #define __int__(intno) asm int intno;
void disable(void); void disable(void);
#pragma aux disable = "cli" modify exact []; #pragma aux disable = "cli" modify exact [];
@ -170,10 +175,12 @@ We might even deal with a pre-ANSI compiler. This will certainly not compile.
typedef __SIZE_TYPE__ size_t; typedef __SIZE_TYPE__ size_t;
#else #else
#define CONST #define CONST
#if !(defined(_SIZE_T) || defined(_SIZE_T_DEFINED) || defined(__SIZE_T_DEFINED))
typedef unsigned size_t; typedef unsigned size_t;
#endif #endif
#endif #endif
#ifdef I86 #endif
#if defined(I86) && !defined(MC68K)
#define VOID void #define VOID void
#define FAR far /* segment architecture */ #define FAR far /* segment architecture */
#define NEAR near /* " " */ #define NEAR near /* " " */

View File

@ -1542,7 +1542,7 @@ err:printf("%s has invalid format\n", filename);
{ {
if (hdr[i].length != 6) if (hdr[i].length != 6)
goto err; goto err;
if (hdr[i].id < 1 || hdr[i].id > 6 || hdr[i].id == 3) if (hdr[i].id < 1 || hdr[i].id > 7 || hdr[i].id == 3)
continue; continue;
if (lseek(fd, hdr[i].offset) == 0xffffffffL if (lseek(fd, hdr[i].offset) == 0xffffffffL
|| read(fd, &subf_data, 10) != 10 || read(fd, &subf_data, 10) != 10

View File

@ -1377,7 +1377,7 @@ dispatch:
case 0: case 0:
p = DosGetDBCS(); p = DosGetDBCS();
lr.DS = FP_SEG(p); lr.DS = FP_SEG(p);
lr.SI = FP_OFF(p); lr.SI = FP_OFF(p) + 2;
break; break;
case 1: /* set Korean Hangul input method to DL 0/1 */ case 1: /* set Korean Hangul input method to DL 0/1 */
lr.AL = 0xff; /* flag error (AL would be 0 if okay) */ lr.AL = 0xff; /* flag error (AL would be 0 if okay) */

View File

@ -21,9 +21,9 @@ OBJS4=break.obj dosfns.obj fatdir.obj fatfs.obj fattab.obj fcbfns.obj \
inthndlr.obj inthndlr.obj
OBJS5=ioctl.obj memmgr.obj task.obj newstuff.obj nls.obj network.obj OBJS5=ioctl.obj memmgr.obj task.obj newstuff.obj nls.obj network.obj
OBJS6=prf.obj misc.obj strings.obj syspack.obj lfnapi.obj iasmsupt.obj memdisk.obj OBJS6=prf.obj misc.obj strings.obj syspack.obj lfnapi.obj iasmsupt.obj memdisk.obj
OBJS7=main.obj config.obj initoem.obj inithma.obj dyninit.obj iprf.obj \ OBJS7=main.obj config.obj initoem.obj inithma.obj dyninit.obj iprf.obj
initdisk.obj initclk.obj cpu.obj OBJS8=initdisk.obj initclk.obj cpu.obj
OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS6) $(OBJS7) OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS6) $(OBJS7) $(OBJS8)
# *Explicit Rules* # *Explicit Rules*
@ -62,7 +62,8 @@ $(TARGET).lnk: turboc.cfg makefile ../mkfiles/generic.mak ../mkfiles/$(COMPILER)
$(ECHOTO) $(TARGET).lnk $(OBJS4)+ $(ECHOTO) $(TARGET).lnk $(OBJS4)+
$(ECHOTO) $(TARGET).lnk $(OBJS5)+ $(ECHOTO) $(TARGET).lnk $(OBJS5)+
$(ECHOTO) $(TARGET).lnk $(OBJS6)+ $(ECHOTO) $(TARGET).lnk $(OBJS6)+
$(ECHOTO) $(TARGET).lnk $(OBJS7) $(ECHOTO) $(TARGET).lnk $(OBJS7)+
$(ECHOTO) $(TARGET).lnk $(OBJS8)
$(ECHOTO) $(TARGET).lnk kernel.exe $(ECHOTO) $(TARGET).lnk kernel.exe
$(ECHOTO) $(TARGET).lnk kernel.map $(ECHOTO) $(TARGET).lnk kernel.map
$(ECHOTO) $(TARGET).lnk $(LIBS) $(ECHOTO) $(TARGET).lnk $(LIBS)

View File

@ -1,10 +1,14 @@
# What you WANT on DOS is: # What you WANT on DOS is:
# EDIT CONFIG.B, COPY CONFIG.B to CONFIG.BAT, RUN BUILD.BAT # EDIT CONFIG.B, COPY CONFIG.B to CONFIG.BAT, RUN BUILD.BAT
# On Linux, use config.mak, and "make all", "make clean", or "make clobber" # On Linux, use config.mak, and "make all", "make clean", or "make clobber"
# On Windows, use config.mak, and
# "mingw32-make all", "mingw32-make clean", or "mingw32-make clobber"
default: default:
@echo On DOS, please type build, clean, or clobber. @echo On DOS, please type build, clean, or clobber.
@echo On Linux, please type make all, make clean, or make clobber. @echo On Linux, please type make all, make clean, or make clobber.
@echo On Windows, please type mingw32-make all, mingw32-make clean, or
@echo mingw32-make clobber.
build: build:
build build
@ -60,14 +64,27 @@ zip: zip_src zipfat16 zipfat32
#Linux part #Linux part
#defaults: override using config.mak #defaults: override using config.mak
export export
COMPILER=owlinux
XCPU=86 ifeq ($(OS),Windows_NT)
XFAT=32 BUILDENV ?= windows
else
BUILDENV ?= linux
endif
ifeq ($(BUILDENV),windows)
COMPILER=owwin
TEST_F=type >nul 2>nul
else
COMPILER=owlinux
TEST_F=test -f
ifndef WATCOM ifndef WATCOM
WATCOM=$(HOME)/watcom WATCOM=$(HOME)/watcom
PATH:=$(WATCOM)/binl:$(PATH) PATH:=$(WATCOM)/binl:$(PATH)
endif endif
endif
XCPU=86
XFAT=32
XUPX=upx --8086 --best XUPX=upx --8086 --best
XNASM=nasm XNASM=nasm
MAKE=wmake -ms -h MAKE=wmake -ms -h
@ -81,7 +98,7 @@ endif
all: all:
cd utils && $(MAKE) production cd utils && $(MAKE) production
cd lib && ( test -f libm.lib || touch libm.lib ) cd lib && ( $(TEST_F) libm.lib || wtouch libm.lib )
cd drivers && $(MAKE) production cd drivers && $(MAKE) production
cd boot && $(MAKE) production cd boot && $(MAKE) production
cd sys && $(MAKE) production cd sys && $(MAKE) production

21
mkfiles/owwin.mak Normal file
View File

@ -0,0 +1,21 @@
#
# WATCOM.MAK - kernel compiler options for Open Watcom on Windows (cross-compile)
#
# Get definitions from watcom.mak, then override
include "../mkfiles/watcom.mak"
DIRSEP=\
INCLUDEPATH=$(COMPILERPATH)$(DIRSEP)h
#RM=del 2>nul
#CP=copy
#ECHOTO=echo>>
#INITPATCH=@echo > nul
CLDEF=1
CLT=owcc -DDOSC_TIME_H -DBUILD_UTILS -I../hdr -o $@
CLC=$(CLT)
CFLAGST=-fo=.obj $(CFLAGST)
ALLCFLAGS=-fo=.obj $(ALLCFLAGS)
NASMFLAGS=-Dowlinux $(NASMFLAGS)
XLINK=$(XLINK) debug all op symfile format dos option map,statics,verbose F { $(OBJS) } L ..$(DIRSEP)lib$(DIRSEP)device.lib N kernel.exe $#

View File

@ -1,5 +1,5 @@
# #
# makefile for bin2c.com and sys.com # makefile for bin2c.exe and sys.com
# #
# $Id: makefile 1482 2009-07-11 16:59:43Z perditionc $ # $Id: makefile 1482 2009-07-11 16:59:43Z perditionc $
# #
@ -18,31 +18,31 @@ SYS_EXE_dependencies = \
talloc.obj talloc.obj
# *Explicit Rules* # *Explicit Rules*
production: bin2c.com ../bin/sys.com production: bin2c.exe ../bin/sys.com
bin2c.com: bin2c.c bin2c.exe: bin2c.c
$(CLT) bin2c.c $(CLC) bin2c.c
../bin/sys.com: sys.com ../bin/sys.com: sys.com
$(CP) sys.com ..$(DIRSEP)bin $(CP) sys.com ..$(DIRSEP)bin
fat12com.h: ../boot/fat12com.bin bin2c.com fat12com.h: ../boot/fat12com.bin bin2c.exe
.$(DIRSEP)bin2c.com ../boot/fat12com.bin fat12com.h fat12com .$(DIRSEP)bin2c.exe ../boot/fat12com.bin fat12com.h fat12com
fat16com.h: ../boot/fat16com.bin bin2c.com fat16com.h: ../boot/fat16com.bin bin2c.exe
.$(DIRSEP)bin2c.com ../boot/fat16com.bin fat16com.h fat16com .$(DIRSEP)bin2c.exe ../boot/fat16com.bin fat16com.h fat16com
fat32chs.h: ../boot/fat32chs.bin bin2c.com fat32chs.h: ../boot/fat32chs.bin bin2c.exe
.$(DIRSEP)bin2c.com ../boot/fat32chs.bin fat32chs.h fat32chs .$(DIRSEP)bin2c.exe ../boot/fat32chs.bin fat32chs.h fat32chs
fat32lba.h: ../boot/fat32lba.bin bin2c.com fat32lba.h: ../boot/fat32lba.bin bin2c.exe
.$(DIRSEP)bin2c.com ../boot/fat32lba.bin fat32lba.h fat32lba .$(DIRSEP)bin2c.exe ../boot/fat32lba.bin fat32lba.h fat32lba
oemfat12.h: ../boot/oemfat12.bin bin2c.com oemfat12.h: ../boot/oemfat12.bin bin2c.exe
.$(DIRSEP)bin2c.com ../boot/oemfat12.bin oemfat12.h oemfat12 .$(DIRSEP)bin2c.exe ../boot/oemfat12.bin oemfat12.h oemfat12
oemfat16.h: ../boot/oemfat16.bin bin2c.com oemfat16.h: ../boot/oemfat16.bin bin2c.exe
.$(DIRSEP)bin2c.com ../boot/oemfat16.bin oemfat16.h oemfat16 .$(DIRSEP)bin2c.exe ../boot/oemfat16.bin oemfat16.h oemfat16
prf.obj: ../kernel/prf.c prf.obj: ../kernel/prf.c
$(CC) $(CFLAGS) ..$(DIRSEP)kernel$(DIRSEP)prf.c $(CC) $(CFLAGS) ..$(DIRSEP)kernel$(DIRSEP)prf.c
@ -55,7 +55,7 @@ sys.com: $(SYS_EXE_dependencies)
$(CL) $(CFLAGST) $(TINY) $(SYS_EXE_dependencies) $(CL) $(CFLAGST) $(TINY) $(SYS_EXE_dependencies)
clobber: clean clobber: clean
-$(RM) bin2c.com sys.com fat*.h oemfat*.h -$(RM) bin2c.exe sys.com fat*.h oemfat*.h
clean: clean:
-$(RM) *.obj *.bak *.crf *.xrf *.map *.lst *.las *.cod *.err status.me -$(RM) *.obj *.bak *.crf *.xrf *.map *.lst *.las *.cod *.err status.me