diff options
author | 2011-05-31 17:33:14 +0000 | |
---|---|---|
committer | 2011-05-31 17:33:14 +0000 | |
commit | 9cfc7c1ee47b7a39c0f04f3803cb2b0990923dd2 (patch) | |
tree | 1520103bf5e897d1209d407b08237df108b42762 /src/emu/cpu/nec | |
parent | 130b3fcabb9e735d1d61af5579dfc8072cc743fa (diff) |
Fixed POP, POPF, PUSHF, and flags for V20 core [Carl]
Diffstat (limited to 'src/emu/cpu/nec')
-rw-r--r-- | src/emu/cpu/nec/nec.c | 3 | ||||
-rw-r--r-- | src/emu/cpu/nec/necinstr.c | 4 | ||||
-rw-r--r-- | src/emu/cpu/nec/necpriv.h | 5 | ||||
-rw-r--r-- | src/emu/cpu/nec/v25.c | 3 | ||||
-rw-r--r-- | src/emu/cpu/nec/v25priv.h | 3 |
5 files changed, 11 insertions, 7 deletions
diff --git a/src/emu/cpu/nec/nec.c b/src/emu/cpu/nec/nec.c index 026d7850013..2a9dd2cef90 100644 --- a/src/emu/cpu/nec/nec.c +++ b/src/emu/cpu/nec/nec.c @@ -215,6 +215,7 @@ static CPU_RESET( nec ) nec_state->nmi_state = 0; nec_state->irq_state = 0; nec_state->poll_state = 1; + nec_state->noem = 1; // brkem should set to 0 when implemented Sreg(PS) = 0xffff; Sreg(SS) = 0; @@ -586,7 +587,7 @@ static CPU_GET_INFO( nec ) flags & 0x0001 ? 'C':'.'); break; - case CPUINFO_STR_REGISTER + NEC_PC: sprintf(info->s, "PC:%04X", (Sreg(PS)<<4) + nec_state->ip); break; + case CPUINFO_STR_REGISTER + NEC_PC: sprintf(info->s, "PC:%05X", (Sreg(PS)<<4) + nec_state->ip); break; case CPUINFO_STR_REGISTER + NEC_IP: sprintf(info->s, "IP:%04X", nec_state->ip); break; case CPUINFO_STR_REGISTER + NEC_SP: sprintf(info->s, "SP:%04X", Wreg(SP)); break; case CPUINFO_STR_REGISTER + NEC_FLAGS: sprintf(info->s, "F:%04X", CompressFlags()); break; diff --git a/src/emu/cpu/nec/necinstr.c b/src/emu/cpu/nec/necinstr.c index 1fb8ee1d195..3e0f5268490 100644 --- a/src/emu/cpu/nec/necinstr.c +++ b/src/emu/cpu/nec/necinstr.c @@ -357,8 +357,8 @@ OP( 0x98, i_cbw ) { Breg(AH) = (Breg(AL) & 0x80) ? 0xff : 0; CLK(2); } OP( 0x99, i_cwd ) { Wreg(DW) = (Breg(AH) & 0x80) ? 0xffff : 0; CLK(4); } OP( 0x9a, i_call_far ) { UINT32 tmp, tmp2; tmp = FETCHWORD(); tmp2 = FETCHWORD(); PUSH(Sreg(PS)); PUSH(nec_state->ip); nec_state->ip = (WORD)tmp; Sreg(PS) = (WORD)tmp2; CHANGE_PC; CLKW(29,29,13,29,21,9,Wreg(SP)); } OP( 0x9b, i_wait ) { if (!nec_state->poll_state) nec_state->ip--; CLK(5); } -OP( 0x9c, i_pushf ) { UINT16 tmp = CompressFlags(); PUSH( tmp ); CLKS(12,8,3); } -OP( 0x9d, i_popf ) { UINT32 tmp; POP(tmp); ExpandFlags(tmp); CLKS(12,8,5); if (nec_state->TF) nec_trap(nec_state); } +OP( 0x9c, i_pushf ) { UINT16 tmp = CompressFlags(); tmp |= (nec_state->noem << 15); PUSH( tmp ); CLKS(12,8,3); } +OP( 0x9d, i_popf ) { UINT32 tmp; POP(tmp); tmp |= (nec_state->noem << 15); ExpandFlags(tmp); CLKS(12,8,5); if (nec_state->TF) nec_trap(nec_state); } OP( 0x9e, i_sahf ) { UINT32 tmp = (CompressFlags() & 0xff00) | (Breg(AH) & 0xd5); ExpandFlags(tmp); CLKS(3,3,2); } OP( 0x9f, i_lahf ) { Breg(AH) = CompressFlags() & 0xff; CLKS(3,3,2); } diff --git a/src/emu/cpu/nec/necpriv.h b/src/emu/cpu/nec/necpriv.h index 697030974c5..a19279a912e 100644 --- a/src/emu/cpu/nec/necpriv.h +++ b/src/emu/cpu/nec/necpriv.h @@ -60,6 +60,7 @@ struct _nec_state_t direct_read_data *direct; address_space *io; int icount; + int noem; UINT8 prefetch_size; UINT8 prefetch_cycles; @@ -131,7 +132,7 @@ typedef enum { #define PUSH(val) { Wreg(SP)-=2; write_mem_word((((Sreg(SS)<<4)+Wreg(SP))),val); } -#define POP(var) { var = read_mem_word((((Sreg(SS)<<4)+Wreg(SP)))); Wreg(SP)+=2; } +#define POP(var) { Wreg(SP)+=2; var = read_mem_word((((Sreg(SS)<<4)+Wreg(SP)-2))); } #define GetModRM UINT32 ModRM=FETCH() @@ -156,7 +157,7 @@ typedef enum { /************************************************************************/ #define CompressFlags() (WORD)(int(CF) | 0x02 | (int(PF) << 2) | (int(AF) << 4) | (int(ZF) << 6) \ | (int(SF) << 7) | (nec_state->TF << 8) | (nec_state->IF << 9) \ - | (nec_state->DF << 10) | (int(OF) << 11) | (nec_state->MF << 15)) + | (nec_state->DF << 10) | (int(OF) << 11) | 0x7000 | (nec_state->MF << 15)) #define ExpandFlags(f) \ { \ diff --git a/src/emu/cpu/nec/v25.c b/src/emu/cpu/nec/v25.c index 1447575c5ad..a73e4325faa 100644 --- a/src/emu/cpu/nec/v25.c +++ b/src/emu/cpu/nec/v25.c @@ -181,6 +181,7 @@ static CPU_RESET( v25 ) nec_state->intp_state[0] = 0; nec_state->intp_state[1] = 0; nec_state->intp_state[2] = 0; + nec_state->noem = 1; nec_state->TM0 = nec_state->MD0 = nec_state->TM1 = nec_state->MD1 = 0; nec_state->TMC0 = nec_state->TMC1 = 0; @@ -694,7 +695,7 @@ static CPU_GET_INFO( v25v35 ) flags & 0x0001 ? 'C':'.'); break; - case CPUINFO_STR_REGISTER + NEC_PC: sprintf(info->s, "PC:%04X", (Sreg(PS)<<4) + nec_state->ip); break; + case CPUINFO_STR_REGISTER + NEC_PC: sprintf(info->s, "PC:%05X", (Sreg(PS)<<4) + nec_state->ip); break; case CPUINFO_STR_REGISTER + NEC_IP: sprintf(info->s, "IP:%04X", nec_state->ip); break; case CPUINFO_STR_REGISTER + NEC_SP: sprintf(info->s, "SP:%04X", Wreg(SP)); break; case CPUINFO_STR_REGISTER + NEC_FLAGS: sprintf(info->s, "F:%04X", CompressFlags()); break; diff --git a/src/emu/cpu/nec/v25priv.h b/src/emu/cpu/nec/v25priv.h index df71b50c10e..a94731d8979 100644 --- a/src/emu/cpu/nec/v25priv.h +++ b/src/emu/cpu/nec/v25priv.h @@ -108,6 +108,7 @@ struct _v25_state_t direct_read_data *direct; address_space *io; int icount; + int noem; const nec_config *config; @@ -211,7 +212,7 @@ void v25_write_word(v25_state_t *nec_state, unsigned a, UINT16 d); #define PUSH(val) { Wreg(SP)-=2; write_mem_word((((Sreg(SS)<<4)+Wreg(SP))),val); } -#define POP(var) { var = read_mem_word((((Sreg(SS)<<4)+Wreg(SP)))); Wreg(SP)+=2; } +#define POP(var) { Wreg(SP)+=2; var = read_mem_word((((Sreg(SS)<<4)+Wreg(SP)-2))); } #define GetModRM UINT32 ModRM=FETCH() |