Previous 15994 Revisions Next

r15227 Saturday 19th May, 2012 at 17:58:31 UTC by Miodrag Milanović
Sync with MAME r16351 note there is new POKEY sounde device used (no whatsnew)
[src/emu/machine]68681.c 68681.h
[src/mame/drivers]adp.c bfm_sc4h.c igs017.c maygay1b.c maygayv1.c tmaster.c
[src/mame/includes]micro3d.h
[src/mame/machine]micro3d.c
[src/mess/drivers]a7800.c atari400.c

src/mame/machine/micro3d.c
r15226r15227
2929 *
3030 *************************************/
3131
32void micro3d_duart_irq_handler(device_t *device, UINT8 vector)
32void micro3d_duart_irq_handler(device_t *device, int state, UINT8 vector)
3333{
34   cputag_set_input_line_and_vector(device->machine(), "maincpu", 3, HOLD_LINE, vector);
34   cputag_set_input_line_and_vector(device->machine(), "maincpu", 3, state, vector);
3535};
3636
3737void micro3d_duart_tx(device_t *device, int channel, UINT8 data)
src/mame/includes/micro3d.h
r15226r15227
123123
124124
125125
126void micro3d_duart_irq_handler(device_t *device, UINT8 vector);
126void micro3d_duart_irq_handler(device_t *device, int state, UINT8 vector);
127127UINT8 micro3d_duart_input_r(device_t *device);
128128void micro3d_duart_output_w(device_t *device, UINT8 data);
129129void micro3d_duart_tx(device_t *device, int channel, UINT8 data);
src/mame/drivers/igs017.c
r15226r15227
8080   UINT8 m_hopper;
8181   UINT16 m_igs_magic[2];
8282   UINT8 m_scramble_data;
83   UINT8 m_prot[2];
8483   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
8589   int m_irq2_enable;
8690   DECLARE_WRITE8_MEMBER(video_disable_w);
8791   DECLARE_WRITE16_MEMBER(video_disable_lsb_w);
r15226r15227
116120   DECLARE_READ16_MEMBER(lhzb2a_input_r);
117121   DECLARE_WRITE16_MEMBER(lhzb2a_input_addr_w);
118122   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
121132   DECLARE_WRITE16_MEMBER(lhzb2_magic_w);
122133   DECLARE_READ16_MEMBER(lhzb2_magic_r);
123134   DECLARE_WRITE16_MEMBER(slqz2_paletteram_w);
r15226r15227
10311042
10321043//lhzb2a
10331044
1034static 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
10491045static DRIVER_INIT( lhzb2a )
10501046{
10511047   int i;
r15226r15227
11061102
11071103   lhzb2_decrypt_tiles(machine);
11081104   lhzb2_decrypt_sprites(machine);
1109   lhzb2a_patch_rom(machine);
11101105}
11111106
11121107
r15226r15227
18321827// lhzb2a
18331828// To do: what devices are on this PCB?
18341829
1830/***************************************************************************
18351831
1836WRITE16_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
1869WRITE16_MEMBER(igs017_state::lhzb2a_prot_w)
18371870{
1838   COMBINE_DATA(&m_igs_magic[offset]);
1871   COMBINE_DATA(&m_prot_regs[offset]);
18391872
18401873   if (offset == 0)
18411874      return;
18421875
1843   switch(m_igs_magic[0])
1876   switch(m_prot_regs[0])
18441877   {
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
18461993      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]);
18481995   }
18491996}
18501997
1851READ16_MEMBER(igs017_state::lhzb2a_magic_r)
1998READ16_MEMBER(igs017_state::lhzb2a_prot_r)
18521999{
1853   switch(m_igs_magic[0])
2000   switch(m_prot_regs[0])
18542001   {
1855      case 0x03:
2002      case 0x03:   // result
18562003      {
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;
18602018      }
18612019
18622020      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]);
18642022         break;
18652023   }
18662024
18672025   return 0xffff;
18682026}
18692027
2028// Protection 2
2029
2030WRITE16_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
2036WRITE16_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
2042WRITE16_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
2048READ16_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
18702062WRITE16_MEMBER(igs017_state::lhzb2a_paletteram_w)
18712063{
18722064   COMBINE_DATA(&m_generic_paletteram_16[offset]);
r15226r15227
19212113   m_input_addr = data & 0xff;
19222114
19232115   // 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));
19252117   space.install_read_handler      (m_input_addr * 0x10000 + 0x8000, m_input_addr * 0x10000 + 0x8005, read16_delegate (FUNC(igs017_state::lhzb2a_input_r),      this));
19262118   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);
19272121}
19282122
19292123WRITE16_MEMBER(igs017_state::lhzb2a_input_select_w)
r15226r15227
19462140}
19472141
19482142static 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
19492149   AM_RANGE(0x000000, 0x07ffff) AM_ROM
19502150   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
19522152   AM_RANGE(0xb02000, 0xb02fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
19532153   AM_RANGE(0xb03000, 0xb037ff) AM_RAM_WRITE( lhzb2a_paletteram_w ) AM_SHARE("paletteram")
19542154   AM_RANGE(0xb04024, 0xb04025) AM_WRITE( video_disable_lsb_w )
r15226r15227
23272527   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
23282528
23292529   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  )
23312531   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL   )   // hopper switch
23322532   PORT_SERVICE_NO_TOGGLE( 0x04,   IP_ACTIVE_LOW )   // keep pressed while booting
23332533   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SERVICE1  ) PORT_NAME("Statistics") // press with the above for sound test
23342534   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_COIN1     ) PORT_IMPULSE(2)
23352535   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   )
23362538
23372539   PORT_START("KEY0")
23382540   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
src/mame/drivers/adp.c
r15226r15227
265265
266266***************************************************************************/
267267
268static void duart_irq_handler( device_t *device, UINT8 vector )
268static void duart_irq_handler( device_t *device, int state, UINT8 vector )
269269{
270   adp_state *state = device->machine().driver_data<adp_state>();
271   device_set_input_line_and_vector(state->m_maincpu, 4, HOLD_LINE, vector);
270   adp_state *adp = device->machine().driver_data<adp_state>();
271   device_set_input_line_and_vector(adp->m_maincpu, 4, state, vector);
272272}
273273
274274static void duart_tx( device_t *device, int channel, UINT8 data )
src/mame/drivers/maygayv1.c
r15226r15227
926926
927927***************************************************************************/
928928
929static void duart_irq_handler(device_t *device, UINT8 vector)
929static void duart_irq_handler(device_t *device, int state, UINT8 vector)
930930{
931   cputag_set_input_line_and_vector(device->machine(), "maincpu", 5, ASSERT_LINE, vector);
931   cputag_set_input_line_and_vector(device->machine(), "maincpu", 5, state, vector);
932932//  cputag_set_input_line(device->machine(), "maincpu", 5, state ? ASSERT_LINE : CLEAR_LINE);
933933};
934934
src/mame/drivers/bfm_sc4h.c
r15226r15227
654654 
655655 
656656 
657void bfm_sc4_duart_irq_handler(device_t *device, UINT8 vector)
657void bfm_sc4_duart_irq_handler(device_t *device, int state, UINT8 vector)
658658{
659659   // triggers after reel tests on luckb, at the start on dnd...
660660   // not sure this is right, causes some games to crash
661661   logerror("bfm_sc4_duart_irq_handler\n");
662   m68307_licr2_interrupt((legacy_cpu_device*)device->machine().device("maincpu"));
662    if (state == ASSERT_LINE)
663    {
664        m68307_licr2_interrupt((legacy_cpu_device*)device->machine().device("maincpu"));
665    }
663666};
664667 
665668void bfm_sc4_duart_tx(device_t *device, int channel, UINT8 data)
666669{
667   logerror("bfm_sc4_duart_irq_handler\n");
670   logerror("bfm_sc4_duart_tx\n");
668671};
669672 
670673 
r15226r15227
706709 
707710 
708711 
709void m68307_duart_irq_handler(device_t *device, UINT8 vector)
712void m68307_duart_irq_handler(device_t *device, int state, UINT8 vector)
710713{
711714   logerror("m68307_duart_irq_handler\n");
712   m68307_serial_interrupt((legacy_cpu_device*)device->machine().device("maincpu"), vector);
715    if (state == ASSERT_LINE)
716    {
717        m68307_serial_interrupt((legacy_cpu_device*)device->machine().device("maincpu"), vector);
718    }
713719};
714720 
715721void m68307_duart_tx(device_t *device, int channel, UINT8 data)
src/mame/drivers/maygay1b.c
r15226r15227
541541
542542///////////////////////////////////////////////////////////////////////////
543543
544static void duart_irq_handler(device_t *device, UINT8 state)
544static void duart_irq_handler(device_t *device, int state, UINT8 vector)
545545{
546   cputag_set_input_line(device->machine(), "maincpu", M6809_IRQ_LINE, state?ASSERT_LINE:CLEAR_LINE);
546   cputag_set_input_line(device->machine(), "maincpu", M6809_IRQ_LINE, state);
547547   LOG(("6809 irq%d \n",state));
548548}
549549
src/mame/drivers/tmaster.c
r15226r15227
196196
197197***************************************************************************/
198198
199static void duart_irq_handler(device_t *device, UINT8 vector)
199static void duart_irq_handler(device_t *device, int state, UINT8 vector)
200200{
201   cputag_set_input_line_and_vector(device->machine(), "maincpu", 4, HOLD_LINE, vector);
201   cputag_set_input_line_and_vector(device->machine(), "maincpu", 4, state, vector);
202202};
203203
204204static void duart_tx(device_t *device, int channel, UINT8 data)
src/emu/machine/68681.c
r15226r15227
33
44    Written by Mariusz Wojcieszek
55    Updated by Jonathan Gevaryahu AKA Lord Nightmare
6    Improved interrupt handling by R. Belmont
67*/
78
89#include "emu.h"
r15226r15227
230231      if ( duart68681->duart_config->irq_handler )
231232      {
232233         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 );
234235      }
235236   }
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    }
236245};
237246
238247static TIMER_CALLBACK( duart_timer_callback )
r15226r15227
336345         else
337346            duart68681->ISR &= ~INT_TXRDYB;
338347         duart68681->channel[ch].tx_timer->adjust(attotime::never, ch);
339         break;
348            break;
340349      case 4: /* Reset Error Status */
341350         duart68681->channel[ch].SR &= ~(STATUS_RECEIVED_BREAK | STATUS_FRAMING_ERROR | STATUS_PARITY_ERROR | STATUS_OVERRUN_ERROR);
342351         break;
r15226r15227
355364         LOG(( "68681: Unhandled command (%x) in CR%d\n", (data >> 4) & 0x07, ch ));
356365         break;
357366   }
358   duart68681_update_interrupts(duart68681);
359367
360368   if (BIT(data, 0)) {
361369      duart68681->channel[ch].rx_enabled = 1;
r15226r15227
384392         duart68681->ISR &= ~INT_TXRDYB;
385393   }
386394
395    duart68681_update_interrupts(duart68681);
387396};
388397
389398static UINT8 duart68681_read_rx_fifo(duart68681_state *duart68681, int ch)
r15226r15227
613622            break;
614623            case 0x06: /* Timer, CLK/1 */       // Timer modes start without reading address 0xe, as per the Freescale 68681 manual
615624                {
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                    }
617634                    duart68681->duart_timer->adjust(rate, 0, rate);
618635                }
619636                break;
r15226r15227
621638                {
622639                    //double hz;
623640                    //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));
626645
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
629653                    {
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                        }
631662                    }
663                       
664                    //hz = ATTOSECONDS_TO_HZ(rate.attoseconds);
632665
633666                    duart68681->duart_timer->adjust(rate, 0, rate);
634667                }
src/emu/machine/68681.h
r15226r15227
66typedef struct _duart68681_config duart68681_config;
77struct _duart68681_config
88{
9   void (*irq_handler)(device_t *device, UINT8 vector);
9   void (*irq_handler)(device_t *device, int state, UINT8 vector);
1010   void (*tx_callback)(device_t *device, int channel, UINT8 data);
1111   UINT8 (*input_port_read)(device_t *device);
1212   void (*output_port_write)(device_t *device, UINT8 data);
src/mess/drivers/atari400.c
r15226r15227
250250   AM_RANGE(0xc000, 0xcfff) AM_ROM
251251   AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w)
252252   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)
254254   AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt)
255255   AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w)
256256   AM_RANGE(0xd500, 0xd7ff) AM_NOP
r15226r15227
265265   AM_RANGE(0xc000, 0xcfff) AM_ROM
266266   AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w)
267267   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)
269269   AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt)
270270   AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w)
271271   AM_RANGE(0xd500, 0xd7ff) AM_NOP
r15226r15227
280280   AM_RANGE(0xc000, 0xcfff) AM_ROM /* OS */
281281   AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w)
282282   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)
284284   AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt)
285285   AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w)
286286   AM_RANGE(0xd500, 0xd7ff) AM_NOP
r15226r15227
296296   AM_RANGE(0xc000, 0xcfff) AM_RAMBANK("bank3")
297297   AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w)
298298   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)
300300   AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt)
301301   AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w)
302302   AM_RANGE(0xd500, 0xd7ff) AM_NOP
r15226r15227
312312   AM_RANGE(0xc000, 0xcfff) AM_RAMBANK("bank3")
313313   AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w)
314314   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)
316316   AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt)
317317   AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w)
318318   AM_RANGE(0xd500, 0xd7ff) AM_NOP
r15226r15227
325325   AM_RANGE(0x4000, 0xbfff) AM_ROM
326326   AM_RANGE(0xc000, 0xc0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w)
327327   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)
329329   AM_RANGE(0xf800, 0xffff) AM_ROM
330330ADDRESS_MAP_END
331331
r15226r15227
10981098
10991099   /* sound hardware */
11001100   MCFG_SPEAKER_STANDARD_MONO("mono")
1101   MCFG_SOUND_ADD("pokey", POKEY, FREQ_17_EXACT)
1101   MCFG_SOUND_ADD("pokey", POKEYN, FREQ_17_EXACT)
11021102   MCFG_SOUND_CONFIG(atari_pokey_interface)
11031103   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
11041104
r15226r15227
12861286   MCFG_TIMER_ADD_SCANLINE("scantimer", a5200_interrupt, "screen", 0, 1)
12871287
12881288   MCFG_DEVICE_REMOVE("pokey")
1289   MCFG_SOUND_ADD("pokey", POKEY, FREQ_17_EXACT)
1289   MCFG_SOUND_ADD("pokey", POKEYN, FREQ_17_EXACT)
12901290   MCFG_SOUND_CONFIG(a5200_pokey_interface)
12911291   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
12921292
src/mess/drivers/a7800.c
r15226r15227
274274   MCFG_SPEAKER_STANDARD_MONO("mono")
275275   MCFG_SOUND_ADD("tia", TIA, 31400)
276276   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
277   MCFG_SOUND_ADD("pokey", POKEY, A7800_NTSC_Y1/8)
277   MCFG_SOUND_ADD("pokey", POKEYN, A7800_NTSC_Y1/8)
278278   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
279279
280280   /* devices */
r15226r15227
308308   MCFG_PALETTE_INIT( a7800p )
309309
310310   /* sound hardware */
311   MCFG_SOUND_REPLACE("pokey", POKEY, CLK_PAL)
311   MCFG_SOUND_REPLACE("pokey", POKEYN, CLK_PAL)
312312   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
313313
314314   /* devices */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team