trunk/src/mess/drivers/pencil2.c
| r19787 | r19788 | |
| 63 | 63 | |
| 64 | 64 | ToDo: |
| 65 | 65 | - Keys missing (Shift, Ctrl, F1 to F6, Esc) |
| 66 | | - Printer (out 00) |
| 67 | | - Cassette |
| 66 | - Cassette isn't working |
| 68 | 67 | - Joysticks |
| 69 | 68 | - Cart slot |
| 70 | 69 | - Screen size is wrong in BASIC. Should be 24 lines of text with a wide |
| r19787 | r19788 | |
| 78 | 77 | #include "sound/sn76496.h" |
| 79 | 78 | #include "machine/ctronics.h" |
| 80 | 79 | //#include "imagedev/cartslot.h" |
| 81 | | //#include "imagedev/cassette.h" |
| 82 | | //#include "sound/wave.h" |
| 80 | #include "imagedev/cassette.h" |
| 81 | #include "sound/wave.h" |
| 83 | 82 | |
| 84 | 83 | |
| 85 | 84 | class pencil2_state : public driver_device |
| r19787 | r19788 | |
| 88 | 87 | pencil2_state(const machine_config &mconfig, device_type type, const char *tag) |
| 89 | 88 | : driver_device(mconfig, type, tag), |
| 90 | 89 | m_maincpu(*this, "maincpu"), |
| 91 | | m_printer(*this, "centronics") |
| 90 | m_printer(*this, "centronics"), |
| 91 | m_cass(*this, CASSETTE_TAG) |
| 92 | 92 | { } |
| 93 | 93 | |
| 94 | 94 | DECLARE_WRITE8_MEMBER(port10_w); |
| 95 | DECLARE_WRITE8_MEMBER(port30_w); |
| 95 | 96 | DECLARE_WRITE8_MEMBER(port80_w); |
| 96 | 97 | DECLARE_WRITE8_MEMBER(portc0_w); |
| 97 | 98 | DECLARE_READ8_MEMBER(porte0_r); |
| r19787 | r19788 | |
| 100 | 101 | virtual void machine_reset(); |
| 101 | 102 | required_device<cpu_device> m_maincpu; |
| 102 | 103 | required_device<centronics_device> m_printer; |
| 104 | required_device<cassette_image_device> m_cass; |
| 103 | 105 | }; |
| 104 | 106 | |
| 105 | 107 | static ADDRESS_MAP_START(pencil2_mem, AS_PROGRAM, 8, pencil2_state) |
| r19787 | r19788 | |
| 115 | 117 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 116 | 118 | AM_RANGE(0x00, 0x0f) AM_DEVWRITE("centronics", centronics_device, write) |
| 117 | 119 | AM_RANGE(0x10, 0x1f) AM_WRITE(port10_w) |
| 118 | | //AM_RANGE(0x30, 0x3f) AM_WRITE(port30_w) cass out |
| 120 | AM_RANGE(0x30, 0x3f) AM_WRITE(port30_w) |
| 119 | 121 | AM_RANGE(0x80, 0x9f) AM_WRITE(port80_w) |
| 120 | 122 | AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) |
| 121 | 123 | AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) |
| r19787 | r19788 | |
| 125 | 127 | |
| 126 | 128 | READ8_MEMBER( pencil2_state::porte0_r) |
| 127 | 129 | { |
| 128 | | char kbdrow[6]; |
| 129 | | sprintf(kbdrow,"X%X",offset); |
| 130 | | return ioport( kbdrow )->read(); |
| 130 | if (offset==2) |
| 131 | return (m_cass->input() > 0.1); |
| 132 | else |
| 133 | { |
| 134 | char kbdrow[6]; |
| 135 | sprintf(kbdrow,"X%X",offset); |
| 136 | //printf("%X ",offset); |
| 137 | return ioport( kbdrow )->read(); |
| 138 | } |
| 131 | 139 | } |
| 132 | 140 | |
| 133 | 141 | WRITE8_MEMBER( pencil2_state::port10_w ) |
| r19787 | r19788 | |
| 135 | 143 | m_printer->strobe_w(BIT(data, 0)); |
| 136 | 144 | } |
| 137 | 145 | |
| 146 | WRITE8_MEMBER( pencil2_state::port30_w ) |
| 147 | { |
| 148 | m_cass->output( BIT(data, 0) ? -1.0 : +1.0); |
| 149 | } |
| 150 | |
| 138 | 151 | WRITE8_MEMBER( pencil2_state::port80_w ) |
| 139 | 152 | { |
| 140 | 153 | } |
| r19787 | r19788 | |
| 281 | 294 | MCFG_SOUND_ADD("sn76489a", SN76489A, XTAL_10_738635MHz/3) // guess |
| 282 | 295 | MCFG_SOUND_CONFIG(psg_intf) |
| 283 | 296 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 284 | | // MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG) |
| 285 | | // MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 297 | MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG) |
| 298 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 286 | 299 | |
| 287 | 300 | /* cassette */ |
| 288 | | // MCFG_CASSETTE_ADD( CASSETTE_TAG, pencil2_cassette_interface ) |
| 301 | MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface ) |
| 289 | 302 | |
| 290 | 303 | /* cartridge */ |
| 291 | 304 | // MCFG_CARTSLOT_ADD("cart") |