Perform NULL segment checks upfront in opcode handlers, rather than on every memory access.
This removes the need to pass the segment to readmem*l()/writemem*l().
This commit is contained in:
parent
648aa0e3e8
commit
0f0a1c3223
31 changed files with 976 additions and 325 deletions
|
|
@ -104,6 +104,8 @@ static int opFF_w_a16(uint32_t fetchdat)
|
|||
switch (rmdat & 0x38)
|
||||
{
|
||||
case 0x00: /*INC w*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
seteaw(temp + 1); if (cpu_state.abrt) return 1;
|
||||
setadd16nc(temp, 1);
|
||||
|
|
@ -111,6 +113,8 @@ static int opFF_w_a16(uint32_t fetchdat)
|
|||
PREFETCH_RUN((cpu_mod == 3) ? timing_rr : timing_mm, 2, rmdat, (cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1,0, 0);
|
||||
break;
|
||||
case 0x08: /*DEC w*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
seteaw(temp - 1); if (cpu_state.abrt) return 1;
|
||||
setsub16nc(temp, 1);
|
||||
|
|
@ -118,6 +122,8 @@ static int opFF_w_a16(uint32_t fetchdat)
|
|||
PREFETCH_RUN((cpu_mod == 3) ? timing_rr : timing_mm, 2, rmdat, (cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1,0, 0);
|
||||
break;
|
||||
case 0x10: /*CALL*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = geteaw(); if (cpu_state.abrt) return 1;
|
||||
PUSH_W(cpu_state.pc);
|
||||
cpu_state.pc = new_pc;
|
||||
|
|
@ -128,6 +134,8 @@ static int opFF_w_a16(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x18: /*CALL far*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = readmemw(easeg, cpu_state.eaaddr);
|
||||
new_cs = readmemw(easeg, (cpu_state.eaaddr + 2)); if (cpu_state.abrt) return 1;
|
||||
|
||||
|
|
@ -137,6 +145,8 @@ static int opFF_w_a16(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x20: /*JMP*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = geteaw(); if (cpu_state.abrt) return 1;
|
||||
cpu_state.pc = new_pc;
|
||||
CPU_BLOCK_END();
|
||||
|
|
@ -146,6 +156,8 @@ static int opFF_w_a16(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x28: /*JMP far*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
oxpc = cpu_state.pc;
|
||||
new_pc = readmemw(easeg, cpu_state.eaaddr);
|
||||
new_cs = readmemw(easeg, cpu_state.eaaddr + 2); if (cpu_state.abrt) return 1;
|
||||
|
|
@ -156,6 +168,8 @@ static int opFF_w_a16(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x30: /*PUSH w*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
PUSH_W(temp);
|
||||
CLOCK_CYCLES((cpu_mod == 3) ? 2 : 5);
|
||||
|
|
@ -181,6 +195,8 @@ static int opFF_w_a32(uint32_t fetchdat)
|
|||
switch (rmdat & 0x38)
|
||||
{
|
||||
case 0x00: /*INC w*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
seteaw(temp + 1); if (cpu_state.abrt) return 1;
|
||||
setadd16nc(temp, 1);
|
||||
|
|
@ -188,6 +204,8 @@ static int opFF_w_a32(uint32_t fetchdat)
|
|||
PREFETCH_RUN((cpu_mod == 3) ? timing_rr : timing_mm, 2, rmdat, (cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1,0, 1);
|
||||
break;
|
||||
case 0x08: /*DEC w*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
seteaw(temp - 1); if (cpu_state.abrt) return 1;
|
||||
setsub16nc(temp, 1);
|
||||
|
|
@ -195,6 +213,8 @@ static int opFF_w_a32(uint32_t fetchdat)
|
|||
PREFETCH_RUN((cpu_mod == 3) ? timing_rr : timing_mm, 2, rmdat, (cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1,0, 1);
|
||||
break;
|
||||
case 0x10: /*CALL*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = geteaw(); if (cpu_state.abrt) return 1;
|
||||
PUSH_W(cpu_state.pc);
|
||||
cpu_state.pc = new_pc;
|
||||
|
|
@ -205,6 +225,8 @@ static int opFF_w_a32(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x18: /*CALL far*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = readmemw(easeg, cpu_state.eaaddr);
|
||||
new_cs = readmemw(easeg, (cpu_state.eaaddr + 2)); if (cpu_state.abrt) return 1;
|
||||
|
||||
|
|
@ -214,6 +236,8 @@ static int opFF_w_a32(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x20: /*JMP*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = geteaw(); if (cpu_state.abrt) return 1;
|
||||
cpu_state.pc = new_pc;
|
||||
CPU_BLOCK_END();
|
||||
|
|
@ -223,6 +247,8 @@ static int opFF_w_a32(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x28: /*JMP far*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
oxpc = cpu_state.pc;
|
||||
new_pc = readmemw(easeg, cpu_state.eaaddr);
|
||||
new_cs = readmemw(easeg, cpu_state.eaaddr + 2); if (cpu_state.abrt) return 1;
|
||||
|
|
@ -233,6 +259,8 @@ static int opFF_w_a32(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x30: /*PUSH w*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
PUSH_W(temp);
|
||||
CLOCK_CYCLES((cpu_mod == 3) ? 2 : 5);
|
||||
|
|
@ -259,6 +287,8 @@ static int opFF_l_a16(uint32_t fetchdat)
|
|||
switch (rmdat & 0x38)
|
||||
{
|
||||
case 0x00: /*INC l*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
seteal(temp + 1); if (cpu_state.abrt) return 1;
|
||||
setadd32nc(temp, 1);
|
||||
|
|
@ -266,6 +296,8 @@ static int opFF_l_a16(uint32_t fetchdat)
|
|||
PREFETCH_RUN((cpu_mod == 3) ? timing_rr : timing_mm, 2, rmdat, 0,(cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1, 0);
|
||||
break;
|
||||
case 0x08: /*DEC l*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
seteal(temp - 1); if (cpu_state.abrt) return 1;
|
||||
setsub32nc(temp, 1);
|
||||
|
|
@ -273,6 +305,8 @@ static int opFF_l_a16(uint32_t fetchdat)
|
|||
PREFETCH_RUN((cpu_mod == 3) ? timing_rr : timing_mm, 2, rmdat, 0,(cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1, 0);
|
||||
break;
|
||||
case 0x10: /*CALL*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = geteal(); if (cpu_state.abrt) return 1;
|
||||
PUSH_L(cpu_state.pc);
|
||||
cpu_state.pc = new_pc;
|
||||
|
|
@ -283,6 +317,8 @@ static int opFF_l_a16(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x18: /*CALL far*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = readmeml(easeg, cpu_state.eaaddr);
|
||||
new_cs = readmemw(easeg, (cpu_state.eaaddr + 4)); if (cpu_state.abrt) return 1;
|
||||
|
||||
|
|
@ -292,6 +328,8 @@ static int opFF_l_a16(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x20: /*JMP*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = geteal(); if (cpu_state.abrt) return 1;
|
||||
cpu_state.pc = new_pc;
|
||||
CPU_BLOCK_END();
|
||||
|
|
@ -301,6 +339,8 @@ static int opFF_l_a16(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x28: /*JMP far*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
oxpc = cpu_state.pc;
|
||||
new_pc = readmeml(easeg, cpu_state.eaaddr);
|
||||
new_cs = readmemw(easeg, cpu_state.eaaddr + 4); if (cpu_state.abrt) return 1;
|
||||
|
|
@ -311,6 +351,8 @@ static int opFF_l_a16(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x30: /*PUSH l*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
PUSH_L(temp);
|
||||
CLOCK_CYCLES((cpu_mod == 3) ? 2 : 5);
|
||||
|
|
@ -336,6 +378,8 @@ static int opFF_l_a32(uint32_t fetchdat)
|
|||
switch (rmdat & 0x38)
|
||||
{
|
||||
case 0x00: /*INC l*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
seteal(temp + 1); if (cpu_state.abrt) return 1;
|
||||
setadd32nc(temp, 1);
|
||||
|
|
@ -343,6 +387,8 @@ static int opFF_l_a32(uint32_t fetchdat)
|
|||
PREFETCH_RUN((cpu_mod == 3) ? timing_rr : timing_mm, 2, rmdat, 0,(cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1, 1);
|
||||
break;
|
||||
case 0x08: /*DEC l*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
seteal(temp - 1); if (cpu_state.abrt) return 1;
|
||||
setsub32nc(temp, 1);
|
||||
|
|
@ -350,6 +396,8 @@ static int opFF_l_a32(uint32_t fetchdat)
|
|||
PREFETCH_RUN((cpu_mod == 3) ? timing_rr : timing_mm, 2, rmdat, 0,(cpu_mod == 3) ? 0:1,0,(cpu_mod == 3) ? 0:1, 1);
|
||||
break;
|
||||
case 0x10: /*CALL*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = geteal(); if (cpu_state.abrt) return 1;
|
||||
PUSH_L(cpu_state.pc); if (cpu_state.abrt) return 1;
|
||||
cpu_state.pc = new_pc;
|
||||
|
|
@ -360,6 +408,8 @@ static int opFF_l_a32(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x18: /*CALL far*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = readmeml(easeg, cpu_state.eaaddr);
|
||||
new_cs = readmemw(easeg, (cpu_state.eaaddr + 4)); if (cpu_state.abrt) return 1;
|
||||
|
||||
|
|
@ -369,6 +419,8 @@ static int opFF_l_a32(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x20: /*JMP*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
new_pc = geteal(); if (cpu_state.abrt) return 1;
|
||||
cpu_state.pc = new_pc;
|
||||
CPU_BLOCK_END();
|
||||
|
|
@ -378,6 +430,8 @@ static int opFF_l_a32(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x28: /*JMP far*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
oxpc = cpu_state.pc;
|
||||
new_pc = readmeml(easeg, cpu_state.eaaddr);
|
||||
new_cs = readmemw(easeg, cpu_state.eaaddr + 4); if (cpu_state.abrt) return 1;
|
||||
|
|
@ -388,6 +442,8 @@ static int opFF_l_a32(uint32_t fetchdat)
|
|||
PREFETCH_FLUSH();
|
||||
break;
|
||||
case 0x30: /*PUSH l*/
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
PUSH_L(temp);
|
||||
PREFETCH_RUN((cpu_mod == 3) ? 2 : 5, 2, rmdat, 0,(cpu_mod == 3) ? 0:1,0,1, 1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue