Document some revision differences

This commit is contained in:
Lior Halphon 2018-07-14 21:52:54 +03:00
parent 0145b790a3
commit 2e9e3424ec
4 changed files with 43 additions and 14 deletions

View File

@ -381,7 +381,10 @@ void GB_apu_run(GB_gameboy_t *gb)
if (gb->model == GB_MODEL_CGB_C) { if (gb->model == GB_MODEL_CGB_C) {
/* Todo: This was confirmed to happen on a CGB-C. This may or may not happen on pre-CGB models. /* Todo: This was confirmed to happen on a CGB-C. This may or may not happen on pre-CGB models.
Because this degrades audio quality, and testing this on a pre-CGB device requires audio records, Because this degrades audio quality, and testing this on a pre-CGB device requires audio records,
I'll assume these devices are innocent until proven guilty. */ I'll assume these devices are innocent until proven guilty.
Also happens on CGB-B, but not on CGB-D.
*/
gb->apu.current_lfsr_sample &= gb->apu.previous_lfsr_sample; gb->apu.current_lfsr_sample &= gb->apu.previous_lfsr_sample;
} }
gb->apu.previous_lfsr_sample = gb->apu.noise_channel.lfsr & 1; gb->apu.previous_lfsr_sample = gb->apu.noise_channel.lfsr & 1;

View File

@ -447,7 +447,7 @@ static void reset_ram(GB_gameboy_t *gb)
{ {
switch (gb->model) { switch (gb->model) {
case GB_MODEL_CGB_E: case GB_MODEL_CGB_E:
default: case GB_MODEL_AGB: /* Unverified */
for (unsigned i = 0; i < gb->ram_size; i++) { for (unsigned i = 0; i < gb->ram_size; i++) {
gb->ram[i] = (random() & 0xFF); gb->ram[i] = (random() & 0xFF);
} }

View File

@ -22,24 +22,22 @@
#define GB_STRUCT_VERSION 13 #define GB_STRUCT_VERSION 13
typedef enum {
#ifdef GB_INTERNAL #ifdef GB_INTERNAL
GB_MODEL_FAMILY_MASK = 0xF00, #define GB_MODEL_FAMILY_MASK 0xF00
GB_MODEL_DMG_FAMILY = 0x000, #define GB_MODEL_DMG_FAMILY 0x000
#define GB_MODEL_MGB_FAMILY 0x100
#define GB_MODEL_CGB_FAMILY 0x200
#endif #endif
typedef enum {
// GB_MODEL_DMG_0 = 0x000, // GB_MODEL_DMG_0 = 0x000,
// GB_MODEL_DMG_A = 0x001, // GB_MODEL_DMG_A = 0x001,
GB_MODEL_DMG_B = 0x002, GB_MODEL_DMG_B = 0x002,
// GB_MODEL_DMG_C = 0x003, // GB_MODEL_DMG_C = 0x003,
// GB_MODEL_SGB = 0x004, // GB_MODEL_SGB = 0x004,
#ifdef GB_INTERNAL
GB_MODEL_MGB_FAMILY = 0x100,
#endif
// GB_MODEL_MGB = 0x100, // GB_MODEL_MGB = 0x100,
// GB_MODEL_SGB2 = 0x101, // GB_MODEL_SGB2 = 0x101,
#ifdef GB_INTERNAL
GB_MODEL_CGB_FAMILY = 0x200,
#endif
// GB_MODEL_CGB_0 = 0x200, // GB_MODEL_CGB_0 = 0x200,
// GB_MODEL_CGB_A = 0x201, // GB_MODEL_CGB_A = 0x201,
// GB_MODEL_CGB_B = 0x202, // GB_MODEL_CGB_B = 0x202,

View File

@ -253,11 +253,24 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr)
case GB_MODEL_AGB: case GB_MODEL_AGB:
return (addr & 0xF0) | ((addr >> 4) & 0xF); return (addr & 0xF0) | ((addr >> 4) & 0xF);
/*
case GB_MODEL_CGB_D:
if (addr > 0xfec0) {
addr |= 0xf0;
}
return gb->extra_oam[addr - 0xfea0];
*/
case GB_MODEL_CGB_C: case GB_MODEL_CGB_C:
/*
case GB_MODEL_CGB_B:
case GB_MODEL_CGB_A:
case GB_MODEL_CGB_0:
*/
addr &= ~0x18; addr &= ~0x18;
return gb->extra_oam[addr - 0xfea0]; return gb->extra_oam[addr - 0xfea0];
default: case GB_MODEL_DMG_B:
; ;
} }
} }
@ -544,11 +557,26 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
gb->oam[addr & 0xFF] = value; gb->oam[addr & 0xFF] = value;
} }
switch (gb->model) { switch (gb->model) {
/*
case GB_MODEL_CGB_D:
if (addr > 0xfec0) {
addr |= 0xf0;
}
gb->extra_oam[addr - 0xfea0] = value;
break;
*/
case GB_MODEL_CGB_C: case GB_MODEL_CGB_C:
/*
case GB_MODEL_CGB_B:
case GB_MODEL_CGB_A:
case GB_MODEL_CGB_0:
*/
addr &= ~0x18; addr &= ~0x18;
gb->extra_oam[addr - 0xfea0] = value; gb->extra_oam[addr - 0xfea0] = value;
break; break;
default: case GB_MODEL_DMG_B:
case GB_MODEL_CGB_E:
case GB_MODEL_AGB:
break; break;
} }
return; return;