Fixed zelda lyc first line timing issue

This commit is contained in:
2025-05-22 20:51:04 -06:00
parent 237b68892e
commit 2a5f083929
2 changed files with 11 additions and 10 deletions

View File

@ -121,14 +121,8 @@ void ppu_mode_xfer() {
void ppu_mode_vblank() {
if(ppu_get_context()->line_ticks >= TICKS_PER_LINE) {
increment_ly();
if(lcd_get_context()->ly >= LINES_PER_FRAME) {
LCDS_MODE_SET(MODE_OAM);
if(LCDS_STAT_INT(SS_OAM)) {
cpu_request_interrupt(IT_LCD_STAT);
}
lcd_get_context()->ly = 0;
if(lcd_get_context()->ly == lcd_get_context()->ly_compare) {
if(lcd_get_context()->ly == LINES_PER_FRAME-1) {
if(lcd_get_context()->ly_compare == 0) {
LCDS_LYC_SET(1);
if(LCDS_STAT_INT(SS_LYC)) {
cpu_request_interrupt(IT_LCD_STAT);
@ -136,6 +130,13 @@ void ppu_mode_vblank() {
} else {
LCDS_LYC_SET(0);
}
}
if(lcd_get_context()->ly >= LINES_PER_FRAME) {
LCDS_MODE_SET(MODE_OAM);
if(LCDS_STAT_INT(SS_OAM)) {
cpu_request_interrupt(IT_LCD_STAT);
}
lcd_get_context()->ly = 0;
ppu_get_context()->window_line = 0;
}