Previous 15994 Revisions Next

r14486 Thursday 16th February, 2012 at 19:31:22 UTC by Wilbert Pol
sg1000.c: Added support for games that need a Dahjee RAM expansion cartridge. (nw)
[src/mess/drivers]sg1000.c

src/mess/drivers/sg1000.c
r14485r14486
701701   sg1000_state *state = machine.driver_data<sg1000_state>();
702702   address_space *program = machine.device(Z80_TAG)->memory().space(AS_PROGRAM);
703703   UINT8 *ptr = machine.region(Z80_TAG)->base();
704   UINT32 ram_size = 0x400;
705   bool install_2000_ram = false;
704706   UINT32 size;
705707
706708   if (image.software_entry() == NULL)
r14485r14486
713715   {
714716      size = image.get_software_region_length("rom");
715717      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      }
716739   }
717740
718741   /* cartridge ROM banking */
719742   state->install_cartridge(ptr, size);
720743
744   if ( install_2000_ram )
745   {
746      program->install_ram(0x2000, 0x3FFF);
747   }
748
721749   /* 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");
723751
724752   return IMAGE_INIT_PASS;
725753}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team