src/mess/drivers/sg1000.c
| r14485 | r14486 | |
| 701 | 701 | sg1000_state *state = machine.driver_data<sg1000_state>(); |
| 702 | 702 | address_space *program = machine.device(Z80_TAG)->memory().space(AS_PROGRAM); |
| 703 | 703 | UINT8 *ptr = machine.region(Z80_TAG)->base(); |
| 704 | UINT32 ram_size = 0x400; |
| 705 | bool install_2000_ram = false; |
| 704 | 706 | UINT32 size; |
| 705 | 707 | |
| 706 | 708 | if (image.software_entry() == NULL) |
| r14485 | r14486 | |
| 713 | 715 | { |
| 714 | 716 | size = image.get_software_region_length("rom"); |
| 715 | 717 | memcpy(ptr, image.get_software_region("rom"), size); |
| 718 | |
| 719 | const char *needs_addon = image.get_feature("needs_addon"); |
| 720 | |
| 721 | // |
| 722 | // The Dahjee (Type A) RAM cartridge had 9KB of RAM. 1KB replaces |
| 723 | // the main unit's system ram (0xC000-0xC3FF) and 8K which appears |
| 724 | // at 0x2000-0x3FFF in the memory map. |
| 725 | // |
| 726 | if ( ! strcmp( needs_addon, "dahjee_type_a" ) ) |
| 727 | { |
| 728 | install_2000_ram = true; |
| 729 | } |
| 730 | |
| 731 | // |
| 732 | // The Dahjee (Type B) RAM cartridge had 8KB of RAM which |
| 733 | // replaces the main unit RAM in the memory map. (0xC000-0xDFFF area) |
| 734 | // |
| 735 | if ( ! strcmp( needs_addon, "dahjee_type_b" ) ) |
| 736 | { |
| 737 | ram_size = 0x2000; |
| 738 | } |
| 716 | 739 | } |
| 717 | 740 | |
| 718 | 741 | /* cartridge ROM banking */ |
| 719 | 742 | state->install_cartridge(ptr, size); |
| 720 | 743 | |
| 744 | if ( install_2000_ram ) |
| 745 | { |
| 746 | program->install_ram(0x2000, 0x3FFF); |
| 747 | } |
| 748 | |
| 721 | 749 | /* work RAM banking */ |
| 722 | | program->install_readwrite_bank(0xc000, 0xc3ff, 0, 0x3c00, "bank2"); |
| 750 | program->install_readwrite_bank(0xc000, 0xc000 + ram_size - 1, 0, 0x4000 - ram_size, "bank2"); |
| 723 | 751 | |
| 724 | 752 | return IMAGE_INIT_PASS; |
| 725 | 753 | } |