From fd18010d49bcc4108d1ad137a17b93e038b7031c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 25 Dec 2017 05:33:28 +0100 Subject: [PATCH] Make it work with MSVC 2003 --- Makefile | 24 ++++++++++++++++++++++-- mednafen/wswan/v30mz-private.h | 2 -- mednafen/wswan/v30mz.cpp | 18 ++++++++++++++++-- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 59dc2b14..7970e8b1 100644 --- a/Makefile +++ b/Makefile @@ -384,7 +384,28 @@ 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 @@ -392,7 +413,6 @@ else 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 diff --git a/mednafen/wswan/v30mz-private.h b/mednafen/wswan/v30mz-private.h index 47c6d19e..29099066 100644 --- a/mednafen/wswan/v30mz-private.h +++ b/mednafen/wswan/v30mz-private.h @@ -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)) diff --git a/mednafen/wswan/v30mz.cpp b/mednafen/wswan/v30mz.cpp index b38dae44..b6484222 100644 --- a/mednafen/wswan/v30mz.cpp +++ b/mednafen/wswan/v30mz.cpp @@ -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); } @@ -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); } @@ -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);