Skip to content

Commit

Permalink
Make it work with MSVC 2003
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Dec 25, 2017
1 parent 415e97e commit fd18010
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
24 changes: 22 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,35 @@ PSS_STYLE :=2
LDFLAGS += -DLL
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
LIBS =
FLAGS += -DHAVE__MKDIR

# Windows MSVC 2003 x86
else ifeq ($(platform), windows_msvc2003_x86)
CC = cl.exe
CXX = cl.exe

PATH := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/include")
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS71COMNTOOLS)../../Vc7/lib")
BIN := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin")

WindowsSdkDir := $(INETSDK)

export INCLUDE := $(INCLUDE);$(INETSDK)/Include;libretro-common/include/compat/msvc
export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
WINDOWS_VERSION=1

# Windows
else
TARGET := $(TARGET_NAME)_libretro.dll
CC = gcc
CXX = g++
SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T
LDFLAGS += -static-libgcc -static-libstdc++ -lwinmm
FLAGS += -DHAVE__MKDIR
endif

include Makefile.common
Expand Down
2 changes: 0 additions & 2 deletions mednafen/wswan/v30mz-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ typedef enum
#define FETCH (cpu_readop_arg((I.sregs[PS]<<4)+I.pc++))
#define FETCHOP (cpu_readop((I.sregs[PS]<<4)+I.pc++))
#define FETCHuint16(var) { var=cpu_readop_arg((((I.sregs[PS]<<4)+I.pc)))+(cpu_readop_arg((((I.sregs[PS]<<4)+I.pc+1)))<<8); I.pc+=2; }
#define PUSH(val) { I.regs.w[SP]-=2; WriteWord((((I.sregs[SS]<<4)+I.regs.w[SP])),val); }
#define POP(var) { var = ReadWord((((I.sregs[SS]<<4)+I.regs.w[SP]))); I.regs.w[SP]+=2; }
#define PEEK(addr) ((uint8)cpu_readop_arg(addr))
#define PEEKOP(addr) ((uint8)cpu_readop(addr))

Expand Down
18 changes: 16 additions & 2 deletions mednafen/wswan/v30mz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@

static uint16 old_CS, old_IP;

#define PUSH(val) \
{ \
I.regs.w[SP] -= 2; \
WriteWord((((I.sregs[SS]<<4)+I.regs.w[SP])),val); \
}

#define POP(var) \
{ \
var = ReadWord((((I.sregs[SS]<<4)+I.regs.w[SP]))); \
I.regs.w[SP]+=2; \
}

#ifdef WANT_DEBUGGER
#define ADDBRANCHTRACE(x,y) { if(branch_trace_hook) branch_trace_hook(old_CS, old_IP, x, y, false); }
#define ADDBRANCHTRACE_INT(x,y) { if(branch_trace_hook) branch_trace_hook(old_CS, old_IP, x,y, true); }
Expand Down Expand Up @@ -101,7 +113,8 @@ static uint8 parity_table[256];

static INLINE void i_real_pushf(void)
{
PUSH( CompressFlags() );
uint8 compr = CompressFlags();
PUSH(compr);
CLK(2);
}

Expand Down Expand Up @@ -172,8 +185,9 @@ void v30mz_int(uint32 vector, bool IgnoreIF)
if(I.IF || IgnoreIF)
{
uint32 dest_seg, dest_off;
uint8 compr = CompressFlags();

PUSH( CompressFlags() );
PUSH( compr );
I.TF = I.IF = 0;
dest_off = ReadWord(vector);
dest_seg = ReadWord(vector+2);
Expand Down

0 comments on commit fd18010

Please sign in to comment.