diff --git a/src/emu/cpu/z8000/z8000.c b/src/emu/cpu/z8000/z8000.c index 16189741415..9ec8fd70dd3 100644 --- a/src/emu/cpu/z8000/z8000.c +++ b/src/emu/cpu/z8000/z8000.c @@ -68,8 +68,8 @@ union _z8000_reg_file struct _z8000_state { UINT16 op[4]; /* opcodes/data of current instruction */ - UINT16 ppc; /* previous program counter */ - UINT16 pc; /* program counter */ + UINT32 ppc; /* previous program counter */ + UINT32 pc; /* program counter */ UINT16 psap; /* program status pointer */ UINT16 fcw; /* flags and control word */ UINT16 refresh; /* refresh timer/counter */ @@ -114,18 +114,18 @@ INLINE UINT16 RDOP(z8000_state *cpustate) return res; } -INLINE UINT8 RDMEM_B(z8000_state *cpustate, UINT16 addr) +INLINE UINT8 RDMEM_B(z8000_state *cpustate, UINT32 addr) { return memory_read_byte_16be(cpustate->program, addr); } -INLINE UINT16 RDMEM_W(z8000_state *cpustate, UINT16 addr) +INLINE UINT16 RDMEM_W(z8000_state *cpustate, UINT32 addr) { addr &= ~1; return memory_read_word_16be(cpustate->program, addr); } -INLINE UINT32 RDMEM_L(z8000_state *cpustate, UINT16 addr) +INLINE UINT32 RDMEM_L(z8000_state *cpustate, UINT32 addr) { UINT32 result; addr &= ~1; @@ -400,8 +400,7 @@ static CPU_RESET( z8001 ) cpustate->fcw = RDMEM_W(cpustate, 2); /* get reset cpustate->fcw */ if(cpustate->fcw & F_SEG) { - //cpustate->seg_pc = RDMEM_W(cpustate, 4); - cpustate->pc = RDMEM_W(cpustate, 6); + cpustate->pc = ((RDMEM_W(cpustate, 4) & 0x0700) << 8) | (RDMEM_W(cpustate, 6) & 0xffff); /* get reset cpustate->pc */ } else { @@ -665,7 +664,7 @@ CPU_GET_INFO( z8002 ) cpustate->fcw & 0x0001 ? '?':'.'); break; - case CPUINFO_STR_REGISTER + Z8000_PC: sprintf(info->s, "pc :%04X", cpustate->pc); break; + case CPUINFO_STR_REGISTER + Z8000_PC: sprintf(info->s, "pc :%08X", cpustate->pc); break; case CPUINFO_STR_REGISTER + Z8000_NSP: sprintf(info->s, "SP :%04X", cpustate->nsp); break; case CPUINFO_STR_REGISTER + Z8000_FCW: sprintf(info->s, "fcw:%04X", cpustate->fcw); break; case CPUINFO_STR_REGISTER + Z8000_PSAP: sprintf(info->s, "nsp:%04X", cpustate->psap); break; diff --git a/src/emu/cpu/z8000/z8000ops.c b/src/emu/cpu/z8000/z8000ops.c index f17e8f1465d..7a6d5cf7258 100644 --- a/src/emu/cpu/z8000/z8000ops.c +++ b/src/emu/cpu/z8000/z8000ops.c @@ -1865,6 +1865,17 @@ static void Z20_ssN0_dddd(z8000_state *cpustate) cpustate->RB(dst) = RDMEM_B(cpustate, cpustate->RW(src)); } +static void Z20_ssN0_dddd_seg(z8000_state *cpustate) +{ + UINT32 addr; + GET_DST(OP0,NIB3); + GET_SRC(OP0,NIB2); + addr = (cpustate->RW(src) & 0x0007) << 16; + addr|= cpustate->RW(src+1) & 0xffff; + cpustate->RB(dst) = RDMEM_B(cpustate, addr); + //cycles? +} + /****************************************** ld rd,imm16 flags: ------ diff --git a/src/emu/cpu/z8000/z8000tbl.c b/src/emu/cpu/z8000/z8000tbl.c index 3cc09c88b8b..e4fa5064356 100644 --- a/src/emu/cpu/z8000/z8000tbl.c +++ b/src/emu/cpu/z8000/z8000tbl.c @@ -610,7 +610,7 @@ static const Z8000_init seg_table[] = { {0x1d10,0x1dff, 1,1, 11,Z1D_ddN0_ssss, "ldl @%rw2,%rl3", 0}, {0x1e10,0x1eff, 1,1, 10,Z1E_ddN0_cccc, "jp %c3,@%rl2", 0}, {0x1f10,0x1ff0,16,1, 10,Z1F_ddN0_0000, "call %rw2", DASMFLAG_STEP_OVER}, -{0x2010,0x20ff, 1,1, 7,Z20_ssN0_dddd, "ldb %rb3,@%rw2", 0}, +{0x2010,0x20ff, 1,1, 7,Z20_ssN0_dddd_seg, "ldb %rb3,@%rw2", 0}, {0x2100,0x210f, 1,2, 7,Z21_0000_dddd_imm16, "ld %rw3,%#w1", 0}, {0x2110,0x21ff, 1,1, 7,Z21_ssN0_dddd, "ld %rw3,@%rw2", 0}, {0x2200,0x220f, 1,2, 10,Z22_0000_ssss_0000_dddd_0000_0000, "resb %rb5,%rw3", 0},