Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions Mkfiles/openwcom.mak
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
# cross-compile on a DOS/Win32/OS2 platform host
#

.DEFAULT : what

top_srcdir = .
srcdir = .
VPATH = $(srcdir)\asm;$(srcdir)\x86;asm;x86;$(srcdir)\macros;macros;$(srcdir)\output;$(srcdir)\lib;$(srcdir)\common;$(srcdir)\stdlib;$(srcdir)\nasmlib;$(srcdir)\disasm
VPATH = $(srcdir)\asm;$(srcdir)\x86;asm;x86;$(srcdir)\macros;macros;$(srcdir)\output;$(srcdir)\lib;$(srcdir)\common;$(srcdir)\stdlib;$(srcdir)\nasmlib;$(srcdir)\disasm;$(srcdir)\zlib
prefix = C:\Program Files\NASM
exec_prefix = $(prefix)
bindir = $(prefix)\bin
Expand All @@ -16,7 +18,7 @@ CC = *wcl386
DEBUG =
CFLAGS = -zq -6 -ox -wx -wcd=124 -ze -fpi $(DEBUG)
BUILD_CFLAGS = $(CFLAGS) $(%TARGET_CFLAGS)
INTERNAL_CFLAGS = -I$(srcdir) -I. -I$(srcdir)\include -I$(srcdir)\x86 -Ix86 -I$(srcdir)\asm -Iasm -I$(srcdir)\disasm -I$(srcdir)\output
INTERNAL_CFLAGS = -I$(srcdir) -I. -I$(srcdir)\include -I$(srcdir)\x86 -Ix86 -I$(srcdir)\asm -Iasm -I$(srcdir)\disasm -I$(srcdir)\output -I$(srcdir)\zlib
ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
LD = *wlink
LDEBUG =
Expand All @@ -31,9 +33,9 @@ RUNPERL = $(PERL) $(PERLFLAGS)
.BEFORE
set COPYCMD=/y

RM_F = -del /f
RM_F = -rm -f
LN_S = copy
EMPTY = copy nul:
EMPTY = %create
SIDE = %null Created by side effect

MAKENSIS = makensis
Expand Down Expand Up @@ -149,15 +151,23 @@ LIBOBJ_DIS = &

# Objects for the local copy of zlib. The variable ZLIB is set to
# $(ZLIBOBJ) if the internal version of zlib should be used.
# zlib\crc32.obj is renamed to zlib\z_crc32.obj to avoid conflicts with
# nasmlib\crc32.obj.
ZLIBOBJ = &
zlib\adler32.obj &
zlib\crc32.obj &
zlib\z_crc32.obj &
zlib\infback.obj &
zlib\inffast.obj &
zlib\inflate.obj &
zlib\inftrees.obj &
zlib\zutil.obj

# Special rule to avoid conflicts with nasmlib\crc32.obj because of stupid
# behavior of implicit rules and VPATH of Open Watcom Make.
zlib\z_crc32.obj : zlib\crc32.c
@set INCLUDE=
$(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@

LIBOBJ = $(LIBOBJ_W) $(LIBOBJ_NW) $(ZLIB)
ALLOBJ_W = $(NASM) $(LIBOBJ_W)
ALLOBJ = $(PROGOBJ) $(LIBOBJ)
Expand Down
13 changes: 13 additions & 0 deletions asm/assemble.c
Original file line number Diff line number Diff line change
Expand Up @@ -3103,6 +3103,7 @@ static enum match_result matches(const struct itemplate * const itemp,
* If this is an *explicitly* sized immediate,
* allow it to match an extending pattern.
*/
#ifndef __WATCOMC__
switch (isize[i]) {
case BITS8:
if (ttype & BYTEEXTMASK) {
Expand All @@ -3117,6 +3118,18 @@ static enum match_result matches(const struct itemplate * const itemp,
default:
break;
}
#else
/* Open Watcom does not support 64-bit constants at *case*. */
if (isize[i] == BITS8) {
if (ttype & BYTEEXTMASK) {
isize[i] = tsize[i];
itype[i] |= BYTEEXTMASK;
}
} else if (isize[i] == BITS32) {
if (ttype & DWORDEXTMASK)
isize[i] = tsize[i];
}
#endif

/*
* MOST instructions which take an sdword64 are the only form;
Expand Down
51 changes: 51 additions & 0 deletions disasm/disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ static enum reg_enum whichreg(opflags_t regflags, int regval, uint32_t rex)
*/
static enum reg_enum implicit_reg(opflags_t regflags)
{
#ifndef __WATCOMC__
switch (regflags) {
case REG_AL: return R_AL;
case REG_AX: return R_AX;
Expand All @@ -139,6 +140,56 @@ static enum reg_enum implicit_reg(opflags_t regflags)
case OPMASK0: return R_K0;
default: return 0;
}
#else
/* Open Watcom does not support 64-bit constants at *case*. */
if (regflags == REG_AL)
return R_AL;
if (regflags == REG_AX)
return R_AX;
if (regflags == REG_EAX)
return R_EAX;
if (regflags == REG_RAX)
return R_RAX;
if (regflags == REG_DL)
return R_DL;
if (regflags == REG_DX)
return R_DX;
if (regflags == REG_EDX)
return R_EDX;
if (regflags == REG_RDX)
return R_RDX;
if (regflags == REG_CL)
return R_CL;
if (regflags == REG_CX)
return R_CX;
if (regflags == REG_ECX)
return R_ECX;
if (regflags == REG_RCX)
return R_RCX;
if (regflags == FPU0)
return R_ST0;
if (regflags == XMM0)
return R_XMM0;
if (regflags == YMM0)
return R_YMM0;
if (regflags == ZMM0)
return R_ZMM0;
if (regflags == REG_ES)
return R_ES;
if (regflags == REG_CS)
return R_CS;
if (regflags == REG_SS)
return R_SS;
if (regflags == REG_DS)
return R_DS;
if (regflags == REG_FS)
return R_FS;
if (regflags == REG_GS)
return R_GS;
if (regflags == OPMASK0)
return R_K0;
return 0;
#endif
}

/*
Expand Down