Mercurial > repos > blastem
comparison vdp.c @ 720:15d9359fd771
Add some tests for hint timing and fix it properly this time.
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 20 May 2015 22:27:51 -0700 |
parents | 019d27995e32 |
children | 8f5339961903 |
comparison
equal
deleted
inserted
replaced
719:019d27995e32 | 720:15d9359fd771 |
---|---|
1441 uint32_t const h40_hsync_cycles[] = {19, 20, 20, 20, 18, 20, 20, 20, 18, 20, 20, 20, 18, 20, 20, 20, 19}; | 1441 uint32_t const h40_hsync_cycles[] = {19, 20, 20, 20, 18, 20, 20, 20, 18, 20, 20, 20, 18, 20, 20, 20, 19}; |
1442 | 1442 |
1443 void vdp_advance_line(vdp_context *context) | 1443 void vdp_advance_line(vdp_context *context) |
1444 { | 1444 { |
1445 context->vcounter++; | 1445 context->vcounter++; |
1446 context->vcounter &= 0x1FF; | |
1447 if (context->flags2 & FLAG2_REGION_PAL) { | |
1448 if (context->latched_mode & BIT_PAL) { | |
1449 if (context->vcounter == 0x10B) { | |
1450 context->vcounter = 0x1D2; | |
1451 } | |
1452 } else if (context->vcounter == 0x103){ | |
1453 context->vcounter = 0x1CA; | |
1454 } | |
1455 } else if (!(context->latched_mode & BIT_PAL) && context->vcounter == 0xEB) { | |
1456 context->vcounter = 0x1E5; | |
1457 } | |
1458 | |
1446 if (context->vcounter > (context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START)) { | 1459 if (context->vcounter > (context->latched_mode & BIT_PAL ? PAL_INACTIVE_START : NTSC_INACTIVE_START)) { |
1447 context->hint_counter = context->regs[REG_HINT]; | 1460 context->hint_counter = context->regs[REG_HINT]; |
1448 } else if (context->hint_counter) { | 1461 } else if (context->hint_counter) { |
1449 context->hint_counter--; | 1462 context->hint_counter--; |
1450 } else { | 1463 } else { |
1563 } | 1576 } |
1564 | 1577 |
1565 } else { | 1578 } else { |
1566 vdp_advance_line(context); | 1579 vdp_advance_line(context); |
1567 } | 1580 } |
1568 context->vcounter &= 0x1FF; | |
1569 if (context->flags2 & FLAG2_REGION_PAL) { | |
1570 if (context->latched_mode & BIT_PAL) { | |
1571 if (context->vcounter == 0x10B) { | |
1572 context->vcounter = 0x1D2; | |
1573 } | |
1574 } else if (context->vcounter == 0x103){ | |
1575 context->vcounter = 0x1CA; | |
1576 } | |
1577 } else if (!(context->latched_mode & BIT_PAL) && context->vcounter == 0xEB) { | |
1578 context->vcounter = 0x1E5; | |
1579 } | |
1580 | |
1581 } | 1581 } |
1582 } | 1582 } |
1583 | 1583 |
1584 uint32_t vdp_run_to_vblank(vdp_context * context) | 1584 uint32_t vdp_run_to_vblank(vdp_context * context) |
1585 { | 1585 { |