Enable VBA linking

This commit is contained in:
DJRobX 2007-11-07 23:44:57 +00:00
parent d399ef263f
commit 3fbb21a027
2 changed files with 38 additions and 2 deletions

View File

@ -71,6 +71,14 @@
extern int emulating;
extern int linktime;
extern void StartLink(u16);
extern void StartJOYLink(u16);
extern void StartGPLink(u16);
extern void LinkSSend(u16);
extern void LinkUpdate(int);
extern int linktime2;
int SWITicks = 0;
int IRQTicks = 0;
@ -2979,7 +2987,8 @@ void CPUUpdateRegister(u32 address, u16 value)
cpuNextEvent = cpuTotalTicks;
break;
case 0x128:
if(value & 0x80) {
StartLink(value); // Link
/* if(value & 0x80) {
value &= 0xff7f;
if(value & 1 && (value & 0x4000)) {
UPDATE_REG(0x12a, 0xFF);
@ -2988,8 +2997,13 @@ void CPUUpdateRegister(u32 address, u16 value)
value &= 0x7f7f;
}
}
UPDATE_REG(0x128, value);
UPDATE_REG(0x128, value); */
break;
case 0x12a:
if(lspeed)
LinkSSend(value);
UPDATE_REG(0x12a, value);
break;
case 0x130:
P1 |= (value & 0x3FF);
UPDATE_REG(0x130, P1);
@ -2997,6 +3011,13 @@ void CPUUpdateRegister(u32 address, u16 value)
case 0x132:
UPDATE_REG(0x132, value & 0xC3FF);
break;
case 0x134:
StartGPLink(value);
break;
case 0x140:
StartJOYLink(value);
break;
case 0x200:
IE = value & 0x3FFF;
UPDATE_REG(0x200, IE);
@ -4288,6 +4309,10 @@ void CPULoop(int ticks)
#endif
ticks -= clockTicks;
/* Link
----------------------------------*/
LinkUpdate(clockTicks);
/* ----------------------------- */
cpuNextEvent = CPUUpdateTicks();

View File

@ -28,6 +28,8 @@ extern bool cpuSramEnabled;
extern bool cpuFlashEnabled;
extern bool cpuEEPROMEnabled;
extern bool cpuEEPROMSensorEnabled;
extern int lspeed;
extern void LinkSStop(void);
extern bool cpuDmaHack;
extern u32 cpuDmaLast;
extern bool timer0On;
@ -90,6 +92,9 @@ static inline u32 CPUReadMemory(u32 address)
value = READ32LE(((u32 *)&internalRAM[address & 0x7ffC]));
break;
case 4:
if((address>=0x4000120||address<=0x4000126)&&lspeed)
LinkSStop();
if((address < 0x4000400) && ioReadable[address & 0x3fc]) {
if(ioReadable[(address & 0x3fc) + 2])
value = READ32LE(((u32 *)&ioMem[address & 0x3fC]));
@ -213,6 +218,9 @@ static inline u32 CPUReadHalfWord(u32 address)
value = READ16LE(((u16 *)&internalRAM[address & 0x7ffe]));
break;
case 4:
if((address>=0x4000120||address<=0x4000126)&&lspeed)
LinkSStop();
if((address < 0x4000400) && ioReadable[address & 0x3fe])
{
value = READ16LE(((u16 *)&ioMem[address & 0x3fe]));
@ -326,6 +334,9 @@ static inline u8 CPUReadByte(u32 address)
case 3:
return internalRAM[address & 0x7fff];
case 4:
if((address>=0x4000120||address<=0x4000126)&&lspeed)
LinkSStop();
if((address < 0x4000400) && ioReadable[address & 0x3ff])
return ioMem[address & 0x3ff];
else goto unreadable;