Mercurial > repos > blastem
comparison vdp.c @ 1134:15a32da89d23
Fix a bug in hslot advancement in Mode 4. Fix some of the "inactive_start" calculations that did not take into account Mode 4.
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 01 Jan 2017 02:33:06 -0800 |
parents | 28363cb568c4 |
children | 8506b305e0e8 |
comparison
equal
deleted
inserted
replaced
1133:28363cb568c4 | 1134:15a32da89d23 |
---|---|
1333 } | 1333 } |
1334 } else if (!(context->latched_mode & BIT_PAL) && context->vcounter == 0xEB) { | 1334 } else if (!(context->latched_mode & BIT_PAL) && context->vcounter == 0xEB) { |
1335 context->vcounter = 0x1E5; | 1335 context->vcounter = 0x1E5; |
1336 } | 1336 } |
1337 uint32_t inactive_start = (context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START); | 1337 uint32_t inactive_start = (context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START); |
1338 if (!(context->regs[REG_MODE_2] & BIT_MODE_5)) { | |
1339 inactive_start = MODE4_INACTIVE_START; | |
1340 } | |
1338 if (!headless) { | 1341 if (!headless) { |
1339 if (!context->vcounter && !context->output) { | 1342 if (!context->vcounter && !context->output) { |
1340 context->output = render_get_framebuffer(context->flags2 & FLAG2_EVEN_FIELD ? FRAMEBUFFER_EVEN : FRAMEBUFFER_ODD, &context->output_pitch); | 1343 context->output = render_get_framebuffer(context->flags2 & FLAG2_EVEN_FIELD ? FRAMEBUFFER_EVEN : FRAMEBUFFER_ODD, &context->output_pitch); |
1341 context->h40_lines = 0; | 1344 context->h40_lines = 0; |
1342 } else if (context->vcounter == inactive_start) { //TODO: Change this once border emulation is added | 1345 } else if (context->vcounter == inactive_start) { //TODO: Change this once border emulation is added |
1500 CHECK_ONLY\ | 1503 CHECK_ONLY\ |
1501 case (slot == 147 ? 233 : slot+1):\ | 1504 case (slot == 147 ? 233 : slot+1):\ |
1502 render_sprite_cells_mode4(context);\ | 1505 render_sprite_cells_mode4(context);\ |
1503 scan_sprite_table(context->vcounter, context);\ | 1506 scan_sprite_table(context->vcounter, context);\ |
1504 if (context->flags & FLAG_DMA_RUN) { run_dma_src(context, -1); } \ | 1507 if (context->flags & FLAG_DMA_RUN) { run_dma_src(context, -1); } \ |
1505 if (slot == 147) {\ | 1508 if ((slot+1) == 147) {\ |
1506 context->hslot = 233;\ | 1509 context->hslot = 233;\ |
1507 } else {\ | 1510 } else {\ |
1508 context->hslot++;\ | 1511 context->hslot++;\ |
1509 }\ | 1512 }\ |
1510 context->cycles += slot_cycles;\ | 1513 context->cycles += slot_cycles;\ |
2321 value |= 0x10; | 2324 value |= 0x10; |
2322 } | 2325 } |
2323 uint32_t line= context->vcounter; | 2326 uint32_t line= context->vcounter; |
2324 uint32_t slot = context->hslot; | 2327 uint32_t slot = context->hslot; |
2325 uint32_t inactive_start = (context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START); | 2328 uint32_t inactive_start = (context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START); |
2329 if (!(context->regs[REG_MODE_2] & BIT_MODE_5)) { | |
2330 inactive_start = MODE4_INACTIVE_START; | |
2331 } | |
2326 if ((line >= inactive_start && line < 0x1FF) || !(context->regs[REG_MODE_2] & BIT_DISP_EN)) { | 2332 if ((line >= inactive_start && line < 0x1FF) || !(context->regs[REG_MODE_2] & BIT_DISP_EN)) { |
2327 value |= 0x8; | 2333 value |= 0x8; |
2328 } | 2334 } |
2329 if (context->regs[REG_MODE_4] & BIT_H40) { | 2335 if (context->regs[REG_MODE_4] & BIT_H40) { |
2330 if (slot < HBLANK_END_H40 || slot > HBLANK_START_H40) { | 2336 if (slot < HBLANK_END_H40 || slot > HBLANK_START_H40) { |
2555 } | 2561 } |
2556 | 2562 |
2557 uint32_t vdp_next_vint_z80(vdp_context * context) | 2563 uint32_t vdp_next_vint_z80(vdp_context * context) |
2558 { | 2564 { |
2559 uint32_t inactive_start = context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START; | 2565 uint32_t inactive_start = context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START; |
2566 if (!(context->regs[REG_MODE_2] & BIT_MODE_5)) { | |
2567 inactive_start = MODE4_INACTIVE_START; | |
2568 } | |
2560 if (context->vcounter == inactive_start) { | 2569 if (context->vcounter == inactive_start) { |
2561 if (context->regs[REG_MODE_4] & BIT_H40) { | 2570 if (context->regs[REG_MODE_4] & BIT_H40) { |
2562 if (context->hslot >= LINE_CHANGE_H40 && context->hslot <= VINT_SLOT_H40) { | 2571 if (context->hslot >= LINE_CHANGE_H40 && context->hslot <= VINT_SLOT_H40) { |
2563 uint32_t cycles = context->cycles; | 2572 uint32_t cycles = context->cycles; |
2564 if (context->hslot < 182) { | 2573 if (context->hslot < 182) { |