Previous 15994 Revisions Next

r5696 Friday 11th September, 2009 at 19:34:33 UTC by Wilbert Pol
[GBCOLOR] Added preliminary support for the bootstrap rom.
[docs]messnew.txt
[src/mess/drivers]gb.c
[src/mess/machine]gb.c

src/mess/machine/gb.c
r5695r5696
175175{
176176   memory_set_bankptr( machine, 5, addr );
177177   memory_set_bankptr( machine, 10, addr + 0x0100 );
178   memory_set_bankptr( machine, 6, addr + 0x0150 );
179   memory_set_bankptr( machine, 11, addr + 0x0400 );
178180}
179181
180182static void gb_rom16_4000( running_machine *machine, UINT8 *addr )
r5695r5696
301303
302304   gb_video_init( machine, GB_VIDEO_DMG );
303305
306   gb_rom16_0000( machine, ROMMap[ROMBank00] );
307
304308   /* Enable BIOS rom */
305309   memory_set_bankptr(machine, 5, memory_region(machine, "maincpu") );
306   memory_set_bankptr(machine, 10, ROMMap[ROMBank00] + 0x0100 );
307310
308311   gb_timer.divcount = 0x0004;
309312}
r5695r5696
316319
317320   gb_init_regs(machine);
318321
319   memory_set_bankptr(machine, 5, ROMMap[ROMBank00] ? ROMMap[ROMBank00] : gb_dummy_rom_bank );
320   memory_set_bankptr(machine, 10, ROMMap[ROMBank00] ? ROMMap[ROMBank00] + 0x0100 : gb_dummy_rom_bank + 0x0100 );
322   gb_rom16_0000( machine, ROMMap[ROMBank00] ? ROMMap[ROMBank00] : gb_dummy_rom_bank );
321323
322324   sgb_tile_data = auto_alloc_array_clear(machine, UINT8, 0x2000 );
323325   memset( sgb_tile_data, 0, 0x2000 );
r5695r5696
360362   gb_sound_w(devtag_get_device(machine, "custom"), 0x14,0x77);
361363
362364   /* Enable BIOS rom if we have one */
363   memory_set_bankptr(machine, 5, ROMMap[ROMBank00] ? ROMMap[ROMBank00] : gb_dummy_rom_bank );
364   memory_set_bankptr(machine, 10, ROMMap[ROMBank00] ? ROMMap[ROMBank00] + 0x0100 : gb_dummy_rom_bank + 0x0100);
365   gb_rom16_0000( machine, ROMMap[ROMBank00] ? ROMMap[ROMBank00] : gb_dummy_rom_bank );
365366
366367   gb_timer.divcount = 0xABC8;
367368}
r5695r5696
381382   gb_sound_w(devtag_get_device(machine, "custom"), 0x15, 0xF3);
382383   gb_sound_w(devtag_get_device(machine, "custom"), 0x14, 0x77);
383384
384   memory_set_bankptr(machine, 5, ROMMap[ROMBank00] ? ROMMap[ROMBank00] : gb_dummy_rom_bank );
385   memory_set_bankptr(machine, 10, ROMMap[ROMBank00] ? ROMMap[ROMBank00] + 0x0100 : gb_dummy_rom_bank + 0x0100);
385   gb_rom16_0000( machine, ROMMap[ROMBank00] ? ROMMap[ROMBank00] : gb_dummy_rom_bank );
386386
387   /* Enable BIOS rom */
388   memory_set_bankptr(machine, 5, memory_region(machine, "maincpu") );
389   memory_set_bankptr(machine, 6, memory_region(machine, "maincpu") + 0x100 );
390
387391   /* Allocate memory for internal ram */
388392   for( ii = 0; ii < 8; ii++ )
389393   {
r5695r5696
890894   if ( offset == 0x10 )
891895   {
892896      /* disable BIOS ROM */
893      memory_set_bankptr(space->machine, 5, ROMMap[ROMBank00]);
897      gb_rom16_0000( space->machine, ROMMap[ROMBank00] );
894898   }
895899   else
896900   {
r5695r5696
19861990      case 0x0D:   /* KEY1 - Prepare speed switch */
19871991         cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), LR35902_SPEED, data );
19881992         return;
1993      case 0x10:   /* BFF - Bios disable */
1994         gb_rom16_0000( space->machine, ROMMap[ROMBank00] );
1995         return;
19891996      case 0x16:   /* RP - Infrared port */
19901997         break;
19911998      case 0x30:   /* SVBK - RAM bank select */
src/mess/drivers/gb.c
r5695r5696
445445/* Initial value of the cpu registers (hacks until we get bios dumps) */
446446static const UINT16 sgb_cpu_regs[6] = { 0x01B0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 };    /* Super Game Boy                    */
447447static const UINT16 mgb_cpu_regs[6] = { 0xFFB0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 };   /* Game Boy Pocket / Super Game Boy 2 */
448static const UINT16 cgb_cpu_regs[6] = { 0x11B0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 };   /* Game Boy Color  / Game Boy Advance */
448//static const UINT16 cgb_cpu_regs[6] = { 0x11B0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 };   /* Game Boy Color  / Game Boy Advance */
449449static const UINT16 megaduck_cpu_regs[6] = { 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFE, 0x0000 };   /* Megaduck */
450450
451451static const lr35902_cpu_core dmg_cpu_reset = { NULL, LR35902_FEATURE_HALT_BUG, gb_timer_callback };
452452static const lr35902_cpu_core sgb_cpu_reset = { sgb_cpu_regs, LR35902_FEATURE_HALT_BUG, gb_timer_callback };
453453static const lr35902_cpu_core mgb_cpu_reset = { mgb_cpu_regs, LR35902_FEATURE_HALT_BUG, gb_timer_callback };
454static const lr35902_cpu_core cgb_cpu_reset = { cgb_cpu_regs, 0, gb_timer_callback };
454static const lr35902_cpu_core cgb_cpu_reset = { NULL, 0, gb_timer_callback };
455455static const lr35902_cpu_core megaduck_cpu_reset = { megaduck_cpu_regs, LR35902_FEATURE_HALT_BUG, gb_timer_callback };
456456
457457static ADDRESS_MAP_START(gb_map, ADDRESS_SPACE_PROGRAM, 8)
458458   ADDRESS_MAP_UNMAP_HIGH
459459   AM_RANGE(0x0000, 0x00ff) AM_ROMBANK(5)               /* BIOS or ROM */
460   AM_RANGE(0x0100, 0x3fff) AM_ROMBANK(10)               /* ROM bank */
460   AM_RANGE(0x0100, 0x014f) AM_ROMBANK(10)               /* ROM bank */
461   AM_RANGE(0x0150, 0x03ff) AM_ROMBANK(6)
462   AM_RANGE(0x0400, 0x3fff) AM_ROMBANK(11)
461463   AM_RANGE(0x4000, 0x5fff) AM_ROMBANK(1)               /* 8KB/16KB switched ROM bank */
462464   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK(4)               /* 8KB/16KB switched ROM bank */
463465   AM_RANGE(0x8000, 0x9fff) AM_READWRITE( gb_vram_r, gb_vram_w ) /* 8k VRAM */
r5695r5696
476478static ADDRESS_MAP_START(sgb_map, ADDRESS_SPACE_PROGRAM, 8)
477479   ADDRESS_MAP_UNMAP_HIGH
478480   AM_RANGE(0x0000, 0x00ff) AM_ROMBANK(5)               /* 16k fixed ROM bank */
479   AM_RANGE(0x0100, 0x3fff) AM_ROMBANK(10)               /* ROM bank */
481   AM_RANGE(0x0100, 0x014f) AM_ROMBANK(10)               /* ROM bank */
482   AM_RANGE(0x0150, 0x03ff) AM_ROMBANK(6)
483   AM_RANGE(0x0400, 0x3fff) AM_ROMBANK(11)
480484   AM_RANGE(0x4000, 0x5fff) AM_ROMBANK(1)               /* 8KB/16KB switched ROM bank */
481485   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK(4)               /* 8KB/16KB switched ROM bank */
482486   AM_RANGE(0x8000, 0x9fff) AM_READWRITE( gb_vram_r, gb_vram_w ) /* 8k VRAM */
r5695r5696
495499static ADDRESS_MAP_START(gbc_map, ADDRESS_SPACE_PROGRAM, 8)
496500   ADDRESS_MAP_UNMAP_HIGH
497501   AM_RANGE(0x0000, 0x00ff) AM_ROMBANK(5)               /* 16k fixed ROM bank */
498   AM_RANGE(0x0100, 0x3fff) AM_ROMBANK(10)               /* ROM bank */
502   AM_RANGE(0x0100, 0x014f) AM_ROMBANK(10)               /* ROM bank */
503   AM_RANGE(0x0150, 0x03ff) AM_ROMBANK(6)
504   AM_RANGE(0x0400, 0x3fff) AM_ROMBANK(11)
499505   AM_RANGE(0x4000, 0x5fff) AM_ROMBANK(1)               /* 8KB/16KB switched ROM bank */
500506   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK(4)               /* 8KB/16KB switched ROM bank */
501507   AM_RANGE(0x8000, 0x9fff) AM_READWRITE( gb_vram_r, gb_vram_w )      /* 8k switched VRAM bank */
r5695r5696
629635
630636   MDRV_PALETTE_LENGTH(32768)
631637   MDRV_PALETTE_INIT(gbc)
632
633   MDRV_CARTSLOT_MODIFY("cart")
634   MDRV_CARTSLOT_MANDATORY
635638MACHINE_DRIVER_END
636639
637640static SYSTEM_CONFIG_START(gb_cgb)
r5695r5696
701704ROM_END
702705
703706ROM_START( gbcolor )
704   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
705/*  ROM_LOAD( "gbc_boot.bin", 0x0000, 0x0100, NO_DUMP ) */
707   ROM_REGION( 0x03B0 + 1792, "maincpu", 0 )
708   ROM_LOAD( "gbc_boot.1", 0x0000, 0x0100, BAD_DUMP CRC(607a2f81) SHA1(6b232a802ca1f4c3c7c29ad10de10737bbc064bc) )   /* Bootstrap code part 1 */
709   ROM_LOAD( "gbc_boot.2", 0x0100, 0x02B0, BAD_DUMP CRC(2a8e6294) SHA1(0b9a3836b524ffbff74729e0a01f33fef45b457b) ) /* Bootstrap code part 2 */
710   ROM_LOAD( "gbc_boot.3", 0x03B0, 1792, NO_DUMP )   /* DMG game - palette lookup table(?) */
706711ROM_END
707712
708713
r5695r5696
715720CONS( 1994, supergb,  0,       gameboy,   supergb,  gameboy, 0,    0,    "Nintendo", "Super Game Boy" , 0)
716721CONS( 1996, gbpocket, gameboy, 0,   gbpocket, gameboy, 0,    0,    "Nintendo", "Game Boy Pocket" , 0)
717722CONS( 1997, gblight,  gameboy, 0,   gbpocket, gameboy, 0,    0,    "Nintendo", "Game Boy Light" , 0)
718CONS( 1998, gbcolor,  0,       gameboy,   gbcolor,  gameboy, 0,    gb_cgb, "Nintendo", "Game Boy Color" , GAME_NOT_WORKING)
723CONS( 1998, gbcolor,  gameboy, 0,   gbcolor,  gameboy, 0,    gb_cgb, "Nintendo", "Game Boy Color" , GAME_NOT_WORKING)
719724
720725/* Sound is not 100% yet, it generates some sounds which could be ok. Since we're lacking a real
721726   system there's no way to verify. Same goes for the colors of the LCD. We are no using the default
docs/messnew.txt
r5695r5696
4242
4343- [COLECO] Bug #1460 fixed [Robbbert]
4444
45- [GBCOLOR] Added preliminary support for the bootstrap rom.  [Wilbert Pol]
46
4547- [MEGADRIVE]  Fixed multisession issues, fixed SRAM size and SRAM memory
4648  leak. [Enik]
4749

Previous 15994 Revisions Next


© 1998-2018 The MESS Team