Skip to content

Commit

Permalink
Fix 6280 io buffer init value
Browse files Browse the repository at this point in the history
  • Loading branch information
drhelius committed Sep 10, 2024
1 parent 35ae273 commit 39050eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/huc6270_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ inline u8 HuC6270::ReadRegister(u32 address)
{
if (m_address_register != HUC6270_REG_VRR)
{
Debug("HuC6270 invalid data register (LSB) read: %02X", m_address_register);
Debug("[PC=%04X] HuC6270 invalid data register (LSB) read: %02X", m_huc6280->GetState()->PC->GetValue(), m_address_register);
}
return m_read_buffer & 0xFF;
}
Expand All @@ -105,14 +105,14 @@ inline u8 HuC6270::ReadRegister(u32 address)
}
else
{
Debug("HuC6270 invalid data register (MSB) read: %02X", m_address_register);
Debug("[PC=%04X] HuC6270 invalid data register (MSB) read: %02X", m_huc6280->GetState()->PC->GetValue(), m_address_register);
}

return ret;
}
default:
{
Debug("HuC6270 invalid register read at %06X, reg=%d", address, address & 0x03);
Debug("[PC=%04X] HuC6270 invalid register read at %06X, reg=%d", m_huc6280->GetState()->PC->GetValue(), address, address & 0x03);
return 0x00;
}
}
Expand All @@ -139,7 +139,7 @@ inline void HuC6270::WriteRegister(u32 address, u8 value)

if (m_address_register > 0x13)
{
Debug("HuC6270 INVALID write to data register (%s) %02X: %04X", msb ? "MSB" : "LSB", value, m_address_register);
Debug("[PC=%04X] HuC6270 INVALID write to data register (%s) %02X: %04X", m_huc6280->GetState()->PC->GetValue(), msb ? "MSB" : "LSB", value, m_address_register);
return;
}

Expand All @@ -166,7 +166,7 @@ inline void HuC6270::WriteRegister(u32 address, u8 value)
{
if (m_register[HUC6270_REG_MAWR] >= 0x8000)
{
Debug("HuC6270 ignoring write VWR out of bounds (%s) %04X: %02X", msb ? "MSB" : "LSB", m_register[HUC6270_REG_MAWR], value);
Debug("[PC=%04X] HuC6270 ignoring write VWR out of bounds (%s) %04X: %02X", m_huc6280->GetState()->PC->GetValue(), msb ? "MSB" : "LSB", m_register[HUC6270_REG_MAWR], value);
}
else
{
Expand Down Expand Up @@ -199,7 +199,7 @@ inline void HuC6270::WriteRegister(u32 address, u8 value)
{
if (m_register[HUC6270_REG_DESR] >= 0x8000)
{
Debug("HuC6270 ignoring write VRAM-DMA out of bounds: %04X", m_register[HUC6270_REG_DESR], value);
Debug("[PC=%04X] HuC6270 ignoring write VRAM-DMA out of bounds: %04X", m_huc6280->GetState()->PC->GetValue(), m_register[HUC6270_REG_DESR], value);
}
else
{
Expand Down Expand Up @@ -227,7 +227,7 @@ inline void HuC6270::WriteRegister(u32 address, u8 value)
break;
}
default:
Debug("HuC6270 invalid write at %06X, value=%02X", address, value);
Debug("[PC=%04X] HuC6270 invalid write at %06X, value=%02X", m_huc6280->GetState()->PC->GetValue(), address, value);
break;
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Memory::Memory(HuC6260* huc6260, HuC6270* huc6270, HuC6280* huc6280, Cartridge*
InitPointer(m_wram);
InitPointer(m_disassembler);
InitPointer(m_test_memory);
m_io_buffer = 0;
}

Memory::~Memory()
Expand Down Expand Up @@ -75,7 +74,7 @@ void Memory::Init()

void Memory::Reset()
{
m_io_buffer = 0;
m_io_buffer = 0xFF;
m_mpr[7] = 0x00;

for (int i = 0; i < 7; i++)
Expand Down

0 comments on commit 39050eb

Please sign in to comment.