From 333e9377ff54696ed2e7f81017fdf71b9ca10c37 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 20 Apr 2023 02:24:03 +0200 Subject: [PATCH] Some minor CPU bugfixes - one for 808x and one for the new dynarec. --- src/cpu/808x.c | 6 +++--- src/cpu/cpu.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cpu/808x.c b/src/cpu/808x.c index b2859153a..1a842dd9c 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -426,13 +426,13 @@ pfq_write(void) free in the queue. */ tempw = readmemwf(pfq_ip); *(uint16_t *) &(pfq[pfq_pos]) = tempw; - pfq_ip += 2; + pfq_ip = (pfq_ip + 2) & 0xffff; pfq_pos += 2; } else if (!is8086 && (pfq_pos < pfq_size)) { /* The 8088 fetches 1 byte at a time, and only if there's at least 1 byte free in the queue. */ pfq[pfq_pos] = readmembf(pfq_ip); - pfq_ip++; + pfq_ip = (pfq_ip + 1) & 0xffff; pfq_pos++; } } @@ -2248,7 +2248,7 @@ execx86(int cycs) default: opcode = orig_opcode; - cpu_state.pc--; + cpu_state.pc = (cpu_state.pc - 1) & 0xffff; break; } } else diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 229fcb9bb..93dae98d1 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -416,7 +416,11 @@ typedef struct { #define CPU_STATUS_PMODE (1 << 2) #define CPU_STATUS_V86 (1 << 3) #define CPU_STATUS_SMM (1 << 4) +#ifdef USE_NEW_DYNAREC +#define CPU_STATUS_FLAGS 0xff +#else #define CPU_STATUS_FLAGS 0xffff +#endif /*If the cpu_state.flags below are set in cpu_cur_status, they must be set in block->status. Otherwise they are ignored*/