src/mess/drivers/mz2500.c
| r8977 | r8978 | |
| 55 | 55 | #include "machine/wd17xx.h" |
| 56 | 56 | #include "machine/pit8253.h" |
| 57 | 57 | #include "sound/2203intf.h" |
| 58 | #include "machine/rp5c15.h" |
| 58 | 59 | |
| 59 | 60 | //#include "devices/cassette.h" |
| 60 | 61 | #include "devices/flopdrv.h" |
| r8977 | r8978 | |
| 885 | 886 | irq_mask[2] = (data & 0x02); //printer |
| 886 | 887 | irq_mask[3] = (data & 0x01); //RP5c15 |
| 887 | 888 | |
| 888 | | // printf("%02x\n",data); |
| 889 | printf("%02x\n",data); |
| 889 | 890 | } |
| 890 | 891 | |
| 891 | 892 | static WRITE8_HANDLER( mz2500_irq_data_w ) |
| r8977 | r8978 | |
| 1214 | 1215 | (offset & 1) ? (kanji_index = (data << 8) | (kanji_index & 0xff)) : (kanji_index = (data & 0xff) | (kanji_index & 0xff00)); |
| 1215 | 1216 | } |
| 1216 | 1217 | |
| 1218 | static READ8_DEVICE_HANDLER( rp5c15_8_r ) |
| 1219 | { |
| 1220 | UINT8 rtc_index; |
| 1217 | 1221 | |
| 1222 | rtc_index = (cpu_get_reg(device->machine->device("maincpu"), Z80_B)); |
| 1223 | |
| 1224 | return rp5c15_r(device,rtc_index,0xff); |
| 1225 | } |
| 1226 | |
| 1227 | static WRITE8_DEVICE_HANDLER( rp5c15_8_w ) |
| 1228 | { |
| 1229 | UINT8 rtc_index; |
| 1230 | |
| 1231 | rtc_index = (cpu_get_reg(device->machine->device("maincpu"), Z80_B)); |
| 1232 | |
| 1233 | rp5c15_w(device,rtc_index,data,0xff); |
| 1234 | } |
| 1235 | |
| 1218 | 1236 | static ADDRESS_MAP_START(mz2500_io, ADDRESS_SPACE_IO, 8) |
| 1219 | 1237 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 1220 | 1238 | // AM_RANGE(0x60, 0x63) AM_WRITE(w3100a_w) |
| r8977 | r8978 | |
| 1242 | 1260 | AM_RANGE(0xc7, 0xc7) AM_WRITE(mz2500_irq_data_w) |
| 1243 | 1261 | AM_RANGE(0xc8, 0xc9) AM_DEVREADWRITE("ym", ym2203_r, ym2203_w) |
| 1244 | 1262 | // AM_RANGE(0xca, 0xca) AM_READWRITE(voice_r,voice_w) |
| 1245 | | // AM_RANGE(0xcc, 0xcc) AM_READWRITE(calendar_r,calendar_w) |
| 1246 | | AM_RANGE(0xcc, 0xcd) AM_NOP |
| 1263 | AM_RANGE(0xcc, 0xcc) AM_DEVREADWRITE("rp5c15", rp5c15_8_r, rp5c15_8_w) |
| 1247 | 1264 | AM_RANGE(0xce, 0xce) AM_WRITE(mz2500_dictionary_bank_w) |
| 1248 | 1265 | AM_RANGE(0xcf, 0xcf) AM_WRITE(mz2500_kanji_bank_w) |
| 1249 | 1266 | AM_RANGE(0xd8, 0xdb) AM_DEVREADWRITE("mb8877a", mz2500_wd17xx_r, mz2500_wd17xx_w) |
| r8977 | r8978 | |
| 1534 | 1551 | |
| 1535 | 1552 | static READ8_DEVICE_HANDLER( mz2500_porta_r ) |
| 1536 | 1553 | { |
| 1554 | logerror("PPI PORTA R\n"); |
| 1555 | |
| 1537 | 1556 | return 0xff; |
| 1538 | 1557 | } |
| 1539 | 1558 | |
| r8977 | r8978 | |
| 1548 | 1567 | |
| 1549 | 1568 | static READ8_DEVICE_HANDLER( mz2500_portc_r ) |
| 1550 | 1569 | { |
| 1570 | logerror("PPI PORTC R\n"); |
| 1571 | |
| 1551 | 1572 | return 0xff; |
| 1552 | 1573 | } |
| 1553 | 1574 | |
| 1554 | 1575 | static WRITE8_DEVICE_HANDLER( mz2500_porta_w ) |
| 1555 | 1576 | { |
| 1577 | logerror("PPI PORTA W %02x\n",data); |
| 1556 | 1578 | } |
| 1557 | 1579 | |
| 1558 | 1580 | static WRITE8_DEVICE_HANDLER( mz2500_portb_w ) |
| 1559 | 1581 | { |
| 1582 | logerror("PPI PORTB W %02x\n",data); |
| 1560 | 1583 | } |
| 1561 | 1584 | |
| 1562 | 1585 | static WRITE8_DEVICE_HANDLER( mz2500_portc_w ) |
| r8977 | r8978 | |
| 1579 | 1602 | |
| 1580 | 1603 | reset_lines = data; |
| 1581 | 1604 | |
| 1582 | | //printf("%02x\n",data); |
| 1605 | if(data & ~0x0a) |
| 1606 | logerror("PPI PORTC W %02x\n",data & ~0x0a); |
| 1583 | 1607 | } |
| 1584 | 1608 | |
| 1585 | 1609 | static I8255A_INTERFACE( ppi8255_intf ) |
| r8977 | r8978 | |
| 1665 | 1689 | ym_porta = data; |
| 1666 | 1690 | } |
| 1667 | 1691 | |
| 1668 | | static WRITE8_DEVICE_HANDLER( opn_portb_w ) |
| 1669 | | { |
| 1670 | | logerror("B %02x\n",data); |
| 1671 | | } |
| 1672 | | |
| 1673 | 1692 | static const ym2203_interface ym2203_interface_1 = |
| 1674 | 1693 | { |
| 1675 | 1694 | { |
| r8977 | r8978 | |
| 1678 | 1697 | DEVCB_HANDLER(opn_porta_r), // read A |
| 1679 | 1698 | DEVCB_INPUT_PORT("DSW1"), // read B |
| 1680 | 1699 | DEVCB_HANDLER(opn_porta_w), // write A |
| 1681 | | DEVCB_HANDLER(opn_portb_w) // write B |
| 1700 | DEVCB_NULL // write B |
| 1682 | 1701 | }, |
| 1683 | 1702 | NULL |
| 1684 | 1703 | }; |
| r8977 | r8978 | |
| 1701 | 1720 | |
| 1702 | 1721 | static WRITE_LINE_DEVICE_HANDLER( pit8253_clk1_irq ) |
| 1703 | 1722 | { |
| 1704 | | if(irq_mask[1]) |
| 1723 | if(irq_mask[1]/* && state & 1*/) |
| 1705 | 1724 | cputag_set_input_line_and_vector(device->machine, "maincpu", 0, HOLD_LINE,irq_vector[1]); |
| 1706 | 1725 | } |
| 1707 | 1726 | |
| r8977 | r8978 | |
| 1726 | 1745 | } |
| 1727 | 1746 | }; |
| 1728 | 1747 | |
| 1748 | static void mz2500_rtc_alarm_irq(int state) |
| 1749 | { |
| 1750 | /* TODO: doesn't work yet */ |
| 1751 | // if(irq_mask[3] && state & 1) |
| 1752 | // cputag_set_input_line_and_vector(device, "maincpu", 0, HOLD_LINE,irq_vector[3]); |
| 1753 | } |
| 1754 | |
| 1755 | static const struct rp5c15_interface rtc_intf = |
| 1756 | { |
| 1757 | mz2500_rtc_alarm_irq |
| 1758 | }; |
| 1759 | |
| 1729 | 1760 | static MACHINE_DRIVER_START( mz2500 ) |
| 1730 | 1761 | /* basic machine hardware */ |
| 1731 | 1762 | MDRV_CPU_ADD("maincpu", Z80, 6000000) |
| r8977 | r8978 | |
| 1737 | 1768 | |
| 1738 | 1769 | MDRV_I8255A_ADD( "i8255_0", ppi8255_intf ) |
| 1739 | 1770 | MDRV_Z80PIO_ADD( "z80pio_1", 6000000, mz2500_pio1_intf ) |
| 1771 | MDRV_RP5C15_ADD( "rp5c15" , rtc_intf) |
| 1740 | 1772 | |
| 1741 | 1773 | MDRV_MB8877_ADD("mb8877a",mz2500_mb8877a_interface) |
| 1742 | 1774 | MDRV_FLOPPY_4_DRIVES_ADD(mz2500_floppy_config) |
| 1743 | 1775 | |
| 1744 | | |
| 1745 | 1776 | /* video hardware */ |
| 1746 | 1777 | MDRV_SCREEN_ADD("screen", RASTER) |
| 1747 | 1778 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |