src/mess/drivers/mbee.c
| r3725 | r3726 | |
| 55 | 55 | #include "devices/cassette.h" |
| 56 | 56 | #include "devices/z80bin.h" |
| 57 | 57 | #include "sound/speaker.h" |
| 58 | | #include "deprecat.h" |
| 59 | 58 | |
| 60 | 59 | static const device_config *cassette_device_image(running_machine *machine) |
| 61 | 60 | { |
| r3725 | r3726 | |
| 545 | 544 | |
| 546 | 545 | static Z80BIN_EXECUTE( mbee ) |
| 547 | 546 | { |
| 548 | | memory_write_word_16le(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0xa6, execute_address); /* fix the EXEC command */ |
| 547 | const device_config *cpu = cputag_get_cpu(machine, "main"); |
| 548 | const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM); |
| 549 | 549 | |
| 550 | memory_write_word_16le(space, 0xa6, execute_address); /* fix the EXEC command */ |
| 551 | |
| 550 | 552 | if (autorun) |
| 551 | 553 | { |
| 552 | | 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 */ |
| 553 | | cpu_set_reg(cputag_get_cpu(Machine, "main"), REG_PC, execute_address); |
| 554 | memory_write_word_16le(space, 0xa2, execute_address); /* fix warm-start vector to get around some copy-protections */ |
| 555 | cpu_set_reg(cpu, REG_PC, execute_address); |
| 554 | 556 | } |
| 555 | 557 | else |
| 556 | 558 | { |
| 557 | | memory_write_word_16le(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0xa2, 0x8517); |
| 559 | memory_write_word_16le(space, 0xa2, 0x8517); |
| 558 | 560 | } |
| 559 | 561 | } |
| 560 | 562 | |
| 561 | 563 | static QUICKLOAD_LOAD( mbee ) |
| 562 | 564 | { |
| 565 | const device_config *cpu = cputag_get_cpu(image->machine, "main"); |
| 566 | const address_space *space = cputag_get_address_space(image->machine, "main", ADDRESS_SPACE_PROGRAM); |
| 563 | 567 | UINT16 i, j; |
| 564 | 568 | UINT8 data, sw = input_port_read(image->machine, "CONFIG") & 1; /* reading the dipswitch: 1 = autorun */ |
| 565 | 569 | |
| r3725 | r3726 | |
| 573 | 577 | if (image_fread(image, &data, 1) != 1) return INIT_FAIL; |
| 574 | 578 | |
| 575 | 579 | if ((j < mbee_size) || (j > 0xefff)) |
| 576 | | memory_write_byte(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), j, data); |
| 580 | memory_write_byte(space, j, data); |
| 577 | 581 | else |
| 578 | 582 | return INIT_FAIL; |
| 579 | 583 | } |
| 580 | 584 | |
| 581 | 585 | if (sw) |
| 582 | 586 | { |
| 583 | | 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 */ |
| 584 | | cpu_set_reg(cputag_get_cpu(Machine, "main"), REG_PC, 0x801e); |
| 587 | memory_write_word_16le(space, 0xa2,0x801e); /* fix warm-start vector to get around some copy-protections */ |
| 588 | cpu_set_reg(cpu, REG_PC, 0x801e); |
| 585 | 589 | } |
| 586 | 590 | else |
| 587 | | memory_write_word_16le(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0xa2,0x8517); |
| 591 | memory_write_word_16le(space, 0xa2,0x8517); |
| 588 | 592 | } |
| 589 | 593 | else if (!mame_stricmp(image_filetype(image), "com")) |
| 590 | 594 | { |
| r3725 | r3726 | |
| 596 | 600 | if (image_fread(image, &data, 1) != 1) return INIT_FAIL; |
| 597 | 601 | |
| 598 | 602 | if ((j < mbee_size) || (j > 0xefff)) |
| 599 | | memory_write_byte(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), j, data); |
| 603 | memory_write_byte(space, j, data); |
| 600 | 604 | else |
| 601 | 605 | return INIT_FAIL; |
| 602 | 606 | } |
| 603 | 607 | |
| 604 | | if (sw) cpu_set_reg(cputag_get_cpu(Machine, "main"), REG_PC, 0x100); |
| 608 | if (sw) cpu_set_reg(cpu, REG_PC, 0x100); |
| 605 | 609 | } |
| 606 | 610 | |
| 607 | 611 | return INIT_PASS; |
src/mess/drivers/vtech1.c
| r3725 | r3726 | |
| 113 | 113 | #include "devices/printer.h" |
| 114 | 114 | #include "devices/z80bin.h" |
| 115 | 115 | #include "formats/vt_cas.h" |
| 116 | | #include "deprecat.h" |
| 117 | 116 | |
| 118 | 117 | static Z80BIN_EXECUTE(vtech1); |
| 119 | 118 | |
| r3725 | r3726 | |
| 423 | 422 | |
| 424 | 423 | static Z80BIN_EXECUTE( vtech1 ) |
| 425 | 424 | { |
| 425 | const device_config *cpu = cputag_get_cpu(machine, "main"); |
| 426 | const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM); |
| 427 | |
| 426 | 428 | /* A Microsoft Basic program needs some manipulation before it can be run. |
| 427 | 429 | 1. A start address of 7ae9 indicates a basic program which needs its pointers fixed up. |
| 428 | 430 | 2. If autorun is turned off, the pointers still need fixing, but then display READY. |
| r3725 | r3726 | |
| 430 | 432 | 7ae9 = start (load) address of a conventional basic program |
| 431 | 433 | 791e = custom routine to fix basic pointers */ |
| 432 | 434 | |
| 433 | | memory_write_word_16le(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0x791c, end_address + 1); |
| 434 | | memory_write_word_16le(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0x781e, execute_address); |
| 435 | memory_write_word_16le(space, 0x791c, end_address + 1); |
| 436 | memory_write_word_16le(space, 0x781e, execute_address); |
| 435 | 437 | |
| 436 | 438 | if (start_address == 0x7ae9) |
| 437 | 439 | { |
| r3725 | r3726 | |
| 445 | 447 | 0xc3, 0xcf, 0x36,}; // JP 36CF ;enter bios at autorun point |
| 446 | 448 | |
| 447 | 449 | for (i = 0; i < ARRAY_LENGTH(data); i++) |
| 448 | | memory_write_byte(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0x791e + i, data[i]); |
| 450 | memory_write_byte(space, 0x791e + i, data[i]); |
| 449 | 451 | |
| 450 | 452 | if (!autorun) |
| 451 | | memory_write_byte(cputag_get_address_space(Machine,"main",ADDRESS_SPACE_PROGRAM), 0x7929, 0xb6); /* turn off autorun */ |
| 453 | memory_write_byte(space, 0x7929, 0xb6); /* turn off autorun */ |
| 452 | 454 | |
| 453 | | cpu_set_reg(cputag_get_cpu(Machine, "main"), REG_PC, 0x791e); |
| 455 | cpu_set_reg(cpu, REG_PC, 0x791e); |
| 454 | 456 | } |
| 455 | 457 | else |
| 456 | 458 | { |
| 457 | 459 | if (autorun) |
| 458 | | cpu_set_reg(cputag_get_cpu(Machine, "main"), REG_PC, execute_address); |
| 460 | cpu_set_reg(cpu, REG_PC, execute_address); |
| 459 | 461 | } |
| 460 | 462 | } |
| 461 | 463 | |