src/mess/drivers/elwro800.c
| r5498 | r5499 | |
| 2 | 2 | |
| 3 | 3 | Elwro 800 Junior |
| 4 | 4 | |
| 5 | | 12/05/2009 Skeleton driver. |
| 5 | Driver by Mariusz Wojcieszek |
| 6 | 6 | |
| 7 | ToDo: |
| 8 | - map keys with Polish characters |
| 9 | - add reading of computer number (read of FE port when bit 4 of port F7 is set) |
| 10 | - printing (LPRINT from ZX Basic) hangs waiting for bit 0 of DD register (port C of PPI8255), |
| 11 | may be a bug in handshake implementation of PPI (both PPI implementations are affected) |
| 12 | - 8251 DTR and DTS signals are connected (with some additional logic) to NMI of Z80, this |
| 13 | is not emulated |
| 14 | - 8251 is used for JUNET network (a network of Elwro 800 Junior computers, allows sharing |
| 15 | floppy disc drives and printers) - network is not emulated |
| 16 | - when RAM is mapped at 0x0000 - 0x1fff (in CP/J mode), reading a location 66 with /M1=0 |
| 17 | (effectively reading NMI vector) is hardwired to return 0xDF (RST #18) - this is not emulated |
| 18 | (note that in CP/J mode address 66 is used for FCB) |
| 19 | |
| 7 | 20 | ****************************************************************************/ |
| 8 | 21 | |
| 9 | 22 | #include "driver.h" |
| 23 | #include "includes/spectrum.h" |
| 24 | |
| 25 | /* Components */ |
| 10 | 26 | #include "cpu/z80/z80.h" |
| 27 | #include "machine/nec765.h" /* for floppy disc controller */ |
| 28 | #include "machine/i8255a.h" |
| 29 | #include "sound/speaker.h" |
| 30 | #include "sound/wave.h" |
| 31 | #include "machine/ctronics.h" |
| 32 | #include "machine/msm8251.h" |
| 11 | 33 | |
| 34 | /* Devices */ |
| 35 | #include "devices/dsk.h" /* for CPCEMU style disk images */ |
| 36 | #include "devices/cassette.h" |
| 37 | #include "formats/tzx_cas.h" |
| 38 | |
| 39 | /************************************* |
| 40 | * |
| 41 | * NEC765/Floppy drive |
| 42 | * |
| 43 | *************************************/ |
| 44 | |
| 45 | static const struct nec765_interface elwro800jr_nec765_interface = |
| 46 | { |
| 47 | DEVCB_NULL, |
| 48 | NULL, |
| 49 | NULL, |
| 50 | NEC765_RDY_PIN_CONNECTED |
| 51 | }; |
| 52 | |
| 53 | static WRITE8_HANDLER(elwro800jr_fdc_control_w) |
| 54 | { |
| 55 | const device_config *fdc = devtag_get_device(space->machine, "nec765"); |
| 56 | |
| 57 | floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), (data & 0x01)); |
| 58 | floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 1), (data & 0x02)); |
| 59 | floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), 1,1); |
| 60 | floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 1), 1,1); |
| 61 | |
| 62 | nec765_tc_w(fdc, data & 0x04); |
| 63 | |
| 64 | nec765_reset_w(fdc, !(data & 0x08)); |
| 65 | } |
| 66 | |
| 67 | /************************************* |
| 68 | * |
| 69 | * I/O port F7: memory mapping |
| 70 | * |
| 71 | *************************************/ |
| 72 | |
| 73 | static void elwro800jr_mmu_w(running_machine *machine, UINT8 data) |
| 74 | { |
| 75 | UINT8 *prom = memory_region(machine, "proms") + 0x200; |
| 76 | UINT8 cs; |
| 77 | UINT8 ls175; |
| 78 | |
| 79 | ls175 = BITSWAP8(data, 7, 6, 5, 4, 4, 5, 7, 6) & 0x0f; |
| 80 | |
| 81 | cs = prom[((0x0000 >> 10) | (ls175 << 6)) & 0x1ff]; |
| 82 | if (!BIT(cs,0)) |
| 83 | { |
| 84 | // rom BAS0 |
| 85 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x0000); /* BAS0 ROM */ |
| 86 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, SMH_NOP); |
| 87 | } |
| 88 | else if (!BIT(cs,4)) |
| 89 | { |
| 90 | // rom BOOT |
| 91 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x4000); /* BOOT ROM */ |
| 92 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, SMH_NOP); |
| 93 | } |
| 94 | else |
| 95 | { |
| 96 | // RAM |
| 97 | memory_set_bankptr(machine, 1, mess_ram); |
| 98 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, SMH_BANK(1)); |
| 99 | } |
| 100 | |
| 101 | cs = prom[((0x2000 >> 10) | (ls175 << 6)) & 0x1ff]; |
| 102 | if (!BIT(cs,1)) |
| 103 | { |
| 104 | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x2000); /* BAS1 ROM */ |
| 105 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, SMH_NOP); |
| 106 | } |
| 107 | else |
| 108 | { |
| 109 | memory_set_bankptr(machine, 2, mess_ram + 0x2000); /* RAM */ |
| 110 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, SMH_BANK(2)); |
| 111 | } |
| 112 | |
| 113 | if (BIT(ls175,2)) |
| 114 | { |
| 115 | // relok |
| 116 | spectrum_screen_location = mess_ram + 0xe000; |
| 117 | } |
| 118 | else |
| 119 | { |
| 120 | spectrum_screen_location = mess_ram + 0x4000; |
| 121 | } |
| 122 | |
| 123 | if (BIT(ls175,3)) |
| 124 | { |
| 125 | logerror("Reading network number\n"); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | /************************************* |
| 130 | * |
| 131 | * 8255: joystick and Centronics printer connections |
| 132 | * |
| 133 | *************************************/ |
| 134 | |
| 135 | static READ8_DEVICE_HANDLER(i8255_port_c_r) |
| 136 | { |
| 137 | const device_config *printer = devtag_get_device(device->machine, "centronics"); |
| 138 | return (centronics_ack_r(printer) << 2); |
| 139 | } |
| 140 | |
| 141 | static WRITE8_DEVICE_HANDLER(i8255_port_c_w) |
| 142 | { |
| 143 | const device_config *printer = devtag_get_device(device->machine, "centronics"); |
| 144 | centronics_strobe_w(printer, (data >> 7) & 0x01); |
| 145 | } |
| 146 | |
| 147 | static I8255A_INTERFACE(elwro800jr_ppi8255_interface) |
| 148 | { |
| 149 | DEVCB_INPUT_PORT("JOY"), |
| 150 | DEVCB_DEVICE_HANDLER("centronics", centronics_data_r), |
| 151 | DEVCB_HANDLER(i8255_port_c_r), |
| 152 | DEVCB_NULL, |
| 153 | DEVCB_DEVICE_HANDLER("centronics", centronics_data_w), |
| 154 | DEVCB_HANDLER(i8255_port_c_w) |
| 155 | }; |
| 156 | |
| 157 | static const centronics_interface elwro800jr_centronics_interface = |
| 158 | { |
| 159 | FALSE, |
| 160 | DEVCB_DEVICE_LINE("ppi8255", i8255a_pc2_w), |
| 161 | DEVCB_NULL, |
| 162 | DEVCB_NULL |
| 163 | }; |
| 164 | |
| 165 | /************************************* |
| 166 | * |
| 167 | * I/O reads and writes |
| 168 | * |
| 169 | * I/O accesses are decoded by prom which uses 8 low address lines (A0-A8) as input |
| 170 | * and outputs chip select signals for system components. Standard adresses are: |
| 171 | * |
| 172 | * 0x1F: 8255 port A (joystick) |
| 173 | * 0xBE: 8251 data (Junet network) |
| 174 | * 0xBF: 8251 control/status (Junet network) |
| 175 | * 0xDC: 8255 control |
| 176 | * 0xDD: 8255 port C (centronics 7-strobe, 2-ack) |
| 177 | * 0xDE: 8255 port B (centronics data) |
| 178 | * 0xDF: 8255 port A (joystick) |
| 179 | * 0xEE: FDC 765A status |
| 180 | * 0xEF: FDC 765A command and data |
| 181 | * 0xF1: FDC control (motor on/off) |
| 182 | * 0xF7: memory banking |
| 183 | * 0xFE (write): border color, speaker and tape (as in Spectrum) |
| 184 | * 0x??FE, 0x??7F, 0x??7B (read): keyboard reading |
| 185 | *************************************/ |
| 186 | |
| 187 | static READ8_HANDLER(elwro800jr_io_r) |
| 188 | { |
| 189 | UINT8 *prom = memory_region(space->machine, "proms"); |
| 190 | UINT8 cs = prom[offset & 0x1ff]; |
| 191 | |
| 192 | if (!BIT(cs,0)) |
| 193 | { |
| 194 | // CFE |
| 195 | int mask = 0x8000; |
| 196 | int data = 0xff; |
| 197 | int i; |
| 198 | char port_name[6] = "LINE0"; |
| 199 | |
| 200 | for (i = 0; i < 9; mask >>= 1, i++) |
| 201 | { |
| 202 | if (!(offset & mask)) |
| 203 | { |
| 204 | if (i == 8) |
| 205 | { |
| 206 | port_name[4] = '8'; |
| 207 | } |
| 208 | else |
| 209 | { |
| 210 | port_name[4] = '0' + (7 - i); |
| 211 | } |
| 212 | data &= (input_port_read(space->machine, port_name)); |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | if ((offset & 0xff) == 0xfb) |
| 217 | { |
| 218 | data &= input_port_read(space->machine, "LINE9"); |
| 219 | } |
| 220 | |
| 221 | /* cassette input from wav */ |
| 222 | if (cassette_input(devtag_get_device(space->machine, "cassette")) > 0.0038 ) |
| 223 | { |
| 224 | data &= ~0x40; |
| 225 | } |
| 226 | |
| 227 | return data; |
| 228 | } |
| 229 | else if (!BIT(cs,1)) |
| 230 | { |
| 231 | // CF7 |
| 232 | } |
| 233 | else if (!BIT(cs,2)) |
| 234 | { |
| 235 | // CS55 |
| 236 | const device_config *ppi = devtag_get_device(space->machine, "ppi8255"); |
| 237 | return i8255a_r(ppi, (offset & 0x03) ^ 0x03); |
| 238 | //return ppi8255_r(ppi, (offset & 0x03) ^ 0x03); |
| 239 | } |
| 240 | else if (!BIT(cs,3)) |
| 241 | { |
| 242 | // CSFDC |
| 243 | const device_config *fdc = devtag_get_device(space->machine, "nec765"); |
| 244 | if (offset & 1) |
| 245 | { |
| 246 | return nec765_data_r(fdc,0); |
| 247 | } |
| 248 | else |
| 249 | { |
| 250 | return nec765_status_r(fdc,0); |
| 251 | } |
| 252 | } |
| 253 | else if (!BIT(cs,4)) |
| 254 | { |
| 255 | // CS51 |
| 256 | const device_config *usart = devtag_get_device(space->machine, "msm8251"); |
| 257 | if (offset & 1) |
| 258 | { |
| 259 | return msm8251_status_r(usart, 0); |
| 260 | } |
| 261 | else |
| 262 | { |
| 263 | return msm8251_data_r(usart, 0); |
| 264 | } |
| 265 | } |
| 266 | else if (!BIT(cs,5)) |
| 267 | { |
| 268 | // CF1 |
| 269 | } |
| 270 | else |
| 271 | { |
| 272 | logerror("Unmapped I/O read: %04x\n", offset); |
| 273 | } |
| 274 | return 0x00; |
| 275 | } |
| 276 | |
| 277 | static WRITE8_HANDLER(elwro800jr_io_w) |
| 278 | { |
| 279 | UINT8 *prom = memory_region(space->machine, "proms"); |
| 280 | UINT8 cs = prom[offset & 0x1ff]; |
| 281 | |
| 282 | if (!BIT(cs,0)) |
| 283 | { |
| 284 | // CFE |
| 285 | spectrum_port_fe_w(space, 0, data); |
| 286 | } |
| 287 | else if (!BIT(cs,1)) |
| 288 | { |
| 289 | // CF7 |
| 290 | elwro800jr_mmu_w(space->machine, data); |
| 291 | } |
| 292 | else if (!BIT(cs,2)) |
| 293 | { |
| 294 | // CS55 |
| 295 | const device_config *ppi = devtag_get_device(space->machine, "ppi8255"); |
| 296 | i8255a_w(ppi, (offset & 0x03) ^ 0x03, data); |
| 297 | //ppi8255_w(ppi, (offset & 0x03) ^ 0x03, data); |
| 298 | } |
| 299 | else if (!BIT(cs,3)) |
| 300 | { |
| 301 | // CSFDC |
| 302 | const device_config *fdc = devtag_get_device(space->machine, "nec765"); |
| 303 | if (offset & 1) |
| 304 | { |
| 305 | nec765_data_w(fdc, 0, data); |
| 306 | } |
| 307 | } |
| 308 | else if (!BIT(cs,4)) |
| 309 | { |
| 310 | // CS51 |
| 311 | const device_config *usart = devtag_get_device(space->machine, "msm8251"); |
| 312 | if (offset & 1) |
| 313 | { |
| 314 | msm8251_control_w(usart, 0, data); |
| 315 | } |
| 316 | else |
| 317 | { |
| 318 | msm8251_data_w(usart, 0, data); |
| 319 | } |
| 320 | } |
| 321 | else if (!BIT(cs,5)) |
| 322 | { |
| 323 | // CF1 |
| 324 | elwro800jr_fdc_control_w(space, 0, data); |
| 325 | } |
| 326 | else |
| 327 | { |
| 328 | logerror("Unmapped I/O write: %04x %02x\n", offset, data); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | /************************************* |
| 333 | * |
| 334 | * Memory maps |
| 335 | * |
| 336 | *************************************/ |
| 337 | |
| 12 | 338 | static ADDRESS_MAP_START(elwro800_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 13 | | ADDRESS_MAP_UNMAP_HIGH |
| 339 | AM_RANGE(0x0000, 0x1fff) AM_RAMBANK(1) |
| 340 | AM_RANGE(0x2000, 0x3fff) AM_RAMBANK(2) |
| 341 | AM_RANGE(0x4000, 0xffff) AM_RAMBANK(3) |
| 14 | 342 | ADDRESS_MAP_END |
| 15 | 343 | |
| 16 | | static ADDRESS_MAP_START( elwro800_io , ADDRESS_SPACE_IO, 8) |
| 17 | | ADDRESS_MAP_UNMAP_HIGH |
| 344 | static ADDRESS_MAP_START(elwro800_io, ADDRESS_SPACE_IO, 8) |
| 345 | AM_RANGE(0x0000, 0xffff) AM_READWRITE(elwro800jr_io_r, elwro800jr_io_w) |
| 18 | 346 | ADDRESS_MAP_END |
| 19 | 347 | |
| 20 | | /* Input ports */ |
| 348 | /************************************* |
| 349 | * |
| 350 | * Input ports |
| 351 | * |
| 352 | *************************************/ |
| 353 | |
| 21 | 354 | static INPUT_PORTS_START( elwro800 ) |
| 355 | /* PORT_NAME = KEY Mode CAPS Mode SYMBOL Mode EXT Mode EXT+Shift Mode BASIC Mode */ |
| 356 | PORT_START("LINE0") /* 0xFEFE */ |
| 357 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 358 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z Z : LN BEEP COPY") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(':') |
| 359 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x X \xC2\xA3 EXP INK CLEAR") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR('\xA3') |
| 360 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c C ? LPRINT PAPER CONT") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR('?') |
| 361 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v V / LLIST FLASH CLS") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR('/') |
| 362 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_ASTERISK) |
| 363 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) |
| 364 | |
| 365 | PORT_START("LINE1") /* 0xFDFE */ |
| 366 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a A STOP READ ~ NEW") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')// PORT_CHAR('~') |
| 367 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s S NOT RESTORE | SAVE") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')// PORT_CHAR('|') |
| 368 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d D STEP DATA \\ DIM") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')// PORT_CHAR('\\') |
| 369 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f F TO SGN { FOR") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')// PORT_CHAR('{') |
| 370 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g G THEN ABS } GOTO") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')// PORT_CHAR('}') |
| 371 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) |
| 372 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) |
| 373 | |
| 374 | PORT_START("LINE2") /* 0xFBFE */ |
| 375 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q Q <= SIN ASN PLOT") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 376 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w W <> COS ACS DRAW") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 377 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e E >= TAN ATN REM") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 378 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r R < INT VERIFY RUN") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('<') |
| 379 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t T > RND MERGE RAND") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR('>') |
| 380 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) |
| 381 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) |
| 382 | |
| 383 | PORT_START("LINE3") /* 0xF7FE */ |
| 384 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 EDIT ! BLUE DEF FN") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('\xD7') PORT_CHAR('!') |
| 385 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 CAPS LOCK @ RED FN") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\xD7') PORT_CHAR('@') |
| 386 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 TRUE VID # MAGENTA LINE") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xD7') PORT_CHAR('#') |
| 387 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 INV VID $ GREEN OPEN#") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xD7') PORT_CHAR('$') |
| 388 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 Left % CYAN CLOSE#") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR('%') |
| 389 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) |
| 390 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \\") PORT_CODE(KEYCODE_BACKSLASH) |
| 391 | |
| 392 | PORT_START("LINE4") /* 0xEFFE */ |
| 393 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 DEL _ BLACK FORMAT") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(8) PORT_CHAR('_') |
| 394 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 GRAPH ) POINT") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('\xD7') PORT_CHAR(')') |
| 395 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 Right ( CAT") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR('(') |
| 396 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 Up ' WHITE ERASE") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR('\'') |
| 397 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 Down & YELLOW CP/J") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR('&') |
| 398 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) |
| 399 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) |
| 400 | |
| 401 | PORT_START("LINE5") /* 0xDFFE */ |
| 402 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p P \" TAB (c) PRINT") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('"') |
| 403 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o O ; PEEK OUT POKE") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(';') |
| 404 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i I AT CODE IN INPUT") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 405 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u U OR CHR$ ] IF") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')// PORT_CHAR(']') |
| 406 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y Y AND STR$ [ RETURN") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')// PORT_CHAR('[') |
| 407 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) |
| 408 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) |
| 409 | |
| 410 | PORT_START("LINE6") /* 0xBFFE */ |
| 411 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 412 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l L = USR ATTR LET") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR('=') |
| 413 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k K + LEN SCREEN$ LIST") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR('+') |
| 414 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j J - VAL VAL$ LOAD") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR('-') |
| 415 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h H ^ SQR CIRCLE GOSUB") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR('^') |
| 416 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) |
| 417 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) |
| 418 | |
| 419 | PORT_START("LINE7") /* 0x7FFE */ |
| 420 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 421 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SYMBOL SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_2) |
| 422 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m M . PI INVERSE PAUSE") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR('.') |
| 423 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n N , INKEY$ OVER NEXT") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(',') |
| 424 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b B * BIN BRIGHT BORDER") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR('*') |
| 425 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) |
| 426 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ -") PORT_CODE(KEYCODE_TILDE) |
| 427 | |
| 428 | PORT_START("LINE8") |
| 429 | PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 430 | |
| 431 | PORT_START("LINE9") |
| 432 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DIR") PORT_CODE(KEYCODE_HOME) |
| 433 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Down") PORT_CODE(KEYCODE_DOWN) |
| 434 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Up") PORT_CODE(KEYCODE_UP) |
| 435 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) |
| 436 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Left") PORT_CODE(KEYCODE_LEFT) |
| 437 | PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN) |
| 438 | |
| 439 | PORT_START("JOY") |
| 440 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Right") PORT_CODE(JOYCODE_X_RIGHT_SWITCH) |
| 441 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Left") PORT_CODE(JOYCODE_X_LEFT_SWITCH) |
| 442 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Down") PORT_CODE(JOYCODE_Y_DOWN_SWITCH) |
| 443 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Up") PORT_CODE(JOYCODE_Y_UP_SWITCH) |
| 444 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P1 Joystick Fire") PORT_CODE(JOYCODE_BUTTON1) |
| 22 | 445 | INPUT_PORTS_END |
| 23 | 446 | |
| 447 | /************************************* |
| 448 | * |
| 449 | * Machine |
| 450 | * |
| 451 | *************************************/ |
| 24 | 452 | |
| 25 | 453 | static MACHINE_RESET(elwro800) |
| 26 | 454 | { |
| 455 | memset(mess_ram, 0, 64*1024); |
| 456 | |
| 457 | memory_set_bankptr(machine, 3, mess_ram + 0x4000); |
| 458 | |
| 459 | // this is a reset of ls175 in mmu |
| 460 | elwro800jr_mmu_w(machine, 0); |
| 27 | 461 | } |
| 28 | 462 | |
| 29 | | static VIDEO_START( elwro800 ) |
| 463 | static const cassette_config elwro800jr_cassette_config = |
| 30 | 464 | { |
| 31 | | } |
| 465 | tzx_cassette_formats, |
| 466 | NULL, |
| 467 | CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED |
| 468 | }; |
| 32 | 469 | |
| 33 | | static VIDEO_UPDATE( elwro800 ) |
| 470 | static INTERRUPT_GEN( elwro800jr_interrupt ) |
| 34 | 471 | { |
| 35 | | return 0; |
| 472 | cpu_set_input_line(device, 0, HOLD_LINE); |
| 36 | 473 | } |
| 37 | 474 | |
| 38 | 475 | static MACHINE_DRIVER_START( elwro800 ) |
| 39 | 476 | /* basic machine hardware */ |
| 40 | | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 477 | MDRV_CPU_ADD("maincpu",Z80, 3500000) /* 3.5 MHz */ |
| 41 | 478 | MDRV_CPU_PROGRAM_MAP(elwro800_mem) |
| 42 | 479 | MDRV_CPU_IO_MAP(elwro800_io) |
| 480 | MDRV_CPU_VBLANK_INT("screen", elwro800jr_interrupt) |
| 43 | 481 | |
| 44 | 482 | MDRV_MACHINE_RESET(elwro800) |
| 45 | 483 | |
| 46 | 484 | /* video hardware */ |
| 47 | | MDRV_SCREEN_ADD("screen", RASTER) |
| 48 | | MDRV_SCREEN_REFRESH_RATE(50) |
| 49 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 50 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 51 | | MDRV_SCREEN_SIZE(640, 480) |
| 52 | | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 53 | | MDRV_PALETTE_LENGTH(2) |
| 54 | | MDRV_PALETTE_INIT(black_and_white) |
| 485 | MDRV_SCREEN_ADD("screen", RASTER) |
| 486 | MDRV_SCREEN_REFRESH_RATE(50.08) |
| 487 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 488 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 489 | MDRV_SCREEN_SIZE(SPEC_SCREEN_WIDTH, SPEC_SCREEN_HEIGHT) |
| 490 | MDRV_SCREEN_VISIBLE_AREA(0, SPEC_SCREEN_WIDTH-1, 0, SPEC_SCREEN_HEIGHT-1) |
| 491 | MDRV_PALETTE_LENGTH(16) |
| 492 | MDRV_PALETTE_INIT( spectrum ) |
| 55 | 493 | |
| 56 | | MDRV_VIDEO_START(elwro800) |
| 57 | | MDRV_VIDEO_UPDATE(elwro800) |
| 494 | MDRV_VIDEO_START( spectrum ) |
| 495 | MDRV_VIDEO_UPDATE( spectrum ) |
| 496 | MDRV_VIDEO_EOF( spectrum ) |
| 497 | |
| 498 | MDRV_NEC765A_ADD("nec765", elwro800jr_nec765_interface) |
| 499 | MDRV_I8255A_ADD( "ppi8255", elwro800jr_ppi8255_interface) |
| 500 | |
| 501 | /* printer */ |
| 502 | MDRV_CENTRONICS_ADD("centronics", elwro800jr_centronics_interface) |
| 503 | |
| 504 | MDRV_MSM8251_ADD("msm8251", default_msm8251_interface) |
| 505 | |
| 506 | /* sound hardware */ |
| 507 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 508 | MDRV_SOUND_WAVE_ADD("wave", "cassette") |
| 509 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 510 | MDRV_SOUND_ADD("speaker", SPEAKER, 0) |
| 511 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 512 | |
| 513 | MDRV_CASSETTE_ADD( "cassette", elwro800jr_cassette_config ) |
| 514 | |
| 58 | 515 | MACHINE_DRIVER_END |
| 59 | 516 | |
| 517 | static void elwro800jr_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 518 | { |
| 519 | /* floppy */ |
| 520 | switch(state) |
| 521 | { |
| 522 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 523 | case MESS_DEVINFO_INT_COUNT: info->i = 2; break; |
| 524 | |
| 525 | default: legacydsk_device_getinfo(devclass, state, info); break; |
| 526 | } |
| 527 | } |
| 528 | |
| 60 | 529 | static SYSTEM_CONFIG_START(elwro800) |
| 530 | CONFIG_RAM_DEFAULT(64 * 1024) |
| 531 | CONFIG_DEVICE(elwro800jr_floppy_getinfo) |
| 61 | 532 | SYSTEM_CONFIG_END |
| 62 | 533 | |
| 63 | | /* ROM definition */ |
| 534 | /************************************* |
| 535 | * |
| 536 | * ROM definition |
| 537 | * |
| 538 | *************************************/ |
| 539 | |
| 64 | 540 | ROM_START( elwro800 ) |
| 65 | | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 66 | | ROM_LOAD( "bas01.bin", 0x0000, 0x2000, CRC(6ab16f36) SHA1(49a19b279f311279c7fed3d2b3f207732d674c26)) |
| 67 | | ROM_LOAD( "bas02.bin", 0x0000, 0x2000, CRC(15c54f1b) SHA1(b9b8dd6e0e1efff9288d0bd2079c2043f86efa2b)) |
| 68 | | ROM_LOAD( "bas03.bin", 0x0000, 0x2000, CRC(6ab16f36) SHA1(49a19b279f311279c7fed3d2b3f207732d674c26)) |
| 69 | | ROM_LOAD( "bas11.bin", 0x0000, 0x2000, CRC(a743eb80) SHA1(3a300550838535b4adfe6d05c05fe0b39c47df16)) |
| 70 | | ROM_LOAD( "bas12.bin", 0x0000, 0x2000, CRC(a247c19b) SHA1(98c0a73b32548cb33c87ceb5f89f62ff0a1cf8a0)) |
| 71 | | ROM_LOAD( "bas13.bin", 0x0000, 0x2000, CRC(a743eb80) SHA1(3a300550838535b4adfe6d05c05fe0b39c47df16)) |
| 72 | | ROM_LOAD( "boot01.bin", 0x0000, 0x2000, CRC(0efd0e7c) SHA1(b86a96519510750e7805029af463c0b9526e0c3a)) |
| 73 | | ROM_LOAD( "boot02.bin", 0x0000, 0x2000, CRC(24d62a81) SHA1(f08c525bb602f6f53790d55af1f78ec222a90924)) |
| 74 | | ROM_LOAD( "boot03.bin", 0x0000, 0x2000, CRC(0efd0e7c) SHA1(b86a96519510750e7805029af463c0b9526e0c3a)) |
| 75 | | ROM_LOAD( "junior_io_prom.bin", 0x0000, 0x0200, CRC(c6a777c4) SHA1(41debc1b4c3bd4eef7e0e572327c759e0399a49c)) |
| 76 | | ROM_LOAD( "junior_mem_prom.bin", 0x0000, 0x0200, CRC(0f745f42) SHA1(360ec23887fb6d7e19ee85d2bb30d9fa57f4936e)) |
| 541 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 542 | ROM_LOAD( "bas04.epr", 0x0000, 0x2000, CRC(6ab16f36) SHA1(49a19b279f311279c7fed3d2b3f207732d674c26) ) |
| 543 | ROM_LOAD( "bas14.epr", 0x2000, 0x2000, CRC(a743eb80) SHA1(3a300550838535b4adfe6d05c05fe0b39c47df16) ) |
| 544 | ROM_LOAD( "bootv.epr", 0x4000, 0x2000, CRC(de5fa37d) SHA1(4f203efe53524d84f69459c54b1a0296faa83fd9) ) |
| 77 | 545 | |
| 546 | ROM_REGION(0x0400, "proms", 0 ) |
| 547 | ROM_LOAD( "junior_io_prom.bin", 0x0000, 0x0200, CRC(c6a777c4) SHA1(41debc1b4c3bd4eef7e0e572327c759e0399a49c)) |
| 548 | ROM_LOAD( "junior_mem_prom.bin", 0x0200, 0x0200, CRC(0f745f42) SHA1(360ec23887fb6d7e19ee85d2bb30d9fa57f4936e)) |
| 78 | 549 | ROM_END |
| 79 | 550 | |
| 80 | 551 | /* Driver */ |
| 81 | 552 | |
| 82 | 553 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 83 | | COMP( 1986, elwro800, 0, 0, elwro800, elwro800, 0, elwro800, "Elwro", "800 Junior", GAME_NOT_WORKING) |
| 84 | | |
| 554 | COMP( 1986, elwro800, 0, 0, elwro800, elwro800, 0, elwro800, "Elwro", "800 Junior", 0) |