comparison vdp.c @ 680:4996369f1463

Some small synchronization improvements that do not seem to fix anything
author Michael Pavone <pavone@retrodev.com>
date Sun, 04 Jan 2015 23:05:37 -0800
parents a7971650c04e
children 7f96bd1cb1be
comparison
equal deleted inserted replaced
679:7dd83295193a 680:4996369f1463
1625 if (reg == REG_MODE_4) { 1625 if (reg == REG_MODE_4) {
1626 context->double_res = (value & (BIT_INTERLACE | BIT_DOUBLE_RES)) == (BIT_INTERLACE | BIT_DOUBLE_RES); 1626 context->double_res = (value & (BIT_INTERLACE | BIT_DOUBLE_RES)) == (BIT_INTERLACE | BIT_DOUBLE_RES);
1627 if (!context->double_res) { 1627 if (!context->double_res) {
1628 context->framebuf = context->oddbuf; 1628 context->framebuf = context->oddbuf;
1629 } 1629 }
1630 } 1630 }
1631 context->cd &= 0x3C; 1631 context->cd &= 0x3C;
1632 } 1632 }
1633 } else { 1633 } else {
1634 context->flags |= FLAG_PENDING; 1634 context->flags |= FLAG_PENDING;
1635 context->address = (context->address &0xC000) | (value & 0x3FFF); 1635 context->address = (context->address &0xC000) | (value & 0x3FFF);
1890 } 1890 }
1891 } 1891 }
1892 return MCLKS_LINE * (lines - 1) + vdp_cycles_next_line(context); 1892 return MCLKS_LINE * (lines - 1) + vdp_cycles_next_line(context);
1893 } 1893 }
1894 1894
1895 uint32_t vdp_cycles_to_frame_end(vdp_context * context) 1895 uint32_t vdp_frame_end_line(vdp_context * context)
1896 { 1896 {
1897 uint32_t frame_end; 1897 uint32_t frame_end;
1898 if (context->flags2 & FLAG2_REGION_PAL) { 1898 if (context->flags2 & FLAG2_REGION_PAL) {
1899 if (context->latched_mode & BIT_PAL) { 1899 if (context->latched_mode & BIT_PAL) {
1900 frame_end = PAL_INACTIVE_START + 8; 1900 frame_end = PAL_INACTIVE_START + 8;
1906 frame_end = 512; 1906 frame_end = 512;
1907 } else { 1907 } else {
1908 frame_end = NTSC_INACTIVE_START + 8; 1908 frame_end = NTSC_INACTIVE_START + 8;
1909 } 1909 }
1910 } 1910 }
1911 return context->cycles + vdp_cycles_to_line(context, frame_end); 1911 return frame_end;
1912 }
1913
1914 uint32_t vdp_cycles_to_frame_end(vdp_context * context)
1915 {
1916 return context->cycles + vdp_cycles_to_line(context, vdp_frame_end_line(context));
1917 }
1918
1919 uint8_t vdp_is_frame_over(vdp_context * context)
1920 {
1921 uint32_t frame_end = vdp_frame_end_line(context);
1922 return context->vcounter >= frame_end && context->vcounter < (frame_end + 8);
1912 } 1923 }
1913 1924
1914 uint32_t vdp_next_hint(vdp_context * context) 1925 uint32_t vdp_next_hint(vdp_context * context)
1915 { 1926 {
1916 if (!(context->regs[REG_MODE_1] & BIT_HINT_EN)) { 1927 if (!(context->regs[REG_MODE_1] & BIT_HINT_EN)) {