src/mame/drivers/igs017.c
| r15226 | r15227 | |
| 80 | 80 | UINT8 m_hopper; |
| 81 | 81 | UINT16 m_igs_magic[2]; |
| 82 | 82 | UINT8 m_scramble_data; |
| 83 | | UINT8 m_prot[2]; |
| 84 | 83 | int m_irq1_enable; |
| 84 | |
| 85 | // lhzb2a protection: |
| 86 | UINT16 m_prot_regs[2], m_prot_val, m_prot_word, m_prot_m3, m_prot_mf; |
| 87 | UINT8 m_prot2; |
| 88 | |
| 85 | 89 | int m_irq2_enable; |
| 86 | 90 | DECLARE_WRITE8_MEMBER(video_disable_w); |
| 87 | 91 | DECLARE_WRITE16_MEMBER(video_disable_lsb_w); |
| r15226 | r15227 | |
| 116 | 120 | DECLARE_READ16_MEMBER(lhzb2a_input_r); |
| 117 | 121 | DECLARE_WRITE16_MEMBER(lhzb2a_input_addr_w); |
| 118 | 122 | DECLARE_WRITE16_MEMBER(lhzb2a_input_select_w); |
| 119 | | DECLARE_WRITE16_MEMBER(lhzb2a_magic_w); |
| 120 | | DECLARE_READ16_MEMBER(lhzb2a_magic_r); |
| 123 | |
| 124 | DECLARE_WRITE16_MEMBER(lhzb2a_prot_w); |
| 125 | DECLARE_READ16_MEMBER(lhzb2a_prot_r); |
| 126 | |
| 127 | DECLARE_WRITE16_MEMBER(lhzb2a_prot2_reset_w); |
| 128 | DECLARE_WRITE16_MEMBER(lhzb2a_prot2_inc_w); |
| 129 | DECLARE_WRITE16_MEMBER(lhzb2a_prot2_dec_w); |
| 130 | DECLARE_READ16_MEMBER(lhzb2a_prot2_r); |
| 131 | |
| 121 | 132 | DECLARE_WRITE16_MEMBER(lhzb2_magic_w); |
| 122 | 133 | DECLARE_READ16_MEMBER(lhzb2_magic_r); |
| 123 | 134 | DECLARE_WRITE16_MEMBER(slqz2_paletteram_w); |
| r15226 | r15227 | |
| 1031 | 1042 | |
| 1032 | 1043 | //lhzb2a |
| 1033 | 1044 | |
| 1034 | | static void lhzb2a_patch_rom(running_machine &machine) |
| 1035 | | { |
| 1036 | | UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base(); |
| 1037 | | |
| 1038 | | // Prot. checks: |
| 1039 | | rom[0x09c52/2] = 0x6026; // 009C52: 6726 beq $9c7a |
| 1040 | | rom[0x0c62c/2] = 0x6026; // 00C62C: 6726 beq $c654 |
| 1041 | | rom[0x0ea10/2] = 0x6030; // 00EA10: 6730 beq $ea42 |
| 1042 | | rom[0x23472/2] = 0x6026; // 023472: 6726 beq $2349a |
| 1043 | | rom[0x6601a/2] = 0x6024; // 06601A: 6724 beq $66040 |
| 1044 | | |
| 1045 | | // ROM check: |
| 1046 | | rom[0x32ab6/2] = 0x604e; // 032AB6: 674E beq $32b06 |
| 1047 | | } |
| 1048 | | |
| 1049 | 1045 | static DRIVER_INIT( lhzb2a ) |
| 1050 | 1046 | { |
| 1051 | 1047 | int i; |
| r15226 | r15227 | |
| 1106 | 1102 | |
| 1107 | 1103 | lhzb2_decrypt_tiles(machine); |
| 1108 | 1104 | lhzb2_decrypt_sprites(machine); |
| 1109 | | lhzb2a_patch_rom(machine); |
| 1110 | 1105 | } |
| 1111 | 1106 | |
| 1112 | 1107 | |
| r15226 | r15227 | |
| 1832 | 1827 | // lhzb2a |
| 1833 | 1828 | // To do: what devices are on this PCB? |
| 1834 | 1829 | |
| 1830 | /*************************************************************************** |
| 1835 | 1831 | |
| 1836 | | WRITE16_MEMBER(igs017_state::lhzb2a_magic_w) |
| 1832 | LHZB2A Protection (similar to that found in igs011.c) |
| 1833 | |
| 1834 | ---- Protection 1 (parametric bitswaps) ---- |
| 1835 | |
| 1836 | An address base register (xx = F0 at reset) determines where this protection device, |
| 1837 | as well as game inputs and the address base register itself are mapped in memory: |
| 1838 | inputs are mapped at xx8000, protection at xx4000 and base register at xxc000. |
| 1839 | |
| 1840 | The protection involves an internal 16-bit value (val), two mode registers |
| 1841 | (mode_f = 0..f, mode_3 = 0..3) and 8 x 16-bit registers (word). |
| 1842 | |
| 1843 | The two modes affect the bitswap, and are set by loading the (same) mode-specific value |
| 1844 | to all the word registers, and then writing to the mode_f or mode_3 trigger register. |
| 1845 | |
| 1846 | The bitswap of the internal value is then performed writing to one of 8 trigger registers, |
| 1847 | according to the modes, trigger register and value written. |
| 1848 | |
| 1849 | The result is read through a fixed bitswap of the internal value. |
| 1850 | |
| 1851 | ---- Protection 2 (simple inc,dec + bitswapped read) ---- |
| 1852 | |
| 1853 | The chip holds an internal 8-bit value. It is manipulated by issuing commands, |
| 1854 | where each command is assigned a specific address range, and is triggered |
| 1855 | by writing FF to that range. Possible commands: |
| 1856 | |
| 1857 | - INC: increment value |
| 1858 | - DEC: decrement value |
| 1859 | - RESET: value = 0 |
| 1860 | |
| 1861 | The protection value is read from an additional address range: |
| 1862 | |
| 1863 | - READ: read bitswap(value). Only 4 bits are checked. |
| 1864 | |
| 1865 | ***************************************************************************/ |
| 1866 | |
| 1867 | // Bitswap protection |
| 1868 | |
| 1869 | WRITE16_MEMBER(igs017_state::lhzb2a_prot_w) |
| 1837 | 1870 | { |
| 1838 | | COMBINE_DATA(&m_igs_magic[offset]); |
| 1871 | COMBINE_DATA(&m_prot_regs[offset]); |
| 1839 | 1872 | |
| 1840 | 1873 | if (offset == 0) |
| 1841 | 1874 | return; |
| 1842 | 1875 | |
| 1843 | | switch(m_igs_magic[0]) |
| 1876 | switch(m_prot_regs[0]) |
| 1844 | 1877 | { |
| 1845 | | // to do: m_prot values |
| 1878 | case 0x40: // prot_word |
| 1879 | { |
| 1880 | m_prot_word = (m_prot_word << 8) | (m_prot_regs[1] & 0xff); |
| 1881 | break; |
| 1882 | } |
| 1883 | case 0x41: |
| 1884 | case 0x42: |
| 1885 | case 0x43: |
| 1886 | case 0x44: |
| 1887 | case 0x45: |
| 1888 | case 0x46: |
| 1889 | case 0x47: |
| 1890 | // same value as reg 0x40 |
| 1891 | break; |
| 1892 | |
| 1893 | case 0x48: // mode_f |
| 1894 | { |
| 1895 | switch (m_prot_word) |
| 1896 | { |
| 1897 | case 0x9a96: m_prot_mf = 0x0; break; |
| 1898 | case 0x9a06: m_prot_mf = 0x1; break; |
| 1899 | case 0x9a90: m_prot_mf = 0x2; break; |
| 1900 | case 0x9a00: m_prot_mf = 0x3; break; |
| 1901 | case 0x0a96: m_prot_mf = 0x4; break; |
| 1902 | case 0x0a06: m_prot_mf = 0x5; break; |
| 1903 | case 0x0a90: m_prot_mf = 0x6; break; |
| 1904 | case 0x0a00: m_prot_mf = 0x7; break; |
| 1905 | case 0x9096: m_prot_mf = 0x8; break; |
| 1906 | case 0x9006: m_prot_mf = 0x9; break; |
| 1907 | case 0x9090: m_prot_mf = 0xa; break; |
| 1908 | case 0x9000: m_prot_mf = 0xb; break; |
| 1909 | case 0x0096: m_prot_mf = 0xc; break; |
| 1910 | case 0x0006: m_prot_mf = 0xd; break; |
| 1911 | case 0x0090: m_prot_mf = 0xe; break; |
| 1912 | case 0x0000: m_prot_mf = 0xf; break; |
| 1913 | default: |
| 1914 | m_prot_mf = 0; |
| 1915 | logerror("%s: warning, setting mode_f with unknown prot_word = %02x\n", machine().describe_context(), m_prot_word); |
| 1916 | return; |
| 1917 | } |
| 1918 | |
| 1919 | logerror("%s: mode_f = %02x\n", machine().describe_context(), m_prot_mf); |
| 1920 | break; |
| 1921 | } |
| 1922 | |
| 1923 | case 0x50: // mode_3 |
| 1924 | { |
| 1925 | switch (m_prot_word & 0xff) |
| 1926 | { |
| 1927 | case 0x53: m_prot_m3 = 0x0; break; |
| 1928 | case 0x03: m_prot_m3 = 0x1; break; |
| 1929 | case 0x50: m_prot_m3 = 0x2; break; |
| 1930 | case 0x00: m_prot_m3 = 0x3; break; |
| 1931 | default: |
| 1932 | m_prot_m3 = 0; |
| 1933 | logerror("%s: warning, setting mode_3 with unknown prot_word = %02x\n", machine().describe_context(), m_prot_word); |
| 1934 | return; |
| 1935 | } |
| 1936 | |
| 1937 | logerror("%s: mode_3 = %02x\n", machine().describe_context(), m_prot_m3); |
| 1938 | break; |
| 1939 | } |
| 1940 | |
| 1941 | case 0x80: // do bitswap |
| 1942 | case 0x81: |
| 1943 | case 0x82: |
| 1944 | case 0x83: |
| 1945 | case 0x84: |
| 1946 | case 0x85: |
| 1947 | case 0x86: |
| 1948 | case 0x87: |
| 1949 | { |
| 1950 | UINT16 x = m_prot_val; |
| 1951 | UINT16 mf = m_prot_mf; |
| 1952 | |
| 1953 | UINT16 bit0 = 0; |
| 1954 | switch (m_prot_m3) |
| 1955 | { |
| 1956 | case 0: bit0 = BIT(~x,12) ^ BIT(~x,15) ^ BIT( x, 8) ^ BIT(~x, 3); break; |
| 1957 | case 1: bit0 = BIT(~x, 6) ^ BIT(~x,15) ^ BIT(~x, 3) ^ BIT(~x, 9); break; |
| 1958 | case 2: bit0 = BIT(~x, 3) ^ BIT(~x,15) ^ BIT(~x, 5) ^ BIT( x, 4); break; |
| 1959 | case 3: bit0 = BIT(~x,15) ^ BIT(~x, 9) ^ BIT( x,12) ^ BIT(~x,11); break; |
| 1960 | } |
| 1961 | |
| 1962 | UINT16 xor0 = BIT(m_prot_regs[1], m_prot_regs[0] - 0x80); |
| 1963 | bit0 ^= xor0; |
| 1964 | |
| 1965 | m_prot_val = ( BIT( x,14) << 15 ) | |
| 1966 | ( (BIT(~x,13) ^ BIT(mf,3)) << 14 ) | |
| 1967 | ( BIT( x,12) << 13 ) | |
| 1968 | ( BIT(~x,11) << 12 ) | |
| 1969 | ( (BIT( x,10) ^ BIT(mf,2)) << 11 ) | |
| 1970 | ( BIT( x, 9) << 10 ) | |
| 1971 | ( BIT( x, 8) << 9 ) | |
| 1972 | ( (BIT(~x, 7) ^ BIT(mf,1)) << 8 ) | |
| 1973 | ( BIT( x, 6) << 7 ) | |
| 1974 | ( BIT( x, 5) << 6 ) | |
| 1975 | ( (BIT(~x, 4) ^ BIT(mf,0)) << 5 ) | |
| 1976 | ( BIT(~x, 3) << 4 ) | |
| 1977 | ( BIT( x, 2) << 3 ) | |
| 1978 | ( BIT(~x, 1) << 2 ) | |
| 1979 | ( BIT( x, 0) << 1 ) | |
| 1980 | ( bit0 << 0 ) ; |
| 1981 | |
| 1982 | logerror("%s: exec bitswap - mode_3 %02x, mode_f %02x, xor0 %x, val %04x -> %04x\n", machine().describe_context(), m_prot_m3, m_prot_mf, xor0, x, m_prot_val); |
| 1983 | |
| 1984 | break; |
| 1985 | } |
| 1986 | |
| 1987 | case 0xa0: // reset |
| 1988 | { |
| 1989 | m_prot_val = 0; |
| 1990 | break; |
| 1991 | } |
| 1992 | |
| 1846 | 1993 | default: |
| 1847 | | logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_igs_magic[0], data); |
| 1994 | logerror("%s: warning, writing to prot_reg %02x = %02x\n", machine().describe_context(), m_prot_regs[0], m_prot_regs[1]); |
| 1848 | 1995 | } |
| 1849 | 1996 | } |
| 1850 | 1997 | |
| 1851 | | READ16_MEMBER(igs017_state::lhzb2a_magic_r) |
| 1998 | READ16_MEMBER(igs017_state::lhzb2a_prot_r) |
| 1852 | 1999 | { |
| 1853 | | switch(m_igs_magic[0]) |
| 2000 | switch(m_prot_regs[0]) |
| 1854 | 2001 | { |
| 1855 | | case 0x03: |
| 2002 | case 0x03: // result |
| 1856 | 2003 | { |
| 1857 | | UINT8 a = BITSWAP8((UINT16)m_prot[0], 9,9,1,9,2,5,4,7); // 9 means 0 value |
| 1858 | | UINT8 b = BITSWAP8((UINT16)m_prot[1], 5,2,9,7,9,9,9,9); |
| 1859 | | return a | b; |
| 2004 | UINT16 x = m_prot_val; |
| 2005 | UINT16 res = (BIT(x, 5) << 7) | |
| 2006 | (BIT(x, 2) << 6) | |
| 2007 | (BIT(x, 9) << 5) | |
| 2008 | (BIT(x, 7) << 4) | |
| 2009 | (BIT(x,10) << 3) | |
| 2010 | (BIT(x,13) << 2) | |
| 2011 | (BIT(x,12) << 1) | |
| 2012 | (BIT(x,15) << 0) ; |
| 2013 | |
| 2014 | logerror("%s: read bitswap - val %04x -> %02x\n", machine().describe_context(), m_prot_val, res); |
| 2015 | return res; |
| 2016 | |
| 2017 | break; |
| 1860 | 2018 | } |
| 1861 | 2019 | |
| 1862 | 2020 | default: |
| 1863 | | logerror("%s: warning, reading with igs_magic = %02x\n", machine().describe_context(), m_igs_magic[0]); |
| 2021 | logerror("%s: warning, reading with prot_reg = %02x\n", machine().describe_context(), m_prot_regs[0]); |
| 1864 | 2022 | break; |
| 1865 | 2023 | } |
| 1866 | 2024 | |
| 1867 | 2025 | return 0xffff; |
| 1868 | 2026 | } |
| 1869 | 2027 | |
| 2028 | // Protection 2 |
| 2029 | |
| 2030 | WRITE16_MEMBER(igs017_state::lhzb2a_prot2_reset_w) |
| 2031 | { |
| 2032 | m_prot2 = 0x00; |
| 2033 | logerror("%s: prot2 reset -> %02x\n", machine().describe_context(), m_prot2); |
| 2034 | } |
| 2035 | |
| 2036 | WRITE16_MEMBER(igs017_state::lhzb2a_prot2_inc_w) |
| 2037 | { |
| 2038 | m_prot2++; |
| 2039 | logerror("%s: prot2 inc -> %02x\n", machine().describe_context(), m_prot2); |
| 2040 | } |
| 2041 | |
| 2042 | WRITE16_MEMBER(igs017_state::lhzb2a_prot2_dec_w) |
| 2043 | { |
| 2044 | m_prot2--; |
| 2045 | logerror("%s: prot2 dec -> %02x\n", machine().describe_context(), m_prot2); |
| 2046 | } |
| 2047 | |
| 2048 | READ16_MEMBER(igs017_state::lhzb2a_prot2_r) |
| 2049 | { |
| 2050 | UINT8 x = m_prot2; |
| 2051 | UINT8 res = (BIT(x, 0) << 7) | |
| 2052 | (BIT(x, 3) << 5) | |
| 2053 | (BIT(x, 2) << 4) | |
| 2054 | (BIT(x, 1) << 2) ; |
| 2055 | |
| 2056 | logerror("%s: prot2 read, %02x -> %02x\n", machine().describe_context(), m_prot2, res); |
| 2057 | return res; |
| 2058 | } |
| 2059 | |
| 2060 | |
| 2061 | |
| 1870 | 2062 | WRITE16_MEMBER(igs017_state::lhzb2a_paletteram_w) |
| 1871 | 2063 | { |
| 1872 | 2064 | COMBINE_DATA(&m_generic_paletteram_16[offset]); |
| r15226 | r15227 | |
| 1921 | 2113 | m_input_addr = data & 0xff; |
| 1922 | 2114 | |
| 1923 | 2115 | // Add new memory ranges |
| 1924 | | space.install_readwrite_handler (m_input_addr * 0x10000 + 0x4000, m_input_addr * 0x10000 + 0x4003, read16_delegate (FUNC(igs017_state::lhzb2a_magic_r), this), write16_delegate (FUNC(igs017_state::lhzb2a_magic_w), this)); |
| 2116 | space.install_readwrite_handler (m_input_addr * 0x10000 + 0x4000, m_input_addr * 0x10000 + 0x4003, read16_delegate (FUNC(igs017_state::lhzb2a_prot_r), this), write16_delegate (FUNC(igs017_state::lhzb2a_prot_w), this)); |
| 1925 | 2117 | space.install_read_handler (m_input_addr * 0x10000 + 0x8000, m_input_addr * 0x10000 + 0x8005, read16_delegate (FUNC(igs017_state::lhzb2a_input_r), this)); |
| 1926 | 2118 | space.install_write_handler (m_input_addr * 0x10000 + 0xc000, m_input_addr * 0x10000 + 0xc001, write16_delegate(FUNC(igs017_state::lhzb2a_input_addr_w), this)); |
| 2119 | |
| 2120 | logerror("%s: inputs and protection remapped at %02xxxxx\n", machine().describe_context(), m_input_addr); |
| 1927 | 2121 | } |
| 1928 | 2122 | |
| 1929 | 2123 | WRITE16_MEMBER(igs017_state::lhzb2a_input_select_w) |
| r15226 | r15227 | |
| 1946 | 2140 | } |
| 1947 | 2141 | |
| 1948 | 2142 | static ADDRESS_MAP_START( lhzb2a, AS_PROGRAM, 16, igs017_state ) |
| 2143 | // prot2 |
| 2144 | AM_RANGE(0x003200, 0x003201) AM_WRITE( lhzb2a_prot2_reset_w ) |
| 2145 | AM_RANGE(0x003202, 0x003203) AM_WRITE( lhzb2a_prot2_dec_w ) |
| 2146 | AM_RANGE(0x003206, 0x003207) AM_WRITE( lhzb2a_prot2_inc_w ) |
| 2147 | AM_RANGE(0x00320a, 0x00320b) AM_READ( lhzb2a_prot2_r ) |
| 2148 | |
| 1949 | 2149 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 1950 | 2150 | AM_RANGE(0x500000, 0x503fff) AM_RAM |
| 1951 | | // AM_RANGE(0x910000, 0x910003) protection |
| 2151 | // AM_RANGE(0x910000, 0x910003) accesses appear to be from leftover code where the final checks were disabled |
| 1952 | 2152 | AM_RANGE(0xb02000, 0xb02fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram") |
| 1953 | 2153 | AM_RANGE(0xb03000, 0xb037ff) AM_RAM_WRITE( lhzb2a_paletteram_w ) AM_SHARE("paletteram") |
| 1954 | 2154 | AM_RANGE(0xb04024, 0xb04025) AM_WRITE( video_disable_lsb_w ) |
| r15226 | r15227 | |
| 2327 | 2527 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2328 | 2528 | |
| 2329 | 2529 | PORT_START("COINS") |
| 2330 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) // shown in test mode |
| 2530 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2331 | 2531 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) // hopper switch |
| 2332 | 2532 | PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW ) // keep pressed while booting |
| 2333 | 2533 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Statistics") // press with the above for sound test |
| 2334 | 2534 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) |
| 2335 | 2535 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O) |
| 2536 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 ) // shown in test mode |
| 2537 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2336 | 2538 | |
| 2337 | 2539 | PORT_START("KEY0") |
| 2338 | 2540 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) |
src/emu/machine/68681.c
| r15226 | r15227 | |
| 3 | 3 | |
| 4 | 4 | Written by Mariusz Wojcieszek |
| 5 | 5 | Updated by Jonathan Gevaryahu AKA Lord Nightmare |
| 6 | Improved interrupt handling by R. Belmont |
| 6 | 7 | */ |
| 7 | 8 | |
| 8 | 9 | #include "emu.h" |
| r15226 | r15227 | |
| 230 | 231 | if ( duart68681->duart_config->irq_handler ) |
| 231 | 232 | { |
| 232 | 233 | LOG(( "68681: Interrupt line active (IMR & ISR = %02X)\n", (duart68681->ISR & duart68681->IMR) )); |
| 233 | | duart68681->duart_config->irq_handler( duart68681->device, duart68681->IVR ); |
| 234 | duart68681->duart_config->irq_handler( duart68681->device, ASSERT_LINE, duart68681->IVR ); |
| 234 | 235 | } |
| 235 | 236 | } |
| 237 | else |
| 238 | { |
| 239 | if ( duart68681->duart_config->irq_handler ) |
| 240 | { |
| 241 | LOG(( "68681: Interrupt line not active (IMR & ISR = %02X)\n", (duart68681->ISR & duart68681->IMR) )); |
| 242 | duart68681->duart_config->irq_handler( duart68681->device, CLEAR_LINE, duart68681->IVR ); |
| 243 | } |
| 244 | } |
| 236 | 245 | }; |
| 237 | 246 | |
| 238 | 247 | static TIMER_CALLBACK( duart_timer_callback ) |
| r15226 | r15227 | |
| 336 | 345 | else |
| 337 | 346 | duart68681->ISR &= ~INT_TXRDYB; |
| 338 | 347 | duart68681->channel[ch].tx_timer->adjust(attotime::never, ch); |
| 339 | | break; |
| 348 | break; |
| 340 | 349 | case 4: /* Reset Error Status */ |
| 341 | 350 | duart68681->channel[ch].SR &= ~(STATUS_RECEIVED_BREAK | STATUS_FRAMING_ERROR | STATUS_PARITY_ERROR | STATUS_OVERRUN_ERROR); |
| 342 | 351 | break; |
| r15226 | r15227 | |
| 355 | 364 | LOG(( "68681: Unhandled command (%x) in CR%d\n", (data >> 4) & 0x07, ch )); |
| 356 | 365 | break; |
| 357 | 366 | } |
| 358 | | duart68681_update_interrupts(duart68681); |
| 359 | 367 | |
| 360 | 368 | if (BIT(data, 0)) { |
| 361 | 369 | duart68681->channel[ch].rx_enabled = 1; |
| r15226 | r15227 | |
| 384 | 392 | duart68681->ISR &= ~INT_TXRDYB; |
| 385 | 393 | } |
| 386 | 394 | |
| 395 | duart68681_update_interrupts(duart68681); |
| 387 | 396 | }; |
| 388 | 397 | |
| 389 | 398 | static UINT8 duart68681_read_rx_fifo(duart68681_state *duart68681, int ch) |
| r15226 | r15227 | |
| 613 | 622 | break; |
| 614 | 623 | case 0x06: /* Timer, CLK/1 */ // Timer modes start without reading address 0xe, as per the Freescale 68681 manual |
| 615 | 624 | { |
| 616 | | attotime rate = attotime::from_hz(2*device->clock()/(2*16*duart68681->CTR.w.l)); |
| 625 | attotime rate; |
| 626 | if (duart68681->CTR.w.l > 0) |
| 627 | { |
| 628 | rate = attotime::from_hz(2*device->clock()/(2*16*duart68681->CTR.w.l)); |
| 629 | } |
| 630 | else |
| 631 | { |
| 632 | rate = attotime::from_hz(2*device->clock()/(2*16*0x10000)); |
| 633 | } |
| 617 | 634 | duart68681->duart_timer->adjust(rate, 0, rate); |
| 618 | 635 | } |
| 619 | 636 | break; |
| r15226 | r15227 | |
| 621 | 638 | { |
| 622 | 639 | //double hz; |
| 623 | 640 | //attotime rate = attotime::from_hz(duart68681->clock) * (16*duart68681->CTR.w.l); |
| 624 | | attotime rate = attotime::from_hz(2*device->clock()/(2*16*16*duart68681->CTR.w.l)); |
| 625 | | //hz = ATTOSECONDS_TO_HZ(rate.attoseconds); |
| 641 | attotime rate; |
| 642 | if (duart68681->CTR.w.l > 0) |
| 643 | { |
| 644 | rate = attotime::from_hz(2*device->clock()/(2*16*16*duart68681->CTR.w.l)); |
| 626 | 645 | |
| 627 | | // workaround for maygay1b locking up MAME |
| 628 | | if ((2*device->clock()/(2*16*16*duart68681->CTR.w.l)) == 0) |
| 646 | // workaround for maygay1b locking up MAME |
| 647 | if ((2*device->clock()/(2*16*16*duart68681->CTR.w.l)) == 0) |
| 648 | { |
| 649 | rate = attotime::from_hz(1); |
| 650 | } |
| 651 | } |
| 652 | else |
| 629 | 653 | { |
| 630 | | rate = attotime::from_hz(1); |
| 654 | if (2*device->clock()/(2*16*16*0x10000) == 0) |
| 655 | { |
| 656 | rate = attotime::from_hz(1); |
| 657 | } |
| 658 | else |
| 659 | { |
| 660 | rate = attotime::from_hz(2*device->clock()/(2*16*16*0x10000)); |
| 661 | } |
| 631 | 662 | } |
| 663 | |
| 664 | //hz = ATTOSECONDS_TO_HZ(rate.attoseconds); |
| 632 | 665 | |
| 633 | 666 | duart68681->duart_timer->adjust(rate, 0, rate); |
| 634 | 667 | } |
src/mess/drivers/atari400.c
| r15226 | r15227 | |
| 250 | 250 | AM_RANGE(0xc000, 0xcfff) AM_ROM |
| 251 | 251 | AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w) |
| 252 | 252 | AM_RANGE(0xd100, 0xd1ff) AM_NOP |
| 253 | | AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) |
| 253 | AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) |
| 254 | 254 | AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) |
| 255 | 255 | AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w) |
| 256 | 256 | AM_RANGE(0xd500, 0xd7ff) AM_NOP |
| r15226 | r15227 | |
| 265 | 265 | AM_RANGE(0xc000, 0xcfff) AM_ROM |
| 266 | 266 | AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w) |
| 267 | 267 | AM_RANGE(0xd100, 0xd1ff) AM_NOP |
| 268 | | AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) |
| 268 | AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) |
| 269 | 269 | AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) |
| 270 | 270 | AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w) |
| 271 | 271 | AM_RANGE(0xd500, 0xd7ff) AM_NOP |
| r15226 | r15227 | |
| 280 | 280 | AM_RANGE(0xc000, 0xcfff) AM_ROM /* OS */ |
| 281 | 281 | AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w) |
| 282 | 282 | AM_RANGE(0xd100, 0xd1ff) AM_NOP |
| 283 | | AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) |
| 283 | AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) |
| 284 | 284 | AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) |
| 285 | 285 | AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w) |
| 286 | 286 | AM_RANGE(0xd500, 0xd7ff) AM_NOP |
| r15226 | r15227 | |
| 296 | 296 | AM_RANGE(0xc000, 0xcfff) AM_RAMBANK("bank3") |
| 297 | 297 | AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w) |
| 298 | 298 | AM_RANGE(0xd100, 0xd1ff) AM_NOP |
| 299 | | AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) |
| 299 | AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) |
| 300 | 300 | AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) |
| 301 | 301 | AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w) |
| 302 | 302 | AM_RANGE(0xd500, 0xd7ff) AM_NOP |
| r15226 | r15227 | |
| 312 | 312 | AM_RANGE(0xc000, 0xcfff) AM_RAMBANK("bank3") |
| 313 | 313 | AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w) |
| 314 | 314 | AM_RANGE(0xd100, 0xd1ff) AM_NOP |
| 315 | | AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) |
| 315 | AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) |
| 316 | 316 | AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt) |
| 317 | 317 | AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w) |
| 318 | 318 | AM_RANGE(0xd500, 0xd7ff) AM_NOP |
| r15226 | r15227 | |
| 325 | 325 | AM_RANGE(0x4000, 0xbfff) AM_ROM |
| 326 | 326 | AM_RANGE(0xc000, 0xc0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w) |
| 327 | 327 | AM_RANGE(0xd400, 0xd5ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w) |
| 328 | | AM_RANGE(0xe800, 0xe8ff) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) |
| 328 | AM_RANGE(0xe800, 0xe8ff) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) |
| 329 | 329 | AM_RANGE(0xf800, 0xffff) AM_ROM |
| 330 | 330 | ADDRESS_MAP_END |
| 331 | 331 | |
| r15226 | r15227 | |
| 1098 | 1098 | |
| 1099 | 1099 | /* sound hardware */ |
| 1100 | 1100 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 1101 | | MCFG_SOUND_ADD("pokey", POKEY, FREQ_17_EXACT) |
| 1101 | MCFG_SOUND_ADD("pokey", POKEYN, FREQ_17_EXACT) |
| 1102 | 1102 | MCFG_SOUND_CONFIG(atari_pokey_interface) |
| 1103 | 1103 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1104 | 1104 | |
| r15226 | r15227 | |
| 1286 | 1286 | MCFG_TIMER_ADD_SCANLINE("scantimer", a5200_interrupt, "screen", 0, 1) |
| 1287 | 1287 | |
| 1288 | 1288 | MCFG_DEVICE_REMOVE("pokey") |
| 1289 | | MCFG_SOUND_ADD("pokey", POKEY, FREQ_17_EXACT) |
| 1289 | MCFG_SOUND_ADD("pokey", POKEYN, FREQ_17_EXACT) |
| 1290 | 1290 | MCFG_SOUND_CONFIG(a5200_pokey_interface) |
| 1291 | 1291 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1292 | 1292 | |