N64, RSP, drc : Wrap PC to 12 bits in a few more places.

This commit is contained in:
Happy 2017-04-25 23:36:30 -06:00
parent 66ac95eb05
commit 3fc3f8254e
2 changed files with 4 additions and 4 deletions

View File

@ -671,7 +671,7 @@ void rsp_device::generate_checksum_block(drcuml_block *block, compiler_state *co
if (seqhead->delay.first() != nullptr && seqhead->physpc != seqhead->delay.first()->physpc) if (seqhead->delay.first() != nullptr && seqhead->physpc != seqhead->delay.first()->physpc)
{ {
base = m_direct->read_ptr(seqhead->delay.first()->physpc | 0x1000); base = m_direct->read_ptr((seqhead->delay.first()->physpc & 0x00000fff) | 0x1000);
assert(base != nullptr); assert(base != nullptr);
UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1 UML_ADD(block, I0, I0, I1); // add i0,i0,i1
@ -702,7 +702,7 @@ void rsp_device::generate_checksum_block(drcuml_block *block, compiler_state *co
if (curdesc->delay.first() != nullptr && (curdesc == seqlast || (curdesc->next() != nullptr && curdesc->next()->physpc != curdesc->delay.first()->physpc))) if (curdesc->delay.first() != nullptr && (curdesc == seqlast || (curdesc->next() != nullptr && curdesc->next()->physpc != curdesc->delay.first()->physpc)))
{ {
base = m_direct->read_ptr(curdesc->delay.first()->physpc | 0x1000); base = m_direct->read_ptr((curdesc->delay.first()->physpc & 0x00000fff) | 0x1000);
assert(base != nullptr); assert(base != nullptr);
UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1 UML_ADD(block, I0, I0, I1); // add i0,i0,i1
@ -813,7 +813,7 @@ void rsp_device::generate_delay_slot_and_branch(drcuml_block *block, compiler_st
/* set the link if needed -- before the delay slot */ /* set the link if needed -- before the delay slot */
if (linkreg != 0) if (linkreg != 0)
{ {
UML_MOV(block, R32(linkreg), (int32_t)(desc->pc + 8)); // mov <linkreg>,desc->pc + 8 UML_MOV(block, R32(linkreg), (int32_t)((desc->pc + 8) & 0x0000fff)); // mov <linkreg>,desc->pc + 8
} }
/* compile the delay slot using temporary compiler state */ /* compile the delay slot using temporary compiler state */

View File

@ -37,7 +37,7 @@ bool rsp_frontend::describe(opcode_desc &desc, const opcode_desc *prev)
uint32_t op, opswitch; uint32_t op, opswitch;
// fetch the opcode // fetch the opcode
op = desc.opptr.l[0] = m_rsp.m_direct->read_dword(desc.physpc | 0x1000); op = desc.opptr.l[0] = m_rsp.m_direct->read_dword((desc.physpc & 0x00000fff) | 0x1000);
// all instructions are 4 bytes and default to a single cycle each // all instructions are 4 bytes and default to a single cycle each
desc.length = 4; desc.length = 4;