- [FIX] Un poc mes de neteja
- [NEW] Implementat el glitch "STAT IRQ Blocking" - [NEW] Afegit lagueirtofile
This commit is contained in:
@@ -1 +1,2 @@
|
||||
gb
|
||||
build/*
|
||||
+20
-13
@@ -69,6 +69,8 @@ namespace gbscreen
|
||||
#define WY (*_WY)
|
||||
#define WX (*_WX)
|
||||
|
||||
#define IF 0xff0f
|
||||
bool last_interrupt_lcd_state = false;
|
||||
|
||||
bool eventHandler(SDL_Event *e)
|
||||
{
|
||||
@@ -315,7 +317,7 @@ namespace gbscreen
|
||||
void refresh(const uint32_t dt, const bool full)
|
||||
{
|
||||
if ((LCDC&0x80)==0) return;
|
||||
|
||||
|
||||
for (int i=0;i<dt;++i)
|
||||
{
|
||||
// Açò va volcant els pixels del line_buffer en pantalla
|
||||
@@ -328,7 +330,8 @@ namespace gbscreen
|
||||
}
|
||||
|
||||
// gestió de en quin dot i linea estem, i tot el que ha de passar
|
||||
uint8_t interrupts = 0x00;
|
||||
//uint8_t interrupts = 0x00;
|
||||
bool current_interrupt_lcd_state = false;
|
||||
dots_in_scanline++;
|
||||
if ( (dots_in_scanline==80) && (LY<144) )
|
||||
{
|
||||
@@ -337,7 +340,7 @@ namespace gbscreen
|
||||
else if ( (dots_in_scanline==252) && (LY<144) )
|
||||
{
|
||||
STAT = (STAT & 0xFC); // Set mode 0
|
||||
if (STAT&0x08) interrupts |= INTERRUPT_LCD;
|
||||
if (STAT&0x08) current_interrupt_lcd_state = true; // interrupts |= INTERRUPT_LCD;
|
||||
}
|
||||
else if (dots_in_scanline==456)
|
||||
{
|
||||
@@ -346,16 +349,18 @@ namespace gbscreen
|
||||
if (LY==154) LY=0;
|
||||
if (LY==144)
|
||||
{
|
||||
// Set vblank interrupt
|
||||
mem::writeMem(IF, mem::readMem(IF) | INTERRUPT_VBLANK);
|
||||
STAT = (STAT & 0xFC) | 0x01; // Set mode 1
|
||||
interrupts |= INTERRUPT_VBLANK;
|
||||
if (STAT&0x10) interrupts |= INTERRUPT_LCD;
|
||||
//interrupts |= INTERRUPT_VBLANK;
|
||||
if (STAT&0x10) current_interrupt_lcd_state = true; //interrupts |= INTERRUPT_LCD;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LY<144)
|
||||
{
|
||||
STAT = (STAT & 0xFC) | 0x02; // Set mode 2
|
||||
if (STAT&0x20) interrupts |= INTERRUPT_LCD;
|
||||
if (STAT&0x20) current_interrupt_lcd_state = true; // interrupts |= INTERRUPT_LCD;
|
||||
fill_line_buffer_bkg();
|
||||
fill_line_buffer_win();
|
||||
fill_line_buffer_obj();
|
||||
@@ -364,7 +369,7 @@ namespace gbscreen
|
||||
if (LY==LYC)
|
||||
{
|
||||
STAT = (STAT & 0xFB) | 0x04;
|
||||
if (STAT&0x40) interrupts |= INTERRUPT_LCD;
|
||||
if (STAT&0x40) current_interrupt_lcd_state = true; // interrupts |= INTERRUPT_LCD;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -372,10 +377,12 @@ namespace gbscreen
|
||||
}
|
||||
}
|
||||
|
||||
if (interrupts)
|
||||
if (!last_interrupt_lcd_state && current_interrupt_lcd_state)
|
||||
{
|
||||
sm83::interrupt(interrupts);
|
||||
mem::writeMem(IF, mem::readMem(IF) | INTERRUPT_LCD);
|
||||
//sm83::interrupt(interrupts);
|
||||
}
|
||||
last_interrupt_lcd_state = current_interrupt_lcd_state;
|
||||
|
||||
t_screen++;
|
||||
if (t_screen>=t_states_total)
|
||||
@@ -504,8 +511,8 @@ namespace gbscreen
|
||||
return full_refresh;
|
||||
}
|
||||
|
||||
SDL_Renderer *getrenderer()
|
||||
{
|
||||
return ren;
|
||||
}
|
||||
//SDL_Renderer *getrenderer()
|
||||
//{
|
||||
// return ren;
|
||||
//}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,5 +21,5 @@ namespace gbscreen
|
||||
void toggleFullRefresh();
|
||||
const bool getFullRefresh();
|
||||
|
||||
SDL_Renderer *getrenderer();
|
||||
//SDL_Renderer *getrenderer();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[linux_debug] default
|
||||
cppflags = -g
|
||||
libs = -lSDL2
|
||||
executable = gb
|
||||
sourcepath = .
|
||||
buildpath = build
|
||||
Reference in New Issue
Block a user