src/mess/drivers/ql.c
| r1261 | r1262 | |
| 1 | 1 | #include "driver.h" |
| 2 | 2 | #include "cpu/i8039/i8039.h" |
| 3 | 3 | #include "cpu/m68000/m68000.h" |
| 4 | #include "devices/cartslot.h" |
| 5 | #include "includes/serial.h" |
| 4 | 6 | #include "video/generic.h" |
| 5 | 7 | #include "video/zx8301.h" |
| 6 | 8 | #include "inputx.h" |
| r1261 | r1262 | |
| 35 | 37 | zx8302_baudx4 = zx8302_baudx4 ? 0 : 1; |
| 36 | 38 | } |
| 37 | 39 | |
| 38 | | static WRITE8_HANDLER( zx8302_w ) |
| 40 | static WRITE8_HANDLER( zx8302_control_w ) |
| 39 | 41 | { |
| 40 | 42 | int baudx4 = 0; |
| 41 | 43 | |
| r1261 | r1262 | |
| 66 | 68 | mame_timer_adjust(zx8302_baud_timer, time_zero, 0, MAME_TIME_IN_HZ(baudx4)); |
| 67 | 69 | } |
| 68 | 70 | |
| 69 | | static WRITE8_HANDLER( i8049_w ) |
| 71 | static WRITE8_HANDLER( zx8302_ipc_w ) |
| 70 | 72 | { |
| 71 | 73 | /* |
| 72 | 74 | process 8049 commands (p92) |
| r1261 | r1262 | |
| 138 | 140 | return 0x0; |
| 139 | 141 | } |
| 140 | 142 | |
| 141 | | static WRITE8_HANDLER( clock_w ) |
| 143 | static WRITE8_HANDLER( zx8302_clock_w ) |
| 142 | 144 | { |
| 143 | 145 | } |
| 144 | 146 | |
| r1261 | r1262 | |
| 262 | 264 | |
| 263 | 265 | static ADDRESS_MAP_START( ql_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 264 | 266 | AM_RANGE(0x000000, 0x00bfff) AM_ROM // System ROM |
| 265 | | AM_RANGE(0x00c000, 0x00ffff) AM_ROM // Cartridge ROM |
| 266 | | AM_RANGE(0x018000, 0x018001) AM_WRITE(clock_w) |
| 267 | | AM_RANGE(0x018002, 0x018002) AM_WRITE(zx8302_w) |
| 268 | | AM_RANGE(0x018003, 0x018003) AM_WRITE(i8049_w) |
| 267 | AM_RANGE(0x00c000, 0x00ffff) AM_ROMBANK(1) // Cartridge ROM |
| 268 | AM_RANGE(0x018000, 0x018001) AM_WRITE(zx8302_clock_w) |
| 269 | AM_RANGE(0x018002, 0x018002) AM_WRITE(zx8302_control_w) |
| 270 | AM_RANGE(0x018003, 0x018003) AM_WRITE(zx8302_ipc_w) |
| 269 | 271 | AM_RANGE(0x018020, 0x018020) AM_READWRITE(mdv_status_r, mdv_ctrl_w) |
| 270 | | AM_RANGE(0x018021, 0x018021) AM_WRITENOP // ??? |
| 271 | 272 | AM_RANGE(0x018022, 0x018022) AM_WRITE(mdv_data_w) |
| 272 | | AM_RANGE(0x018023, 0x018023) AM_WRITENOP // ??? |
| 273 | 273 | AM_RANGE(0x018063, 0x018063) AM_WRITE(zx8301_control_w) |
| 274 | 274 | AM_RANGE(0x020000, 0x02ffff) AM_RAM AM_BASE(&videoram) |
| 275 | 275 | AM_RANGE(0x030000, 0x03ffff) AM_RAM // onboard RAM |
| 276 | 276 | AM_RANGE(0x040000, 0x0bffff) AM_RAM // 512KB add-on RAM |
| 277 | 277 | AM_RANGE(0x0c0000, 0x0dffff) AM_NOP // 8x16KB device slots |
| 278 | | AM_RANGE(0x0e0000, 0x0fffff) AM_ROM // add-on ROM |
| 278 | AM_RANGE(0x0e0000, 0x0fffff) AM_ROMBANK(2) // add-on ROM |
| 279 | 279 | ADDRESS_MAP_END |
| 280 | 280 | |
| 281 | 281 | static ADDRESS_MAP_START( ipc_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r1261 | r1262 | |
| 398 | 398 | static MACHINE_START( ql ) |
| 399 | 399 | { |
| 400 | 400 | zx8302_baud_timer = mame_timer_alloc(zx8302_baud_tick); |
| 401 | |
| 402 | memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x00c000, 0x00ffff, 0, 0, MRA8_UNMAP, MWA8_UNMAP); |
| 403 | |
| 404 | memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1) + 0x00c000, 0); |
| 405 | memory_set_bank(1, 0); |
| 401 | 406 | } |
| 402 | 407 | |
| 403 | 408 | static MACHINE_DRIVER_START( ql ) |
| r1261 | r1262 | |
| 539 | 544 | |
| 540 | 545 | /* System Configuration */ |
| 541 | 546 | |
| 547 | static DEVICE_LOAD( ql_microdrive ) |
| 548 | { |
| 549 | int filesize = image_length(image); |
| 550 | |
| 551 | if (filesize == 174930) |
| 552 | { |
| 553 | return INIT_PASS; |
| 554 | } |
| 555 | |
| 556 | return INIT_FAIL; |
| 557 | } |
| 558 | |
| 559 | static void ql_microdrive_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) |
| 560 | { |
| 561 | switch(state) |
| 562 | { |
| 563 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 564 | case DEVINFO_INT_TYPE: info->i = IO_CASSETTE; break; |
| 565 | case DEVINFO_INT_COUNT: info->i = 2; break; |
| 566 | |
| 567 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 568 | case DEVINFO_PTR_LOAD: info->load = device_load_ql_microdrive; break; |
| 569 | |
| 570 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 571 | case DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "mdv"); break; |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | static DEVICE_LOAD( ql_serial ) |
| 576 | { |
| 577 | /* filename specified */ |
| 578 | if (serial_device_load(image)==INIT_PASS) |
| 579 | { |
| 580 | /* setup transmit parameters */ |
| 581 | serial_device_setup(image, 9600, 8, 1, SERIAL_PARITY_NONE); |
| 582 | |
| 583 | serial_device_set_protocol(image, SERIAL_PROTOCOL_NONE); |
| 584 | |
| 585 | /* and start transmit */ |
| 586 | serial_device_set_transmit_state(image, 1); |
| 587 | |
| 588 | return INIT_PASS; |
| 589 | } |
| 590 | |
| 591 | return INIT_FAIL; |
| 592 | } |
| 593 | |
| 594 | static void ql_serial_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) |
| 595 | { |
| 596 | /* serial */ |
| 597 | switch(state) |
| 598 | { |
| 599 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 600 | case DEVINFO_INT_TYPE: info->i = IO_SERIAL; break; |
| 601 | case DEVINFO_INT_COUNT: info->i = 2; break; |
| 602 | |
| 603 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 604 | case DEVINFO_PTR_INIT: info->init = serial_device_init; break; |
| 605 | case DEVINFO_PTR_LOAD: info->load = device_load_ql_serial; break; |
| 606 | case DEVINFO_PTR_UNLOAD: info->unload = serial_device_unload; break; |
| 607 | |
| 608 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 609 | case DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "txt"); break; |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | static DEVICE_LOAD( ql_cart ) |
| 614 | { |
| 615 | UINT8 *ptr = ((UINT8 *)memory_region(REGION_CPU1)) + 0x00c000; |
| 616 | int filesize = image_length(image); |
| 617 | |
| 618 | if (filesize <= 16 * 1024) |
| 619 | { |
| 620 | if (image_fread(image, ptr, filesize) == filesize) |
| 621 | { |
| 622 | memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x00c000, 0x00ffff, 0, 0, MRA8_BANK1, MWA8_BANK1); |
| 623 | |
| 624 | return INIT_PASS; |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | return INIT_FAIL; |
| 629 | } |
| 630 | |
| 631 | static void ql_cartslot_getinfo( const device_class *devclass, UINT32 state, union devinfo *info ) |
| 632 | { |
| 633 | switch( state ) |
| 634 | { |
| 635 | case DEVINFO_INT_COUNT: |
| 636 | info->i = 1; |
| 637 | break; |
| 638 | case DEVINFO_PTR_LOAD: |
| 639 | info->load = device_load_ql_cart; |
| 640 | break; |
| 641 | case DEVINFO_STR_FILE_EXTENSIONS: |
| 642 | strcpy(info->s = device_temp_str(), "qlc"); |
| 643 | break; |
| 644 | default: |
| 645 | cartslot_device_getinfo( devclass, state, info ); |
| 646 | break; |
| 647 | } |
| 648 | } |
| 649 | |
| 542 | 650 | SYSTEM_CONFIG_START( ql ) |
| 543 | 651 | CONFIG_RAM_DEFAULT (128 * 1024) |
| 544 | 652 | CONFIG_RAM (640 * 1024) |
| 653 | CONFIG_DEVICE(ql_microdrive_getinfo) |
| 654 | CONFIG_DEVICE(ql_serial_getinfo) |
| 655 | CONFIG_DEVICE(ql_cartslot_getinfo) |
| 545 | 656 | SYSTEM_CONFIG_END |
| 546 | 657 | |
| 547 | 658 | /* Computer Drivers */ |