mirror of
https://github.com/JorjBauer/aiie.git
synced 2024-11-27 18:49:46 +00:00
fix transcription error in mouse rom; update irq semantics
This commit is contained in:
parent
55703a0838
commit
c5f0985fc2
@ -16,7 +16,7 @@ static
|
||||
0x68, 0xAA, 0x68, 0xEA, 0x68, 0x99, 0x80, 0xC0,
|
||||
0x60, 0x99, 0x81, 0xC0, 0x68, 0xBD, 0x38, 0x06,
|
||||
0xAA, 0x68, 0xA8, 0x68, 0xBD, 0x00, 0x02, 0x60,
|
||||
0xC9, 0x0A, 0xB0, 0x04, 0x8D, 0xCF, 0xC0, 0x60,
|
||||
0xC9, 0x10, 0xB0, 0x04, 0x8D, 0xCF, 0xC0, 0x60,
|
||||
0x38, 0x60, 0x48, 0x78, 0x8D, 0xCE, 0xC0, 0xA2,
|
||||
0x04, 0xBD, 0xB8, 0x06, 0x29, 0x0E, 0xD0, 0x01,
|
||||
0x38, 0x68, 0x60, 0x8D, 0xCB, 0xC0, 0x18, 0x60,
|
||||
|
@ -11,6 +11,8 @@ enum {
|
||||
SW_W_INITPR = 0x00,
|
||||
SW_W_HANDLEIN = 0x01,
|
||||
|
||||
SW_R_ERR = 0x07,
|
||||
|
||||
SW_R_HOMEMOUSE = 0x08,
|
||||
SW_R_POSMOUSE = 0x09,
|
||||
SW_R_CLEARMOUSE = 0x0A,
|
||||
@ -159,6 +161,7 @@ void Mouse::writeSwitches(uint8_t s, uint8_t v)
|
||||
g_vm->getMMU()->write(0x778+4, interruptsTriggered);
|
||||
g_vm->getMMU()->write(0x6B8+4, interruptsTriggered); // hack to appease ROM
|
||||
interruptsTriggered = 0;
|
||||
g_cpu->deassertIrq();
|
||||
break;
|
||||
case SW_W_CLAMPMOUSE:
|
||||
{
|
||||
@ -198,7 +201,7 @@ void Mouse::loadROM(uint8_t *toWhere)
|
||||
toWhere[i] = pgm_read_byte(&romData[i]);
|
||||
}
|
||||
#else
|
||||
printf("loading HD32 rom\n");
|
||||
printf("loading Mouse rom\n");
|
||||
memcpy(toWhere, romData, 256);
|
||||
#endif
|
||||
}
|
||||
@ -216,11 +219,10 @@ void Mouse::maintainMouse(int64_t cycleCount)
|
||||
{
|
||||
// Fake a 60Hz VBL in case we need it for our interrupts
|
||||
static int64_t nextInterruptTime = cycleCount + 17050;
|
||||
|
||||
if ( (status & ST_MOUSEENABLE) &&
|
||||
(status & ST_INTVBL) &&
|
||||
(cycleCount >= nextInterruptTime) ) {
|
||||
g_cpu->irq();
|
||||
g_cpu->assertIrq();
|
||||
|
||||
interruptsTriggered |= ST_INTVBL;
|
||||
|
||||
@ -232,14 +234,14 @@ void Mouse::maintainMouse(int64_t cycleCount)
|
||||
if ( (status & ST_MOUSEENABLE) &&
|
||||
(status & ST_INTMOUSE) &&
|
||||
(xpos != lastXForInt || ypos != lastYForInt) ) {
|
||||
g_cpu->irq();
|
||||
g_cpu->assertIrq();
|
||||
|
||||
interruptsTriggered |= ST_INTMOUSE;
|
||||
lastXForInt = xpos; lastYForInt = ypos;
|
||||
} else if ( (status & ST_MOUSEENABLE) &&
|
||||
(status & ST_INTBUTTON) &&
|
||||
lastButtonForInt != g_mouse->getButton()) {
|
||||
g_cpu->irq();
|
||||
g_cpu->assertIrq();
|
||||
|
||||
interruptsTriggered |= ST_INTBUTTON;
|
||||
lastButtonForInt = g_mouse->getButton();
|
||||
|
@ -85,7 +85,7 @@ INHandler:
|
||||
RTS
|
||||
|
||||
SetMouse:
|
||||
CMP #$0A ; values >= 10 are invalid
|
||||
CMP #$10 ; values >= $10 are invalid
|
||||
BCS ExitWithError
|
||||
STA $C0CF ; soft switch 0x0F, hard-coded slot 4 for now
|
||||
RTS
|
||||
|
@ -89,7 +89,7 @@ Current file: mouserom.asm
|
||||
00C45F 1 60 RTS
|
||||
00C460 1
|
||||
00C460 1 SetMouse:
|
||||
00C460 1 C9 0A CMP #$0A ; values >= 10 are invalid
|
||||
00C460 1 C9 10 CMP #$10 ; values >= $10 are invalid
|
||||
00C462 1 B0 04 BCS ExitWithError
|
||||
00C464 1 8D CF C0 STA $C0CF ; soft switch 0x0F, hard-coded slot 4 for now
|
||||
00C467 1 60 RTS
|
||||
|
16
cpu.cpp
16
cpu.cpp
@ -444,6 +444,16 @@ void Cpu::brk()
|
||||
cycles += 2;
|
||||
}
|
||||
|
||||
void Cpu::assertIrq()
|
||||
{
|
||||
irqPending = true;
|
||||
}
|
||||
|
||||
void Cpu::deassertIrq()
|
||||
{
|
||||
irqPending = false;
|
||||
}
|
||||
|
||||
void Cpu::irq()
|
||||
{
|
||||
// If interrupts are disabled, then do nothing
|
||||
@ -472,7 +482,6 @@ uint8_t Cpu::Run(uint8_t numSteps)
|
||||
uint8_t Cpu::step()
|
||||
{
|
||||
if (irqPending) {
|
||||
irqPending = false;
|
||||
irq();
|
||||
}
|
||||
|
||||
@ -1217,11 +1226,6 @@ uint16_t Cpu::popS16()
|
||||
return (msb << 8) | lsb;
|
||||
}
|
||||
|
||||
void Cpu::stageIRQ()
|
||||
{
|
||||
irqPending = true;
|
||||
}
|
||||
|
||||
void Cpu::realtime()
|
||||
{
|
||||
realtimeProcessing = true;
|
||||
|
Loading…
Reference in New Issue
Block a user