src/mess/machine/comx35.c
| r0 | r2620 | |
| 1 | #include "driver.h"
|
| 2 | #include "cpu/cdp1802/cdp1802.h"
|
| 3 | #include "machine/wd17xx.h"
|
| 4 | #include "devices/basicdsk.h"
|
| 5 | #include "devices/printer.h"
|
| 6 | #include "devices/snapquik.h"
|
| 7 | #include "video/cdp1869.h"
|
| 8 | #include "video/mc6845.h"
|
| 9 | #include "includes/comx35.h"
|
| 10 | |
| 11 | enum
|
| 12 | {
|
| 13 | PRINTER_PARALLEL = 0,
|
| 14 | PRINTER_SERIAL,
|
| 15 | PRINTER_THERMAL,
|
| 16 | PRINTER_PLOTTER
|
| 17 | };
|
| 18 | |
| 19 | enum
|
| 20 | {
|
| 21 | COMX_TYPE_BINARY = 1,
|
| 22 | COMX_TYPE_BASIC,
|
| 23 | COMX_TYPE_BASIC_FM,
|
| 24 | COMX_TYPE_RESERVED,
|
| 25 | COMX_TYPE_DATA
|
| 26 | };
|
| 27 | |
| 28 | static const device_config *printer_device(running_machine *machine)
|
| 29 | {
|
| 30 | return device_list_find_by_tag(machine->config->devicelist, PRINTER, "printer");
|
| 31 | }
|
| 32 | |
| 33 | /* Floppy Disc Controller */
|
| 34 | |
| 35 | DEVICE_IMAGE_LOAD( comx35_floppy )
|
| 36 | {
|
| 37 | if (image_has_been_created(image))
|
| 38 | return INIT_FAIL;
|
| 39 | |
| 40 | if (device_load_basicdsk_floppy(image) == INIT_PASS)
|
| 41 | {
|
| 42 | int size = image_length(image);
|
| 43 | |
| 44 | switch (size)
|
| 45 | {
|
| 46 | case 35*16*128:
|
| 47 | /* drive, tracks, heads, sectors per track, sector length, first sector id, offset track zero, track skipping */
|
| 48 | basicdsk_set_geometry(image, 35, 1, 16, 128, 0, 0, FALSE);
|
| 49 | break;
|
| 50 | |
| 51 | case 70*16*128:
|
| 52 | basicdsk_set_geometry(image, 70, 1, 16, 128, 0, 0, FALSE);
|
| 53 | break;
|
| 54 | |
| 55 | case 89*16*128: // ???
|
| 56 | basicdsk_set_geometry(image, 89, 1, 16, 128, 0, 0, FALSE);
|
| 57 | break;
|
| 58 | }
|
| 59 | |
| 60 | return INIT_PASS;
|
| 61 | }
|
| 62 | |
| 63 | return INIT_FAIL;
|
| 64 | }
|
| 65 | |
| 66 | static void comx35_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param)
|
| 67 | {
|
| 68 | comx35_state *state = machine->driver_data;
|
| 69 | |
| 70 | switch (event)
|
| 71 | {
|
| 72 | case WD17XX_IRQ_SET:
|
| 73 | state->fdc_irq = 1;
|
| 74 | break;
|
| 75 | |
| 76 | case WD17XX_IRQ_CLR:
|
| 77 | state->fdc_irq = 0;
|
| 78 | break;
|
| 79 | |
| 80 | case WD17XX_DRQ_SET:
|
| 81 | if (state->fdc_drq_enable)
|
| 82 | {
|
| 83 | state->cdp1802_ef4 = 1;
|
| 84 | }
|
| 85 | break;
|
| 86 | |
| 87 | case WD17XX_DRQ_CLR:
|
| 88 | if (state->fdc_drq_enable)
|
| 89 | {
|
| 90 | state->cdp1802_ef4 = 0;
|
| 91 | }
|
| 92 | break;
|
| 93 | }
|
| 94 | }
|
| 95 | |
| 96 | static UINT8 fdc_r(running_machine *machine)
|
| 97 | {
|
| 98 | comx35_state *state = machine->driver_data;
|
| 99 | |
| 100 | UINT8 data;
|
| 101 | |
| 102 | if (state->cdp1802_q)
|
| 103 | {
|
| 104 | data = state->fdc_irq;
|
| 105 | }
|
| 106 | else
|
| 107 | {
|
| 108 | data = wd17xx_r(machine, state->fdc_addr);
|
| 109 | }
|
| 110 | |
| 111 | return data;
|
| 112 | }
|
| 113 | |
| 114 | static void fdc_w(running_machine *machine, UINT8 data)
|
| 115 | {
|
| 116 | /*
|
| 117 | |
| 118 | bit description
|
| 119 | |
| 120 | 0 A0
|
| 121 | 1 A1
|
| 122 | 2 DRIVE0
|
| 123 | 3 DRIVE1
|
| 124 | 4 F9 DISB
|
| 125 | 5 SIDE SELECT
|
| 126 | |
| 127 | */
|
| 128 | |
| 129 | comx35_state *state = machine->driver_data;
|
| 130 | |
| 131 | if (state->cdp1802_q)
|
| 132 | {
|
| 133 | // latch data to F3
|
| 134 | |
| 135 | state->fdc_addr = data & 0x03;
|
| 136 | |
| 137 | if (BIT(data, 2))
|
| 138 | {
|
| 139 | wd17xx_set_drive(0);
|
| 140 | } |
| 141 | else if (BIT(data, 3))
|
| 142 | {
|
| 143 | wd17xx_set_drive(1);
|
| 144 | }
|
| 145 | |
| 146 | state->fdc_drq_enable = BIT(data, 4);
|
| 147 | |
| 148 | if (!state->fdc_drq_enable)
|
| 149 | {
|
| 150 | state->cdp1802_ef4 = 1;
|
| 151 | }
|
| 152 | |
| 153 | wd17xx_set_side(BIT(data, 5));
|
| 154 | }
|
| 155 | else
|
| 156 | {
|
| 157 | // write data to WD1770
|
| 158 | |
| 159 | wd17xx_w(machine, state->fdc_addr, data);
|
| 160 | }
|
| 161 | }
|
| 162 | |
| 163 | /* Printer */
|
| 164 | |
| 165 | static UINT8 printer_r(running_machine *machine)
|
| 166 | {
|
| 167 | // comx35_state *state = machine->driver_data;
|
| 168 | |
| 169 | int printer = input_port_read(machine, "PRINTER") & 0x07;
|
| 170 | UINT8 data = 0;
|
| 171 | |
| 172 | switch (printer)
|
| 173 | {
|
| 174 | case PRINTER_PARALLEL:
|
| 175 | case PRINTER_PLOTTER:
|
| 176 | /*
|
| 177 | INP 2 for the printer status, where:
|
| 178 | b0=1: Acknowledge Fault
|
| 179 | b1=0: Device Busy
|
| 180 | b2=0: Paper Empty
|
| 181 | b3=1: Device Not Selected |
| 182 | */
|
| 183 | |
| 184 | data = 0x06;
|
| 185 | break;
|
| 186 | |
| 187 | case PRINTER_SERIAL:
|
| 188 | /*
|
| 189 | INP 2 for the printer status and to start a new range of bits for the next byte. |
| 190 | */
|
| 191 | break;
|
| 192 | |
| 193 | case PRINTER_THERMAL:
|
| 194 | /*
|
| 195 | INP 2 is used for the printer status, where:
|
| 196 | b0=1: Printer Not Ready
|
| 197 | b1=1: Energizing Head
|
| 198 | b2=1: Head At Position 0 |
| 199 | */
|
| 200 | break;
|
| 201 | }
|
| 202 | |
| 203 | return data;
|
| 204 | }
|
| 205 | |
| 206 | static void printer_w(running_machine *machine, UINT8 data)
|
| 207 | {
|
| 208 | // comx35_state *state = machine->driver_data;
|
| 209 | int printer = input_port_read(machine, "PRINTER") & 0x07;
|
| 210 | |
| 211 | switch (printer)
|
| 212 | {
|
| 213 | case PRINTER_PARALLEL:
|
| 214 | case PRINTER_PLOTTER:
|
| 215 | /*
|
| 216 | OUT 2 is used to send a byte to the printer
|
| 217 | */
|
| 218 | |
| 219 | printer_output(printer_device(machine), data);
|
| 220 | break;
|
| 221 | |
| 222 | case PRINTER_SERIAL:
|
| 223 | /*
|
| 224 | OUT 2 is used to send a bit to the printer
|
| 225 | */
|
| 226 | break;
|
| 227 | |
| 228 | case PRINTER_THERMAL:
|
| 229 | /*
|
| 230 | OUT 2 is used to control the thermal printer where:
|
| 231 | Q = 0, b0-7: Pixel 1 to 8
|
| 232 | Q = 1, b7: Pixel 9 (if b0-6=#21)
|
| 233 | Q = 1, b3=1: Move head right
|
| 234 | Q = 1, b0-7=#12: Move head left |
| 235 | */
|
| 236 | break;
|
| 237 | }
|
| 238 | }
|
| 239 | |
| 240 | /* Read/Write Handlers */
|
| 241 | |
| 242 | static int get_active_bank(running_machine *machine, UINT8 data)
|
| 243 | {
|
| 244 | comx35_state *state = machine->driver_data;
|
| 245 | int bank = 0;
|
| 246 | |
| 247 | if (memory_region(REGION_CPU1)[0xe000] != 0xff)
|
| 248 | {
|
| 249 | // expansion box
|
| 250 | |
| 251 | char port[6];
|
| 252 | int i;
|
| 253 | |
| 254 | for (i = 1; i < 5; i++)
|
| 255 | {
|
| 256 | if (BIT(data, i))
|
| 257 | {
|
| 258 | state->slot = i;
|
| 259 | break;
|
| 260 | }
|
| 261 | }
|
| 262 | |
| 263 | if (state->slot > 0)
|
| 264 | {
|
| 265 | sprintf(port, "SLOT%d", state->slot);
|
| 266 | |
| 267 | bank = input_port_read(machine, port);
|
| 268 | }
|
| 269 | }
|
| 270 | else
|
| 271 | {
|
| 272 | // no expansion box
|
| 273 | |
| 274 | bank = input_port_read(machine, "EXPANSION");
|
| 275 | }
|
| 276 | |
| 277 | return bank;
|
| 278 | }
|
| 279 | |
| 280 | WRITE8_HANDLER( comx35_bank_select_w )
|
| 281 | {
|
| 282 | comx35_state *state = machine->driver_data;
|
| 283 | |
| 284 | int bank = get_active_bank(machine, data);
|
| 285 | |
| 286 | state->bank = bank;
|
| 287 | |
| 288 | switch (state->bank)
|
| 289 | {
|
| 290 | case BANK_NONE:
|
| 291 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
|
| 292 | break;
|
| 293 | |
| 294 | case BANK_FLOPPY:
|
| 295 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_BANK1, SMH_UNMAP);
|
| 296 | break;
|
| 297 | |
| 298 | case BANK_PRINTER_PARALLEL:
|
| 299 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc7ff, 0, 0, SMH_BANK1, SMH_UNMAP);
|
| 300 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xdfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
|
| 301 | break;
|
| 302 | |
| 303 | case BANK_PRINTER_PARALLEL_FM:
|
| 304 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xcfff, 0, 0, SMH_BANK1, SMH_UNMAP);
|
| 305 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd000, 0xdfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
|
| 306 | break;
|
| 307 | |
| 308 | case BANK_PRINTER_SERIAL:
|
| 309 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc7ff, 0, 0, SMH_BANK1, SMH_UNMAP);
|
| 310 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xdfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
|
| 311 | break;
|
| 312 | |
| 313 | case BANK_PRINTER_THERMAL:
|
| 314 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xcfff, 0, 0, SMH_BANK1, SMH_UNMAP);
|
| 315 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd000, 0xdfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
|
| 316 | break;
|
| 317 | |
| 318 | case BANK_JOYCARD:
|
| 319 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc002, 0, 0, SMH_BANK1, SMH_UNMAP);
|
| 320 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc003, 0xdfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
|
| 321 | break;
|
| 322 | |
| 323 | case BANK_80_COLUMNS:
|
| 324 | {
|
| 325 | const device_config *mc6845 = device_list_find_by_tag(machine->config->devicelist, MC6845, MC6845_TAG);
|
| 326 | |
| 327 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc7ff, 0, 0, SMH_BANK1, SMH_UNMAP); // ROM
|
| 328 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xcfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
|
| 329 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd000, 0xd7ff, 0, 0, SMH_BANK1, SMH_BANK1); // RAM
|
| 330 | memory_install_readwrite8_device_handler(mc6845, 0, ADDRESS_SPACE_PROGRAM, 0xd800, 0xd800, 0, 0, SMH_UNMAP, mc6845_address_w);
|
| 331 | memory_install_readwrite8_device_handler(mc6845, 0, ADDRESS_SPACE_PROGRAM, 0xd801, 0xd801, 0, 0, mc6845_register_r, mc6845_register_w);
|
| 332 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd802, 0xdfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
|
| 333 | }
|
| 334 | break;
|
| 335 | |
| 336 | case BANK_RAMCARD:
|
| 337 | {
|
| 338 | int rambank = (data >> 5) & 0x03;
|
| 339 | |
| 340 | bank = BANK_RAMCARD + rambank;
|
| 341 | |
| 342 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_BANK1, SMH_BANK1);
|
| 343 | }
|
| 344 | break;
|
| 345 | }
|
| 346 | |
| 347 | memory_set_bank(1, bank);
|
| 348 | }
|
| 349 | |
| 350 | READ8_HANDLER( comx35_io_r )
|
| 351 | {
|
| 352 | comx35_state *state = machine->driver_data;
|
| 353 | |
| 354 | UINT8 data = 0xff;
|
| 355 | |
| 356 | switch (state->bank)
|
| 357 | {
|
| 358 | case BANK_NONE:
|
| 359 | break;
|
| 360 | |
| 361 | case BANK_FLOPPY:
|
| 362 | data = fdc_r(machine);
|
| 363 | break;
|
| 364 | |
| 365 | case BANK_PRINTER_PARALLEL:
|
| 366 | case BANK_PRINTER_PARALLEL_FM:
|
| 367 | case BANK_PRINTER_SERIAL:
|
| 368 | case BANK_PRINTER_THERMAL:
|
| 369 | data = printer_r(machine);
|
| 370 | break;
|
| 371 | |
| 372 | case BANK_JOYCARD:
|
| 373 | data = input_port_read(machine, "JOY1");
|
| 374 | break;
|
| 375 | |
| 376 | case BANK_80_COLUMNS:
|
| 377 | break;
|
| 378 | |
| 379 | case BANK_RAMCARD:
|
| 380 | break;
|
| 381 | }
|
| 382 | |
| 383 | return data;
|
| 384 | }
|
| 385 | |
| 386 | READ8_HANDLER( comx35_io2_r )
|
| 387 | {
|
| 388 | comx35_state *state = machine->driver_data;
|
| 389 | |
| 390 | UINT8 data = 0xff;
|
| 391 | |
| 392 | switch (state->bank)
|
| 393 | {
|
| 394 | case BANK_NONE:
|
| 395 | break;
|
| 396 | |
| 397 | case BANK_FLOPPY:
|
| 398 | break;
|
| 399 | |
| 400 | case BANK_PRINTER_PARALLEL:
|
| 401 | case BANK_PRINTER_PARALLEL_FM:
|
| 402 | case BANK_PRINTER_SERIAL:
|
| 403 | case BANK_PRINTER_THERMAL:
|
| 404 | break;
|
| 405 | |
| 406 | case BANK_JOYCARD:
|
| 407 | data = input_port_read(machine, "JOY2");
|
| 408 | break;
|
| 409 | |
| 410 | case BANK_80_COLUMNS:
|
| 411 | break;
|
| 412 | |
| 413 | case BANK_RAMCARD:
|
| 414 | break;
|
| 415 | }
|
| 416 | |
| 417 | return data;
|
| 418 | }
|
| 419 | |
| 420 | WRITE8_HANDLER( comx35_io_w )
|
| 421 | {
|
| 422 | comx35_state *state = machine->driver_data;
|
| 423 | |
| 424 | switch (state->bank)
|
| 425 | {
|
| 426 | case BANK_NONE:
|
| 427 | break;
|
| 428 | |
| 429 | case BANK_FLOPPY:
|
| 430 | fdc_w(machine, data);
|
| 431 | break;
|
| 432 | |
| 433 | case BANK_PRINTER_PARALLEL:
|
| 434 | case BANK_PRINTER_PARALLEL_FM:
|
| 435 | case BANK_PRINTER_SERIAL:
|
| 436 | case BANK_PRINTER_THERMAL:
|
| 437 | printer_w(machine, data);
|
| 438 | break;
|
| 439 | |
| 440 | case BANK_JOYCARD:
|
| 441 | data = input_port_read(machine, "JOY2");
|
| 442 | break;
|
| 443 | |
| 444 | case BANK_80_COLUMNS:
|
| 445 | break;
|
| 446 | |
| 447 | case BANK_RAMCARD:
|
| 448 | break;
|
| 449 | }
|
| 450 | }
|
| 451 | |
| 452 | /* Machine Initialization */
|
| 453 | |
| 454 | static TIMER_CALLBACK( dma_tick )
|
| 455 | {
|
| 456 | comx35_state *state = machine->driver_data;
|
| 457 | |
| 458 | if (!state->iden)
|
| 459 | {
|
| 460 | // cpunum_set_input_line(device->machine, 0, CDP1802_INPUT_LINE_DMAOUT, ASSERT_LINE);
|
| 461 | // cpunum_set_input_line(device->machine, 0, CDP1802_INPUT_LINE_DMAOUT, CLEAR_LINE);
|
| 462 | }
|
| 463 | }
|
| 464 | |
| 465 | static TIMER_CALLBACK( reset_tick )
|
| 466 | {
|
| 467 | comx35_state *state = machine->driver_data;
|
| 468 | |
| 469 | state->cdp1802_mode = CDP1802_MODE_RUN;
|
| 470 | }
|
| 471 | |
| 472 | MACHINE_START( comx35p )
|
| 473 | {
|
| 474 | comx35_state *state = machine->driver_data;
|
| 475 | |
| 476 | // card slot banking
|
| 477 | |
| 478 | memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1), 0xc000);
|
| 479 | memory_configure_bank(1, BANK_FLOPPY, 7, memory_region(REGION_USER1), 0x2000);
|
| 480 | memory_configure_bank(1, BANK_RAMCARD, 4, mess_ram, 0x2000);
|
| 481 | |
| 482 | memory_set_bank(1, 0);
|
| 483 | |
| 484 | // allocate DMA timer
|
| 485 | |
| 486 | state->dma_timer = timer_alloc(dma_tick, NULL);
|
| 487 | timer_adjust_periodic(state->dma_timer, attotime_zero, 0, ATTOTIME_IN_HZ(CDP1869_CPU_CLK_PAL / 8));
|
| 488 | |
| 489 | // allocate reset timer
|
| 490 |
|
| 491 | state->reset_timer = timer_alloc(reset_tick, NULL);
|
| 492 | |
| 493 | // screen format
|
| 494 | |
| 495 | state->pal_ntsc = CDP1869_PAL;
|
| 496 | |
| 497 | wd17xx_init(machine, WD_TYPE_1770, comx35_fdc_callback, NULL);
|
| 498 | |
| 499 | // external flag 4
|
| 500 | |
| 501 | state->cdp1802_ef4 = 1;
|
| 502 | |
| 503 | // register save states
|
| 504 | |
| 505 | state_save_register_global(state->cdp1802_mode);
|
| 506 | state_save_register_global(state->cdp1802_q);
|
| 507 | state_save_register_global(state->cdp1802_ef4);
|
| 508 | state_save_register_global(state->iden);
|
| 509 | state_save_register_global(state->slot);
|
| 510 | |
| 511 | state_save_register_global(state->pal_ntsc);
|
| 512 | state_save_register_global(state->cdp1869_prd);
|
| 513 | |
| 514 | state_save_register_global(state->cdp1871_efxa);
|
| 515 | state_save_register_global(state->cdp1871_efxb);
|
| 516 | |
| 517 | state_save_register_global(state->fdc_addr);
|
| 518 | state_save_register_global(state->fdc_irq);
|
| 519 | state_save_register_global(state->fdc_drq_enable);
|
| 520 | }
|
| 521 | |
| 522 | MACHINE_START( comx35n )
|
| 523 | {
|
| 524 | comx35_state *state = machine->driver_data;
|
| 525 | |
| 526 | MACHINE_START_CALL(comx35p);
|
| 527 | |
| 528 | timer_adjust_periodic(state->dma_timer, attotime_zero, 0, ATTOTIME_IN_HZ(CDP1869_CPU_CLK_NTSC / 8));
|
| 529 | |
| 530 | // screen format
|
| 531 | |
| 532 | state->pal_ntsc = CDP1869_NTSC;
|
| 533 | }
|
| 534 | |
| 535 | MACHINE_RESET( comx35 )
|
| 536 | {
|
| 537 | comx35_state *state = machine->driver_data;
|
| 538 | |
| 539 | state->cdp1802_mode = CDP1802_MODE_RESET;
|
| 540 | state->iden = 1;
|
| 541 | |
| 542 | timer_adjust_oneshot(state->reset_timer, ATTOTIME_IN_MSEC(200), 0);
|
| 543 | }
|
| 544 | |
| 545 | /* Quickload */
|
| 546 | |
| 547 | static void image_fread_memory(const device_config *image, UINT16 addr, UINT32 count)
|
| 548 | {
|
| 549 | void *ptr = memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, addr);
|
| 550 | |
| 551 | image_fread(image, ptr, count);
|
| 552 | }
|
| 553 | |
| 554 | static void write_memory(UINT16 addr, UINT8 data)
|
| 555 | {
|
| 556 | UINT8 *ptr = (UINT8 *) memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, addr);
|
| 557 | |
| 558 | ptr[0] = data;
|
| 559 | }
|
| 560 | |
| 561 | static UINT8 read_memory(UINT16 addr)
|
| 562 | {
|
| 563 | UINT8 *ptr = (UINT8 *) memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, addr);
|
| 564 | |
| 565 | return ptr[0];
|
| 566 | }
|
| 567 | |
| 568 | QUICKLOAD_LOAD( comx35 )
|
| 569 | {
|
| 570 | UINT8 header[16] = {0};
|
| 571 | int size = image_length(image);
|
| 572 | |
| 573 | if (size > mess_ram_size)
|
| 574 | {
|
| 575 | return INIT_FAIL;
|
| 576 | }
|
| 577 | |
| 578 | image_fread(image, header, 5);
|
| 579 | |
| 580 | if (header[1] != 'C' || header[2] != 'O' || header[3] != 'M' || header[4] != 'X' )
|
| 581 | {
|
| 582 | return INIT_FAIL;
|
| 583 | }
|
| 584 | |
| 585 | switch (header[0])
|
| 586 | {
|
| 587 | case COMX_TYPE_BINARY:
|
| 588 | /*
|
| 589 | |
| 590 | Type 1: pure machine code (i.e. no basic)
|
| 591 | |
| 592 | Byte 0 to 4: 1 - 'COMX'
|
| 593 | Byte 5 and 6: Start address (1802 way; see above)
|
| 594 | Byte 6 and 7: End address
|
| 595 | Byte 9 and 10: Execution address
|
| 596 | |
| 597 | Byte 11 to Eof, should be stored in ram from start to end; execution address
|
| 598 | 'xxxx' for the CALL (@xxxx) basic statement to actually run the code.
|
| 599 | |
| 600 | */
|
| 601 | {
|
| 602 | UINT16 start_address, end_address, run_address;
|
| 603 |
|
| 604 | image_fread(image, header, 6);
|
| 605 | |
| 606 | start_address = header[0] << 8 | header[1];
|
| 607 | end_address = header[2] << 8 | header[3];
|
| 608 | run_address = header[4] << 8 | header[5];
|
| 609 | |
| 610 | image_fread_memory(image, start_address, end_address - start_address);
|
| 611 | |
| 612 | popmessage("Type CALL (@%04x) to start program", run_address);
|
| 613 | }
|
| 614 | break;
|
| 615 | |
| 616 | case COMX_TYPE_BASIC:
|
| 617 | /*
|
| 618 | |
| 619 | Type 2: Regular basic code or machine code followed by basic
|
| 620 | |
| 621 | Byte 0 to 4: 2 - 'COMX'
|
| 622 | Byte 5 and 6: DEFUS value, to be stored on 0x4281 and 0x4282
|
| 623 | Byte 7 and 8: EOP value, to be stored on 0x4283 and 0x4284
|
| 624 | Byte 9 and 10: End array, start string to be stored on 0x4292 and 0x4293
|
| 625 | Byte 11 and 12: start array to be stored on 0x4294 and 0x4295
|
| 626 | Byte 13 and 14: EOD and end string to be stored on 0x4299 and 0x429A
|
| 627 | |
| 628 | Byte 15 to Eof to be stored on 0x4400 and onwards
|
| 629 | |
| 630 | Byte 0x4281-0x429A (or at least the ones above) should be set otherwise
|
| 631 | BASIC won't 'see' the code.
|
| 632 | |
| 633 | */
|
| 634 | |
| 635 | image_fread_memory(image, 0x4281, 4);
|
| 636 | image_fread_memory(image, 0x4292, 4);
|
| 637 | image_fread_memory(image, 0x4299, 2);
|
| 638 | image_fread_memory(image, 0x4400, size);
|
| 639 | break;
|
| 640 | |
| 641 | case COMX_TYPE_BASIC_FM:
|
| 642 | /*
|
| 643 | |
| 644 | Type 3: F&M basic load
|
| 645 | |
| 646 | Not the most important! But we designed our own basic extension, you can
|
| 647 | find it in the F&M basic folder as F&M Basic.comx. When you run this all
|
| 648 | basic code should start at address 0x6700 instead of 0x4400 as from
|
| 649 | 0x4400-0x6700 the F&M basic stuff is loaded. So format is identical to Type
|
| 650 | 2 except Byte 15 to Eof should be stored on 0x6700 instead. .comx files of
|
| 651 | this format can also be found in the same folder as the F&M basic.comx file.
|
| 652 | |
| 653 | */
|
| 654 | |
| 655 | image_fread_memory(image, 0x4281, 4);
|
| 656 | image_fread_memory(image, 0x4292, 4);
|
| 657 | image_fread_memory(image, 0x4299, 2);
|
| 658 | image_fread_memory(image, 0x6700, size);
|
| 659 | break;
|
| 660 | |
| 661 | case COMX_TYPE_RESERVED:
|
| 662 | /*
|
| 663 | |
| 664 | Type 4: Incorrect DATA format, I suggest to forget this one as it won't work
|
| 665 | in most cases. Instead I left this one reserved and designed Type 5 instead.
|
| 666 | |
| 667 | */
|
| 668 | break;
|
| 669 | |
| 670 | case COMX_TYPE_DATA:
|
| 671 | /*
|
| 672 | |
| 673 | Type 5: Data load
|
| 674 | |
| 675 | Byte 0 to 4: 5 - 'COMX'
|
| 676 | Byte 5 and 6: Array length
|
| 677 | Byte 7 to Eof: Basic 'data'
|
| 678 | |
| 679 | To load this first get the 'start array' from the running COMX, i.e. address
|
| 680 | 0x4295/0x4296. Calculate the EOD as 'start array' + length of the data (i.e.
|
| 681 | file length - 7). Store the EOD back on 0x4299 and ox429A. Calculate the
|
| 682 | 'Start String' as 'start array' + 'Array length' (Byte 5 and 6). Store the
|
| 683 | 'Start String' on 0x4292/0x4293. Load byte 7 and onwards starting from the
|
| 684 | 'start array' value fetched from 0x4295/0x4296.
|
| 685 | |
| 686 | */
|
| 687 | {
|
| 688 | UINT16 start_array, end_array, start_string, array_length;
|
| 689 | |
| 690 | image_fread(image, header, 2);
|
| 691 | |
| 692 | array_length = (header[0] << 8) | header[1];
|
| 693 | start_array = (read_memory(0x4295) << 8) | read_memory(0x4296);
|
| 694 | end_array = start_array + (size - 7);
|
| 695 | |
| 696 | write_memory(0x4299, end_array >> 8);
|
| 697 | write_memory(0x429a, end_array & 0xff);
|
| 698 |
|
| 699 | start_string = start_array + array_length;
|
| 700 | |
| 701 | write_memory(0x4292, start_string >> 8);
|
| 702 | write_memory(0x4293, start_string & 0xff);
|
| 703 | |
| 704 | image_fread_memory(image, start_array, size);
|
| 705 | }
|
| 706 | break;
|
| 707 | }
|
| 708 | |
| 709 | return INIT_PASS;
|
| 710 | }
|
src/mess/drivers/comx35.c
| r2619 | r2620 | |
| 2 | 2 | |
| 3 | 3 | TODO:
|
| 4 | 4 | |
| 5 | | - fix keyboard
|
| 6 | | - power on reset timeout?
|
| 5 | - empty keyboard buffer at startup
|
| 6 | - F&M joycard detection
|
| 7 | - DOS ROM mirror @ 0xdd0-0xddf
|
| 8 | - DOS CAT halts after version prompt
|
| 9 | - fix CDP1869 scrolling
|
| 10 | - ROM_COPY only when bioses used
|
| 11 | - power on reset timeout value?
|
| 7 | 12 | - reset on SPACE+RESET
|
| 8 | 13 | - DMA memory refresh
|
| 9 | | - load .comx snapshots
|
| 10 | |
|
| 14 | |
| 11 | 15 | - tape
|
| 12 | | - floppy
|
| 13 | | - expansion box
|
| 14 | | - expansion box w/F&M
|
| 15 | | - 32K RAM card
|
| 16 | | - F&M joy card
|
| 17 | | - printer controller
|
| 18 | | - printer controller w/F&M
|
| 19 | | - F&M basic
|
| 20 | 16 | - PL-80 plotter
|
| 17 | - serial printer
|
| 21 | 18 | - thermal printer
|
| 22 | | - 80 column card with MC6845
|
| 19 | - 80 column card
|
| 23 | 20 | |
| 24 | 21 | */
|
| 25 | 22 | |
| 26 | 23 | #include "driver.h"
|
| 27 | 24 | #include "includes/comx35.h"
|
| 28 | 25 | #include "cpu/cdp1802/cdp1802.h"
|
| 26 | #include "devices/basicdsk.h"
|
| 29 | 27 | #include "devices/cassette.h"
|
| 28 | #include "devices/printer.h"
|
| 29 | #include "devices/snapquik.h"
|
| 30 | 30 | #include "machine/cdp1871.h"
|
| 31 | #include "machine/wd17xx.h"
|
| 31 | 32 | #include "video/cdp1869.h"
|
| 33 | #include "video/mc6845.h"
|
| 32 | 34 | |
| 33 | 35 | static const device_config *cassette_device_image(void)
|
| 34 | 36 | {
|
| 35 | 37 | return image_from_devtype_and_index(IO_CASSETTE, 0);
|
| 36 | 38 | }
|
| 37 | 39 | |
| 38 | | /* Read/Write Handlers */
|
| 39 | | |
| 40 | | static WRITE8_HANDLER( bank_select_w )
|
| 41 | | {
|
| 42 | | memory_set_bank(1, data & 0x07);
|
| 43 | | }
|
| 44 | | |
| 45 | | static WRITE8_HANDLER( system_io_w )
|
| 46 | | {
|
| 47 | | logerror("System IO %02x\n", data);
|
| 48 | | }
|
| 49 | | |
| 50 | 40 | /* Memory Maps */
|
| 51 | 41 | |
| 52 | 42 | static ADDRESS_MAP_START( comx35_map, ADDRESS_SPACE_PROGRAM, 8 )
|
| 43 | ADDRESS_MAP_UNMAP_HIGH
|
| 53 | 44 | AM_RANGE(0x0000, 0x3fff) AM_ROM
|
| 54 | 45 | AM_RANGE(0x4000, 0xbfff) AM_RAM
|
| 55 | 46 | AM_RANGE(0xc000, 0xdfff) AM_RAMBANK(1)
|
| 56 | | AM_RANGE(0xe000, 0xefff) AM_RAM
|
| 47 | AM_RANGE(0xe000, 0xefff) AM_ROM
|
| 57 | 48 | AM_RANGE(0xf400, 0xf7ff) AM_DEVREADWRITE(CDP1869_VIDEO, CDP1869_TAG, cdp1869_charram_r, cdp1869_charram_w)
|
| 58 | 49 | AM_RANGE(0xf800, 0xffff) AM_DEVREADWRITE(CDP1869_VIDEO, CDP1869_TAG, cdp1869_pageram_r, cdp1869_pageram_w)
|
| 59 | 50 | ADDRESS_MAP_END
|
| 60 | 51 | |
| 61 | 52 | static ADDRESS_MAP_START( comx35_io_map, ADDRESS_SPACE_IO, 8 )
|
| 62 | | AM_RANGE(0x01, 0x01) AM_WRITE(bank_select_w)
|
| 63 | | AM_RANGE(0x02, 0x02) AM_WRITE(system_io_w)
|
| 53 | ADDRESS_MAP_UNMAP_HIGH
|
| 54 | AM_RANGE(0x01, 0x01) AM_WRITE(comx35_bank_select_w)
|
| 55 | AM_RANGE(0x02, 0x02) AM_READWRITE(comx35_io_r, comx35_io_w)
|
| 64 | 56 | AM_RANGE(0x03, 0x03) AM_DEVREAD(CDP1871, CDP1871_TAG, cdp1871_data_r) AM_DEVWRITE(CDP1869_VIDEO, CDP1869_TAG, cdp1869_out3_w)
|
| 65 | | AM_RANGE(0x04, 0x04) AM_DEVWRITE(CDP1869_VIDEO, CDP1869_TAG, cdp1869_out4_w)
|
| 57 | AM_RANGE(0x04, 0x04) AM_READ(comx35_io2_r) AM_DEVWRITE(CDP1869_VIDEO, CDP1869_TAG, cdp1869_out4_w)
|
| 66 | 58 | AM_RANGE(0x05, 0x05) AM_DEVWRITE(CDP1869_VIDEO, CDP1869_TAG, cdp1869_out5_w)
|
| 67 | 59 | AM_RANGE(0x06, 0x06) AM_DEVWRITE(CDP1869_VIDEO, CDP1869_TAG, cdp1869_out6_w)
|
| 68 | 60 | AM_RANGE(0x07, 0x07) AM_DEVWRITE(CDP1869_VIDEO, CDP1869_TAG, cdp1869_out7_w)
|
| r2619 | r2620 | |
| 70 | 62 | |
| 71 | 63 | /* Input Ports */
|
| 72 | 64 | |
| 65 | #define COMX35_DEVICES \
|
| 66 | PORT_CONFSETTING( 0x00, DEF_STR( None ) ) \
|
| 67 | PORT_CONFSETTING( 0x01, "DOS Card" ) \
|
| 68 | PORT_CONFSETTING( 0x02, "Standard Printer Card" ) \
|
| 69 | PORT_CONFSETTING( 0x03, "Standard Printer Card (F&M)" ) \
|
| 70 | PORT_CONFSETTING( 0x04, "Serial Printer Card" ) \
|
| 71 | PORT_CONFSETTING( 0x05, "Thermal Printer Card" ) \
|
| 72 | PORT_CONFSETTING( 0x06, "F&M Joycard" ) \
|
| 73 | PORT_CONFSETTING( 0x07, "80 Column Card" ) \
|
| 74 | PORT_CONFSETTING( 0x08, "RAM Card" )
|
| 75 | |
| 73 | 76 | static INPUT_PORTS_START( comx35 )
|
| 74 | 77 | PORT_START_TAG("D1")
|
| 75 | 78 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(' ')
|
| r2619 | r2620 | |
| 132 | 135 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR(8)
|
| 133 | 136 | |
| 134 | 137 | PORT_START_TAG("D7")
|
| 135 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
|
| 138 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
|
| 139 | |
| 140 | PORT_START_TAG("D8")
|
| 141 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CR") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
|
| 136 | 142 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
|
| 137 | 143 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
|
| 138 | 144 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
|
| r2619 | r2620 | |
| 141 | 147 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
|
| 142 | 148 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
|
| 143 | 149 | |
| 144 | | PORT_START_TAG("D8")
|
| 145 | | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
|
| 146 | | |
| 147 | 150 | PORT_START_TAG("D9")
|
| 148 | 151 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
|
| 149 | 152 | |
| r2619 | r2620 | |
| 155 | 158 | |
| 156 | 159 | PORT_START_TAG("MODIFIERS")
|
| 157 | 160 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
|
| 158 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL))
|
| 161 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CNTL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL))
|
| 159 | 162 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
|
| 160 | 163 | |
| 161 | 164 | PORT_START_TAG("RESET")
|
| 162 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_NAME("RT") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
|
| 165 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RT") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
|
| 166 | |
| 167 | PORT_START_TAG("JOY1")
|
| 168 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
|
| 169 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
|
| 170 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
|
| 171 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
|
| 172 | PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
|
| 173 | |
| 174 | PORT_START_TAG("JOY2")
|
| 175 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY
|
| 176 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY
|
| 177 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY
|
| 178 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY
|
| 179 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
|
| 180 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
|
| 181 | PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
|
| 182 | |
| 183 | PORT_START_TAG("PRINTER")
|
| 184 | PORT_CONFNAME( 0x04, 0x00, "Printer")
|
| 185 | PORT_CONFSETTING( 0x00, "Parallel" )
|
| 186 | PORT_CONFSETTING( 0x01, "Serial" )
|
| 187 | PORT_CONFSETTING( 0x02, "Thermal" )
|
| 188 | PORT_CONFSETTING( 0x03, "COMX PL-80 Plotter" )
|
| 189 | |
| 190 | PORT_START_TAG("EXPANSION")
|
| 191 | PORT_CONFNAME( 0x0f, 0x00, "Expansion (without Expansion Box)")
|
| 192 | COMX35_DEVICES
|
| 193 | |
| 194 | PORT_START_TAG("SLOT1")
|
| 195 | PORT_CONFNAME( 0x0f, 0x01, "Expansion Box Slot 1")
|
| 196 | COMX35_DEVICES
|
| 197 | |
| 198 | PORT_START_TAG("SLOT2")
|
| 199 | PORT_CONFNAME( 0x0f, 0x02, "Expansion Box Slot 2")
|
| 200 | COMX35_DEVICES
|
| 201 | |
| 202 | PORT_START_TAG("SLOT3")
|
| 203 | PORT_CONFNAME( 0x0f, 0x06, "Expansion Box Slot 3")
|
| 204 | COMX35_DEVICES
|
| 205 | |
| 206 | PORT_START_TAG("SLOT4")
|
| 207 | PORT_CONFNAME( 0x0f, 0x08, "Expansion Box Slot 4")
|
| 208 | COMX35_DEVICES
|
| 163 | 209 | INPUT_PORTS_END
|
| 164 | 210 | |
| 165 | 211 | /* CDP1802 Interface */
|
| 166 | 212 | |
| 167 | | static TIMER_CALLBACK( dma_tick )
|
| 168 | | {
|
| 169 | | comx35_state *state = machine->driver_data;
|
| 170 | | |
| 171 | | if (!state->iden)
|
| 172 | | {
|
| 173 | | // cpunum_set_input_line(device->machine, 0, CDP1802_INPUT_LINE_DMAOUT, ASSERT_LINE);
|
| 174 | | // cpunum_set_input_line(device->machine, 0, CDP1802_INPUT_LINE_DMAOUT, CLEAR_LINE);
|
| 175 | | }
|
| 176 | | }
|
| 177 | | |
| 178 | 213 | static CDP1802_MODE_READ( comx35_mode_r )
|
| 179 | 214 | {
|
| 180 | 215 | comx35_state *state = machine->driver_data;
|
| r2619 | r2620 | |
| 208 | 243 | |
| 209 | 244 | if (!state->cdp1871_efxa) flags -= EF3;
|
| 210 | 245 | |
| 211 | | if (cassette_input(cassette_device_image()) > +1.0) flags -= EF4;
|
| 246 | if (!state->cdp1802_ef4 || cassette_input(cassette_device_image()) > +1.0) flags -= EF4;
|
| 212 | 247 | |
| 213 | 248 | return flags;
|
| 214 | 249 | }
|
| r2619 | r2620 | |
| 225 | 260 | {
|
| 226 | 261 | comx35_state *state = machine->driver_data;
|
| 227 | 262 | |
| 263 | state->cdp1802_q = level;
|
| 264 | |
| 228 | 265 | if (state->iden && level)
|
| 229 | 266 | {
|
| 230 | 267 | state->iden = 0;
|
| r2619 | r2620 | |
| 273 | 310 | comx35_rpt_w
|
| 274 | 311 | };
|
| 275 | 312 | |
| 276 | | /* Machine Initialization */
|
| 277 | | |
| 278 | | static TIMER_CALLBACK( reset_tick )
|
| 279 | | {
|
| 280 | | comx35_state *state = machine->driver_data;
|
| 281 | | |
| 282 | | state->cdp1802_mode = CDP1802_MODE_RUN;
|
| 283 | | }
|
| 284 | | |
| 285 | | static MACHINE_START( comx35p )
|
| 286 | | {
|
| 287 | | comx35_state *state = machine->driver_data;
|
| 288 | | |
| 289 | | // RAM banking
|
| 290 | | |
| 291 | | memory_configure_bank(1, 0, 8, memory_region(REGION_USER1), 0x2000);
|
| 292 | | memory_set_bank(1, 0);
|
| 293 | | |
| 294 | | // allocate DMA timer
|
| 295 | | |
| 296 | | state->dma_timer = timer_alloc(dma_tick, NULL);
|
| 297 | | timer_adjust_periodic(state->dma_timer, attotime_zero, 0, ATTOTIME_IN_HZ(CDP1869_CPU_CLK_PAL / 8));
|
| 298 | | |
| 299 | | // allocate reset timer
|
| 300 | |
|
| 301 | | state->reset_timer = timer_alloc(reset_tick, NULL);
|
| 302 | | |
| 303 | | // screen format
|
| 304 | | |
| 305 | | state->pal_ntsc = CDP1869_PAL;
|
| 306 | | }
|
| 307 | | |
| 308 | | static MACHINE_START( comx35n )
|
| 309 | | {
|
| 310 | | comx35_state *state = machine->driver_data;
|
| 311 | | |
| 312 | | MACHINE_START_CALL(comx35p);
|
| 313 | | |
| 314 | | timer_adjust_periodic(state->dma_timer, attotime_zero, 0, ATTOTIME_IN_HZ(CDP1869_CPU_CLK_NTSC / 8));
|
| 315 | | |
| 316 | | // screen format
|
| 317 | | |
| 318 | | state->pal_ntsc = CDP1869_NTSC;
|
| 319 | | }
|
| 320 | | |
| 321 | | static MACHINE_RESET( comx35 )
|
| 322 | | {
|
| 323 | | comx35_state *state = machine->driver_data;
|
| 324 | | |
| 325 | | state->cdp1802_mode = CDP1802_MODE_RESET;
|
| 326 | | state->iden = 1;
|
| 327 | | |
| 328 | | timer_adjust_oneshot(state->reset_timer, ATTOTIME_IN_MSEC(200), 0);
|
| 329 | | }
|
| 330 | | |
| 331 | 313 | /* Machine Drivers */
|
| 332 | 314 | |
| 333 | 315 | static MACHINE_DRIVER_START( comx35p )
|
| r2619 | r2620 | |
| 358 | 340 | |
| 359 | 341 | MDRV_SOUND_ADD(CDP1869, CDP1869_DOT_CLK_PAL)
|
| 360 | 342 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
| 343 | |
| 344 | // printer
|
| 345 | |
| 346 | MDRV_DEVICE_ADD("printer", PRINTER)
|
| 347 | |
| 348 | // quickload
|
| 349 | |
| 350 | MDRV_QUICKLOAD_ADD(comx35, "comx", 0)
|
| 361 | 351 | MACHINE_DRIVER_END
|
| 362 | 352 | |
| 363 | 353 | static MACHINE_DRIVER_START( comx35n )
|
| r2619 | r2620 | |
| 388 | 378 | |
| 389 | 379 | MDRV_SOUND_ADD(CDP1869, CDP1869_DOT_CLK_NTSC)
|
| 390 | 380 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
| 381 | |
| 382 | // printer
|
| 383 | |
| 384 | MDRV_DEVICE_ADD("printer", PRINTER)
|
| 385 | |
| 386 | // quickload
|
| 387 | |
| 388 | MDRV_QUICKLOAD_ADD(comx35, "comx", 0)
|
| 391 | 389 | MACHINE_DRIVER_END
|
| 392 | 390 | |
| 393 | 391 | /* ROMs */
|
| r2619 | r2620 | |
| 396 | 394 | ROM_REGION( 0x10000, REGION_CPU1, 0 )
|
| 397 | 395 | ROM_SYSTEM_BIOS( 0, "basic100", "COMX BASIC V1.00" )
|
| 398 | 396 | ROMX_LOAD( "comx_10.u21", 0x0000, 0x4000, CRC(68d0db2d) SHA1(062328361629019ceed9375afac18e2b7849ce47), ROM_BIOS(1) )
|
| 399 | | ROM_SYSTEM_BIOS( 1, "default", "COMX BASIC V1.01" )
|
| 400 | | ROMX_LOAD( "comx_11.u21", 0x0000, 0x4000, CRC(609d89cd) SHA1(799646810510d8236fbfafaff7a73d5170990f16), ROM_BIOS(2) )
|
| 397 | ROM_FILL( 0xe000, 0x2000, 0xff )
|
| 401 | 398 | |
| 402 | | ROM_REGION( 0x2000, REGION_USER1, 0 )
|
| 403 | | ROM_LOAD( "expansion.bin", 0x0000, 0x1000, CRC(52cb44e2) SHA1(3f9a3d9940b36d4fee5eca9f1359c99d7ed545b9) )
|
| 404 | | ROM_LOAD( "f&m.expansion.3.1.bin", 0x0000, 0x1000, CRC(818ca2ef) SHA1(ea000097622e7fd472d53e7899e3c83773433045) )
|
| 405 | | ROM_LOAD( "printer.bin", 0x0000, 0x0800, CRC(3bbc2b2e) SHA1(08bf7ea4174713ab24969c553affd5c1401876b8) )
|
| 406 | | ROM_LOAD( "thermal.bin", 0x0000, 0x1000, CRC(41a72ba8) SHA1(3a8760c78bd8c7bec2dbf26657b930c9a6814803) )
|
| 407 | | ROM_LOAD( "f&m.printer.1.2.bin", 0x0000, 0x1000, CRC(2feb997d) SHA1(ee9cb91042696c88ff5f2f44d2f702dc93369ba0) )
|
| 408 | | ROM_LOAD( "fdc.bin", 0x0000, 0x2000, CRC(cf4ecd2e) SHA1(290e19bdc89e3c8059e63d5ae3cca4daa194e1fe) )
|
| 409 | | ROM_LOAD( "pl80.tiny.bin", 0x0000, 0x0400, CRC(940ec1ed) SHA1(ad83a3b57e2f0fbaa1e40644cd999b3f239635e8) )
|
| 410 | | ROM_LOAD( "rs232.bin", 0x0000, 0x0800, CRC(926ff2d1) SHA1(be02bd388bba0211ea72d4868264a63308e4318d) )
|
| 411 | | ROM_LOAD( "f&m.joycard.bin", 0x0000, 0x0002, CRC(a681ea11) SHA1(ff4baa8b79471f31667337c30345d642810776e1) )
|
| 412 | | ROM_END
|
| 399 | ROM_SYSTEM_BIOS( 1, "default", "COMX BASIC V1.00 with Expansion Box" )
|
| 400 | ROMX_LOAD( "comx_10.u21", 0x0000, 0x4000, CRC(68d0db2d) SHA1(062328361629019ceed9375afac18e2b7849ce47), ROM_BIOS(2) )
|
| 401 | ROMX_LOAD( "expansion.e5", 0xe000, 0x1000, CRC(52cb44e2) SHA1(3f9a3d9940b36d4fee5eca9f1359c99d7ed545b9), ROM_BIOS(2) )
|
| 402 | ROM_COPY( REGION_CPU1, 0xe000, 0x1000, 0x0800 )
|
| 413 | 403 | |
| 414 | | ROM_START( comx35n )
|
| 415 | | ROM_REGION( 0x10000, REGION_CPU1, 0 )
|
| 416 | | ROM_SYSTEM_BIOS( 0, "basic100", "COMX BASIC V1.00" )
|
| 417 | | ROMX_LOAD( "comx_10.u21", 0x0000, 0x4000, CRC(68d0db2d) SHA1(062328361629019ceed9375afac18e2b7849ce47), ROM_BIOS(1) )
|
| 418 | | ROM_SYSTEM_BIOS( 1, "default", "COMX BASIC V1.01" )
|
| 419 | | ROMX_LOAD( "comx_11.u21", 0x0000, 0x4000, CRC(609d89cd) SHA1(799646810510d8236fbfafaff7a73d5170990f16), ROM_BIOS(2) )
|
| 404 | ROM_SYSTEM_BIOS( 2, "fmbasic31", "F&M BASIC V3.1 with Expansion Box" )
|
| 405 | ROMX_LOAD( "comx_10.u21", 0x0000, 0x4000, CRC(68d0db2d) SHA1(062328361629019ceed9375afac18e2b7849ce47), ROM_BIOS(3) )
|
| 406 | ROMX_LOAD( "f&m.expansion.3.1.e5", 0xe000, 0x1000, CRC(818ca2ef) SHA1(ea000097622e7fd472d53e7899e3c83773433045), ROM_BIOS(3) )
|
| 407 | ROM_COPY( REGION_CPU1, 0xe000, 0x1000, 0x0800 )
|
| 420 | 408 | |
| 421 | | ROM_REGION( 0x2000, REGION_USER1, 0 )
|
| 422 | | ROM_LOAD( "expansion.bin", 0x0000, 0x1000, CRC(52cb44e2) SHA1(3f9a3d9940b36d4fee5eca9f1359c99d7ed545b9) )
|
| 423 | | ROM_LOAD( "f&m.expansion.3.1.bin", 0x0000, 0x1000, CRC(818ca2ef) SHA1(ea000097622e7fd472d53e7899e3c83773433045) )
|
| 424 | | ROM_LOAD( "printer.bin", 0x0000, 0x0800, CRC(3bbc2b2e) SHA1(08bf7ea4174713ab24969c553affd5c1401876b8) )
|
| 425 | | ROM_LOAD( "thermal.bin", 0x0000, 0x1000, CRC(41a72ba8) SHA1(3a8760c78bd8c7bec2dbf26657b930c9a6814803) )
|
| 426 | | ROM_LOAD( "f&m.printer.1.2.bin", 0x0000, 0x1000, CRC(2feb997d) SHA1(ee9cb91042696c88ff5f2f44d2f702dc93369ba0) )
|
| 427 | | ROM_LOAD( "fdc.bin", 0x0000, 0x2000, CRC(cf4ecd2e) SHA1(290e19bdc89e3c8059e63d5ae3cca4daa194e1fe) )
|
| 428 | | ROM_LOAD( "pl80.tiny.bin", 0x0000, 0x0400, CRC(940ec1ed) SHA1(ad83a3b57e2f0fbaa1e40644cd999b3f239635e8) )
|
| 429 | | ROM_LOAD( "rs232.bin", 0x0000, 0x0800, CRC(926ff2d1) SHA1(be02bd388bba0211ea72d4868264a63308e4318d) )
|
| 430 | | ROM_LOAD( "f&m.joycard.bin", 0x0000, 0x0002, CRC(a681ea11) SHA1(ff4baa8b79471f31667337c30345d642810776e1) )
|
| 409 | ROM_SYSTEM_BIOS( 3, "basic101", "COMX BASIC V1.01" )
|
| 410 | ROMX_LOAD( "comx_11.u21", 0x0000, 0x4000, CRC(609d89cd) SHA1(799646810510d8236fbfafaff7a73d5170990f16), ROM_BIOS(4) )
|
| 411 | |
| 412 | ROM_REGION( 0x10000, REGION_USER1, 0 )
|
| 413 | ROM_LOAD( "fdc.f4", 0x0000, 0x2000, CRC(cf4ecd2e) SHA1(290e19bdc89e3c8059e63d5ae3cca4daa194e1fe) )
|
| 414 | ROM_LOAD( "printer.bin", 0x2000, 0x0800, CRC(3bbc2b2e) SHA1(08bf7ea4174713ab24969c553affd5c1401876b8) )
|
| 415 | ROM_LOAD( "f&m.printer.1.2.bin", 0x4000, 0x1000, CRC(2feb997d) SHA1(ee9cb91042696c88ff5f2f44d2f702dc93369ba0) )
|
| 416 | ROM_LOAD( "rs232.bin", 0x6000, 0x0800, CRC(926ff2d1) SHA1(be02bd388bba0211ea72d4868264a63308e4318d) )
|
| 417 | ROM_LOAD( "thermal.bin", 0x8000, 0x1000, CRC(41a72ba8) SHA1(3a8760c78bd8c7bec2dbf26657b930c9a6814803) )
|
| 418 | ROM_LOAD( "f&m.joycard.bin", 0xa000, 0x0002, CRC(a681ea11) SHA1(ff4baa8b79471f31667337c30345d642810776e1) )
|
| 419 | ROM_LOAD( "80.column.card.u3", 0xc000, 0x0800, NO_DUMP )
|
| 420 | |
| 421 | ROM_REGION( 0x10000, REGION_GFX1, 0 ) // MC6845 font
|
| 422 | ROM_LOAD( "mc6845.font.u", 0x0000, 0x0800, NO_DUMP )
|
| 423 | |
| 424 | ROM_REGION( 0x6000, REGION_GFX2, 0 ) // Plotter fonts
|
| 425 | ROM_LOAD( "pl80.it.em.ou.bin", 0x0000, 0x2000, CRC(1b4a3198) SHA1(138ff6666a31c2d18cd63e609dd94d9cd1529931) )
|
| 426 | ROM_LOAD( "pl80.tiny.bin", 0x2000, 0x0400, CRC(940ec1ed) SHA1(ad83a3b57e2f0fbaa1e40644cd999b3f239635e8) )
|
| 427 | |
| 428 | ROM_REGION( 0x1000, REGION_CPU2, 0 ) // COMX PL-80 CPU (CX005)
|
| 429 | ROM_LOAD( "pl80.bin", 0x0080, 0x0e00, CRC(ae059e5b) SHA1(f25812606b0082d32eb603d0a702a2187089d332) )
|
| 431 | 430 | ROM_END
|
| 432 | 431 | |
| 432 | #define rom_comx35n rom_comx35p
|
| 433 | |
| 433 | 434 | /* System Configuration */
|
| 434 | 435 | |
| 435 | 436 | static void comx35_cassette_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
|
| r2619 | r2620 | |
| 445 | 446 | }
|
| 446 | 447 | }
|
| 447 | 448 | |
| 449 | static void comx35_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
|
| 450 | {
|
| 451 | /* floppy */
|
| 452 | switch(state)
|
| 453 | {
|
| 454 | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 455 | case MESS_DEVINFO_INT_COUNT: info->i = 2; break;
|
| 456 | |
| 457 | /* --- the following bits of info are returned as pointers to data or functions --- */
|
| 458 | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(comx35_floppy); break;
|
| 459 | |
| 460 | /* --- the following bits of info are returned as NULL-terminated strings --- */
|
| 461 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "img"); break;
|
| 462 | |
| 463 | default: legacybasicdsk_device_getinfo(devclass, state, info); break;
|
| 464 | }
|
| 465 | }
|
| 466 | |
| 448 | 467 | SYSTEM_CONFIG_START( comx35 )
|
| 449 | 468 | CONFIG_RAM_DEFAULT (32 * 1024)
|
| 450 | | CONFIG_RAM (64 * 1024)
|
| 451 | 469 | CONFIG_DEVICE(comx35_cassette_getinfo)
|
| 470 | CONFIG_DEVICE(comx35_floppy_getinfo)
|
| 452 | 471 | SYSTEM_CONFIG_END
|
| 453 | 472 | |
| 454 | 473 | /* System Drivers */
|
| 455 | 474 | |
| 456 | 475 | // YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS
|
| 457 | | COMP( 1983, comx35p, 0, 0, comx35p, comx35, 0, comx35, "Comx World Operations Ltd", "COMX 35 (PAL)", GAME_NOT_WORKING )
|
| 458 | | COMP( 1983, comx35n, comx35p,0, comx35n, comx35, 0, comx35, "Comx World Operations Ltd", "COMX 35 (NTSC)", GAME_NOT_WORKING )
|
| 476 | COMP( 1983, comx35p, 0, 0, comx35p, comx35, 0, comx35, "Comx World Operations Ltd", "COMX 35 (PAL)", GAME_IMPERFECT_SOUND )
|
| 477 | COMP( 1983, comx35n, comx35p,0, comx35n, comx35, 0, comx35, "Comx World Operations Ltd", "COMX 35 (NTSC)", GAME_IMPERFECT_SOUND )
|