From 36fcf10388bea787f6a5c2a78bbbe889625fb809 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 24 Jul 2017 15:21:17 +0200 Subject: [PATCH] REP instructions now correctly issue a Debug exception after every iteration, fixes NT 3.x on 386 CPU's; Fixed a string bug in the Settings dialog (Joysticks combo box). --- src/CPU/386_dynarec_ops.c | 2 ++ src/CPU/x86_ops_rep.h | 36 ++++++++++++++++++++++++++++++++++++ src/WIN/86Box.rc | 3 ++- src/WIN/win.c | 2 +- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/CPU/386_dynarec_ops.c b/src/CPU/386_dynarec_ops.c index e0e018872..db6958e5a 100644 --- a/src/CPU/386_dynarec_ops.c +++ b/src/CPU/386_dynarec_ops.c @@ -17,6 +17,8 @@ #include "386_common.h" +extern int trap; + extern uint16_t *mod1add[2][8]; extern uint32_t *mod1seg[8]; diff --git a/src/CPU/x86_ops_rep.h b/src/CPU/x86_ops_rep.h index 140f60916..b26b3be3d 100644 --- a/src/CPU/x86_ops_rep.h +++ b/src/CPU/x86_ops_rep.h @@ -167,6 +167,9 @@ static int opREP_MOVSB_ ## size(uint32_t fetchdat) int reads = 0, writes = 0, total_cycles = 0; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ while (CNT_REG > 0) \ { \ uint8_t temp; \ @@ -199,6 +202,9 @@ static int opREP_MOVSW_ ## size(uint32_t fetchdat) int reads = 0, writes = 0, total_cycles = 0; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ while (CNT_REG > 0) \ { \ uint16_t temp; \ @@ -231,6 +237,9 @@ static int opREP_MOVSL_ ## size(uint32_t fetchdat) int reads = 0, writes = 0, total_cycles = 0; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ while (CNT_REG > 0) \ { \ uint32_t temp; \ @@ -265,6 +274,9 @@ static int opREP_STOSB_ ## size(uint32_t fetchdat) int writes = 0, total_cycles = 0; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ while (CNT_REG > 0) \ { \ CHECK_WRITE_REP(&_es, DEST_REG, DEST_REG); \ @@ -292,6 +304,9 @@ static int opREP_STOSW_ ## size(uint32_t fetchdat) int writes = 0, total_cycles = 0; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ while (CNT_REG > 0) \ { \ CHECK_WRITE_REP(&_es, DEST_REG, DEST_REG+1); \ @@ -319,6 +334,9 @@ static int opREP_STOSL_ ## size(uint32_t fetchdat) int writes = 0, total_cycles = 0; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ while (CNT_REG > 0) \ { \ CHECK_WRITE_REP(&_es, DEST_REG, DEST_REG+3); \ @@ -347,6 +365,9 @@ static int opREP_LODSB_ ## size(uint32_t fetchdat) int reads = 0, total_cycles = 0; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ while (CNT_REG > 0) \ { \ AL = readmemb(cpu_state.ea_seg->base, SRC_REG); if (cpu_state.abrt) return 1; \ @@ -373,6 +394,9 @@ static int opREP_LODSW_ ## size(uint32_t fetchdat) int reads = 0, total_cycles = 0; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ while (CNT_REG > 0) \ { \ AX = readmemw(cpu_state.ea_seg->base, SRC_REG); if (cpu_state.abrt) return 1; \ @@ -399,6 +423,9 @@ static int opREP_LODSL_ ## size(uint32_t fetchdat) int reads = 0, total_cycles = 0; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ while (CNT_REG > 0) \ { \ EAX = readmeml(cpu_state.ea_seg->base, SRC_REG); if (cpu_state.abrt) return 1; \ @@ -510,6 +537,9 @@ static int opREP_SCASB_ ## size(uint32_t fetchdat) int reads = 0, total_cycles = 0, tempz; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ tempz = FV; \ while ((CNT_REG > 0) && (FV == tempz)) \ { \ @@ -540,6 +570,9 @@ static int opREP_SCASW_ ## size(uint32_t fetchdat) int reads = 0, total_cycles = 0, tempz; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ tempz = FV; \ while ((CNT_REG > 0) && (FV == tempz)) \ { \ @@ -570,6 +603,9 @@ static int opREP_SCASL_ ## size(uint32_t fetchdat) int reads = 0, total_cycles = 0, tempz; \ int cycles_end = cycles - ((is386 && cpu_use_dynarec) ? 1000 : 100); \ \ + if (trap) \ + cycles_end = cycles+1; \ + \ tempz = FV; \ while ((CNT_REG > 0) && (FV == tempz)) \ { \ diff --git a/src/WIN/86Box.rc b/src/WIN/86Box.rc index 991b8bfe5..ee54378a1 100644 --- a/src/WIN/86Box.rc +++ b/src/WIN/86Box.rc @@ -726,6 +726,7 @@ BEGIN IDS_2072 "Removable devices" IDS_2073 "Unable to create bitmap file: %s" IDS_2074 "Use CTRL+ALT+PAGE DOWN to return to windowed mode" + IDS_2075 "CD-ROM images (*.ISO;*.CUE)\0*.ISO;*.CUE\0All files (*.*)\0*.*\0" IDS_2076 "Host CD/DVD Drive (%c:)" IDS_2077 "Click to capture mouse" IDS_2078 "Press F12-F8 to release mouse" @@ -818,7 +819,7 @@ BEGIN IDS_2148 "CH Flightstick Pro" IDS_2149 "Microsoft SideWinder Pad" IDS_2150 "Thrustmaster Flight Control System" - IDS_2151 "CD-ROM images (*.ISO;*.CUE)\0*.ISO;*.CUE\0All files (*.*)\0*.*\0" + IDS_2151 "Disabled" IDS_2152 "None" IDS_2153 "AT Fixed Disk Adapter" IDS_2154 "Internal IDE" diff --git a/src/WIN/win.c b/src/WIN/win.c index 1de2af41e..66c20625c 100644 --- a/src/WIN/win.c +++ b/src/WIN/win.c @@ -2417,7 +2417,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR break; } - if (!file_dlg_w_st(hwnd, IDS_2151, cdrom_image[id].image_path, 0)) + if (!file_dlg_w_st(hwnd, IDS_2075, cdrom_image[id].image_path, 0)) { cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive; wcscpy(temp_image_path, wopenfilestring);