# HG changeset patch # User Michael Pavone # Date 1453864990 28800 # Node ID 2be771c4dfbdd9834b5d4ddf9adce2e8febe65e4 # Parent e64168bb2b25dbc0ad93144eec6937cd750f5fe0 After reviewing the results of my test ROM again it seems pretty clear that the VBlank flag gets set at the same time as the vcounter changes diff -r e64168bb2b25 -r 2be771c4dfbd vdp.c --- a/vdp.c Sun Jan 17 14:46:12 2016 -0800 +++ b/vdp.c Tue Jan 26 19:23:10 2016 -0800 @@ -1692,22 +1692,7 @@ uint32_t line= context->vcounter; uint32_t slot = context->hslot; uint32_t inactive_start = (context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START); - if ( - ( - line > inactive_start - && line < 0x1FF - ) - || (line == inactive_start - && ( - slot >= (context->regs[REG_MODE_4] & BIT_H40 ? VBLANK_START_H40 : VBLANK_START_H32) - || slot < (context->regs[REG_MODE_4] & BIT_H40 ? LINE_CHANGE_H40 : LINE_CHANGE_H32) - ) - ) - || (line == 0x1FF - && slot < (context->regs[REG_MODE_4] & BIT_H40 ? VBLANK_START_H40 : VBLANK_START_H32)) - && slot >= (context->regs[REG_MODE_4] & BIT_H40 ? LINE_CHANGE_H40 : LINE_CHANGE_H32) - || !(context->regs[REG_MODE_2] & BIT_DISP_EN) - ) { + if ((line >= inactive_start && line < 0x1FF) || !(context->regs[REG_MODE_2] & BIT_DISP_EN)) { value |= 0x8; } if (context->regs[REG_MODE_4] & BIT_H40) {