trunk/src/mame/drivers/cps2.c
| r18139 | r18140 | |
| 621 | 621 | * |
| 622 | 622 | *************************************/ |
| 623 | 623 | |
| 624 | | static TIMER_DEVICE_CALLBACK( cps2_interrupt ) |
| 624 | TIMER_DEVICE_CALLBACK_MEMBER(cps_state::cps2_interrupt) |
| 625 | 625 | { |
| 626 | | cps_state *state = timer.machine().driver_data<cps_state>(); |
| 627 | | |
| 628 | 626 | /* 2 is vblank, 4 is some sort of scanline interrupt, 6 is both at the same time. */ |
| 629 | 627 | if (param == 0) |
| 630 | | state->m_scancalls = 0; |
| 628 | m_scancalls = 0; |
| 631 | 629 | |
| 632 | | if (state->m_cps_b_regs[0x10 / 2] & 0x8000) |
| 633 | | state->m_cps_b_regs[0x10 / 2] &= 0x1ff; |
| 630 | if (m_cps_b_regs[0x10 / 2] & 0x8000) |
| 631 | m_cps_b_regs[0x10 / 2] &= 0x1ff; |
| 634 | 632 | |
| 635 | | if (state->m_cps_b_regs[0x12 / 2] & 0x8000) |
| 636 | | state->m_cps_b_regs[0x12 / 2] &= 0x1ff; |
| 633 | if (m_cps_b_regs[0x12 / 2] & 0x8000) |
| 634 | m_cps_b_regs[0x12 / 2] &= 0x1ff; |
| 637 | 635 | |
| 638 | | // popmessage("%04x %04x - %04x %04x",state->m_scanline1,state->m_scanline2,state->m_cps_b_regs[0x10/2],state->m_cps_b_regs[0x12/2]); |
| 636 | // popmessage("%04x %04x - %04x %04x",m_scanline1,m_scanline2,m_cps_b_regs[0x10/2],m_cps_b_regs[0x12/2]); |
| 639 | 637 | |
| 640 | 638 | /* raster effects */ |
| 641 | | if (state->m_scanline1 == param || (state->m_scanline1 < param && !state->m_scancalls)) |
| 639 | if (m_scanline1 == param || (m_scanline1 < param && !m_scancalls)) |
| 642 | 640 | { |
| 643 | | state->m_cps_b_regs[0x10/2] = 0; |
| 644 | | state->m_maincpu->set_input_line(4, HOLD_LINE); |
| 641 | m_cps_b_regs[0x10/2] = 0; |
| 642 | m_maincpu->set_input_line(4, HOLD_LINE); |
| 645 | 643 | cps2_set_sprite_priorities(timer.machine()); |
| 646 | 644 | timer.machine().primary_screen->update_partial(param); |
| 647 | | state->m_scancalls++; |
| 645 | m_scancalls++; |
| 648 | 646 | // popmessage("IRQ4 scancounter = %04i", param); |
| 649 | 647 | } |
| 650 | 648 | |
| 651 | 649 | /* raster effects */ |
| 652 | | if(state->m_scanline2 == param || (state->m_scanline2 < param && !state->m_scancalls)) |
| 650 | if(m_scanline2 == param || (m_scanline2 < param && !m_scancalls)) |
| 653 | 651 | { |
| 654 | | state->m_cps_b_regs[0x12 / 2] = 0; |
| 655 | | state->m_maincpu->set_input_line(4, HOLD_LINE); |
| 652 | m_cps_b_regs[0x12 / 2] = 0; |
| 653 | m_maincpu->set_input_line(4, HOLD_LINE); |
| 656 | 654 | cps2_set_sprite_priorities(timer.machine()); |
| 657 | 655 | timer.machine().primary_screen->update_partial(param); |
| 658 | | state->m_scancalls++; |
| 656 | m_scancalls++; |
| 659 | 657 | // popmessage("IRQ4 scancounter = %04i", param); |
| 660 | 658 | } |
| 661 | 659 | |
| 662 | 660 | if (param == 240) /* VBlank */ |
| 663 | 661 | { |
| 664 | | state->m_cps_b_regs[0x10 / 2] = state->m_scanline1; |
| 665 | | state->m_cps_b_regs[0x12 / 2] = state->m_scanline2; |
| 666 | | state->m_maincpu->set_input_line(2, HOLD_LINE); |
| 667 | | if(state->m_scancalls) |
| 662 | m_cps_b_regs[0x10 / 2] = m_scanline1; |
| 663 | m_cps_b_regs[0x12 / 2] = m_scanline2; |
| 664 | m_maincpu->set_input_line(2, HOLD_LINE); |
| 665 | if(m_scancalls) |
| 668 | 666 | { |
| 669 | 667 | cps2_set_sprite_priorities(timer.machine()); |
| 670 | 668 | timer.machine().primary_screen->update_partial(256); |
| 671 | 669 | } |
| 672 | 670 | cps2_objram_latch(timer.machine()); |
| 673 | 671 | } |
| 674 | | // popmessage("Raster calls = %i", state->m_scancalls); |
| 672 | // popmessage("Raster calls = %i", m_scancalls); |
| 675 | 673 | } |
| 676 | 674 | |
| 677 | 675 | |
| r18139 | r18140 | |
| 1226 | 1224 | /* basic machine hardware */ |
| 1227 | 1225 | MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) |
| 1228 | 1226 | MCFG_CPU_PROGRAM_MAP(cps2_map) |
| 1229 | | MCFG_TIMER_ADD_SCANLINE("scantimer", cps2_interrupt, "screen", 0, 1) |
| 1227 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", cps_state, cps2_interrupt, "screen", 0, 1) |
| 1230 | 1228 | |
| 1231 | 1229 | MCFG_CPU_ADD("audiocpu", Z80, 8000000) |
| 1232 | 1230 | MCFG_CPU_PROGRAM_MAP(qsound_sub_map) |
trunk/src/mame/drivers/saturn.c
| r18139 | r18140 | |
| 1856 | 1856 | */ |
| 1857 | 1857 | |
| 1858 | 1858 | |
| 1859 | | static TIMER_DEVICE_CALLBACK( saturn_scanline ) |
| 1859 | TIMER_DEVICE_CALLBACK_MEMBER(saturn_state::saturn_scanline) |
| 1860 | 1860 | { |
| 1861 | | saturn_state *state = timer.machine().driver_data<saturn_state>(); |
| 1861 | saturn_state *state = machine().driver_data<saturn_state>(); |
| 1862 | 1862 | int scanline = param; |
| 1863 | 1863 | int max_y = timer.machine().primary_screen->height(); |
| 1864 | 1864 | int y_step,vblank_line; |
| 1865 | 1865 | |
| 1866 | 1866 | y_step = 2; |
| 1867 | 1867 | |
| 1868 | | if((max_y == 263 && state->m_vdp2.pal == 0) || (max_y == 313 && state->m_vdp2.pal == 1)) |
| 1868 | if((max_y == 263 && m_vdp2.pal == 0) || (max_y == 313 && m_vdp2.pal == 1)) |
| 1869 | 1869 | y_step = 1; |
| 1870 | 1870 | |
| 1871 | | vblank_line = (state->m_vdp2.pal) ? 288 : 240; |
| 1871 | vblank_line = (m_vdp2.pal) ? 288 : 240; |
| 1872 | 1872 | |
| 1873 | | //popmessage("%08x %d T0 %d T1 %d %08x",state->m_scu.ism ^ 0xffffffff,max_y,state->m_scu_regs[36],state->m_scu_regs[37],state->m_scu_regs[38]); |
| 1873 | //popmessage("%08x %d T0 %d T1 %d %08x",m_scu.ism ^ 0xffffffff,max_y,m_scu_regs[36],m_scu_regs[37],m_scu_regs[38]); |
| 1874 | 1874 | |
| 1875 | 1875 | if(scanline == (0)*y_step) |
| 1876 | 1876 | { |
| 1877 | 1877 | video_update_vdp1(timer.machine()); |
| 1878 | 1878 | |
| 1879 | 1879 | if(STV_VDP1_VBE) |
| 1880 | | state->m_vdp1.framebuffer_clear_on_next_frame = 1; |
| 1880 | m_vdp1.framebuffer_clear_on_next_frame = 1; |
| 1881 | 1881 | |
| 1882 | | if(!(state->m_scu.ism & IRQ_VDP1_END)) |
| 1882 | if(!(m_scu.ism & IRQ_VDP1_END)) |
| 1883 | 1883 | { |
| 1884 | | state->m_maincpu->set_input_line_and_vector(0x2, HOLD_LINE, 0x4d); |
| 1884 | m_maincpu->set_input_line_and_vector(0x2, HOLD_LINE, 0x4d); |
| 1885 | 1885 | scu_do_transfer(timer.machine(),6); |
| 1886 | 1886 | } |
| 1887 | 1887 | else |
| 1888 | | state->m_scu.ist |= (IRQ_VDP1_END); |
| 1888 | m_scu.ist |= (IRQ_VDP1_END); |
| 1889 | 1889 | } |
| 1890 | 1890 | |
| 1891 | 1891 | if(scanline == 0*y_step) |
| 1892 | 1892 | { |
| 1893 | | if(!(state->m_scu.ism & IRQ_VBLANK_OUT)) |
| 1893 | if(!(m_scu.ism & IRQ_VBLANK_OUT)) |
| 1894 | 1894 | { |
| 1895 | | state->m_maincpu->set_input_line_and_vector(0xe, HOLD_LINE, 0x41); |
| 1895 | m_maincpu->set_input_line_and_vector(0xe, HOLD_LINE, 0x41); |
| 1896 | 1896 | scu_do_transfer(timer.machine(),1); |
| 1897 | 1897 | } |
| 1898 | 1898 | else |
| 1899 | | state->m_scu.ist |= (IRQ_VBLANK_OUT); |
| 1899 | m_scu.ist |= (IRQ_VBLANK_OUT); |
| 1900 | 1900 | |
| 1901 | 1901 | } |
| 1902 | 1902 | else if(scanline == vblank_line*y_step) |
| 1903 | 1903 | { |
| 1904 | | if(!(state->m_scu.ism & IRQ_VBLANK_IN)) |
| 1904 | if(!(m_scu.ism & IRQ_VBLANK_IN)) |
| 1905 | 1905 | { |
| 1906 | | state->m_maincpu->set_input_line_and_vector(0xf, HOLD_LINE ,0x40); |
| 1906 | m_maincpu->set_input_line_and_vector(0xf, HOLD_LINE ,0x40); |
| 1907 | 1907 | scu_do_transfer(timer.machine(),0); |
| 1908 | 1908 | } |
| 1909 | 1909 | else |
| 1910 | | state->m_scu.ist |= (IRQ_VBLANK_IN); |
| 1910 | m_scu.ist |= (IRQ_VBLANK_IN); |
| 1911 | 1911 | } |
| 1912 | 1912 | else if((scanline % y_step) == 0 && scanline < vblank_line*y_step) |
| 1913 | 1913 | { |
| 1914 | | if(!(state->m_scu.ism & IRQ_HBLANK_IN)) |
| 1914 | if(!(m_scu.ism & IRQ_HBLANK_IN)) |
| 1915 | 1915 | { |
| 1916 | | state->m_maincpu->set_input_line_and_vector(0xd, HOLD_LINE, 0x42); |
| 1916 | m_maincpu->set_input_line_and_vector(0xd, HOLD_LINE, 0x42); |
| 1917 | 1917 | scu_do_transfer(timer.machine(),2); |
| 1918 | 1918 | } |
| 1919 | 1919 | else |
| 1920 | | state->m_scu.ist |= (IRQ_HBLANK_IN); |
| 1920 | m_scu.ist |= (IRQ_HBLANK_IN); |
| 1921 | 1921 | } |
| 1922 | 1922 | |
| 1923 | | if(scanline == (state->m_scu_regs[36] & 0x3ff)*y_step) |
| 1923 | if(scanline == (m_scu_regs[36] & 0x3ff)*y_step) |
| 1924 | 1924 | { |
| 1925 | | if(!(state->m_scu.ism & IRQ_TIMER_0)) |
| 1925 | if(!(m_scu.ism & IRQ_TIMER_0)) |
| 1926 | 1926 | { |
| 1927 | | state->m_maincpu->set_input_line_and_vector(0xc, HOLD_LINE, 0x43 ); |
| 1927 | m_maincpu->set_input_line_and_vector(0xc, HOLD_LINE, 0x43 ); |
| 1928 | 1928 | scu_do_transfer(timer.machine(),3); |
| 1929 | 1929 | } |
| 1930 | 1930 | else |
| 1931 | | state->m_scu.ist |= (IRQ_TIMER_0); |
| 1931 | m_scu.ist |= (IRQ_TIMER_0); |
| 1932 | 1932 | } |
| 1933 | 1933 | |
| 1934 | 1934 | /* TODO: this isn't completely correct */ |
| 1935 | | if(state->m_scu_regs[38] & 0x1) |
| 1935 | if(m_scu_regs[38] & 0x1) |
| 1936 | 1936 | { |
| 1937 | | if((!(state->m_scu_regs[38] & 0x100) && (scanline % y_step) == 0) || |
| 1938 | | ((state->m_scu_regs[38] & 0x100) && (scanline == (state->m_scu_regs[36] & 0x3ff)*y_step))) |
| 1937 | if((!(m_scu_regs[38] & 0x100) && (scanline % y_step) == 0) || |
| 1938 | ((m_scu_regs[38] & 0x100) && (scanline == (m_scu_regs[36] & 0x3ff)*y_step))) |
| 1939 | 1939 | { |
| 1940 | | if(!(state->m_scu.ism & IRQ_TIMER_1)) |
| 1940 | if(!(m_scu.ism & IRQ_TIMER_1)) |
| 1941 | 1941 | { |
| 1942 | | state->m_maincpu->set_input_line_and_vector(0xb, HOLD_LINE, 0x44 ); |
| 1942 | m_maincpu->set_input_line_and_vector(0xb, HOLD_LINE, 0x44 ); |
| 1943 | 1943 | scu_do_transfer(timer.machine(),4); |
| 1944 | 1944 | } |
| 1945 | 1945 | else |
| 1946 | | state->m_scu.ist |= (IRQ_TIMER_1); |
| 1946 | m_scu.ist |= (IRQ_TIMER_1); |
| 1947 | 1947 | } |
| 1948 | 1948 | } |
| 1949 | 1949 | } |
| 1950 | 1950 | |
| 1951 | | static TIMER_DEVICE_CALLBACK( saturn_slave_scanline ) |
| 1951 | TIMER_DEVICE_CALLBACK_MEMBER(saturn_state::saturn_slave_scanline ) |
| 1952 | 1952 | { |
| 1953 | | saturn_state *state = timer.machine().driver_data<saturn_state>(); |
| 1954 | 1953 | int scanline = param; |
| 1955 | 1954 | int max_y = timer.machine().primary_screen->height(); |
| 1956 | 1955 | int y_step,vblank_line; |
| 1957 | 1956 | |
| 1958 | 1957 | y_step = 2; |
| 1959 | 1958 | |
| 1960 | | if((max_y == 263 && state->m_vdp2.pal == 0) || (max_y == 313 && state->m_vdp2.pal == 1)) |
| 1959 | if((max_y == 263 && m_vdp2.pal == 0) || (max_y == 313 && m_vdp2.pal == 1)) |
| 1961 | 1960 | y_step = 1; |
| 1962 | 1961 | |
| 1963 | | vblank_line = (state->m_vdp2.pal) ? 288 : 240; |
| 1962 | vblank_line = (m_vdp2.pal) ? 288 : 240; |
| 1964 | 1963 | |
| 1965 | 1964 | if(scanline == vblank_line*y_step) |
| 1966 | | state->m_slave->set_input_line_and_vector(0x6, HOLD_LINE, 0x43); |
| 1965 | m_slave->set_input_line_and_vector(0x6, HOLD_LINE, 0x43); |
| 1967 | 1966 | else if((scanline % y_step) == 0 && scanline < vblank_line*y_step) |
| 1968 | | state->m_slave->set_input_line_and_vector(0x2, HOLD_LINE, 0x41); |
| 1967 | m_slave->set_input_line_and_vector(0x2, HOLD_LINE, 0x41); |
| 1969 | 1968 | } |
| 1970 | 1969 | |
| 1971 | 1970 | /* Die Hard Trilogy tests RAM address 0x25e7ffe bit 2 with Slave during FRT minit irq, in-development tool for breaking execution of it? */ |
| r18139 | r18140 | |
| 2185 | 2184 | MCFG_CPU_ADD("maincpu", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz |
| 2186 | 2185 | MCFG_CPU_PROGRAM_MAP(saturn_mem) |
| 2187 | 2186 | MCFG_CPU_CONFIG(sh2_conf_master) |
| 2188 | | MCFG_TIMER_ADD_SCANLINE("scantimer", saturn_scanline, "screen", 0, 1) |
| 2187 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", saturn_state, saturn_scanline, "screen", 0, 1) |
| 2189 | 2188 | |
| 2190 | 2189 | MCFG_CPU_ADD("slave", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz |
| 2191 | 2190 | MCFG_CPU_PROGRAM_MAP(saturn_mem) |
| 2192 | 2191 | MCFG_CPU_CONFIG(sh2_conf_slave) |
| 2193 | | MCFG_TIMER_ADD_SCANLINE("slave_scantimer", saturn_slave_scanline, "screen", 0, 1) |
| 2192 | MCFG_TIMER_DRIVER_ADD_SCANLINE("slave_scantimer", saturn_state, saturn_slave_scanline, "screen", 0, 1) |
| 2194 | 2193 | |
| 2195 | 2194 | MCFG_CPU_ADD("audiocpu", M68000, 11289600) //256 x 44100 Hz = 11.2896 MHz |
| 2196 | 2195 | MCFG_CPU_PROGRAM_MAP(sound_mem) |
| r18139 | r18140 | |
| 2273 | 2272 | MCFG_CPU_ADD("maincpu", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz |
| 2274 | 2273 | MCFG_CPU_PROGRAM_MAP(stv_mem) |
| 2275 | 2274 | MCFG_CPU_CONFIG(sh2_conf_master) |
| 2276 | | MCFG_TIMER_ADD_SCANLINE("scantimer", saturn_scanline, "screen", 0, 1) |
| 2275 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", saturn_state, saturn_scanline, "screen", 0, 1) |
| 2277 | 2276 | |
| 2278 | 2277 | MCFG_CPU_ADD("slave", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz |
| 2279 | 2278 | MCFG_CPU_PROGRAM_MAP(stv_mem) |
| 2280 | 2279 | MCFG_CPU_CONFIG(sh2_conf_slave) |
| 2281 | | MCFG_TIMER_ADD_SCANLINE("slave_scantimer", saturn_slave_scanline, "screen", 0, 1) |
| 2280 | MCFG_TIMER_DRIVER_ADD_SCANLINE("slave_scantimer", saturn_state, saturn_slave_scanline, "screen", 0, 1) |
| 2282 | 2281 | |
| 2283 | 2282 | MCFG_CPU_ADD("audiocpu", M68000, 11289600) //11.2896 MHz |
| 2284 | 2283 | MCFG_CPU_PROGRAM_MAP(sound_mem) |
trunk/src/mame/drivers/ddenlovr.c
| r18139 | r18140 | |
| 8931 | 8931 | to trigger the blitter irq every frame. |
| 8932 | 8932 | */ |
| 8933 | 8933 | |
| 8934 | | static TIMER_DEVICE_CALLBACK( mjmyster_irq ) |
| 8934 | TIMER_DEVICE_CALLBACK_MEMBER(dynax_state::mjmyster_irq) |
| 8935 | 8935 | { |
| 8936 | | dynax_state *state = timer.machine().driver_data<dynax_state>(); |
| 8937 | 8936 | int scanline = param; |
| 8938 | 8937 | |
| 8939 | 8938 | /* I haven't found a irq ack register, so I need this kludge to |
| 8940 | 8939 | make sure I don't lose any interrupt generated by the blitter, |
| 8941 | 8940 | otherwise quizchq would lock up. */ |
| 8942 | | if (downcast<cpu_device *>(state->m_maincpu)->input_state(0)) |
| 8941 | if (downcast<cpu_device *>(m_maincpu)->input_state(0)) |
| 8943 | 8942 | return; |
| 8944 | 8943 | |
| 8945 | 8944 | if(scanline == 245) |
| 8946 | | state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xf8); |
| 8945 | m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xf8); |
| 8947 | 8946 | |
| 8948 | 8947 | if(scanline == 0) |
| 8949 | | state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xfa); |
| 8948 | m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xfa); |
| 8950 | 8949 | } |
| 8951 | 8950 | |
| 8952 | 8951 | static const ay8910_interface mjmyster_ay8910_interface = |
| r18139 | r18140 | |
| 8985 | 8984 | MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz/2) /* Verified */ |
| 8986 | 8985 | MCFG_CPU_PROGRAM_MAP(mjmyster_map) |
| 8987 | 8986 | MCFG_CPU_IO_MAP(mjmyster_portmap) |
| 8988 | | MCFG_TIMER_ADD_SCANLINE("scantimer", mjmyster_irq, "screen", 0, 1) |
| 8987 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dynax_state, mjmyster_irq, "screen", 0, 1) |
| 8989 | 8988 | |
| 8990 | 8989 | MCFG_DEVICE_MODIFY("rtc") |
| 8991 | 8990 | MCFG_DEVICE_CONFIG(mjmyster_rtc_intf) |
| r18139 | r18140 | |
| 9108 | 9107 | MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz/2) /* Verified */ |
| 9109 | 9108 | MCFG_CPU_PROGRAM_MAP(mjmyster_map) |
| 9110 | 9109 | MCFG_CPU_IO_MAP(mjmyster_portmap) |
| 9111 | | MCFG_TIMER_ADD_SCANLINE("scantimer", mjmyster_irq, "screen", 0, 1) |
| 9110 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dynax_state, mjmyster_irq, "screen", 0, 1) |
| 9112 | 9111 | |
| 9113 | 9112 | MCFG_MACHINE_START_OVERRIDE(dynax_state,mjmyster) |
| 9114 | 9113 | |
| r18139 | r18140 | |
| 9128 | 9127 | MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz/2) /* Verified */ |
| 9129 | 9128 | MCFG_CPU_PROGRAM_MAP(quizchq_map) |
| 9130 | 9129 | MCFG_CPU_IO_MAP(mjmyster_portmap) |
| 9131 | | MCFG_TIMER_ADD_SCANLINE("scantimer", mjmyster_irq, "screen", 0, 1) |
| 9130 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dynax_state, mjmyster_irq, "screen", 0, 1) |
| 9132 | 9131 | |
| 9133 | 9132 | MCFG_MACHINE_START_OVERRIDE(dynax_state,mjmyster) |
| 9134 | 9133 | |
trunk/src/mame/drivers/chinagat.c
| r18139 | r18140 | |
| 108 | 108 | return (vcount - 0x18) | 0x100; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | | static TIMER_DEVICE_CALLBACK( chinagat_scanline ) |
| 111 | TIMER_DEVICE_CALLBACK_MEMBER(ddragon_state::chinagat_scanline) |
| 112 | 112 | { |
| 113 | | ddragon_state *state = timer.machine().driver_data<ddragon_state>(); |
| 114 | 113 | int scanline = param; |
| 115 | | int screen_height = timer.machine().primary_screen->height(); |
| 114 | int screen_height = machine().primary_screen->height(); |
| 116 | 115 | int vcount_old = scanline_to_vcount((scanline == 0) ? screen_height - 1 : scanline - 1); |
| 117 | 116 | int vcount = scanline_to_vcount(scanline); |
| 118 | 117 | |
| 119 | 118 | /* update to the current point */ |
| 120 | 119 | if (scanline > 0) |
| 121 | | timer.machine().primary_screen->update_partial(scanline - 1); |
| 120 | machine().primary_screen->update_partial(scanline - 1); |
| 122 | 121 | |
| 123 | 122 | /* on the rising edge of VBLK (vcount == F8), signal an NMI */ |
| 124 | 123 | if (vcount == 0xf8) |
| 125 | | state->m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); |
| 124 | m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); |
| 126 | 125 | |
| 127 | 126 | /* set 1ms signal on rising edge of vcount & 8 */ |
| 128 | 127 | if (!(vcount_old & 8) && (vcount & 8)) |
| 129 | | state->m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); |
| 128 | m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); |
| 130 | 129 | |
| 131 | 130 | /* adjust for next scanline */ |
| 132 | 131 | if (++scanline >= screen_height) |
| r18139 | r18140 | |
| 571 | 570 | /* basic machine hardware */ |
| 572 | 571 | MCFG_CPU_ADD("maincpu", HD6309, MAIN_CLOCK / 2) /* 1.5 MHz (12MHz oscillator / 4 internally) */ |
| 573 | 572 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 574 | | MCFG_TIMER_ADD_SCANLINE("scantimer", chinagat_scanline, "screen", 0, 1) |
| 573 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", ddragon_state, chinagat_scanline, "screen", 0, 1) |
| 575 | 574 | |
| 576 | 575 | MCFG_CPU_ADD("sub", HD6309, MAIN_CLOCK / 2) /* 1.5 MHz (12MHz oscillator / 4 internally) */ |
| 577 | 576 | MCFG_CPU_PROGRAM_MAP(sub_map) |
| r18139 | r18140 | |
| 611 | 610 | /* basic machine hardware */ |
| 612 | 611 | MCFG_CPU_ADD("maincpu", M6809, MAIN_CLOCK / 8) /* 68B09EP 1.5 MHz (12MHz oscillator) */ |
| 613 | 612 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 614 | | MCFG_TIMER_ADD_SCANLINE("scantimer", chinagat_scanline, "screen", 0, 1) |
| 613 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", ddragon_state, chinagat_scanline, "screen", 0, 1) |
| 615 | 614 | |
| 616 | 615 | MCFG_CPU_ADD("sub", M6809, MAIN_CLOCK / 8) /* 68B09EP 1.5 MHz (12MHz oscillator) */ |
| 617 | 616 | MCFG_CPU_PROGRAM_MAP(sub_map) |
| r18139 | r18140 | |
| 656 | 655 | /* basic machine hardware */ |
| 657 | 656 | MCFG_CPU_ADD("maincpu", M6809, MAIN_CLOCK / 8) /* 1.5 MHz (12MHz oscillator) */ |
| 658 | 657 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 659 | | MCFG_TIMER_ADD_SCANLINE("scantimer", chinagat_scanline, "screen", 0, 1) |
| 658 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", ddragon_state, chinagat_scanline, "screen", 0, 1) |
| 660 | 659 | |
| 661 | 660 | MCFG_CPU_ADD("sub", M6809, MAIN_CLOCK / 8) /* 1.5 MHz (12MHz oscillator) */ |
| 662 | 661 | MCFG_CPU_PROGRAM_MAP(sub_map) |
trunk/src/mess/drivers/geneve.c
| r18139 | r18140 | |
| 260 | 260 | DECLARE_DRIVER_INIT(geneve); |
| 261 | 261 | virtual void machine_start(); |
| 262 | 262 | virtual void machine_reset(); |
| 263 | TIMER_DEVICE_CALLBACK_MEMBER(geneve_hblank_interrupt); |
| 263 | 264 | |
| 264 | 265 | void set_tms9901_INT2_from_v9938(v99x8_device &vdp, int state); |
| 265 | 266 | |
| r18139 | r18140 | |
| 634 | 635 | /* |
| 635 | 636 | scanline interrupt |
| 636 | 637 | */ |
| 637 | | TIMER_DEVICE_CALLBACK( geneve_hblank_interrupt ) |
| 638 | TIMER_DEVICE_CALLBACK_MEMBER(geneve::geneve_hblank_interrupt) |
| 638 | 639 | { |
| 639 | 640 | int scanline = param; |
| 640 | | geneve *driver = timer.machine().driver_data<geneve>(); |
| 641 | 641 | |
| 642 | | timer.machine().device<v9938_device>(VDP_TAG)->interrupt(); |
| 642 | machine().device<v9938_device>(VDP_TAG)->interrupt(); |
| 643 | 643 | |
| 644 | 644 | if (scanline == 0) // was 262 |
| 645 | 645 | { |
| r18139 | r18140 | |
| 649 | 649 | // per vertical interrupt; however, the mouse sometimes shows jerky |
| 650 | 650 | // behaviour. Maybe we should use an autonomous timer with a higher |
| 651 | 651 | // rate? -> to be checked |
| 652 | | driver->m_mouse->poll(); |
| 652 | m_mouse->poll(); |
| 653 | 653 | } |
| 654 | 654 | } |
| 655 | 655 | |
| r18139 | r18140 | |
| 763 | 763 | // painted. Accordingly, the full set of lines is refreshed at 30 Hz, |
| 764 | 764 | // not 60 Hz. This should be fixed in the v9938 emulation. |
| 765 | 765 | MCFG_TI_V9938_ADD(VIDEO_SYSTEM_TAG, 30, SCREEN_TAG, 2500, 512+32, (212+28)*2, DEVICE_SELF, geneve, set_tms9901_INT2_from_v9938) |
| 766 | | MCFG_TIMER_ADD_SCANLINE("scantimer", geneve_hblank_interrupt, SCREEN_TAG, 0, 1) /* 262.5 in 60Hz, 312.5 in 50Hz */ |
| 766 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", geneve, geneve_hblank_interrupt, SCREEN_TAG, 0, 1) /* 262.5 in 60Hz, 312.5 in 50Hz */ |
| 767 | 767 | |
| 768 | 768 | // Main board components |
| 769 | 769 | MCFG_TMS9901_ADD(TMS9901_TAG, tms9901_wiring_geneve, 3000000) |
trunk/src/mess/drivers/tm990189.c
| r18139 | r18140 | |
| 144 | 144 | DECLARE_MACHINE_RESET(tm990_189); |
| 145 | 145 | DECLARE_MACHINE_START(tm990_189_v); |
| 146 | 146 | DECLARE_MACHINE_RESET(tm990_189_v); |
| 147 | |
| 148 | TIMER_DEVICE_CALLBACK_MEMBER(display_callback); |
| 147 | 149 | private: |
| 148 | 150 | void draw_digit(void); |
| 149 | 151 | void led_set(int number, bool state); |
| r18139 | r18140 | |
| 247 | 249 | } |
| 248 | 250 | |
| 249 | 251 | |
| 250 | | static TIMER_DEVICE_CALLBACK( display_callback ) |
| 252 | TIMER_DEVICE_CALLBACK_MEMBER(tm990189::display_callback) |
| 251 | 253 | { |
| 252 | | tm990189 *state = timer.machine().driver_data<tm990189>(); |
| 253 | 254 | UINT8 i; |
| 254 | 255 | char ledname[8]; |
| 255 | 256 | // since the segment data is cleared after being used, the old_segment is there |
| 256 | 257 | // in case the segment data hasn't been refreshed yet. |
| 257 | 258 | for (i = 0; i < 10; i++) |
| 258 | 259 | { |
| 259 | | state->m_old_segment_state[i] |= state->m_segment_state[i]; |
| 260 | m_old_segment_state[i] |= m_segment_state[i]; |
| 260 | 261 | sprintf(ledname,"digit%d",i); |
| 261 | | output_set_digit_value(i, state->m_old_segment_state[i]); |
| 262 | | state->m_old_segment_state[i] = state->m_segment_state[i]; |
| 263 | | state->m_segment_state[i] = 0; |
| 262 | output_set_digit_value(i, m_old_segment_state[i]); |
| 263 | m_old_segment_state[i] = m_segment_state[i]; |
| 264 | m_segment_state[i] = 0; |
| 264 | 265 | } |
| 265 | 266 | |
| 266 | 267 | for (i = 0; i < 7; i++) |
| 267 | 268 | { |
| 268 | 269 | sprintf(ledname,"led%d",i); |
| 269 | | output_set_value(ledname, !BIT(state->m_LED_state, i)); |
| 270 | output_set_value(ledname, !BIT(m_LED_state, i)); |
| 270 | 271 | } |
| 271 | 272 | } |
| 272 | 273 | |
| r18139 | r18140 | |
| 855 | 856 | MCFG_TMS9901_ADD("tms9901_1", sys9901reset_param, 2000000) |
| 856 | 857 | MCFG_TMS9902_ADD("tms9902", tms9902_params, 2000000) |
| 857 | 858 | MCFG_TM990_189_RS232_ADD("rs232") |
| 858 | | MCFG_TIMER_ADD_PERIODIC("display_timer", display_callback, attotime::from_hz(30)) |
| 859 | MCFG_TIMER_DRIVER_ADD_PERIODIC("display_timer", tm990189, display_callback, attotime::from_hz(30)) |
| 859 | 860 | // Need to delay the timer, or it will spoil the initial LOAD |
| 860 | 861 | // TODO: Fix this, probably inside CPU |
| 861 | 862 | MCFG_TIMER_START_DELAY(attotime::from_msec(150)) |
| r18139 | r18140 | |
| 887 | 888 | MCFG_TMS9901_ADD("tms9901_1", sys9901reset_param, 2000000) |
| 888 | 889 | MCFG_TMS9902_ADD("tms9902", tms9902_params, 2000000) |
| 889 | 890 | MCFG_TM990_189_RS232_ADD("rs232") |
| 890 | | MCFG_TIMER_ADD_PERIODIC("display_timer", display_callback, attotime::from_hz(30)) |
| 891 | MCFG_TIMER_DRIVER_ADD_PERIODIC("display_timer", tm990189, display_callback, attotime::from_hz(30)) |
| 891 | 892 | MCFG_TIMER_START_DELAY(attotime::from_msec(150)) |
| 892 | 893 | MACHINE_CONFIG_END |
| 893 | 894 | |