Previous 15994 Revisions Next

r14499 Friday 17th February, 2012 at 20:07:47 UTC by Wilbert Pol
sg1000.c: Fixed loading from softlist for existing items and added auto-detection for Dahlee Type A and B RAM cartridges. (nw)
[src/mess/drivers]sg1000.c

src/mess/drivers/sg1000.c
r14498r14499
723723      // the main unit's system ram (0xC000-0xC3FF) and 8K which appears
724724      // at 0x2000-0x3FFF in the memory map.
725725      //
726      if ( ! strcmp( needs_addon, "dahjee_type_a" ) )
726      if ( needs_addon && ! strcmp( needs_addon, "dahjee_type_a" ) )
727727      {
728728         install_2000_ram = true;
729729      }
r14498r14499
732732      // The Dahjee (Type B) RAM cartridge had 8KB of RAM which
733733      // replaces the main unit RAM in the memory map. (0xC000-0xDFFF area)
734734      //
735      if ( ! strcmp( needs_addon, "dahjee_type_b" ) )
735      if ( needs_addon && ! strcmp( needs_addon, "dahjee_type_b" ) )
736736      {
737737         ram_size = 0x2000;
738738      }
739739   }
740740
741   // Try to auto-detect special features
742   if ( ! install_2000_ram && ram_size == 0x400 )
743   {
744      if ( size >= 0x8000 )
745      {
746         int x2000_3000 = 0, xd000_e000_f000 = 0, x2000_ff = 0;
747
748         for ( int i = 0; i < 0x8000; i++ )
749         {
750            if ( ptr[i] == 0x32 )
751            {
752               UINT16 addr = ptr[i+1] | ( ptr[i+2] << 8 );
753
754               switch ( addr & 0xF000 )
755               {
756               case 0x2000:
757               case 0x3000:
758                  i += 2;
759                  x2000_3000++;
760                  break;
761
762               case 0xD000:
763               case 0xE000:
764               case 0xF000:
765                  i += 2;
766                  xd000_e000_f000++;
767                  break;
768               }
769            }
770         }
771         for ( int i = 0x2000; i < 0x4000; i++ )
772         {
773            if ( ptr[i] == 0xFF )
774            {
775               x2000_ff++;
776            }
777         }
778         if ( x2000_ff == 0x2000 && ( xd000_e000_f000 > 10 || x2000_3000 > 10 ) )
779         {
780            if ( xd000_e000_f000 > x2000_3000 )
781            {
782               ram_size = 0x2000;
783            }
784            else
785            {
786               install_2000_ram = true;
787            }
788         }
789      }
790   }
791
741792   /* cartridge ROM banking */
742793   state->install_cartridge(ptr, size);
743794

Previous 15994 Revisions Next


© 1998-2018 The MESS Team