- [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:
+6
-10
@@ -45,7 +45,6 @@ namespace ppu
|
||||
#define WY (*_WY)
|
||||
#define WX (*_WX)
|
||||
|
||||
#define IF 0xff0f
|
||||
bool last_interrupt_lcd_state = false;
|
||||
|
||||
void init()
|
||||
@@ -212,7 +211,6 @@ namespace ppu
|
||||
}
|
||||
|
||||
// gestió de en quin dot i linea estem, i tot el que ha de passar
|
||||
//uint8_t interrupts = 0x00;
|
||||
bool current_interrupt_lcd_state = false;
|
||||
dots_in_scanline++;
|
||||
if ( (dots_in_scanline==80) && (LY<144) )
|
||||
@@ -222,7 +220,7 @@ namespace ppu
|
||||
else if ( (dots_in_scanline==252) && (LY<144) )
|
||||
{
|
||||
STAT = (STAT & 0xFC); // Set mode 0
|
||||
if (STAT&0x08) current_interrupt_lcd_state = true; // interrupts |= INTERRUPT_LCD;
|
||||
if (STAT&0x08) current_interrupt_lcd_state = true;
|
||||
}
|
||||
else if (dots_in_scanline==456)
|
||||
{
|
||||
@@ -232,17 +230,16 @@ namespace ppu
|
||||
if (LY==144)
|
||||
{
|
||||
// Set vblank interrupt
|
||||
mem::writeMem(IF, mem::readMem(IF) | INTERRUPT_VBLANK);
|
||||
mem::requestInterrupt(gb::interrupts::VBLANK);
|
||||
STAT = (STAT & 0xFC) | 0x01; // Set mode 1
|
||||
//interrupts |= INTERRUPT_VBLANK;
|
||||
if (STAT&0x10) current_interrupt_lcd_state = true; //interrupts |= INTERRUPT_LCD;
|
||||
if (STAT&0x10) current_interrupt_lcd_state = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LY<144)
|
||||
{
|
||||
STAT = (STAT & 0xFC) | 0x02; // Set mode 2
|
||||
if (STAT&0x20) current_interrupt_lcd_state = true; // interrupts |= INTERRUPT_LCD;
|
||||
if (STAT&0x20) current_interrupt_lcd_state = true;
|
||||
fill_line_buffer_bkg();
|
||||
fill_line_buffer_win();
|
||||
fill_line_buffer_obj();
|
||||
@@ -251,7 +248,7 @@ namespace ppu
|
||||
if (LY==LYC)
|
||||
{
|
||||
STAT = (STAT & 0xFB) | 0x04;
|
||||
if (STAT&0x40) current_interrupt_lcd_state = true; // interrupts |= INTERRUPT_LCD;
|
||||
if (STAT&0x40) current_interrupt_lcd_state = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -261,8 +258,7 @@ namespace ppu
|
||||
|
||||
if (!last_interrupt_lcd_state && current_interrupt_lcd_state)
|
||||
{
|
||||
mem::writeMem(IF, mem::readMem(IF) | INTERRUPT_LCD);
|
||||
//sm83::interrupt(interrupts);
|
||||
mem::requestInterrupt(gb::interrupts::LCD);
|
||||
}
|
||||
last_interrupt_lcd_state = current_interrupt_lcd_state;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user