- [FIX] Les interrupcions comencen mirant IE & IF, i després IME. Estava al reves.
- [FIX] En cada interrupció se marcava el exit_from_halt, i sino estaves en halt, el pròxim halt no tenía efecte. - [FIX] Implementat el halt bug quan va despres de EI - [FIX] una demanda de interrupció ha de quedar marcada en IF, encara que en IE no estiga habilitada. - [FIX] durant el pintat se marquen les interrupcions que toque, i al final es quan s'envia tot junt. - [FIX] estava enviant una interrupcio VBLANK al acabar el pintat total, com en spectrum, adicional a la que toca, i tot anava loco. - [FIX] Llevats tots els fullrefresh, no funciona be en GameBoy
This commit is contained in:
+14
-13
@@ -301,7 +301,7 @@ namespace gbscreen
|
||||
}
|
||||
|
||||
// gestió de en quin dot i linea estem, i tot el que ha de passar
|
||||
bool stat_interrupt = false;
|
||||
uint8_t interrupts = 0x00;
|
||||
dots_in_scanline++;
|
||||
if ( (dots_in_scanline==80) && (LY<144) )
|
||||
{
|
||||
@@ -310,26 +310,26 @@ namespace gbscreen
|
||||
else if ( (dots_in_scanline==252) && (LY<144) )
|
||||
{
|
||||
STAT = (STAT & 0xFC); // Set mode 0
|
||||
if (STAT&0x08) stat_interrupt = true;
|
||||
if (STAT&0x08) interrupts |= INTERRUPT_LCD;
|
||||
}
|
||||
else if (dots_in_scanline==456)
|
||||
{
|
||||
dots_in_scanline = 0;
|
||||
dots_in_scanline = 0;
|
||||
LY++;
|
||||
if (LY==144)
|
||||
{
|
||||
STAT = (STAT & 0xFC) | 0x01; // Set mode 1
|
||||
mem::writeMem(0xff41, STAT);
|
||||
mem::writeMem(0xff44, LY);
|
||||
sm83::interrupt(INTERRUPT_VBLANK);
|
||||
if (STAT&0x10) stat_interrupt = true;
|
||||
//mem::writeMem(0xff41, STAT);
|
||||
//mem::writeMem(0xff44, LY);
|
||||
interrupts |= INTERRUPT_VBLANK;
|
||||
if (STAT&0x10) interrupts |= INTERRUPT_LCD;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LY<144)
|
||||
{
|
||||
STAT = (STAT & 0xFC) | 0x02; // Set mode 2
|
||||
if (STAT&0x20) stat_interrupt = true;
|
||||
if (STAT&0x20) interrupts |= INTERRUPT_LCD;
|
||||
fill_line_buffer_bkg(LY);
|
||||
fill_line_buffer_win(LY);
|
||||
fill_line_buffer_obj(LY);
|
||||
@@ -342,7 +342,7 @@ namespace gbscreen
|
||||
if (LY==LYC)
|
||||
{
|
||||
STAT = (STAT & 0xFB) | 0x04;
|
||||
if (STAT&0x40) stat_interrupt = true;
|
||||
if (STAT&0x40) interrupts |= INTERRUPT_LCD;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -350,11 +350,11 @@ namespace gbscreen
|
||||
}
|
||||
}
|
||||
|
||||
if (stat_interrupt)
|
||||
if (interrupts)
|
||||
{
|
||||
mem::writeMem(0xff41, STAT);
|
||||
mem::writeMem(0xff44, LY);
|
||||
sm83::interrupt(INTERRUPT_LCD);
|
||||
sm83::interrupt(interrupts);
|
||||
}
|
||||
|
||||
t_screen++;
|
||||
@@ -363,7 +363,7 @@ namespace gbscreen
|
||||
t_screen=0;
|
||||
ptr_pixel = gb_pixels;
|
||||
redraw();
|
||||
if (!full) sm83::interrupt(INTERRUPT_VBLANK);
|
||||
//if (!full) sm83::interrupt(INTERRUPT_VBLANK);
|
||||
}
|
||||
}
|
||||
mem::writeMem(0xff41, STAT);
|
||||
@@ -383,7 +383,8 @@ namespace gbscreen
|
||||
|
||||
void debugrefresh(const uint32_t dt)
|
||||
{
|
||||
if (full_refresh) fullrefresh(); else refresh(dt);
|
||||
/*if (full_refresh) fullrefresh(); else*/ refresh(dt);
|
||||
redraw();
|
||||
}
|
||||
|
||||
void redraw(const bool present)
|
||||
|
||||
Reference in New Issue
Block a user