src/mess/drivers/m20.c
| r15146 | r15147 | |
| 38 | 38 | #include "cpu/z8000/z8000.h" |
| 39 | 39 | #include "cpu/i86/i86.h" |
| 40 | 40 | #include "video/mc6845.h" |
| 41 | #include "machine/i8251.h" |
| 42 | #include "machine/i8255.h" |
| 41 | 43 | |
| 42 | | |
| 43 | 44 | class m20_state : public driver_device |
| 44 | 45 | { |
| 45 | 46 | public: |
| 46 | 47 | m20_state(const machine_config &mconfig, device_type type, const char *tag) |
| 47 | 48 | : driver_device(mconfig, type, tag) , |
| 48 | 49 | m_maincpu(*this, "maincpu"), |
| 50 | m_kbdi8251(*this, "i8251_1"), |
| 51 | m_ttyi8251(*this, "i8251_2"), |
| 52 | m_i8255(*this, "ppi8255"), |
| 49 | 53 | m_p_videoram(*this, "p_videoram"){ } |
| 50 | 54 | |
| 51 | 55 | required_device<device_t> m_maincpu; |
| 56 | required_device<i8251_device> m_kbdi8251; |
| 57 | required_device<i8251_device> m_ttyi8251; |
| 58 | required_device<i8255_device> m_i8255; |
| 52 | 59 | required_shared_ptr<UINT16> m_p_videoram; |
| 53 | 60 | |
| 54 | 61 | virtual void machine_reset(); |
| 62 | |
| 63 | DECLARE_READ8_MEMBER(ppi_r); |
| 64 | DECLARE_WRITE8_MEMBER(ppi_w); |
| 55 | 65 | }; |
| 56 | 66 | |
| 57 | 67 | |
| r15146 | r15147 | |
| 92 | 102 | return 0; |
| 93 | 103 | } |
| 94 | 104 | |
| 105 | // translate addresses 81/83/85/87 to PPI offsets 0/1/2/3 |
| 106 | READ8_MEMBER(m20_state::ppi_r) |
| 107 | { |
| 108 | return m_i8255->read(space, offset/2); |
| 109 | } |
| 110 | |
| 111 | WRITE8_MEMBER(m20_state::ppi_w) |
| 112 | { |
| 113 | m_i8255->write(space, offset/2, data); |
| 114 | } |
| 115 | |
| 95 | 116 | /* from the M20 hardware reference manual: |
| 96 | 117 | M20 memory is configured according to the following scheme: |
| 97 | 118 | Segment Contents |
| r15146 | r15147 | |
| 126 | 147 | ADDRESS_MAP_GLOBAL_MASK(0xff) // may not be needed |
| 127 | 148 | AM_RANGE(0x61, 0x61) AM_DEVWRITE("crtc", mc6845_device, address_w) |
| 128 | 149 | AM_RANGE(0x63, 0x63) AM_DEVWRITE("crtc", mc6845_device, register_w) |
| 129 | | // 0x81 / 0x87 - i8255A |
| 130 | | // 0xa1 - i8251 keyboard data |
| 131 | | // 0xa3 - i8251 keyboard status / control |
| 132 | | // 0xc1 - i8251 TTY / printer data |
| 133 | | // 0xc3 - i8251 TTY / printer status / control |
| 150 | AM_RANGE(0x81, 0x87) AM_READWRITE(ppi_r, ppi_w) |
| 151 | AM_RANGE(0xa1, 0xa1) AM_DEVREADWRITE("i8251_1", i8251_device, data_r, data_w) |
| 152 | AM_RANGE(0xa3, 0xa3) AM_DEVREADWRITE("i8251_1", i8251_device, status_r, control_w) |
| 153 | AM_RANGE(0xc1, 0xc1) AM_DEVREADWRITE("i8251_2", i8251_device, data_r, data_w) |
| 154 | AM_RANGE(0xc3, 0xc3) AM_DEVREADWRITE("i8251_2", i8251_device, status_r, control_w) |
| 155 | |
| 134 | 156 | // 0x121 / 0x127 - pit8253 (TTY/printer, keyboard, RTC/NVI) |
| 135 | 157 | |
| 136 | 158 | // 0x21?? / 0x21? - fdc ... seems to control the screen colors??? |
| r15146 | r15147 | |
| 184 | 206 | NULL /* update address callback */ |
| 185 | 207 | }; |
| 186 | 208 | |
| 209 | static I8255A_INTERFACE( ppi_interface ) |
| 210 | { |
| 211 | DEVCB_NULL, // port A read |
| 212 | DEVCB_NULL, // port A write |
| 213 | DEVCB_NULL, // port B read |
| 214 | DEVCB_NULL, // port B write |
| 215 | DEVCB_NULL, // port C read |
| 216 | DEVCB_NULL // port C write |
| 217 | }; |
| 218 | |
| 219 | static const i8251_interface kbd_i8251_intf = |
| 220 | { |
| 221 | DEVCB_NULL, // rxd in |
| 222 | DEVCB_NULL, // txd out |
| 223 | DEVCB_NULL, // dsr |
| 224 | DEVCB_NULL, // dtr |
| 225 | DEVCB_NULL, // rts |
| 226 | DEVCB_NULL, // rx ready |
| 227 | DEVCB_NULL, // tx ready |
| 228 | DEVCB_NULL, // tx empty |
| 229 | DEVCB_NULL // syndet |
| 230 | }; |
| 231 | |
| 232 | static const i8251_interface tty_i8251_intf = |
| 233 | { |
| 234 | DEVCB_NULL, // rxd in |
| 235 | DEVCB_NULL, // txd out |
| 236 | DEVCB_NULL, // dsr |
| 237 | DEVCB_NULL, // dtr |
| 238 | DEVCB_NULL, // rts |
| 239 | DEVCB_NULL, // rx ready |
| 240 | DEVCB_NULL, // tx ready |
| 241 | DEVCB_NULL, // tx empty |
| 242 | DEVCB_NULL // syndet |
| 243 | }; |
| 244 | |
| 187 | 245 | static MACHINE_CONFIG_START( m20, m20_state ) |
| 188 | 246 | /* basic machine hardware */ |
| 189 | 247 | MCFG_CPU_ADD("maincpu", Z8001, MAIN_CLOCK) |
| r15146 | r15147 | |
| 209 | 267 | |
| 210 | 268 | /* Devices */ |
| 211 | 269 | MCFG_MC6845_ADD("crtc", MC6845, PIXEL_CLOCK/8, mc6845_intf) /* hand tuned to get ~50 fps */ |
| 270 | MCFG_I8255A_ADD("ppi8255", ppi_interface) |
| 271 | MCFG_I8251_ADD("i8251_1", kbd_i8251_intf) |
| 272 | MCFG_I8251_ADD("i8251_2", tty_i8251_intf) |
| 212 | 273 | MACHINE_CONFIG_END |
| 213 | 274 | |
| 214 | 275 | ROM_START(m20) |