Disk Write fixed, Recompiler support tentative
Unfortunately there's an opcode that Recompiler doesn't recognize. However once it's implemented, there's no reason it shouldn't work. For Disk Writing, so far it works, it seems to not have any trouble so far.
This commit is contained in:
parent
b31d18d8c4
commit
82779033d3
|
@ -24,6 +24,9 @@ uint32_t dd_start_block, dd_current;
|
|||
|
||||
void DiskCommand()
|
||||
{
|
||||
if (g_Disk != NULL)
|
||||
g_Reg->ASIC_STATUS |= DD_STATUS_DISK_PRES;
|
||||
|
||||
//ASIC_CMD_STATUS - Commands
|
||||
uint32_t cmd = g_Reg->ASIC_CMD;
|
||||
|
||||
|
@ -161,12 +164,7 @@ void DiskBMUpdate()
|
|||
if (dd_write)
|
||||
{
|
||||
//Write Data
|
||||
if (dd_current == 0)
|
||||
{
|
||||
dd_current += 1;
|
||||
g_Reg->ASIC_STATUS |= DD_STATUS_DATA_RQ;
|
||||
}
|
||||
else if (dd_current < SECTORS_PER_BLOCK)
|
||||
if (dd_current < SECTORS_PER_BLOCK)
|
||||
{
|
||||
DiskBMWrite();
|
||||
dd_current += 1;
|
||||
|
@ -176,16 +174,15 @@ void DiskBMUpdate()
|
|||
{
|
||||
if (g_Reg->ASIC_BM_STATUS & DD_BM_STATUS_BLOCK)
|
||||
{
|
||||
dd_start_block = 1 - dd_start_block;
|
||||
dd_current = 0;
|
||||
DiskBMWrite();
|
||||
dd_current += 1;
|
||||
dd_start_block = 1 - dd_start_block;
|
||||
dd_current = 1;
|
||||
g_Reg->ASIC_BM_STATUS &= ~DD_BM_STATUS_BLOCK;
|
||||
g_Reg->ASIC_STATUS |= DD_STATUS_DATA_RQ;
|
||||
}
|
||||
else
|
||||
{
|
||||
DiskBMWrite();
|
||||
dd_current += 1;
|
||||
g_Reg->ASIC_BM_STATUS &= ~DD_BM_STATUS_RUNNING;
|
||||
}
|
||||
|
@ -253,8 +250,8 @@ void DiskBMWrite()
|
|||
uint32_t sector = 0;
|
||||
sector += dd_track_offset;
|
||||
sector += dd_start_block * SECTORS_PER_BLOCK * ddZoneSecSize[dd_zone];
|
||||
sector += (dd_current - 1) * (((g_Reg->ASIC_HOST_SECBYTE & 0x00FF0000) >> 16) + 1);
|
||||
WriteTrace(TraceN64System, TraceDebug, "WRITE Block %d Sector %02X - %08X", ((g_Reg->ASIC_CUR_TK & 0x0FFF0000) >> 15) | dd_start_block, dd_current - 1, sector);
|
||||
sector += (dd_current) * (((g_Reg->ASIC_HOST_SECBYTE & 0x00FF0000) >> 16) + 1);
|
||||
WriteTrace(TraceN64System, TraceDebug, "WRITE Block %d Sector %02X - %08X", ((g_Reg->ASIC_CUR_TK & 0x0FFF0000) >> 15) | dd_start_block, dd_current, sector);
|
||||
g_Disk->SetDiskAddressBuffer(sector);
|
||||
return;
|
||||
}
|
||||
|
@ -307,4 +304,20 @@ void DiskSetOffset()
|
|||
}
|
||||
|
||||
dd_track_offset = ddStartOffset[dd_zone] + tr_off * ddZoneSecSize[dd_zone] * SECTORS_PER_BLOCK * BLOCKS_PER_TRACK;
|
||||
}
|
||||
|
||||
void DiskDMACheck(void)
|
||||
{
|
||||
if (g_Reg->PI_CART_ADDR_REG == 0x05000000)
|
||||
{
|
||||
g_Reg->ASIC_STATUS &= ~(DD_STATUS_BM_INT | DD_STATUS_BM_ERR | DD_STATUS_C2_XFER);
|
||||
g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP3;
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
else if (g_Reg->PI_CART_ADDR_REG == 0x05000400)
|
||||
{
|
||||
g_Reg->ASIC_STATUS &= ~(DD_STATUS_BM_INT | DD_STATUS_BM_ERR | DD_STATUS_DATA_RQ);
|
||||
g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP3;
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ void DiskBMUpdate(void);
|
|||
void DiskBMRead(void);
|
||||
void DiskBMWrite(void);
|
||||
void DiskSetOffset(void);
|
||||
void DiskDMACheck(void);
|
||||
|
||||
extern bool dd_write;
|
||||
extern bool dd_reset_hold;
|
||||
|
|
|
@ -959,7 +959,12 @@ void CMipsMemoryVM::Compile_LW(x86Reg Reg, uint32_t VAddr)
|
|||
{
|
||||
case 0x05000500: MoveVariableToX86reg(&g_Reg->ASIC_DATA, "ASIC_DATA", Reg); break;
|
||||
case 0x05000504: MoveVariableToX86reg(&g_Reg->ASIC_MISC_REG, "ASIC_MISC_REG", Reg); break;
|
||||
case 0x05000508: MoveVariableToX86reg(&g_Reg->ASIC_STATUS, "ASIC_STATUS", Reg); break;
|
||||
case 0x05000508:
|
||||
MoveVariableToX86reg(&g_Reg->ASIC_STATUS, "ASIC_STATUS", Reg);
|
||||
BeforeCallDirect(m_RegWorkingSet);
|
||||
Call_Direct(AddressOf(&DiskGapSectorCheck), "DiskGapSectorCheck");
|
||||
AfterCallDirect(m_RegWorkingSet);
|
||||
break;
|
||||
case 0x0500050C: MoveVariableToX86reg(&g_Reg->ASIC_CUR_TK, "ASIC_CUR_TK", Reg); break;
|
||||
case 0x05000510: MoveVariableToX86reg(&g_Reg->ASIC_BM_STATUS, "ASIC_BM_STATUS", Reg); break;
|
||||
case 0x05000514: MoveVariableToX86reg(&g_Reg->ASIC_ERR_SECTOR, "ASIC_ERR_SECTOR", Reg); break;
|
||||
|
@ -1922,7 +1927,15 @@ void CMipsMemoryVM::Compile_SW_Register(x86Reg Reg, uint32_t VAddr)
|
|||
switch (PAddr)
|
||||
{
|
||||
case 0x04600000: MoveX86regToVariable(Reg, &g_Reg->PI_DRAM_ADDR_REG, "PI_DRAM_ADDR_REG"); break;
|
||||
case 0x04600004: MoveX86regToVariable(Reg, &g_Reg->PI_CART_ADDR_REG, "PI_CART_ADDR_REG"); break;
|
||||
case 0x04600004:
|
||||
MoveX86regToVariable(Reg, &g_Reg->PI_CART_ADDR_REG, "PI_CART_ADDR_REG");
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
{
|
||||
BeforeCallDirect(m_RegWorkingSet);
|
||||
Call_Direct(AddressOf(&DiskDMACheck), "DiskDMACheck");
|
||||
AfterCallDirect(m_RegWorkingSet);
|
||||
}
|
||||
break;
|
||||
case 0x04600008:
|
||||
MoveX86regToVariable(Reg, &g_Reg->PI_RD_LEN_REG, "PI_RD_LEN_REG");
|
||||
BeforeCallDirect(m_RegWorkingSet);
|
||||
|
@ -4828,8 +4841,6 @@ void CMipsMemoryVM::Load32CartridgeDomain2Address1(void)
|
|||
case 0x05000500: m_MemLookupValue.UW[0] = g_Reg->ASIC_DATA; break;
|
||||
case 0x05000504: m_MemLookupValue.UW[0] = g_Reg->ASIC_MISC_REG; break;
|
||||
case 0x05000508:
|
||||
if (g_Disk != NULL)
|
||||
g_Reg->ASIC_STATUS |= DD_STATUS_DISK_PRES;
|
||||
m_MemLookupValue.UW[0] = g_Reg->ASIC_STATUS;
|
||||
DiskGapSectorCheck();
|
||||
break;
|
||||
|
@ -5414,18 +5425,8 @@ void CMipsMemoryVM::Write32PeripheralInterface(void)
|
|||
case 0x04600000: g_Reg->PI_DRAM_ADDR_REG = m_MemLookupValue.UW[0]; break;
|
||||
case 0x04600004:
|
||||
g_Reg->PI_CART_ADDR_REG = m_MemLookupValue.UW[0];
|
||||
if (g_Reg->PI_CART_ADDR_REG == 0x05000000)
|
||||
{
|
||||
g_Reg->ASIC_STATUS &= ~(DD_STATUS_BM_INT | DD_STATUS_BM_ERR | DD_STATUS_C2_XFER);
|
||||
g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP3;
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
else if (g_Reg->PI_CART_ADDR_REG == 0x05000400)
|
||||
{
|
||||
g_Reg->ASIC_STATUS &= ~(DD_STATUS_BM_INT | DD_STATUS_BM_ERR | DD_STATUS_DATA_RQ);
|
||||
g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP3;
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
if (g_Settings->LoadBool(Setting_EnableDisk))
|
||||
DiskDMACheck();
|
||||
break;
|
||||
case 0x04600008:
|
||||
g_Reg->PI_RD_LEN_REG = m_MemLookupValue.UW[0];
|
||||
|
|
Loading…
Reference in New Issue