Previous 15994 Revisions Next

r2539 Sunday 4th May, 2008 at 16:29:10 UTC by Justin Kerk
GameBoy -> Game Boy
[src/mess/audio]gb.c
[src/mess/drivers]gb.c
[src/mess/includes]gb.h
[src/mess/machine]gb.c
[src/mess/video]gb.c

src/mess/audio/gb.c
r2538r2539
11/**************************************************************************************
2* Gameboy sound emulation (c) Anthony Kruize (trandor@labyrinth.net.au)
2* Game Boy sound emulation (c) Anthony Kruize (trandor@labyrinth.net.au)
33*
4* Anyways, sound on the gameboy consists of 4 separate 'channels'
4* Anyways, sound on the Game Boy consists of 4 separate 'channels'
55*   Sound1 = Quadrangular waves with SWEEP and ENVELOPE functions  (NR10,11,12,13,14)
66*   Sound2 = Quadrangular waves with ENVELOPE functions (NR21,22,23,24)
77*   Sound3 = Wave patterns from WaveRAM (NR30,31,32,33,34)
src/mess/includes/gb.h
r2538r2539
6161MACHINE_RESET( gb );
6262MACHINE_RESET( gbpocket );
6363
64/* -- Super GameBoy specific -- */
64/* -- Super Game Boy specific -- */
6565#define SGB_BORDER_PAL_OFFSET   64   /* Border colours stored from pal 4-7   */
6666#define SGB_XOFFSET            48   /* GB screen starts at column 48        */
6767#define SGB_YOFFSET            40   /* GB screen starts at row 40           */
r2538r2539
7777extern MACHINE_RESET( sgb );
7878extern WRITE8_HANDLER ( sgb_io_w );
7979
80/* -- GameBoy Color specific -- */
80/* -- Game Boy Color specific -- */
8181#define GBC_MODE_GBC      1      /* GBC is in colour mode                */
8282#define GBC_MODE_MONO      2      /* GBC is in mono mode                  */
8383
src/mess/video/gb.c
r2538r2539
22
33  gb.c
44
5  Video file to handle emulation of the Nintendo GameBoy.
5  Video file to handle emulation of the Nintendo Game Boy.
66
77  Original code                               Carsten Sorensen   1998
88  Mess modifications, bug fixes and speedups  Hans de Goede      1998
r2538r2539
128128   0x84,0x80,0x4E,      /* Medium */
129129   0x4E,0x4E,0x4E,      /* Dark */
130130
131/* Palette for GameBoy Pocket/Light */
131/* Palette for Game Boy Pocket/Light */
132132   0xC4,0xCF,0xA1,      /* Background */
133133   0x8B,0x95,0x6D,      /* Light      */
134134   0x6B,0x73,0x53,      /* Medium     */
r2538r2539
459459   profiler_mark(PROFILER_END);
460460}
461461
462/* --- Super Gameboy Specific --- */
462/* --- Super Game Boy Specific --- */
463463
464464INLINE void sgb_update_sprites (void)
465465{
r2538r2539
792792   profiler_mark(PROFILER_END);
793793}
794794
795/* --- Gameboy Color Specific --- */
795/* --- Game Boy Color Specific --- */
796796
797797INLINE void cgb_update_sprites ( running_machine *machine ) {
798798   bitmap_t *bitmap = tmpbitmap;
r2538r2539
13671367         gb_lcd.oam_locked = UNLOCKED;
13681368         gb_lcd.vram_locked = UNLOCKED;
13691369         /*
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
13711371            SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later
13721372            than usual.
13731373            The SGB probably has the same bug.
r2538r2539
15981598         gb_lcd.oam_locked = UNLOCKED;
15991599         gb_lcd.vram_locked = UNLOCKED;
16001600         /*
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
16021602            SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later
16031603            than usual.
16041604            The SGB probably has the same bug.
src/mess/machine/gb.c
r2538r2539
22
33  gb.c
44
5  Machine file to handle emulation of the Nintendo GameBoy.
5  Machine file to handle emulation of the Nintendo Game Boy.
66
77  Changes:
88
r2538r2539
2626                   Added support for games with more than 128 ROM banks.
2727   12/6/2002      AK - Rewrote the way bg and sprite palettes are handled.
2828                   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.
3131
3232   17/5/2004       WP - Added Megaduck/Cougar Boy support.
3333   13/6/2005      WP - Added support for bootstrap rom banking.
r2538r2539
17391739      logerror("Cart Information\n");
17401740      logerror("\tName:             %s\n", S);
17411741      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" );
17431743      logerror("\tSuper GB:         %s [0x%2X]\n", (gb_header[0x0146] == 0x03) ? "Yes" : "No", gb_header[0x0146] );
17441744      logerror("\tColor GB:         %s [0x%2X]\n", (gb_header[0x0143] == 0x80 || gb_header[0x0143] == 0xc0) ? "Yes" : "No", gb_cart[0x0143] );
17451745      logerror("\tROM Size:         %d 16kB Banks [0x%2X]\n", ROMBanks, gb_header[0x0148]);
r2538r2539
19101910}
19111911
19121912/*
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
19141914
19151915 Different locations of the video registers:
1916 Register      GameBoy    MegaDuck
1916 Register      Game Boy   MegaDuck
19171917 LCDC          FF40       FF10  (See different bit order below)
19181918 STAT          FF41       FF11
19191919 SCY           FF42       FF12
r2538r2539
19331933
19341934 Different LCDC register
19351935
1936 GameBoy        MegaDuck
1936 Game Boy       MegaDuck
19371937 0                      6       - BG & Window Display : 0 - Off, 1 - On
19381938 1                      0       - OBJ Display: 0 - Off, 1 - On
19391939 2                      1       - OBJ Size: 0 - 8x8, 1 - 8x16
r2538r2539
19691969   gb_video_w(machine, offset, data );
19701970}
19711971
1972/* Map megaduck audio offset to gameboy audio offsets */
1972/* Map megaduck audio offset to game boy audio offsets */
19731973
19741974static const UINT8 megaduck_sound_offsets[16] = { 0, 2, 1, 3, 4, 6, 5, 7, 8, 9, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
19751975
src/mess/drivers/gb.c
r2538r2539
22
33  gb.c
44
5  Driver file to handle emulation of the Nintendo Gameboy.
5  Driver file to handle emulation of the Nintendo Game Boy.
66  By:
77
88  Hans de Goede               1998
r2538r2539
164164     etc
165165
166166
167Mappers used in the gameboy
167Mappers used in the Game Boy
168168===========================
169169
170170MBC1 Mapper
r2538r2539
444444
445445
446446/* Initial value of the cpu registers (hacks until we get bios dumps) */
447static const UINT16 sgb_cpu_regs[6] = { 0x01B0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 };    /* Super GameBoy                    */
448static const UINT16 mgb_cpu_regs[6] = { 0xFFB0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 };   /* GameBoy Pocket / Super GameBoy 2 */
449static const UINT16 cgb_cpu_regs[6] = { 0x11B0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 };   /* GameBoy Color  / Gameboy Advance */
447static const UINT16 sgb_cpu_regs[6] = { 0x01B0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 };    /* Super Game Boy                    */
448static const UINT16 mgb_cpu_regs[6] = { 0xFFB0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 };   /* Game Boy Pocket / Super Game Boy 2 */
449static const UINT16 cgb_cpu_regs[6] = { 0x11B0, 0x0013, 0x00D8, 0x014D, 0xFFFE, 0x0100 };   /* Game Boy Color  / Game Boy Advance */
450450static const UINT16 megaduck_cpu_regs[6] = { 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFE, 0x0000 };   /* Megaduck */
451451
452452static const Z80GB_CONFIG dmg_cpu_reset = { NULL, Z80GB_FEATURE_HALT_BUG, gb_timer_callback };
r2538r2539
756756ROM_END
757757
758758/*    YEAR  NAME      PARENT   COMPAT   MACHINE   INPUT    INIT  CONFIG   COMPANY     FULLNAME */
759CONS( 1990, gameboy,  0,       0,      gameboy,  gameboy, 0,    gameboy_gb, "Nintendo", "GameBoy"  , 0)
760CONS( 1994, supergb,  0,       gameboy,   supergb,  gameboy, 0,    gameboy, "Nintendo", "Super GameBoy" , 0)
761CONS( 1996, gbpocket, gameboy, 0,      gbpocket, gameboy, 0,    gameboy, "Nintendo", "GameBoy Pocket" , 0)
762CONS( 1998, gbcolor,  0,       gameboy,   gbcolor,  gameboy, 0,    gb_cgb, "Nintendo", "GameBoy Color" , 0)
759CONS( 1990, gameboy,  0,       0,      gameboy,  gameboy, 0,    gameboy_gb, "Nintendo", "Game Boy"  , 0)
760CONS( 1994, supergb,  0,       gameboy,   supergb,  gameboy, 0,    gameboy, "Nintendo", "Super Game Boy" , 0)
761CONS( 1996, gbpocket, gameboy, 0,      gbpocket, gameboy, 0,    gameboy, "Nintendo", "Game Boy Pocket" , 0)
762CONS( 1998, gbcolor,  0,       gameboy,   gbcolor,  gameboy, 0,    gb_cgb, "Nintendo", "Game Boy Color" , 0)
763763
764764/* Sound is not 100% yet, it generates some sounds which could be ok. Since we're lacking a real
765765   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 */
767767CONS( 1993, megaduck, 0,       0,       megaduck, gameboy, 0,    megaduck,"Creatronic/Videojet/Timlex/Cougar",  "MegaDuck/Cougar Boy" , 0)
768768

Previous 15994 Revisions Next


© 1998-2018 The MESS Team