src/mess/drivers/mbee.c
| r3632 | r3633 | |
| 56 | 56 | #include "devices/cassette.h" |
| 57 | 57 | #include "devices/z80bin.h" |
| 58 | 58 | #include "sound/speaker.h" |
| 59 | #include "deprecat.h" |
| 59 | 60 | |
| 60 | 61 | static const device_config *cassette_device_image(running_machine *machine) |
| 61 | 62 | { |
| r3632 | r3633 | |
| 290 | 291 | |
| 291 | 292 | static Z80PIO_ON_INT_CHANGED( pio_interrupt ) |
| 292 | 293 | { |
| 293 | | cpunum_set_input_line(device->machine, 0, 0, state); |
| 294 | cpu_set_input_line(device->machine->cpu[0], 0, state); |
| 294 | 295 | } |
| 295 | 296 | |
| 296 | 297 | static READ8_DEVICE_HANDLER( pio_port_b_r ) |
| r3632 | r3633 | |
| 453 | 454 | UINT8 *RAM = memory_region(machine, "main"); |
| 454 | 455 | memory_configure_bank(machine, 1, 0, 2, &RAM[0x0000], 0x8000); |
| 455 | 456 | memory_configure_bank(machine, 2, 0, 2, &RAM[0x11000], 0x4000); |
| 456 | | memory_configure_bank(3, 0, 2, &RAM[0x11800], 0x4000); |
| 457 | memory_configure_bank(machine, 3, 0, 2, &RAM[0x11800], 0x4000); |
| 457 | 458 | memory_set_bank(machine, 2, 1); |
| 458 | | memory_set_bank(3, 0); |
| 459 | memory_set_bank(machine, 3, 0); |
| 459 | 460 | } |
| 460 | 461 | |
| 461 | 462 | static DRIVER_INIT( mbee56 ) |
| r3632 | r3633 | |
| 463 | 464 | UINT8 *RAM = memory_region(machine, "main"); |
| 464 | 465 | memory_configure_bank(machine, 1, 0, 2, &RAM[0x0000], 0xe000); |
| 465 | 466 | memory_configure_bank(machine, 2, 0, 2, &RAM[0x11000], 0x4000); |
| 466 | | memory_configure_bank(3, 0, 2, &RAM[0x11800], 0x4000); |
| 467 | memory_configure_bank(machine, 3, 0, 2, &RAM[0x11800], 0x4000); |
| 467 | 468 | memory_set_bank(machine, 2, 1); |
| 468 | | memory_set_bank(3, 0); |
| 469 | memory_set_bank(machine, 3, 0); |
| 469 | 470 | } |
| 470 | 471 | |
| 471 | 472 | ROM_START( mbee ) |
| r3632 | r3633 | |
| 545 | 546 | |
| 546 | 547 | static Z80BIN_EXECUTE( mbee ) |
| 547 | 548 | { |
| 548 | | program_write_word_16le(0xa6, execute_address); /* fix the EXEC command */ |
| 549 | memory_write_word_16le(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0xa6, execute_address); /* fix the EXEC command */ |
| 549 | 550 | |
| 550 | 551 | if (autorun) |
| 551 | 552 | { |
| 552 | | program_write_word_16le(0xa2, execute_address); /* fix warm-start vector to get around some copy-protections */ |
| 553 | | cpunum_set_reg(0, REG_PC, execute_address); |
| 553 | memory_write_word_16le(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0xa2, execute_address); /* fix warm-start vector to get around some copy-protections */ |
| 554 | cpu_set_reg(cputag_get_cpu(Machine, "main"), REG_PC, execute_address); |
| 554 | 555 | } |
| 555 | 556 | else |
| 556 | 557 | { |
| 557 | | program_write_word_16le(0xa2, 0x8517); |
| 558 | memory_write_word_16le(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0xa2, 0x8517); |
| 558 | 559 | } |
| 559 | 560 | } |
| 560 | 561 | |
| r3632 | r3633 | |
| 573 | 574 | if (image_fread(image, &data, 1) != 1) return INIT_FAIL; |
| 574 | 575 | |
| 575 | 576 | if ((j < mbee_size) || (j > 0xefff)) |
| 576 | | memory_write_byte(space, j, data); |
| 577 | memory_write_byte(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), j, data); |
| 577 | 578 | else |
| 578 | 579 | return INIT_FAIL; |
| 579 | 580 | } |
| 580 | 581 | |
| 581 | 582 | if (sw) |
| 582 | 583 | { |
| 583 | | program_write_word_16le(0xa2,0x801e); /* fix warm-start vector to get around some copy-protections */ |
| 584 | | cpunum_set_reg(0, REG_PC, 0x801e); |
| 584 | memory_write_word_16le(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0xa2,0x801e); /* fix warm-start vector to get around some copy-protections */ |
| 585 | cpu_set_reg(cputag_get_cpu(Machine, "main"), REG_PC, 0x801e); |
| 585 | 586 | } |
| 586 | 587 | else |
| 587 | | program_write_word_16le(0xa2,0x8517); |
| 588 | memory_write_word_16le(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0xa2,0x8517); |
| 588 | 589 | } |
| 589 | 590 | else if (!mame_stricmp(image_filetype(image), "com")) |
| 590 | 591 | { |
| r3632 | r3633 | |
| 596 | 597 | if (image_fread(image, &data, 1) != 1) return INIT_FAIL; |
| 597 | 598 | |
| 598 | 599 | if ((j < mbee_size) || (j > 0xefff)) |
| 599 | | memory_write_byte(space, j, data); |
| 600 | memory_write_byte(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), j, data); |
| 600 | 601 | else |
| 601 | 602 | return INIT_FAIL; |
| 602 | 603 | } |
| 603 | 604 | |
| 604 | | if (sw) cpunum_set_reg(0, REG_PC, 0x100); |
| 605 | if (sw) cpu_set_reg(cputag_get_cpu(Machine, "main"), REG_PC, 0x100); |
| 605 | 606 | } |
| 606 | 607 | |
| 607 | 608 | return INIT_PASS; |