add Read8 to VI (Action Replay uses it). tune up some vi regs.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3306 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-06-01 14:15:21 +00:00
parent 840715cb69
commit 898bec5894
3 changed files with 36 additions and 58 deletions

View File

@ -207,6 +207,7 @@ void InitHWMemFuncs()
hwWrite16[PE_START+i] = PixelEngine::Write16; hwWrite16[PE_START+i] = PixelEngine::Write16;
hwWrite32[PE_START+i] = PixelEngine::Write32; hwWrite32[PE_START+i] = PixelEngine::Write32;
hwRead8 [VI_START+i] = VideoInterface::Read8;
hwRead16 [VI_START+i] = VideoInterface::Read16; hwRead16 [VI_START+i] = VideoInterface::Read16;
hwRead32 [VI_START+i] = VideoInterface::Read32; hwRead32 [VI_START+i] = VideoInterface::Read32;
hwWrite16[VI_START+i] = VideoInterface::Write16; hwWrite16[VI_START+i] = VideoInterface::Write16;
@ -281,6 +282,7 @@ void InitHWMemFuncsWii()
hwRead32 [PI_START+i] = CPeripheralInterface::Read32; hwRead32 [PI_START+i] = CPeripheralInterface::Read32;
hwWrite32[PI_START+i] = CPeripheralInterface::Write32; hwWrite32[PI_START+i] = CPeripheralInterface::Write32;
hwRead8 [VI_START+i] = VideoInterface::Read8;
hwRead16 [VI_START+i] = VideoInterface::Read16; hwRead16 [VI_START+i] = VideoInterface::Read16;
hwRead32 [VI_START+i] = VideoInterface::Read32; hwRead32 [VI_START+i] = VideoInterface::Read32;
hwWrite16[VI_START+i] = VideoInterface::Write16; hwWrite16[VI_START+i] = VideoInterface::Write16;

View File

@ -130,11 +130,7 @@ union UVIDisplayControlRegister
union UVIHorizontalTiming0 union UVIHorizontalTiming0
{ {
u32 Hex; u32 Hex;
struct struct { u16 Lo, Hi; };
{
u16 Lo;
u16 Hi;
};
struct struct
{ {
unsigned HLW : 9; // Halfline Width (W*16 = Width (720)) unsigned HLW : 9; // Halfline Width (W*16 = Width (720))
@ -149,17 +145,14 @@ union UVIHorizontalTiming0
union UVIHorizontalTiming1 union UVIHorizontalTiming1
{ {
u32 Hex; u32 Hex;
struct struct { u16 Lo, Hi; };
{
u16 Lo;
u16 Hi;
};
struct struct
{ {
unsigned HSY : 7; // Horizontal Sync Width unsigned HSY : 7; // Horizontal Sync Width
unsigned HBE : 10; // Horizontal Sync Start to horizontal blank end unsigned HBE640 : 9; // Horizontal Sync Start to horizontal blank end
unsigned HBS : 10; // Half line to horizontal blanking start unsigned : 1;
unsigned : 5; unsigned HBS640 : 9; // Half line to horizontal blanking start
unsigned : 6;
}; };
}; };
@ -167,11 +160,7 @@ union UVIHorizontalTiming1
union UVIVBlankTimingRegister union UVIVBlankTimingRegister
{ {
u32 Hex; u32 Hex;
struct struct { u16 Lo, Hi; };
{
u16 Lo;
u16 Hi;
};
struct struct
{ {
unsigned PRB : 10; // Pre-blanking in half lines unsigned PRB : 10; // Pre-blanking in half lines
@ -185,11 +174,7 @@ union UVIVBlankTimingRegister
union UVIBurstBlankingRegister union UVIBurstBlankingRegister
{ {
u32 Hex; u32 Hex;
struct struct { u16 Lo, Hi; };
{
u16 Lo;
u16 Hi;
};
struct struct
{ {
unsigned BS0 : 5; // Field x start to burst blanking start in halflines unsigned BS0 : 5; // Field x start to burst blanking start in halflines
@ -202,11 +187,7 @@ union UVIBurstBlankingRegister
union UVIFBInfoRegister union UVIFBInfoRegister
{ {
u32 Hex; u32 Hex;
struct struct { u16 Lo, Hi; };
{
u16 Lo;
u16 Hi;
};
struct struct
{ {
// TODO: mask out lower 9bits/align to 9bits??? // TODO: mask out lower 9bits/align to 9bits???
@ -222,11 +203,7 @@ union UVIFBInfoRegister
union UVIInterruptRegister union UVIInterruptRegister
{ {
u32 Hex; u32 Hex;
struct struct { u16 Lo, Hi; };
{
u16 Lo;
u16 Hi;
};
struct struct
{ {
unsigned HCT : 11; // Horizontal Position unsigned HCT : 11; // Horizontal Position
@ -242,11 +219,7 @@ union UVIInterruptRegister
union UVILatchRegister union UVILatchRegister
{ {
u32 Hex; u32 Hex;
struct struct { u16 Lo, Hi; };
{
u16 Lo;
u16 Hi;
};
struct struct
{ {
unsigned HCT : 11; // Horizontal Count unsigned HCT : 11; // Horizontal Count
@ -285,11 +258,7 @@ union UVIHorizontalScaling
union UVIFilterCoefTable3 union UVIFilterCoefTable3
{ {
u32 Hex; u32 Hex;
struct struct { u16 Lo, Hi; };
{
u16 Lo;
u16 Hi;
};
struct struct
{ {
unsigned Tap0 : 10; unsigned Tap0 : 10;
@ -302,11 +271,7 @@ union UVIFilterCoefTable3
union UVIFilterCoefTable4 union UVIFilterCoefTable4
{ {
u32 Hex; u32 Hex;
struct struct { u16 Lo, Hi; };
{
u16 Lo;
u16 Hi;
};
struct struct
{ {
unsigned Tap0 : 8; unsigned Tap0 : 8;
@ -325,18 +290,13 @@ struct SVIFilterCoefTables
union UVIBorderBlankRegister union UVIBorderBlankRegister
{ {
u32 Hex; u32 Hex;
struct struct { u16 Lo, Hi; };
{
u16 Lo;
u16 Hi;
};
struct struct
{ {
unsigned HBE656 : 10; // Border Horizontal Blank End unsigned HBE656 : 10; // Border Horizontal Blank End
unsigned : 5; unsigned : 11;
unsigned BRDR_EN : 1; // Border Enable
unsigned HBS656 : 10; // Border Horizontal Blank start unsigned HBS656 : 10; // Border Horizontal Blank start
unsigned : 6; unsigned BRDR_EN : 1; // Border Enable
}; };
}; };
@ -364,7 +324,7 @@ static UVIHorizontalScaling m_HorizontalScaling;
static SVIFilterCoefTables m_FilterCoefTables; static SVIFilterCoefTables m_FilterCoefTables;
static u32 m_UnkAARegister = 0;// ??? 0x00FF0000 static u32 m_UnkAARegister = 0;// ??? 0x00FF0000
static u16 m_Clock = 0; // 0: 27MHz, 1: 54MHz static u16 m_Clock = 0; // 0: 27MHz, 1: 54MHz
static u16 m_DTVStatus = 0; static u16 m_DTVStatus = 0; // Region char and component cable bit (only low 2bits are used?)
static u16 m_FBWidth = 0; // Only correct when scaling is enabled? static u16 m_FBWidth = 0; // Only correct when scaling is enabled?
static UVIBorderBlankRegister m_BorderHBlank; static UVIBorderBlankRegister m_BorderHBlank;
// 0xcc002076 - 0xcc00207f is full of 0x00FF: unknown // 0xcc002076 - 0xcc00207f is full of 0x00FF: unknown
@ -443,11 +403,13 @@ void PreInit(bool _bNTSC)
Write16(0x0001, 0xcc002036); Write16(0x0001, 0xcc002036);
Write16(0x2828, 0xcc002048); Write16(0x2828, 0xcc002048);
Write16(0x0000, 0xcc00206c); Write16(0x0000, 0xcc00206c);
// Say component cable is plugged
m_DTVStatus = 1;
} }
void SetRegionReg(char _region) void SetRegionReg(char _region)
{ {
Write16((u16)_region, 0xcc00206e); m_DTVStatus = _region | (m_DTVStatus & 1);
} }
void Init() void Init()
@ -460,6 +422,19 @@ void Init()
NextXFBRender = 1; NextXFBRender = 1;
} }
void Read8(u8& _uReturnValue, const u32 _iAddress)
{
u16 val = 0;
if (_iAddress % 2 == 0)
Read16(val, _iAddress);
else
Read16(val, _iAddress - 1);
_uReturnValue = (u8)val;
INFO_LOG(VIDEOINTERFACE, "(r 8): 0x%02x, 0x%08x", _uReturnValue, _iAddress);
}
void Read16(u16& _uReturnValue, const u32 _iAddress) void Read16(u16& _uReturnValue, const u32 _iAddress)
{ {
switch (_iAddress & 0xFFF) switch (_iAddress & 0xFFF)

View File

@ -37,6 +37,7 @@ namespace VideoInterface
void Init(); void Init();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void Read8(u8& _uReturnValue, const u32 _uAddress);
void Read16(u16& _uReturnValue, const u32 _uAddress); void Read16(u16& _uReturnValue, const u32 _uAddress);
void Read32(u32& _uReturnValue, const u32 _uAddress); void Read32(u32& _uReturnValue, const u32 _uAddress);