src/mess/video/gb.c
| r4099 | r4100 | |
| 1165 | 1165 | int vram_size = 0x2000; |
| 1166 | 1166 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 1167 | 1167 | |
| 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 ); |
| 1173 | 1172 | memset( gb_vram, 0, vram_size ); |
| 1174 | 1173 | memset( &gb_lcd, 0, sizeof(gb_lcd) ); |
| 1175 | 1174 | |
src/mess/machine/gb.c
| r4099 | r4100 | |
| 196 | 196 | MBC3RTCBank = 0; |
| 197 | 197 | ROMBank = ROMBank00 + 1; |
| 198 | 198 | 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 | } |
| 205 | 212 | } |
| 206 | 213 | |
| 207 | 214 | /* Set handlers based on the Memory Bank Controller in the cart */ |
| r4099 | r4100 | |
| 322 | 329 | For some reason that I haven't figured out, they store the tile |
| 323 | 330 | data differently. Hacks will go once I figure it out */ |
| 324 | 331 | 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 |
| 327 | 334 | { |
| 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; |
| 329 | 338 | } |
| 330 | 339 | |
| 331 | 340 | gb_timer.divcount = 0xABC8; |
| r4099 | r4100 | |
| 386 | 395 | gb_io_w( cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ), 0x77, 0x00 ); |
| 387 | 396 | |
| 388 | 397 | /* 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; |
| 393 | 399 | |
| 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 | } |
| 394 | 405 | gb_timer.divcount = 0x1E9C; |
| 395 | 406 | } |
| 396 | 407 | |
src/mess/drivers/gb.c
| r4099 | r4100 | |
| 587 | 587 | MDRV_SOUND_ROUTE(1, "right", 0.50) |
| 588 | 588 | |
| 589 | 589 | 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 |
| 592 | 592 | MDRV_CARTSLOT_START(gb_cart) |
| 593 | 593 | MDRV_CARTSLOT_LOAD(gb_cart) |
| 594 | 594 | MACHINE_DRIVER_END |
| r4099 | r4100 | |
| 610 | 610 | MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) |
| 611 | 611 | MDRV_PALETTE_LENGTH(32768) |
| 612 | 612 | MDRV_PALETTE_INIT(sgb) |
| 613 | | |
| 614 | | MDRV_CARTSLOT_MODIFY("cart") |
| 615 | | MDRV_CARTSLOT_MANDATORY |
| 616 | 613 | MACHINE_DRIVER_END |
| 617 | 614 | |
| 618 | 615 | static MACHINE_DRIVER_START( gbpocket ) |
| r4099 | r4100 | |
| 621 | 618 | MDRV_CPU_CONFIG(mgb_cpu_reset) |
| 622 | 619 | MDRV_MACHINE_RESET( gbpocket ) |
| 623 | 620 | MDRV_PALETTE_INIT(gbp) |
| 624 | | |
| 625 | | MDRV_CARTSLOT_MODIFY("cart") |
| 626 | | MDRV_CARTSLOT_MANDATORY |
| 627 | 621 | MACHINE_DRIVER_END |
| 628 | 622 | |
| 629 | 623 | static MACHINE_DRIVER_START( gbcolor ) |
| r4099 | r4100 | |
| 638 | 632 | MDRV_PALETTE_INIT(gbc) |
| 639 | 633 | |
| 640 | 634 | MDRV_CARTSLOT_MODIFY("cart") |
| 641 | | MDRV_CARTSLOT_MANDATORY |
| 635 | MDRV_CARTSLOT_EXTENSION_LIST("gb,gmb,cgb,gbc,sgb,bin") |
| 642 | 636 | MACHINE_DRIVER_END |
| 643 | 637 | |
| 644 | 638 | static SYSTEM_CONFIG_START(gb_cgb) |
| r4099 | r4100 | |
| 678 | 672 | |
| 679 | 673 | MDRV_CARTSLOT_ADD("cart") |
| 680 | 674 | MDRV_CARTSLOT_EXTENSION_LIST("bin") |
| 681 | | MDRV_CARTSLOT_MANDATORY |
| 682 | 675 | MDRV_CARTSLOT_LOAD(megaduck_cart) |
| 683 | 676 | MACHINE_DRIVER_END |
| 684 | 677 | |
| r4099 | r4100 | |
| 714 | 707 | ROM_END |
| 715 | 708 | |
| 716 | 709 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 717 | | CONS( 1990, gameboy, 0, 0, gameboy, gameboy, 0, 0, "Nintendo", "Game Boy" , 0) |
| 718 | | CONS( 1994, supergb, 0, gameboy, supergb, gameboy, 0, 0, "Nintendo", "Super Game Boy" , 0) |
| 719 | | CONS( 1996, gbpocket, gameboy, 0, gbpocket, gameboy, 0, 0, "Nintendo", "Game Boy Pocket" , 0) |
| 720 | | CONS( 1998, gbcolor, 0, gameboy, gbcolor, gameboy, 0, gb_cgb, "Nintendo", "Game Boy Color" , 0) |
| 710 | CONS( 1990, gameboy, 0, 0, gameboy, gameboy, 0, 0, "Nintendo", "Game Boy" , 0) |
| 711 | CONS( 1994, supergb, 0, gameboy, supergb, gameboy, 0, 0, "Nintendo", "Super Game Boy" , 0) |
| 712 | CONS( 1996, gbpocket, gameboy, 0, gbpocket, gameboy, 0, 0, "Nintendo", "Game Boy Pocket" , 0) |
| 713 | CONS( 1998, gbcolor, 0, gameboy, gbcolor, gameboy, 0, gb_cgb, "Nintendo", "Game Boy Color" , GAME_NOT_WORKING) |
| 721 | 714 | |
| 722 | 715 | /* Sound is not 100% yet, it generates some sounds which could be ok. Since we're lacking a real |
| 723 | 716 | system there's no way to verify. Same goes for the colors of the LCD. We are no using the default |
| 724 | 717 | Game Boy green colors */ |
| 725 | | CONS( 1993, megaduck, 0, 0, megaduck, gameboy, 0, 0,"Creatronic/Videojet/Timlex/Cougar", "MegaDuck/Cougar Boy" , 0) |
| 718 | CONS( 1993, megaduck, 0, 0, megaduck, gameboy, 0, 0, "Creatronic/Videojet/Timlex/Cougar", "MegaDuck/Cougar Boy" , 0) |
| 726 | 719 | |