src/mess/video/gb.c
| r2538 | r2539 | |
| 2 | 2 | |
| 3 | 3 | gb.c |
| 4 | 4 | |
| 5 | | Video file to handle emulation of the Nintendo GameBoy. |
| 5 | Video file to handle emulation of the Nintendo Game Boy. |
| 6 | 6 | |
| 7 | 7 | Original code Carsten Sorensen 1998 |
| 8 | 8 | Mess modifications, bug fixes and speedups Hans de Goede 1998 |
| r2538 | r2539 | |
| 128 | 128 | 0x84,0x80,0x4E, /* Medium */ |
| 129 | 129 | 0x4E,0x4E,0x4E, /* Dark */ |
| 130 | 130 | |
| 131 | | /* Palette for GameBoy Pocket/Light */ |
| 131 | /* Palette for Game Boy Pocket/Light */ |
| 132 | 132 | 0xC4,0xCF,0xA1, /* Background */ |
| 133 | 133 | 0x8B,0x95,0x6D, /* Light */ |
| 134 | 134 | 0x6B,0x73,0x53, /* Medium */ |
| r2538 | r2539 | |
| 459 | 459 | profiler_mark(PROFILER_END); |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | | /* --- Super Gameboy Specific --- */ |
| 462 | /* --- Super Game Boy Specific --- */ |
| 463 | 463 | |
| 464 | 464 | INLINE void sgb_update_sprites (void) |
| 465 | 465 | { |
| r2538 | r2539 | |
| 792 | 792 | profiler_mark(PROFILER_END); |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | | /* --- Gameboy Color Specific --- */ |
| 795 | /* --- Game Boy Color Specific --- */ |
| 796 | 796 | |
| 797 | 797 | INLINE void cgb_update_sprites ( running_machine *machine ) { |
| 798 | 798 | bitmap_t *bitmap = tmpbitmap; |
| r2538 | r2539 | |
| 1367 | 1367 | gb_lcd.oam_locked = UNLOCKED; |
| 1368 | 1368 | gb_lcd.vram_locked = UNLOCKED; |
| 1369 | 1369 | /* |
| 1370 | | There seems to a kind of feature in the gameboy hardware when the lowest bits of the |
| 1370 | There seems to a kind of feature in the Game Boy hardware when the lowest bits of the |
| 1371 | 1371 | SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later |
| 1372 | 1372 | than usual. |
| 1373 | 1373 | The SGB probably has the same bug. |
| r2538 | r2539 | |
| 1598 | 1598 | gb_lcd.oam_locked = UNLOCKED; |
| 1599 | 1599 | gb_lcd.vram_locked = UNLOCKED; |
| 1600 | 1600 | /* |
| 1601 | | There seems to a kind of feature in the gameboy hardware when the lowest bits of the |
| 1601 | There seems to a kind of feature in the Game Boy hardware when the lowest bits of the |
| 1602 | 1602 | SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later |
| 1603 | 1603 | than usual. |
| 1604 | 1604 | The SGB probably has the same bug. |
src/mess/machine/gb.c
| r2538 | r2539 | |
| 2 | 2 | |
| 3 | 3 | gb.c |
| 4 | 4 | |
| 5 | | Machine file to handle emulation of the Nintendo GameBoy. |
| 5 | Machine file to handle emulation of the Nintendo Game Boy. |
| 6 | 6 | |
| 7 | 7 | Changes: |
| 8 | 8 | |
| r2538 | r2539 | |
| 26 | 26 | Added support for games with more than 128 ROM banks. |
| 27 | 27 | 12/6/2002 AK - Rewrote the way bg and sprite palettes are handled. |
| 28 | 28 | The window layer no longer has it's own palette. |
| 29 | | Added Super GameBoy support. |
| 30 | | 13/6/2002 AK - Added GameBoy Color support. |
| 29 | Added Super Game Boy support. |
| 30 | 13/6/2002 AK - Added Game Boy Color support. |
| 31 | 31 | |
| 32 | 32 | 17/5/2004 WP - Added Megaduck/Cougar Boy support. |
| 33 | 33 | 13/6/2005 WP - Added support for bootstrap rom banking. |
| r2538 | r2539 | |
| 1739 | 1739 | logerror("Cart Information\n"); |
| 1740 | 1740 | logerror("\tName: %s\n", S); |
| 1741 | 1741 | logerror("\tType: %s [0x%2X]\n", CartTypes[gb_header[0x0147]], gb_header[0x0147] ); |
| 1742 | | logerror("\tGameBoy: %s\n", (gb_header[0x0143] == 0xc0) ? "No" : "Yes" ); |
| 1742 | logerror("\tGame Boy: %s\n", (gb_header[0x0143] == 0xc0) ? "No" : "Yes" ); |
| 1743 | 1743 | logerror("\tSuper GB: %s [0x%2X]\n", (gb_header[0x0146] == 0x03) ? "Yes" : "No", gb_header[0x0146] ); |
| 1744 | 1744 | logerror("\tColor GB: %s [0x%2X]\n", (gb_header[0x0143] == 0x80 || gb_header[0x0143] == 0xc0) ? "Yes" : "No", gb_cart[0x0143] ); |
| 1745 | 1745 | logerror("\tROM Size: %d 16kB Banks [0x%2X]\n", ROMBanks, gb_header[0x0148]); |
| r2538 | r2539 | |
| 1910 | 1910 | } |
| 1911 | 1911 | |
| 1912 | 1912 | /* |
| 1913 | | Map megaduck video related area on to regular Gameboy video area |
| 1913 | Map megaduck video related area on to regular Game Boy video area |
| 1914 | 1914 | |
| 1915 | 1915 | Different locations of the video registers: |
| 1916 | | Register GameBoy MegaDuck |
| 1916 | Register Game Boy MegaDuck |
| 1917 | 1917 | LCDC FF40 FF10 (See different bit order below) |
| 1918 | 1918 | STAT FF41 FF11 |
| 1919 | 1919 | SCY FF42 FF12 |
| r2538 | r2539 | |
| 1933 | 1933 | |
| 1934 | 1934 | Different LCDC register |
| 1935 | 1935 | |
| 1936 | | GameBoy MegaDuck |
| 1936 | Game Boy MegaDuck |
| 1937 | 1937 | 0 6 - BG & Window Display : 0 - Off, 1 - On |
| 1938 | 1938 | 1 0 - OBJ Display: 0 - Off, 1 - On |
| 1939 | 1939 | 2 1 - OBJ Size: 0 - 8x8, 1 - 8x16 |
| r2538 | r2539 | |
| 1969 | 1969 | gb_video_w(machine, offset, data ); |
| 1970 | 1970 | } |
| 1971 | 1971 | |
| 1972 | | /* Map megaduck audio offset to gameboy audio offsets */ |
| 1972 | /* Map megaduck audio offset to game boy audio offsets */ |
| 1973 | 1973 | |
| 1974 | 1974 | static const UINT8 megaduck_sound_offsets[16] = { 0, 2, 1, 3, 4, 6, 5, 7, 8, 9, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; |
| 1975 | 1975 | |
src/mess/drivers/gb.c
| r2538 | r2539 | |
| 2 | 2 | |
| 3 | 3 | gb.c |
| 4 | 4 | |
| 5 | | Driver file to handle emulation of the Nintendo Gameboy. |
| 5 | Driver file to handle emulation of the Nintendo Game Boy. |
| 6 | 6 | By: |
| 7 | 7 | |
| 8 | 8 | Hans de Goede 1998 |
| r2538 | r2539 | |
| 164 | 164 | etc |
| 165 | 165 | |
| 166 | 166 | |
| 167 | | Mappers used in the gameboy |
| 167 | Mappers used in the Game Boy |
| 168 | 168 | =========================== |
| 169 | 169 | |
| 170 | 170 | MBC1 Mapper |
| r2538 | r2539 | |
| 444 | 444 | |
| 445 | 445 | |
| 446 | 446 | /* Initial value of the cpu registers (hacks until we get bios dumps) */ |
| 447 | | static const UINT16 sgb_cpu_regs[6] = { 0x01B0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 }; /* Super GameBoy */ |
| 448 | | static const UINT16 mgb_cpu_regs[6] = { 0xFFB0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 }; /* GameBoy Pocket / Super GameBoy 2 */ |
| 449 | | static const UINT16 cgb_cpu_regs[6] = { 0x11B0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 }; /* GameBoy Color / Gameboy Advance */ |
| 447 | static const UINT16 sgb_cpu_regs[6] = { 0x01B0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 }; /* Super Game Boy */ |
| 448 | static const UINT16 mgb_cpu_regs[6] = { 0xFFB0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 }; /* Game Boy Pocket / Super Game Boy 2 */ |
| 449 | static const UINT16 cgb_cpu_regs[6] = { 0x11B0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 }; /* Game Boy Color / Game Boy Advance */ |
| 450 | 450 | static const UINT16 megaduck_cpu_regs[6] = { 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFE, 0x0000 }; /* Megaduck */ |
| 451 | 451 | |
| 452 | 452 | static const Z80GB_CONFIG dmg_cpu_reset = { NULL, Z80GB_FEATURE_HALT_BUG, gb_timer_callback }; |
| r2538 | r2539 | |
| 756 | 756 | ROM_END |
| 757 | 757 | |
| 758 | 758 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 759 | | CONS( 1990, gameboy, 0, 0, gameboy, gameboy, 0, gameboy_gb, "Nintendo", "GameBoy" , 0) |
| 760 | | CONS( 1994, supergb, 0, gameboy, supergb, gameboy, 0, gameboy, "Nintendo", "Super GameBoy" , 0) |
| 761 | | CONS( 1996, gbpocket, gameboy, 0, gbpocket, gameboy, 0, gameboy, "Nintendo", "GameBoy Pocket" , 0) |
| 762 | | CONS( 1998, gbcolor, 0, gameboy, gbcolor, gameboy, 0, gb_cgb, "Nintendo", "GameBoy Color" , 0) |
| 759 | CONS( 1990, gameboy, 0, 0, gameboy, gameboy, 0, gameboy_gb, "Nintendo", "Game Boy" , 0) |
| 760 | CONS( 1994, supergb, 0, gameboy, supergb, gameboy, 0, gameboy, "Nintendo", "Super Game Boy" , 0) |
| 761 | CONS( 1996, gbpocket, gameboy, 0, gbpocket, gameboy, 0, gameboy, "Nintendo", "Game Boy Pocket" , 0) |
| 762 | CONS( 1998, gbcolor, 0, gameboy, gbcolor, gameboy, 0, gb_cgb, "Nintendo", "Game Boy Color" , 0) |
| 763 | 763 | |
| 764 | 764 | /* Sound is not 100% yet, it generates some sounds which could be ok. Since we're lacking a real |
| 765 | 765 | system there's no way to verify. Same goes for the colors of the LCD. We are no using the default |
| 766 | | GameBoy green colors */ |
| 766 | Game Boy green colors */ |
| 767 | 767 | CONS( 1993, megaduck, 0, 0, megaduck, gameboy, 0, megaduck,"Creatronic/Videojet/Timlex/Cougar", "MegaDuck/Cougar Boy" , 0) |
| 768 | 768 | |