Fixes windows compatibility.

This commit is contained in:
Felix Queißner 2016-07-01 19:01:09 +02:00
parent 4f93d2519a
commit 2267d336d0
3 changed files with 20 additions and 7 deletions

View file

@ -3,13 +3,13 @@ SET PATHSAVE=%PATH%
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
SET INIT = /nologo
SET OPTIONS = /Zp1
SET OPTIONS = /Zp1 /Ox
REM echo Building explink...
REM cl %INIT% explink.c getopt.c %OPTIONS%
echo Building explink...
cl %INIT% explink.c getopt.c %OPTIONS%
REM echo Building expdump...
REM cl %INIT% expdump.c getopt.c %OPTIONS%
echo Building expdump...
cl %INIT% expdump.c getopt.c mnemonics.c disassembler.c %OPTIONS%
echo Building emulator...
SET LIBS= /NXCOMPAT /DYNAMICBASE "SDL.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X64 /OPT:REF /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1 /NODEFAULTLIB:msvcrt.lib

View file

@ -3,6 +3,13 @@
#include <string.h>
#include <stdlib.h>
#if defined(_MSC_VER)
#include <intrin.h>
#define popcnt __popcnt
#else
#define popcnt __builtin_popcount
#endif
struct disassembler_options disasmOptions =
{
false,
@ -62,7 +69,7 @@ void disassemble(instruction_t *list, uint32_t count, uint32_t base, FILE *f)
if(mnemonics[j].instr.command != instr.command)
continue;
int thatValue = instructionValue(&mnemonics[j].instr);
int dist = __builtin_popcount(thisValue ^ thatValue);
int dist = popcnt(thisValue ^ thatValue);
// if (memcmp(&instr, &mnemonics[j].instr, sizeof(instruction_t) - sizeof(uint32_t)) == 0) {
if(dist < maxDistance) {
maxDistance = dist;

View file

@ -4,16 +4,18 @@
#include "exp.h"
#include <stdbool.h>
#include <getopt.h>
#if defined(_MSC_VER)
#include <SDL.h>
#include "getopt.h"
#undef main
#else
#include <SDL/SDL.h>
#include <getopt.h>
#endif
bool running = true;
bool instaquit = false;
bool debugMode = false;
bool visualMode = false;
@ -84,6 +86,7 @@ void update_input(SDL_Event *ev)
switch (ev->type)
{
case SDL_QUIT:
instaquit = true;
running = false;
break;
case SDL_KEYDOWN:
@ -203,6 +206,9 @@ void run_visual_mode()
SDL_Flip(screen);
}
if(instaquit)
return;
SDL_WM_SetCaption("DasOS Virtual Platform - STOPPED", NULL);
running = true;