- [CHG] Gestió de interrupcions pasada a "mem" (futur "bus")
- [CHG] Reorganitzacions i neteja de codi - [NEW] Constants del espai io en la seua pròpia capçalera - [NEW] Comentaris en algunes parts menys obvies del codi - [CHG] Alguns defines passats a constexpr - [CHG] display::init() no feia més que cridar a display::reinit(). Concretats els dos en display::init() - [ONGOING] Passant la responsabilitat de tornar el foco a la finestra principal (que estaba en el mòdul debug) al gestor de finestres.
This commit is contained in:
+13
-23
@@ -46,10 +46,6 @@ namespace sm83
|
||||
|
||||
uint8_t *_rIME = ®s[12];
|
||||
|
||||
bool halted = false;
|
||||
bool exit_from_halt = false;
|
||||
int pending_ei = 0;
|
||||
|
||||
#define rA (*_rA)
|
||||
#define rF (*_rF)
|
||||
#define rB (*_rB)
|
||||
@@ -71,6 +67,9 @@ namespace sm83
|
||||
|
||||
#define EX(a,b) {auto temp=a;a=b;b=temp;}
|
||||
|
||||
bool halted = false;
|
||||
bool exit_from_halt = false;
|
||||
int pending_ei = 0;
|
||||
bool reading_m1 = false;
|
||||
|
||||
uint8_t READ_MEM_8(const uint16_t addr, const bool code=false)
|
||||
@@ -534,21 +533,21 @@ namespace sm83
|
||||
DI();
|
||||
PUSH(rPC);
|
||||
//t+=20;
|
||||
if (*IF & INTERRUPT_VBLANK) {
|
||||
if (*IF & gb::interrupts::VBLANK) {
|
||||
rPC = 0x40;
|
||||
*IF = *IF & ~INTERRUPT_VBLANK;
|
||||
} else if (*IF & INTERRUPT_LCD) {
|
||||
*IF = *IF & ~gb::interrupts::VBLANK;
|
||||
} else if (*IF & gb::interrupts::LCD) {
|
||||
rPC = 0x48;
|
||||
*IF = *IF & ~INTERRUPT_LCD;
|
||||
} else if (*IF & INTERRUPT_TIMER) {
|
||||
*IF = *IF & ~gb::interrupts::LCD;
|
||||
} else if (*IF & gb::interrupts::TIMER) {
|
||||
rPC = 0x50;
|
||||
*IF = *IF & ~INTERRUPT_TIMER;
|
||||
} else if (*IF & INTERRUPT_SERIAL) {
|
||||
*IF = *IF & ~gb::interrupts::TIMER;
|
||||
} else if (*IF & gb::interrupts::SERIAL) {
|
||||
rPC = 0x58;
|
||||
*IF = *IF & ~INTERRUPT_SERIAL;
|
||||
} else if (*IF & INTERRUPT_JOYPAD) {
|
||||
*IF = *IF & ~gb::interrupts::SERIAL;
|
||||
} else if (*IF & gb::interrupts::JOYPAD) {
|
||||
rPC = 0x60;
|
||||
*IF = *IF & ~INTERRUPT_JOYPAD;
|
||||
*IF = *IF & ~gb::interrupts::JOYPAD;
|
||||
}
|
||||
/*if (options[Z80_OPTION_BREAK_ON_INTERRUPT]) {
|
||||
printf("Break on interrupt! 0x%2x, PC: 0x%2x\n", address, rPC);
|
||||
@@ -616,15 +615,6 @@ namespace sm83
|
||||
HALT();
|
||||
}
|
||||
|
||||
void interrupt(uint8_t type)
|
||||
{
|
||||
const uint8_t IE = mem::readMem(0xffff);
|
||||
//if (IE & type) exit_from_halt = true;
|
||||
const uint8_t IF = mem::readMem(0xff0f);
|
||||
mem::writeMem(0xff0f, IF | type);
|
||||
//processInterrupts();
|
||||
}
|
||||
|
||||
static inline const uint8_t RLC(const uint8_t v)
|
||||
{
|
||||
const uint8_t res = (v>>7) | (v<<1);
|
||||
|
||||
Reference in New Issue
Block a user