Previous 15994 Revisions Next

r4100 Friday 9th January, 2009 at 16:52:05 UTC by Robbbert
[GB] Fixed crash at soft reset; cleanups.
[src/mess/drivers]gb.c
[src/mess/machine]gb.c
[src/mess/video]gb.c

src/mess/video/gb.c
r4099r4100
11651165   int vram_size = 0x2000;
11661166   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
11671167
1168   switch( mode ) {
1169   case GB_VIDEO_CGB:   vram_size = 0x4000; break;
1170   }
1171   gb_vram = memory_region_alloc( machine, "gfx1", vram_size, 0 );
1172   gb_oam = memory_region_alloc( machine, "gfx2", 0x100, 0 );
1168   if (mode == GB_VIDEO_CGB) vram_size = 0x4000;
1169
1170   if (!memory_region(machine, "gfx1")) gb_vram = memory_region_alloc( machine, "gfx1", vram_size, 0 );
1171   if (!memory_region(machine, "gfx2")) gb_oam = memory_region_alloc( machine, "gfx2", 0x100, 0 );
11731172   memset( gb_vram, 0, vram_size );
11741173   memset( &gb_lcd, 0, sizeof(gb_lcd) );
11751174
src/mess/machine/gb.c
r4099r4100
196196   MBC3RTCBank = 0;
197197   ROMBank = ROMBank00 + 1;
198198   RAMBank = 0;
199   if ( MBCType != MBC_MEGADUCK ) {
200      gb_rom16_4000( machine, ROMMap[ROMBank] );
201      memory_set_bankptr (machine, 2, RAMMap[RAMBank] ? RAMMap[RAMBank] : gb_dummy_ram_bank);
202   } else {
203      memory_set_bankptr( machine, 1, ROMMap[ROMBank] );
204      memory_set_bankptr( machine, 10, ROMMap[0] );
199
200   if (gb_cart)
201   {
202      if ( MBCType != MBC_MEGADUCK )
203      {
204         gb_rom16_4000( machine, ROMMap[ROMBank] );
205         memory_set_bankptr (machine, 2, RAMMap[RAMBank] ? RAMMap[RAMBank] : gb_dummy_ram_bank);
206      }
207      else
208      {
209         memory_set_bankptr( machine, 1, ROMMap[ROMBank] );
210         memory_set_bankptr( machine, 10, ROMMap[0] );
211      }
205212   }
206213
207214   /* Set handlers based on the Memory Bank Controller in the cart */
r4099r4100
322329      For some reason that I haven't figured out, they store the tile
323330      data differently.  Hacks will go once I figure it out */
324331   sgb_hack = 0;
325   if( strncmp( (const char*)(gb_cart + 0x134), "DONKEYKONGLAND 2", 16 ) == 0 ||
326      strncmp( (const char*)(gb_cart + 0x134), "DONKEYKONGLAND 3", 16 ) == 0 )
332
333   if (gb_cart)   // make sure cart is in
327334   {
328      sgb_hack = 1;
335      if( strncmp( (const char*)(gb_cart + 0x134), "DONKEYKONGLAND 2", 16 ) == 0 ||
336         strncmp( (const char*)(gb_cart + 0x134), "DONKEYKONGLAND 3", 16 ) == 0 )
337            sgb_hack = 1;
329338   }
330339
331340   gb_timer.divcount = 0xABC8;
r4099r4100
386395   gb_io_w( cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ), 0x77, 0x00 );
387396
388397   /* Are we in colour or mono mode? */
389   if( gb_cart[0x143] == 0x80 || gb_cart[0x143] == 0xC0 )
390      gbc_mode = GBC_MODE_GBC;
391   else
392      gbc_mode = GBC_MODE_MONO;
398   gbc_mode = GBC_MODE_MONO;
393399
400   if (gb_cart)   // make sure cart is in
401   {
402      if( gb_cart[0x143] == 0x80 || gb_cart[0x143] == 0xC0 )
403         gbc_mode = GBC_MODE_GBC;
404   }
394405   gb_timer.divcount = 0x1E9C;
395406}
396407
src/mess/drivers/gb.c
r4099r4100
587587   MDRV_SOUND_ROUTE(1, "right", 0.50)
588588   
589589   MDRV_CARTSLOT_ADD("cart")
590   MDRV_CARTSLOT_EXTENSION_LIST("gb,gmb,cgb,gbc,sgb,bin")
591   MDRV_CARTSLOT_NOT_MANDATORY
590   MDRV_CARTSLOT_EXTENSION_LIST("gb,gmb,cgb,sgb,bin")
591   MDRV_CARTSLOT_MANDATORY
592592   MDRV_CARTSLOT_START(gb_cart)
593593   MDRV_CARTSLOT_LOAD(gb_cart)
594594MACHINE_DRIVER_END
r4099r4100
610610   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
611611   MDRV_PALETTE_LENGTH(32768)
612612   MDRV_PALETTE_INIT(sgb)
613   
614   MDRV_CARTSLOT_MODIFY("cart")
615   MDRV_CARTSLOT_MANDATORY
616613MACHINE_DRIVER_END
617614
618615static MACHINE_DRIVER_START( gbpocket )
r4099r4100
621618   MDRV_CPU_CONFIG(mgb_cpu_reset)
622619   MDRV_MACHINE_RESET( gbpocket )
623620   MDRV_PALETTE_INIT(gbp)
624
625   MDRV_CARTSLOT_MODIFY("cart")
626   MDRV_CARTSLOT_MANDATORY
627621MACHINE_DRIVER_END
628622
629623static MACHINE_DRIVER_START( gbcolor )
r4099r4100
638632   MDRV_PALETTE_INIT(gbc)
639633   
640634   MDRV_CARTSLOT_MODIFY("cart")
641   MDRV_CARTSLOT_MANDATORY
635   MDRV_CARTSLOT_EXTENSION_LIST("gb,gmb,cgb,gbc,sgb,bin")
642636MACHINE_DRIVER_END
643637
644638static SYSTEM_CONFIG_START(gb_cgb)
r4099r4100
678672   
679673   MDRV_CARTSLOT_ADD("cart")
680674   MDRV_CARTSLOT_EXTENSION_LIST("bin")
681   MDRV_CARTSLOT_MANDATORY
682675   MDRV_CARTSLOT_LOAD(megaduck_cart)
683676MACHINE_DRIVER_END
684677
r4099r4100
714707ROM_END
715708
716709/*    YEAR  NAME      PARENT   COMPAT   MACHINE   INPUT    INIT  CONFIG   COMPANY     FULLNAME */
717CONS( 1990, gameboy,  0,       0,      gameboy,  gameboy, 0,    0, "Nintendo", "Game Boy"  , 0)
718CONS( 1994, supergb,  0,       gameboy,   supergb,  gameboy, 0,    0, "Nintendo", "Super Game Boy" , 0)
719CONS( 1996, gbpocket, gameboy, 0,      gbpocket, gameboy, 0,    0, "Nintendo", "Game Boy Pocket" , 0)
720CONS( 1998, gbcolor,  0,       gameboy,   gbcolor,  gameboy, 0,    gb_cgb, "Nintendo", "Game Boy Color" , 0)
710CONS( 1990, gameboy,  0,       0,   gameboy,  gameboy, 0,    0,    "Nintendo", "Game Boy"  , 0)
711CONS( 1994, supergb,  0,       gameboy,   supergb,  gameboy, 0,    0,    "Nintendo", "Super Game Boy" , 0)
712CONS( 1996, gbpocket, gameboy, 0,   gbpocket, gameboy, 0,    0,    "Nintendo", "Game Boy Pocket" , 0)
713CONS( 1998, gbcolor,  0,       gameboy,   gbcolor,  gameboy, 0,    gb_cgb, "Nintendo", "Game Boy Color" , GAME_NOT_WORKING)
721714
722715/* Sound is not 100% yet, it generates some sounds which could be ok. Since we're lacking a real
723716   system there's no way to verify. Same goes for the colors of the LCD. We are no using the default
724717   Game Boy green colors */
725CONS( 1993, megaduck, 0,       0,       megaduck, gameboy, 0,    0,"Creatronic/Videojet/Timlex/Cougar",  "MegaDuck/Cougar Boy" , 0)
718CONS( 1993, megaduck, 0,       0,       megaduck, gameboy, 0,    0,    "Creatronic/Videojet/Timlex/Cougar",  "MegaDuck/Cougar Boy" , 0)
726719

Previous 15994 Revisions Next


© 1998-2018 The MESS Team