src/mess/machine/comxpl80.c
| r0 | r11065 | |
| 1 | /* |
| 2 | |
| 3 | TODO: |
| 4 | |
| 5 | - CPU type? |
| 6 | |
| 7 | */ |
| 8 | |
| 9 | #define ADDRESS_MAP_MODERN |
| 10 | |
| 11 | #include "emu.h" |
| 12 | #include "comxpl80.h" |
| 13 | #include "cpu/m6805/m6805.h" |
| 14 | #include "machine/devhelpr.h" |
| 15 | |
| 16 | |
| 17 | |
| 18 | //************************************************************************** |
| 19 | // MACROS / CONSTANTS |
| 20 | //************************************************************************** |
| 21 | |
| 22 | #define CX005_TAG "cx005" |
| 23 | |
| 24 | |
| 25 | |
| 26 | //************************************************************************** |
| 27 | // DEVICE DEFINITIONS |
| 28 | //************************************************************************** |
| 29 | |
| 30 | const device_type COMXPL80 = comxpl80_device_config::static_alloc_device_config; |
| 31 | |
| 32 | |
| 33 | |
| 34 | //************************************************************************** |
| 35 | // DEVICE CONFIGURATION |
| 36 | //************************************************************************** |
| 37 | |
| 38 | GENERIC_DEVICE_CONFIG_SETUP(comxpl80, "COMX PL-80") |
| 39 | |
| 40 | |
| 41 | //------------------------------------------------- |
| 42 | // device_config_complete - perform any |
| 43 | // operations now that the configuration is |
| 44 | // complete |
| 45 | //------------------------------------------------- |
| 46 | |
| 47 | void comxpl80_device_config::device_config_complete() |
| 48 | { |
| 49 | // inherit a copy of the static data |
| 50 | const comxpl80_interface *intf = reinterpret_cast<const comxpl80_interface *>(static_config()); |
| 51 | if (intf != NULL) |
| 52 | *static_cast<comxpl80_interface *>(this) = *intf; |
| 53 | |
| 54 | // or initialize to defaults if none provided |
| 55 | else |
| 56 | { |
| 57 | } |
| 58 | |
| 59 | m_shortname = "comxpl80"; |
| 60 | } |
| 61 | |
| 62 | |
| 63 | //------------------------------------------------- |
| 64 | // ROM( comxpl80 ) |
| 65 | //------------------------------------------------- |
| 66 | |
| 67 | ROM_START( comxpl80 ) |
| 68 | ROM_REGION( 0x1000, CX005_TAG, 0 ) |
| 69 | ROM_LOAD( "pl80.pt6", 0x0080, 0x0e00, CRC(ae059e5b) SHA1(f25812606b0082d32eb603d0a702a2187089d332) ) |
| 70 | |
| 71 | ROM_REGION( 0x6000, "gfx1", ROMREGION_ERASEFF ) // Plotter fonts |
| 72 | ROM_LOAD( "it.em.ou.bin", 0x2000, 0x2000, CRC(1b4a3198) SHA1(138ff6666a31c2d18cd63e609dd94d9cd1529931) ) |
| 73 | ROM_LOAD( "tiny.bin", 0x4000, 0x0400, CRC(940ec1ed) SHA1(ad83a3b57e2f0fbaa1e40644cd999b3f239635e8) ) |
| 74 | ROM_END |
| 75 | |
| 76 | |
| 77 | //------------------------------------------------- |
| 78 | // rom_region - device-specific ROM region |
| 79 | //------------------------------------------------- |
| 80 | |
| 81 | const rom_entry *comxpl80_device_config::device_rom_region() const |
| 82 | { |
| 83 | return ROM_NAME( comxpl80 ); |
| 84 | } |
| 85 | |
| 86 | |
| 87 | //------------------------------------------------- |
| 88 | // ADDRESS_MAP( comxpl80_mem ) |
| 89 | //------------------------------------------------- |
| 90 | |
| 91 | static ADDRESS_MAP_START( comxpl80_mem, AS_PROGRAM, 8, comxpl80_device ) |
| 92 | /* AM_RANGE(0x000, 0x000) AM_READWRITE(cx005_port_a_r, cx005_port_a_w) |
| 93 | AM_RANGE(0x001, 0x001) AM_READWRITE(cx005_port_b_r, cx005_port_b_w) |
| 94 | AM_RANGE(0x002, 0x002) AM_READWRITE(cx005_port_c_r, cx005_port_c_w) |
| 95 | AM_RANGE(0x003, 0x003) AM_READ(cx005_port_d_digital_r) |
| 96 | AM_RANGE(0x004, 0x004) AM_WRITE(cx005_port_a_ddr_w) |
| 97 | AM_RANGE(0x005, 0x005) AM_WRITE(cx005_port_b_ddr_w) |
| 98 | AM_RANGE(0x006, 0x006) AM_WRITE(cx005_port_c_ddr_w) |
| 99 | AM_RANGE(0x007, 0x007) AM_READ(cx005_port_d_analog_r) |
| 100 | AM_RANGE(0x008, 0x008) AM_READWRITE(cx005_timer_data_r, cx005_timer_data_w) |
| 101 | AM_RANGE(0x008, 0x008) AM_READWRITE(cx005_timer_ctrl_r, cx005_timer_ctrl_w)*/ |
| 102 | AM_RANGE(0x00a, 0x01f) AM_NOP // Not Used |
| 103 | AM_RANGE(0x020, 0x07f) AM_RAM // Internal RAM |
| 104 | AM_RANGE(0x080, 0xf7f) AM_ROM AM_REGION("comxpl80:cx005", 0) // Internal ROM |
| 105 | AM_RANGE(0xf80, 0xff7) AM_ROM // Self-Test |
| 106 | AM_RANGE(0xff8, 0xfff) AM_ROM // Interrupt Vectors |
| 107 | ADDRESS_MAP_END |
| 108 | |
| 109 | |
| 110 | //------------------------------------------------- |
| 111 | // ADDRESS_MAP( comxpl80_io ) |
| 112 | //------------------------------------------------- |
| 113 | |
| 114 | static ADDRESS_MAP_START( comxpl80_io, AS_IO, 8, comxpl80_device ) |
| 115 | ADDRESS_MAP_UNMAP_HIGH |
| 116 | AM_RANGE(0x00, 0x00) AM_DEVWRITE(DEVICE_SELF_OWNER, comxpl80_device, pa_w) |
| 117 | AM_RANGE(0x01, 0x01) AM_DEVWRITE(DEVICE_SELF_OWNER, comxpl80_device, pb_w) |
| 118 | AM_RANGE(0x02, 0x02) AM_DEVWRITE(DEVICE_SELF_OWNER, comxpl80_device, pc_w) |
| 119 | AM_RANGE(0x03, 0x03) AM_DEVREAD(DEVICE_SELF_OWNER, comxpl80_device, pd_r) |
| 120 | ADDRESS_MAP_END |
| 121 | |
| 122 | |
| 123 | //------------------------------------------------- |
| 124 | // MACHINE_DRIVER( comxpl80 ) |
| 125 | //------------------------------------------------- |
| 126 | |
| 127 | static MACHINE_CONFIG_FRAGMENT( comxpl80 ) |
| 128 | MCFG_CPU_ADD(CX005_TAG, M6805, 4000000) // CX005: some kind of MC6805/MC68HC05 clone |
| 129 | MCFG_CPU_PROGRAM_MAP(comxpl80_mem) |
| 130 | MCFG_CPU_IO_MAP(comxpl80_io) |
| 131 | MACHINE_CONFIG_END |
| 132 | |
| 133 | |
| 134 | //------------------------------------------------- |
| 135 | // machine_config_additions - device-specific |
| 136 | // machine configurations |
| 137 | //------------------------------------------------- |
| 138 | |
| 139 | machine_config_constructor comxpl80_device_config::device_mconfig_additions() const |
| 140 | { |
| 141 | return MACHINE_CONFIG_NAME( comxpl80 ); |
| 142 | } |
| 143 | |
| 144 | |
| 145 | //------------------------------------------------- |
| 146 | // INPUT_PORTS( comxpl80 ) |
| 147 | //------------------------------------------------- |
| 148 | |
| 149 | INPUT_PORTS_START( comxpl80 ) |
| 150 | PORT_START("SW") |
| 151 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("DOWN") |
| 152 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("PEN-SEL") |
| 153 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("UP") |
| 154 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("CR") |
| 155 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("ON LINE") |
| 156 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("PE") |
| 157 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("RIGHT") |
| 158 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("LEFT") |
| 159 | |
| 160 | PORT_START("FONT") |
| 161 | PORT_CONFNAME( 0x03, 0x00, "COMX PL-80 Font Pack") |
| 162 | PORT_CONFSETTING( 0x00, DEF_STR( None ) ) |
| 163 | PORT_CONFSETTING( 0x01, "Italic, Emphasized and Outline" ) |
| 164 | PORT_CONFSETTING( 0x02, "Tiny" ) |
| 165 | INPUT_PORTS_END |
| 166 | |
| 167 | |
| 168 | //------------------------------------------------- |
| 169 | // input_ports - device-specific input ports |
| 170 | //------------------------------------------------- |
| 171 | |
| 172 | const input_port_token *comxpl80_device_config::device_input_ports() const |
| 173 | { |
| 174 | return INPUT_PORTS_NAME( comxpl80 ); |
| 175 | } |
| 176 | |
| 177 | |
| 178 | |
| 179 | //************************************************************************** |
| 180 | // LIVE DEVICE |
| 181 | //************************************************************************** |
| 182 | |
| 183 | //------------------------------------------------- |
| 184 | // comxpl80_device - constructor |
| 185 | //------------------------------------------------- |
| 186 | |
| 187 | comxpl80_device::comxpl80_device(running_machine &_machine, const comxpl80_device_config &config) |
| 188 | : device_t(_machine, config), |
| 189 | m_config(config) |
| 190 | { |
| 191 | } |
| 192 | |
| 193 | |
| 194 | //------------------------------------------------- |
| 195 | // device_start - device-specific startup |
| 196 | //------------------------------------------------- |
| 197 | |
| 198 | void comxpl80_device::device_start() |
| 199 | { |
| 200 | // state saving |
| 201 | save_item(NAME(m_centronics_data)); |
| 202 | save_item(NAME(m_font_addr)); |
| 203 | save_item(NAME(m_x_motor_phase)); |
| 204 | save_item(NAME(m_y_motor_phase)); |
| 205 | save_item(NAME(m_z_motor_phase)); |
| 206 | save_item(NAME(m_plotter_data)); |
| 207 | save_item(NAME(m_plotter_ack)); |
| 208 | save_item(NAME(m_plotter_online)); |
| 209 | } |
| 210 | |
| 211 | |
| 212 | //------------------------------------------------- |
| 213 | // device_reset - device-specific reset |
| 214 | //------------------------------------------------- |
| 215 | |
| 216 | void comxpl80_device::device_reset() |
| 217 | { |
| 218 | } |
| 219 | |
| 220 | |
| 221 | //------------------------------------------------- |
| 222 | // pa_w - |
| 223 | //------------------------------------------------- |
| 224 | |
| 225 | WRITE8_MEMBER( comxpl80_device::pa_w ) |
| 226 | { |
| 227 | /* |
| 228 | |
| 229 | bit description |
| 230 | |
| 231 | 0 Y motor phase A |
| 232 | 1 Y motor phase B |
| 233 | 2 Y motor phase C |
| 234 | 3 Y motor phase D |
| 235 | 4 ROM A12 |
| 236 | 5 ROM CE /PT5 CK |
| 237 | 6 PT4 OE |
| 238 | 7 SW & PE ENABLE |
| 239 | |
| 240 | */ |
| 241 | |
| 242 | m_y_motor_phase = data & 0x0f; |
| 243 | m_font_addr = (BIT(data, 4) << 12) | (m_font_addr & 0xfff); |
| 244 | |
| 245 | m_plotter_data = 0xff; |
| 246 | |
| 247 | if (BIT(data, 5)) |
| 248 | { |
| 249 | // write motor phase data |
| 250 | } |
| 251 | else |
| 252 | { |
| 253 | // read data from font ROM |
| 254 | int font_rom = (input_port_read(this, "FONT") & 0x03) * 0x2000; |
| 255 | |
| 256 | m_plotter_data = m_machine.region("gfx2")->base()[font_rom | m_font_addr]; |
| 257 | } |
| 258 | |
| 259 | if (!BIT(data, 6)) |
| 260 | { |
| 261 | // read data from Centronics bus |
| 262 | m_plotter_data = m_centronics_data; |
| 263 | } |
| 264 | |
| 265 | if (BIT(data, 7)) |
| 266 | { |
| 267 | // read switches |
| 268 | m_plotter_data = input_port_read(this, "SW"); |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | |
| 273 | //------------------------------------------------- |
| 274 | // pb_w - |
| 275 | //------------------------------------------------- |
| 276 | |
| 277 | WRITE8_MEMBER( comxpl80_device::pb_w ) |
| 278 | { |
| 279 | /* |
| 280 | |
| 281 | bit description |
| 282 | |
| 283 | 0 Z motor phase A |
| 284 | 1 Z motor phase B |
| 285 | 2 Z motor phase C |
| 286 | 3 Z motor phase D |
| 287 | 4 ROM A8 |
| 288 | 5 ROM A9 |
| 289 | 6 ROM A10 |
| 290 | 7 ROM A11 |
| 291 | |
| 292 | */ |
| 293 | |
| 294 | m_z_motor_phase = data & 0x0f; |
| 295 | |
| 296 | m_font_addr = (m_font_addr & 0x10ff) | (data << 4); |
| 297 | } |
| 298 | |
| 299 | |
| 300 | //------------------------------------------------- |
| 301 | // pc_w - |
| 302 | //------------------------------------------------- |
| 303 | |
| 304 | WRITE8_MEMBER( comxpl80_device::pc_w ) |
| 305 | { |
| 306 | /* |
| 307 | |
| 308 | bit description |
| 309 | |
| 310 | 0 ROM A0 /X motor phase A |
| 311 | 1 ROM A1 /X motor phase B |
| 312 | 2 ROM A2 /X motor phase C |
| 313 | 3 ROM A3 /X motor phase D |
| 314 | 4 ROM A4 /ACK |
| 315 | 5 ROM A5 /On-line LED |
| 316 | 6 ROM A6 |
| 317 | 7 ROM A7 |
| 318 | |
| 319 | */ |
| 320 | |
| 321 | m_font_addr = (m_font_addr & 0x1f00) | data; |
| 322 | |
| 323 | m_x_motor_phase = data & 0x0f; |
| 324 | |
| 325 | m_plotter_ack = BIT(data, 4); |
| 326 | m_plotter_online = BIT(data, 5); |
| 327 | } |
| 328 | |
| 329 | |
| 330 | //------------------------------------------------- |
| 331 | // pd_r - |
| 332 | //------------------------------------------------- |
| 333 | |
| 334 | READ8_MEMBER( comxpl80_device::pd_r ) |
| 335 | { |
| 336 | /* |
| 337 | |
| 338 | bit description |
| 339 | |
| 340 | 0 D0 /ROM D0 /DOWN SW |
| 341 | 1 D1 /ROM D1 /PEN-SEL SW |
| 342 | 2 D2 /ROM D2 /UP SW |
| 343 | 3 D3 /ROM D3 /CRSW |
| 344 | 4 D4 /ROM D4 /ON LINE SW |
| 345 | 5 D5 /ROM D5 /PE Sensor |
| 346 | 6 D6 /ROM D6 /RIGHT SW |
| 347 | 7 D7 /ROM D7 /LEFT SW |
| 348 | |
| 349 | */ |
| 350 | |
| 351 | return m_plotter_data; |
| 352 | } |
src/mess/machine/comxpl80.h
| r0 | r11065 | |
| 1 | #pragma once |
| 2 | |
| 3 | #ifndef __COMXPL80__ |
| 4 | #define __COMXPL80__ |
| 5 | |
| 6 | #include "emu.h" |
| 7 | |
| 8 | |
| 9 | |
| 10 | //************************************************************************** |
| 11 | // MACROS / CONSTANTS |
| 12 | //************************************************************************** |
| 13 | |
| 14 | #define COMXPL80_TAG "comxpl80" |
| 15 | |
| 16 | |
| 17 | |
| 18 | //************************************************************************** |
| 19 | // INTERFACE CONFIGURATION MACROS |
| 20 | //************************************************************************** |
| 21 | |
| 22 | #define MCFG_COMXPL80_ADD() \ |
| 23 | MCFG_DEVICE_ADD(COMXPL80_TAG, COMXPL80, 0) |
| 24 | |
| 25 | |
| 26 | #define COMXPL80_INTERFACE(_name) \ |
| 27 | const comxpl80_interface (_name) = |
| 28 | |
| 29 | |
| 30 | |
| 31 | //************************************************************************** |
| 32 | // TYPE DEFINITIONS |
| 33 | //************************************************************************** |
| 34 | |
| 35 | // ======================> comxpl80_interface |
| 36 | |
| 37 | struct comxpl80_interface |
| 38 | { |
| 39 | devcb_write_line m_out_txd_func; |
| 40 | devcb_write_line m_out_clock_func; |
| 41 | devcb_write_line m_out_keydown_func; |
| 42 | }; |
| 43 | |
| 44 | |
| 45 | // ======================> comxpl80_device_config |
| 46 | |
| 47 | class comxpl80_device_config : public device_config, |
| 48 | public comxpl80_interface |
| 49 | { |
| 50 | friend class comxpl80_device; |
| 51 | |
| 52 | // construction/destruction |
| 53 | comxpl80_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 54 | |
| 55 | public: |
| 56 | // allocators |
| 57 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 58 | virtual device_t *alloc_device(running_machine &machine) const; |
| 59 | |
| 60 | // optional information overrides |
| 61 | virtual const rom_entry *device_rom_region() const; |
| 62 | virtual machine_config_constructor device_mconfig_additions() const; |
| 63 | virtual const input_port_token *device_input_ports() const; |
| 64 | |
| 65 | protected: |
| 66 | // device_config overrides |
| 67 | virtual void device_config_complete(); |
| 68 | }; |
| 69 | |
| 70 | |
| 71 | // ======================> comxpl80_device |
| 72 | |
| 73 | class comxpl80_device : public device_t |
| 74 | { |
| 75 | friend class comxpl80_device_config; |
| 76 | |
| 77 | // construction/destruction |
| 78 | comxpl80_device(running_machine &_machine, const comxpl80_device_config &_config); |
| 79 | |
| 80 | public: |
| 81 | DECLARE_WRITE8_MEMBER( pa_w ); |
| 82 | DECLARE_WRITE8_MEMBER( pb_w ); |
| 83 | DECLARE_WRITE8_MEMBER( pc_w ); |
| 84 | DECLARE_READ8_MEMBER( pd_r ); |
| 85 | |
| 86 | protected: |
| 87 | // device-level overrides |
| 88 | virtual void device_start(); |
| 89 | virtual void device_reset(); |
| 90 | |
| 91 | private: |
| 92 | // printer state |
| 93 | UINT8 m_centronics_data; // centronics data |
| 94 | |
| 95 | // PL-80 plotter state |
| 96 | UINT16 m_font_addr; // font ROM pack address latch |
| 97 | UINT8 m_x_motor_phase; // X motor phase |
| 98 | UINT8 m_y_motor_phase; // Y motor phase |
| 99 | UINT8 m_z_motor_phase; // Z motor phase |
| 100 | UINT8 m_plotter_data; // plotter data bus |
| 101 | int m_plotter_ack; // plotter acknowledge |
| 102 | int m_plotter_online; // online LED |
| 103 | |
| 104 | const comxpl80_device_config &m_config; |
| 105 | }; |
| 106 | |
| 107 | |
| 108 | // device type definition |
| 109 | extern const device_type COMXPL80; |
| 110 | |
| 111 | |
| 112 | |
| 113 | #endif |
src/mess/drivers/comxpl80.c
| r11064 | r11065 | |
| 1 | | #include "emu.h" |
| 2 | | #include "cpu/m6805/m6805.h" |
| 3 | | |
| 4 | | class comxpl80_state : public driver_device |
| 5 | | { |
| 6 | | public: |
| 7 | | comxpl80_state(running_machine &machine, const driver_device_config_base &config) |
| 8 | | : driver_device(machine, config) { } |
| 9 | | |
| 10 | | /* printer state */ |
| 11 | | UINT8 m_centronics_data; /* centronics data */ |
| 12 | | |
| 13 | | /* PL-80 plotter state */ |
| 14 | | UINT16 m_font_addr; /* font ROM pack address latch */ |
| 15 | | UINT8 m_x_motor_phase; /* X motor phase */ |
| 16 | | UINT8 m_y_motor_phase; /* Y motor phase */ |
| 17 | | UINT8 m_z_motor_phase; /* Z motor phase */ |
| 18 | | UINT8 m_plotter_data; /* plotter data bus */ |
| 19 | | int m_plotter_ack; /* plotter acknowledge */ |
| 20 | | int m_plotter_online; /* online LED */ |
| 21 | | }; |
| 22 | | |
| 23 | | /* Read/Write Handlers */ |
| 24 | | |
| 25 | | static WRITE8_HANDLER( pl80_port_a_w ) |
| 26 | | { |
| 27 | | /* |
| 28 | | |
| 29 | | bit description |
| 30 | | |
| 31 | | 0 Y motor phase A |
| 32 | | 1 Y motor phase B |
| 33 | | 2 Y motor phase C |
| 34 | | 3 Y motor phase D |
| 35 | | 4 ROM A12 |
| 36 | | 5 ROM CE /PT5 CK |
| 37 | | 6 PT4 OE |
| 38 | | 7 SW & PE ENABLE |
| 39 | | |
| 40 | | */ |
| 41 | | |
| 42 | | comxpl80_state *state = space->machine().driver_data<comxpl80_state>(); |
| 43 | | |
| 44 | | state->m_y_motor_phase = data & 0x0f; |
| 45 | | state->m_font_addr = (BIT(data, 4) << 12) | (state->m_font_addr & 0xfff); |
| 46 | | |
| 47 | | state->m_plotter_data = 0xff; |
| 48 | | |
| 49 | | if (BIT(data, 5)) |
| 50 | | { |
| 51 | | // write motor phase data |
| 52 | | } |
| 53 | | else |
| 54 | | { |
| 55 | | // read data from font ROM |
| 56 | | int font_rom = (input_port_read(space->machine(), "FONT") & 0x03) * 0x2000; |
| 57 | | |
| 58 | | state->m_plotter_data = space->machine().region("gfx2")->base()[font_rom | state->m_font_addr]; |
| 59 | | } |
| 60 | | |
| 61 | | if (!BIT(data, 6)) |
| 62 | | { |
| 63 | | // read data from Centronics bus |
| 64 | | state->m_plotter_data = state->m_centronics_data; |
| 65 | | } |
| 66 | | |
| 67 | | if (BIT(data, 7)) |
| 68 | | { |
| 69 | | // read switches |
| 70 | | state->m_plotter_data = input_port_read(space->machine(), "SW"); |
| 71 | | } |
| 72 | | } |
| 73 | | |
| 74 | | static WRITE8_HANDLER( pl80_port_b_w ) |
| 75 | | { |
| 76 | | /* |
| 77 | | |
| 78 | | bit description |
| 79 | | |
| 80 | | 0 Z motor phase A |
| 81 | | 1 Z motor phase B |
| 82 | | 2 Z motor phase C |
| 83 | | 3 Z motor phase D |
| 84 | | 4 ROM A8 |
| 85 | | 5 ROM A9 |
| 86 | | 6 ROM A10 |
| 87 | | 7 ROM A11 |
| 88 | | |
| 89 | | */ |
| 90 | | |
| 91 | | comxpl80_state *state = space->machine().driver_data<comxpl80_state>(); |
| 92 | | |
| 93 | | state->m_z_motor_phase = data & 0x0f; |
| 94 | | |
| 95 | | state->m_font_addr = (state->m_font_addr & 0x10ff) | (data << 4); |
| 96 | | } |
| 97 | | |
| 98 | | static WRITE8_HANDLER( pl80_port_c_w ) |
| 99 | | { |
| 100 | | /* |
| 101 | | |
| 102 | | bit description |
| 103 | | |
| 104 | | 0 ROM A0 /X motor phase A |
| 105 | | 1 ROM A1 /X motor phase B |
| 106 | | 2 ROM A2 /X motor phase C |
| 107 | | 3 ROM A3 /X motor phase D |
| 108 | | 4 ROM A4 /ACK |
| 109 | | 5 ROM A5 /On-line LED |
| 110 | | 6 ROM A6 |
| 111 | | 7 ROM A7 |
| 112 | | |
| 113 | | */ |
| 114 | | |
| 115 | | comxpl80_state *state = space->machine().driver_data<comxpl80_state>(); |
| 116 | | |
| 117 | | state->m_font_addr = (state->m_font_addr & 0x1f00) | data; |
| 118 | | |
| 119 | | state->m_x_motor_phase = data & 0x0f; |
| 120 | | |
| 121 | | state->m_plotter_ack = BIT(data, 4); |
| 122 | | state->m_plotter_online = BIT(data, 5); |
| 123 | | } |
| 124 | | |
| 125 | | static READ8_HANDLER( pl80_port_d_r ) |
| 126 | | { |
| 127 | | /* |
| 128 | | |
| 129 | | bit description |
| 130 | | |
| 131 | | 0 D0 /ROM D0 /DOWN SW |
| 132 | | 1 D1 /ROM D1 /PEN-SEL SW |
| 133 | | 2 D2 /ROM D2 /UP SW |
| 134 | | 3 D3 /ROM D3 /CRSW |
| 135 | | 4 D4 /ROM D4 /ON LINE SW |
| 136 | | 5 D5 /ROM D5 /PE Sensor |
| 137 | | 6 D6 /ROM D6 /RIGHT SW |
| 138 | | 7 D7 /ROM D7 /LEFT SW |
| 139 | | |
| 140 | | */ |
| 141 | | |
| 142 | | comxpl80_state *state = space->machine().driver_data<comxpl80_state>(); |
| 143 | | |
| 144 | | return state->m_plotter_data; |
| 145 | | } |
| 146 | | |
| 147 | | /* Memory Maps */ |
| 148 | | |
| 149 | | static ADDRESS_MAP_START( pl80_map, AS_PROGRAM, 8 ) |
| 150 | | ADDRESS_MAP_UNMAP_HIGH |
| 151 | | /* AM_RANGE(0x000, 0x000) AM_READWRITE(cx005_port_a_r, cx005_port_a_w) |
| 152 | | AM_RANGE(0x001, 0x001) AM_READWRITE(cx005_port_b_r, cx005_port_b_w) |
| 153 | | AM_RANGE(0x002, 0x002) AM_READWRITE(cx005_port_c_r, cx005_port_c_w) |
| 154 | | AM_RANGE(0x003, 0x003) AM_READ(cx005_port_d_digital_r) |
| 155 | | AM_RANGE(0x004, 0x004) AM_WRITE(cx005_port_a_ddr_w) |
| 156 | | AM_RANGE(0x005, 0x005) AM_WRITE(cx005_port_b_ddr_w) |
| 157 | | AM_RANGE(0x006, 0x006) AM_WRITE(cx005_port_c_ddr_w) |
| 158 | | AM_RANGE(0x007, 0x007) AM_READ(cx005_port_d_analog_r) |
| 159 | | AM_RANGE(0x008, 0x008) AM_READWRITE(cx005_timer_data_r, cx005_timer_data_w) |
| 160 | | AM_RANGE(0x008, 0x008) AM_READWRITE(cx005_timer_ctrl_r, cx005_timer_ctrl_w)*/ |
| 161 | | AM_RANGE(0x00a, 0x01f) AM_NOP // Not Used |
| 162 | | AM_RANGE(0x020, 0x07f) AM_RAM // Internal RAM |
| 163 | | AM_RANGE(0x080, 0xf7f) AM_ROM // Internal ROM |
| 164 | | AM_RANGE(0xf80, 0xff7) AM_ROM // Self-Test |
| 165 | | AM_RANGE(0xff8, 0xfff) AM_ROM // Interrupt Vectors |
| 166 | | ADDRESS_MAP_END |
| 167 | | |
| 168 | | static ADDRESS_MAP_START( pl80_io_map, AS_IO, 8 ) |
| 169 | | ADDRESS_MAP_UNMAP_HIGH |
| 170 | | AM_RANGE(0x00, 0x00) AM_WRITE(pl80_port_a_w) |
| 171 | | AM_RANGE(0x01, 0x01) AM_WRITE(pl80_port_b_w) |
| 172 | | AM_RANGE(0x02, 0x02) AM_WRITE(pl80_port_c_w) |
| 173 | | AM_RANGE(0x03, 0x03) AM_READ(pl80_port_d_r) |
| 174 | | ADDRESS_MAP_END |
| 175 | | |
| 176 | | /* Input Ports */ |
| 177 | | |
| 178 | | static INPUT_PORTS_START( comxpl80 ) |
| 179 | | PORT_START("SW") |
| 180 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("DOWN") |
| 181 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("PEN-SEL") |
| 182 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("UP") |
| 183 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("CR") |
| 184 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("ON LINE") |
| 185 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("PE") |
| 186 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("RIGHT") |
| 187 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("LEFT") |
| 188 | | |
| 189 | | PORT_START("FONT") |
| 190 | | PORT_CONFNAME( 0x03, 0x00, "COMX PL-80 Font Pack") |
| 191 | | PORT_CONFSETTING( 0x00, DEF_STR( None ) ) |
| 192 | | PORT_CONFSETTING( 0x01, "Italic, Emphasized and Outline" ) |
| 193 | | PORT_CONFSETTING( 0x02, "Tiny" ) |
| 194 | | INPUT_PORTS_END |
| 195 | | |
| 196 | | /* Machine Driver */ |
| 197 | | |
| 198 | | static MACHINE_CONFIG_START( comxpl80, comxpl80_state ) |
| 199 | | |
| 200 | | // basic system hardware |
| 201 | | |
| 202 | | MCFG_CPU_ADD("maincpu", M6805, 4000000) // CX005: some kind of MC6805/MC68HC05 clone |
| 203 | | MCFG_CPU_PROGRAM_MAP(pl80_map) |
| 204 | | MCFG_CPU_IO_MAP(pl80_io_map) |
| 205 | | MACHINE_CONFIG_END |
| 206 | | |
| 207 | | /* ROMs */ |
| 208 | | |
| 209 | | ROM_START( comxpl80 ) |
| 210 | | ROM_REGION( 0x1000, "maincpu", 0 ) |
| 211 | | ROM_LOAD( "pl80.pt6", 0x0080, 0x0e00, CRC(ae059e5b) SHA1(f25812606b0082d32eb603d0a702a2187089d332) ) |
| 212 | | |
| 213 | | ROM_REGION( 0x6000, "gfx1", ROMREGION_ERASEFF ) // Plotter fonts |
| 214 | | ROM_LOAD( "it.em.ou.bin", 0x2000, 0x2000, CRC(1b4a3198) SHA1(138ff6666a31c2d18cd63e609dd94d9cd1529931) ) |
| 215 | | ROM_LOAD( "tiny.bin", 0x4000, 0x0400, CRC(940ec1ed) SHA1(ad83a3b57e2f0fbaa1e40644cd999b3f239635e8) ) |
| 216 | | ROM_END |
| 217 | | |
| 218 | | /* System Drivers */ |
| 219 | | |
| 220 | | // YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS |
| 221 | | COMP( 1987, comxpl80, 0, 0, comxpl80, comxpl80, 0, "Comx World Operations Ltd", "COMX PL-80", GAME_NOT_WORKING | GAME_NO_SOUND ) |