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