trunk/src/mess/machine/sym1.c
| r20479 | r20480 | |
| 78 | 78 | int data = 0x7f; |
| 79 | 79 | |
| 80 | 80 | /* scan keypad rows */ |
| 81 | | if (!(m_riot_port_a & 0x80)) data &= machine().root_device().ioport("ROW-0")->read(); |
| 82 | | if (!(m_riot_port_b & 0x01)) data &= machine().root_device().ioport("ROW-1")->read(); |
| 83 | | if (!(m_riot_port_b & 0x02)) data &= machine().root_device().ioport("ROW-2")->read(); |
| 84 | | if (!(m_riot_port_b & 0x04)) data &= machine().root_device().ioport("ROW-3")->read(); |
| 81 | if (!(m_riot_port_a & 0x80)) data &= m_row0->read(); |
| 82 | if (!(m_riot_port_b & 0x01)) data &= m_row1->read(); |
| 83 | if (!(m_riot_port_b & 0x02)) data &= m_row2->read(); |
| 84 | if (!(m_riot_port_b & 0x04)) data &= m_row3->read(); |
| 85 | 85 | |
| 86 | 86 | /* determine column */ |
| 87 | | if ( ((m_riot_port_a ^ 0xff) & (ioport("ROW-0")->read() ^ 0xff)) & 0x7f ) |
| 87 | if ( ((m_riot_port_a ^ 0xff) & (m_row0->read() ^ 0xff)) & 0x7f ) |
| 88 | 88 | data &= ~0x80; |
| 89 | 89 | |
| 90 | 90 | return data; |
| r20479 | r20480 | |
| 96 | 96 | int data = 0xff; |
| 97 | 97 | |
| 98 | 98 | /* determine column */ |
| 99 | | if ( ((m_riot_port_a ^ 0xff) & (machine().root_device().ioport("ROW-1")->read() ^ 0xff)) & 0x7f ) |
| 99 | if ( ((m_riot_port_a ^ 0xff) & (m_row1->read() ^ 0xff)) & 0x7f ) |
| 100 | 100 | data &= ~0x01; |
| 101 | 101 | |
| 102 | | if ( ((m_riot_port_a ^ 0xff) & (machine().root_device().ioport("ROW-2")->read() ^ 0xff)) & 0x3f ) |
| 102 | if ( ((m_riot_port_a ^ 0xff) & (m_row2->read() ^ 0xff)) & 0x3f ) |
| 103 | 103 | data &= ~0x02; |
| 104 | 104 | |
| 105 | | if ( ((m_riot_port_a ^ 0xff) & (ioport("ROW-3")->read() ^ 0xff)) & 0x1f ) |
| 105 | if ( ((m_riot_port_a ^ 0xff) & (m_row3->read() ^ 0xff)) & 0x1f ) |
| 106 | 106 | data &= ~0x04; |
| 107 | 107 | |
| 108 | 108 | data &= ~0x80; // else hangs 8b02 |
| r20479 | r20480 | |
| 113 | 113 | |
| 114 | 114 | WRITE8_MEMBER(sym1_state::sym1_riot_a_w) |
| 115 | 115 | { |
| 116 | | logerror("%x: riot_a_w 0x%02x\n", machine().device("maincpu") ->safe_pc( ), data); |
| 116 | logerror("%x: riot_a_w 0x%02x\n", m_maincpu->pc(), data); |
| 117 | 117 | |
| 118 | 118 | /* save for later use */ |
| 119 | 119 | m_riot_port_a = data; |
| r20479 | r20480 | |
| 122 | 122 | |
| 123 | 123 | WRITE8_MEMBER(sym1_state::sym1_riot_b_w) |
| 124 | 124 | { |
| 125 | | logerror("%x: riot_b_w 0x%02x\n", machine().device("maincpu") ->safe_pc( ), data); |
| 125 | logerror("%x: riot_b_w 0x%02x\n", m_maincpu->pc(), data); |
| 126 | 126 | |
| 127 | 127 | /* save for later use */ |
| 128 | 128 | m_riot_port_b = data; |
| 129 | 129 | |
| 130 | 130 | /* first 4 pins are connected to the 74145 */ |
| 131 | | machine().device<ttl74145_device>("ttl74145")->write(data & 0x0f); |
| 131 | m_ttl74145->write(data & 0x0f); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| r20479 | r20480 | |
| 161 | 161 | ******************************************************************************/ |
| 162 | 162 | |
| 163 | 163 | |
| 164 | | static void sym1_irq(device_t *device, int level) |
| 164 | WRITE_LINE_MEMBER(sym1_state::sym1_irq) |
| 165 | 165 | { |
| 166 | | device->machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, level); |
| 166 | m_maincpu->set_input_line(M6502_IRQ_LINE, state); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | |
| r20479 | r20480 | |
| 186 | 186 | */ |
| 187 | 187 | WRITE8_MEMBER(sym1_state::sym1_via2_a_w) |
| 188 | 188 | { |
| 189 | | address_space &cpu0space = machine().device( "maincpu")->memory().space( AS_PROGRAM ); |
| 189 | address_space &cpu0space = m_maincpu->space( AS_PROGRAM ); |
| 190 | 190 | |
| 191 | 191 | logerror("SYM1 VIA2 W 0x%02x\n", data); |
| 192 | 192 | |
| 193 | | if ((machine().root_device().ioport("WP")->read() & 0x01) && !(data & 0x01)) { |
| 193 | if ((m_wp->read() & 0x01) && !(data & 0x01)) { |
| 194 | 194 | cpu0space.nop_write(0xa600, 0xa67f); |
| 195 | 195 | } else { |
| 196 | 196 | cpu0space.install_write_bank(0xa600, 0xa67f, "bank5"); |
| 197 | 197 | } |
| 198 | | if ((machine().root_device().ioport("WP")->read() & 0x02) && !(data & 0x02)) { |
| 198 | if ((m_wp->read() & 0x02) && !(data & 0x02)) { |
| 199 | 199 | cpu0space.nop_write(0x0400, 0x07ff); |
| 200 | 200 | } else { |
| 201 | 201 | cpu0space.install_write_bank(0x0400, 0x07ff, "bank2"); |
| 202 | 202 | } |
| 203 | | if ((machine().root_device().ioport("WP")->read() & 0x04) && !(data & 0x04)) { |
| 203 | if ((m_wp->read() & 0x04) && !(data & 0x04)) { |
| 204 | 204 | cpu0space.nop_write(0x0800, 0x0bff); |
| 205 | 205 | } else { |
| 206 | 206 | cpu0space.install_write_bank(0x0800, 0x0bff, "bank3"); |
| 207 | 207 | } |
| 208 | | if ((machine().root_device().ioport("WP")->read() & 0x08) && !(data & 0x08)) { |
| 208 | if ((m_wp->read() & 0x08) && !(data & 0x08)) { |
| 209 | 209 | cpu0space.nop_write(0x0c00, 0x0fff); |
| 210 | 210 | } else { |
| 211 | 211 | cpu0space.install_write_bank(0x0c00, 0x0fff, "bank4"); |
| r20479 | r20480 | |
| 227 | 227 | DEVCB_NULL, /* VIA Port CB1 Output */ |
| 228 | 228 | DEVCB_NULL, /* VIA Port CA2 Output */ |
| 229 | 229 | DEVCB_NULL, /* VIA Port CB2 Output */ |
| 230 | | DEVCB_LINE(sym1_irq) /* VIA IRQ Callback */ |
| 230 | DEVCB_DRIVER_LINE_MEMBER(sym1_state,sym1_irq) /* VIA IRQ Callback */ |
| 231 | 231 | }; |
| 232 | 232 | |
| 233 | 233 | |
| r20479 | r20480 | |
| 245 | 245 | DEVCB_NULL, /* VIA Port CB1 Output */ |
| 246 | 246 | DEVCB_NULL, /* VIA Port CA2 Output */ |
| 247 | 247 | DEVCB_NULL, /* VIA Port CB2 Output */ |
| 248 | | DEVCB_LINE(sym1_irq) /* VIA IRQ Callback */ |
| 248 | DEVCB_DRIVER_LINE_MEMBER(sym1_state,sym1_irq) /* VIA IRQ Callback */ |
| 249 | 249 | }; |
| 250 | 250 | |
| 251 | 251 | |
| r20479 | r20480 | |
| 263 | 263 | DEVCB_NULL, /* VIA Port CB1 Output */ |
| 264 | 264 | DEVCB_NULL, /* VIA Port CA2 Output */ |
| 265 | 265 | DEVCB_NULL, /* VIA Port CB2 Output */ |
| 266 | | DEVCB_LINE(sym1_irq) /* VIA IRQ Callback */ |
| 266 | DEVCB_DRIVER_LINE_MEMBER(sym1_state,sym1_irq) /* VIA IRQ Callback */ |
| 267 | 267 | }; |
| 268 | 268 | |
| 269 | 269 | |
| r20479 | r20480 | |
| 276 | 276 | DRIVER_INIT_MEMBER(sym1_state,sym1) |
| 277 | 277 | { |
| 278 | 278 | /* wipe expansion memory banks that are not installed */ |
| 279 | | if (machine().device<ram_device>(RAM_TAG)->size() < 4*1024) |
| 279 | if (m_ram->size() < 4*1024) |
| 280 | 280 | { |
| 281 | | machine().device( "maincpu")->memory().space( AS_PROGRAM ).nop_readwrite( |
| 282 | | machine().device<ram_device>(RAM_TAG)->size(), 0x0fff); |
| 281 | m_maincpu->space(AS_PROGRAM).nop_readwrite(m_ram->size(), 0x0fff); |
| 283 | 282 | } |
| 284 | 283 | |
| 285 | 284 | /* allocate a timer to refresh the led display */ |
| r20479 | r20480 | |
| 291 | 290 | { |
| 292 | 291 | /* make 0xf800 to 0xffff point to the last half of the monitor ROM |
| 293 | 292 | so that the CPU can find its reset vectors */ |
| 294 | | machine().device( "maincpu")->memory().space( AS_PROGRAM ).install_read_bank(0xf800, 0xffff, "bank1"); |
| 295 | | machine().device( "maincpu")->memory().space( AS_PROGRAM ).nop_write(0xf800, 0xffff); |
| 293 | m_maincpu->space( AS_PROGRAM ).install_read_bank(0xf800, 0xffff, "bank1"); |
| 294 | m_maincpu->space( AS_PROGRAM ).nop_write(0xf800, 0xffff); |
| 296 | 295 | membank("bank1")->set_base(m_monitor + 0x800); |
| 297 | | machine().device("maincpu")->reset(); |
| 296 | m_maincpu->reset(); |
| 298 | 297 | } |
trunk/src/mess/includes/sym1.h
| r20479 | r20480 | |
| 15 | 15 | #include "machine/6532riot.h" |
| 16 | 16 | #include "machine/6522via.h" |
| 17 | 17 | #include "machine/74145.h" |
| 18 | #include "machine/ram.h" |
| 18 | 19 | |
| 19 | 20 | /* SYM-1 main (and only) oscillator Y1 */ |
| 20 | 21 | #define SYM1_CLOCK XTAL_1MHz |
| r20479 | r20480 | |
| 24 | 25 | { |
| 25 | 26 | public: |
| 26 | 27 | sym1_state(const machine_config &mconfig, device_type type, const char *tag) |
| 27 | | : driver_device(mconfig, type, tag) , |
| 28 | | m_ram_1k(*this, "ram_1k"), |
| 29 | | m_ram_2k(*this, "ram_2k"), |
| 30 | | m_ram_3k(*this, "ram_3k"), |
| 31 | | m_monitor(*this, "monitor"), |
| 32 | | m_riot_ram(*this, "riot_ram"){ } |
| 28 | : driver_device(mconfig, type, tag) |
| 29 | , m_ram_1k(*this, "ram_1k") |
| 30 | , m_ram_2k(*this, "ram_2k") |
| 31 | , m_ram_3k(*this, "ram_3k") |
| 32 | , m_monitor(*this, "monitor") |
| 33 | , m_riot_ram(*this, "riot_ram") |
| 34 | , m_maincpu(*this, "maincpu") |
| 35 | , m_ram(*this, RAM_TAG) |
| 36 | , m_ttl74145(*this, "ttl74145") |
| 37 | , m_row0(*this, "ROW-0") |
| 38 | , m_row1(*this, "ROW-1") |
| 39 | , m_row2(*this, "ROW-2") |
| 40 | , m_row3(*this, "ROW-3") |
| 41 | , m_wp(*this, "WP") |
| 42 | { } |
| 33 | 43 | |
| 34 | 44 | required_shared_ptr<UINT8> m_ram_1k; |
| 35 | 45 | required_shared_ptr<UINT8> m_ram_2k; |
| r20479 | r20480 | |
| 55 | 65 | DECLARE_READ8_MEMBER(sym1_via0_b_r); |
| 56 | 66 | DECLARE_WRITE8_MEMBER(sym1_via0_b_w); |
| 57 | 67 | DECLARE_WRITE8_MEMBER(sym1_via2_a_w); |
| 68 | DECLARE_WRITE_LINE_MEMBER(sym1_irq); |
| 69 | |
| 70 | protected: |
| 71 | required_device<cpu_device> m_maincpu; |
| 72 | required_device<ram_device> m_ram; |
| 73 | required_device<ttl74145_device> m_ttl74145; |
| 74 | required_ioport m_row0; |
| 75 | required_ioport m_row1; |
| 76 | required_ioport m_row2; |
| 77 | required_ioport m_row3; |
| 78 | required_ioport m_wp; |
| 58 | 79 | }; |
| 59 | 80 | |
| 60 | 81 | /*----------- defined in machine/sym1.c -----------*/ |