mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2025-01-30 19:56:45 +01:00
commit
d291c543f0
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Binary file not shown.
Before Width: | Height: | Size: 3.8 MiB After Width: | Height: | Size: 3.8 MiB |
@ -514,7 +514,7 @@ void sms_cart_init(void)
|
|||||||
if (config.bios & 1)
|
if (config.bios & 1)
|
||||||
{
|
{
|
||||||
/* load BIOS file */
|
/* load BIOS file */
|
||||||
int bios_size = load_bios();
|
int bios_size = load_bios(system_hw);
|
||||||
|
|
||||||
if (bios_size > 0xC000)
|
if (bios_size > 0xC000)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* CD data controller (LC89510 compatible)
|
* CD data controller (LC89510 compatible)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -376,8 +376,8 @@ void cdc_reg_w(unsigned char data)
|
|||||||
/* start data transfer if data output is enabled */
|
/* start data transfer if data output is enabled */
|
||||||
if (cdc.ifctrl & BIT_DOUTEN)
|
if (cdc.ifctrl & BIT_DOUTEN)
|
||||||
{
|
{
|
||||||
/* set !DTBSY */
|
/* set !DTBSY and !DTEN */
|
||||||
cdc.ifstat &= ~BIT_DTBSY;
|
cdc.ifstat &= ~(BIT_DTBSY | BIT_DTEN);
|
||||||
|
|
||||||
/* clear DBCH bits 4-7 */
|
/* clear DBCH bits 4-7 */
|
||||||
cdc.dbc.byte.h &= 0x0f;
|
cdc.dbc.byte.h &= 0x0f;
|
||||||
@ -391,10 +391,7 @@ void cdc_reg_w(unsigned char data)
|
|||||||
case 2: /* MAIN-CPU host read */
|
case 2: /* MAIN-CPU host read */
|
||||||
case 3: /* SUB-CPU host read */
|
case 3: /* SUB-CPU host read */
|
||||||
{
|
{
|
||||||
/* set !DTEN */
|
/* set DSR bit (SCD register $04) */
|
||||||
cdc.ifstat &= ~BIT_DTEN;
|
|
||||||
|
|
||||||
/* set DSR bit (register $04) */
|
|
||||||
scd.regs[0x04>>1].byte.h |= 0x40;
|
scd.regs[0x04>>1].byte.h |= 0x40;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -645,7 +642,7 @@ unsigned char cdc_reg_r(void)
|
|||||||
unsigned short cdc_host_r(void)
|
unsigned short cdc_host_r(void)
|
||||||
{
|
{
|
||||||
/* check if data is available */
|
/* check if data is available */
|
||||||
if (!(cdc.ifstat & BIT_DTEN))
|
if (scd.regs[0x04>>1].byte.h & 0x40)
|
||||||
{
|
{
|
||||||
/* read data word from CDC RAM buffer */
|
/* read data word from CDC RAM buffer */
|
||||||
uint16 data = *(uint16 *)(cdc.ram + (cdc.dac.w & 0x3ffe));
|
uint16 data = *(uint16 *)(cdc.ram + (cdc.dac.w & 0x3ffe));
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* CD data controller (LC89510 compatible)
|
* CD data controller (LC89510 compatible)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
824
core/cd_hw/cdd.c
824
core/cd_hw/cdd.c
File diff suppressed because it is too large
Load Diff
@ -58,9 +58,6 @@
|
|||||||
#define CD_STOP 0x09
|
#define CD_STOP 0x09
|
||||||
#define CD_END 0x0C
|
#define CD_END 0x0C
|
||||||
|
|
||||||
/* CD blocks scanning speed */
|
|
||||||
#define CD_SCAN_SPEED 30
|
|
||||||
|
|
||||||
#define CD_MAX_TRACKS 100
|
#define CD_MAX_TRACKS 100
|
||||||
|
|
||||||
/* CD track */
|
/* CD track */
|
||||||
@ -73,6 +70,7 @@ typedef struct
|
|||||||
int offset;
|
int offset;
|
||||||
int start;
|
int start;
|
||||||
int end;
|
int end;
|
||||||
|
int type;
|
||||||
} track_t;
|
} track_t;
|
||||||
|
|
||||||
/* CD TOC */
|
/* CD TOC */
|
||||||
@ -81,6 +79,7 @@ typedef struct
|
|||||||
int end;
|
int end;
|
||||||
int last;
|
int last;
|
||||||
track_t tracks[CD_MAX_TRACKS];
|
track_t tracks[CD_MAX_TRACKS];
|
||||||
|
FILE *sub;
|
||||||
} toc_t;
|
} toc_t;
|
||||||
|
|
||||||
/* CDD hardware */
|
/* CDD hardware */
|
||||||
|
@ -475,8 +475,8 @@ static void s68k_poll_sync(unsigned int reg_mask)
|
|||||||
|
|
||||||
static unsigned int scd_read_byte(unsigned int address)
|
static unsigned int scd_read_byte(unsigned int address)
|
||||||
{
|
{
|
||||||
/* PCM area (8K) is mirrored into $FF0000-$FF7FFF */
|
/* PCM area (8K) mirrored into $xF0000-$xF7FFF */
|
||||||
if (address < 0xff8000)
|
if (!(address & 0x8000))
|
||||||
{
|
{
|
||||||
/* get /LDS only */
|
/* get /LDS only */
|
||||||
if (address & 1)
|
if (address & 1)
|
||||||
@ -491,36 +491,39 @@ static unsigned int scd_read_byte(unsigned int address)
|
|||||||
error("[%d][%d]read byte CD register %X (%X)\n", v_counter, s68k.cycles, address, s68k.pc);
|
error("[%d][%d]read byte CD register %X (%X)\n", v_counter, s68k.cycles, address, s68k.pc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* only A1-A8 are used for decoding */
|
||||||
|
address &= 0x1ff;
|
||||||
|
|
||||||
/* Memory Mode */
|
/* Memory Mode */
|
||||||
if (address == 0xff8003)
|
if (address == 0x03)
|
||||||
{
|
{
|
||||||
s68k_poll_detect(1<<0x03);
|
s68k_poll_detect(1<<0x03);
|
||||||
return scd.regs[0x03>>1].byte.l;
|
return scd.regs[0x03>>1].byte.l;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MAIN-CPU communication flags */
|
/* MAIN-CPU communication flags */
|
||||||
if (address == 0xff800e)
|
if (address == 0x0e)
|
||||||
{
|
{
|
||||||
s68k_poll_detect(1<<0x0e);
|
s68k_poll_detect(1<<0x0e);
|
||||||
return scd.regs[0x0e>>1].byte.h;
|
return scd.regs[0x0e>>1].byte.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CDC transfer status */
|
/* CDC transfer status */
|
||||||
if (address == 0xff8004)
|
if (address == 0x04)
|
||||||
{
|
{
|
||||||
s68k_poll_detect(1<<0x04);
|
s68k_poll_detect(1<<0x04);
|
||||||
return scd.regs[0x04>>1].byte.h;
|
return scd.regs[0x04>>1].byte.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GFX operation status */
|
/* GFX operation status */
|
||||||
if (address == 0xff8058)
|
if (address == 0x58)
|
||||||
{
|
{
|
||||||
s68k_poll_detect(1<<0x08);
|
s68k_poll_detect(1<<0x08);
|
||||||
return scd.regs[0x58>>1].byte.h;
|
return scd.regs[0x58>>1].byte.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CDC register data (controlled by BIOS, byte access only ?) */
|
/* CDC register data (controlled by BIOS, byte access only ?) */
|
||||||
if (address == 0xff8007)
|
if (address == 0x07)
|
||||||
{
|
{
|
||||||
unsigned int data = cdc_reg_r();
|
unsigned int data = cdc_reg_r();
|
||||||
#ifdef LOG_CDC
|
#ifdef LOG_CDC
|
||||||
@ -530,21 +533,21 @@ static unsigned int scd_read_byte(unsigned int address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* LED status */
|
/* LED status */
|
||||||
if (address == 0xff8000)
|
if (address == 0x00)
|
||||||
{
|
{
|
||||||
/* register $00 is reserved for MAIN-CPU, we use $06 instead */
|
/* register $00 is reserved for MAIN-CPU, we use $06 instead */
|
||||||
return scd.regs[0x06>>1].byte.h;
|
return scd.regs[0x06>>1].byte.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RESET status */
|
/* RESET status */
|
||||||
if (address == 0xff8001)
|
if (address == 0x01)
|
||||||
{
|
{
|
||||||
/* always return 1 */
|
/* always return 1 */
|
||||||
return 0x01;
|
return 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Font data */
|
/* Font data */
|
||||||
if ((address >= 0xff8050) && (address <= 0xff8056))
|
if ((address >= 0x50) && (address <= 0x56))
|
||||||
{
|
{
|
||||||
/* shifted 4-bit input (xxxx00) */
|
/* shifted 4-bit input (xxxx00) */
|
||||||
uint8 bits = (scd.regs[0x4e>>1].w >> (((address & 6) ^ 6) << 1)) << 2;
|
uint8 bits = (scd.regs[0x4e>>1].w >> (((address & 6) ^ 6) << 1)) << 2;
|
||||||
@ -573,21 +576,28 @@ static unsigned int scd_read_byte(unsigned int address)
|
|||||||
s68k_poll_detect(1 << (address & 0x1f));
|
s68k_poll_detect(1 << (address & 0x1f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Subcode buffer */
|
||||||
|
else if (address & 0x100)
|
||||||
|
{
|
||||||
|
/* 64 x 16-bit mirrored */
|
||||||
|
address &= 0x17f;
|
||||||
|
}
|
||||||
|
|
||||||
/* default registers */
|
/* default registers */
|
||||||
if (address & 1)
|
if (address & 1)
|
||||||
{
|
{
|
||||||
/* register LSB */
|
/* register LSB */
|
||||||
return scd.regs[(address >> 1) & 0xff].byte.l;
|
return scd.regs[address >> 1].byte.l;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* register MSB */
|
/* register MSB */
|
||||||
return scd.regs[(address >> 1) & 0xff].byte.h;
|
return scd.regs[address >> 1].byte.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int scd_read_word(unsigned int address)
|
static unsigned int scd_read_word(unsigned int address)
|
||||||
{
|
{
|
||||||
/* PCM area (8K) is mirrored into $FF0000-$FF7FFF */
|
/* PCM area (8K) mirrored into $xF0000-$xF7FFF */
|
||||||
if (address < 0xff8000)
|
if (!(address & 0x8000))
|
||||||
{
|
{
|
||||||
/* get /LDS only */
|
/* get /LDS only */
|
||||||
return pcm_read((address >> 1) & 0x1fff);
|
return pcm_read((address >> 1) & 0x1fff);
|
||||||
@ -597,35 +607,38 @@ static unsigned int scd_read_word(unsigned int address)
|
|||||||
error("[%d][%d]read word CD register %X (%X)\n", v_counter, s68k.cycles, address, s68k.pc);
|
error("[%d][%d]read word CD register %X (%X)\n", v_counter, s68k.cycles, address, s68k.pc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* only A1-A8 are used for decoding */
|
||||||
|
address &= 0x1ff;
|
||||||
|
|
||||||
/* Memory Mode */
|
/* Memory Mode */
|
||||||
if (address == 0xff8002)
|
if (address == 0x02)
|
||||||
{
|
{
|
||||||
s68k_poll_detect(1<<0x03);
|
s68k_poll_detect(1<<0x03);
|
||||||
return scd.regs[0x03>>1].w;
|
return scd.regs[0x03>>1].w;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CDC host data (word access only ?) */
|
/* CDC host data (word access only ?) */
|
||||||
if (address == 0xff8008)
|
if (address == 0x08)
|
||||||
{
|
{
|
||||||
return cdc_host_r();
|
return cdc_host_r();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LED & RESET status */
|
/* LED & RESET status */
|
||||||
if (address == 0xff8000)
|
if (address == 0x00)
|
||||||
{
|
{
|
||||||
/* register $00 is reserved for MAIN-CPU, we use $06 instead */
|
/* register $00 is reserved for MAIN-CPU, we use $06 instead */
|
||||||
return scd.regs[0x06>>1].w;
|
return scd.regs[0x06>>1].w;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stopwatch counter (word access only ?) */
|
/* Stopwatch counter (word access only ?) */
|
||||||
if (address == 0xff800c)
|
if (address == 0x0c)
|
||||||
{
|
{
|
||||||
/* cycle-accurate counter value */
|
/* cycle-accurate counter value */
|
||||||
return (scd.regs[0x0c>>1].w + ((s68k.cycles - scd.stopwatch) / TIMERS_SCYCLES_RATIO)) & 0xfff;
|
return (scd.regs[0x0c>>1].w + ((s68k.cycles - scd.stopwatch) / TIMERS_SCYCLES_RATIO)) & 0xfff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Font data */
|
/* Font data */
|
||||||
if ((address >= 0xff8050) && (address <= 0xff8056))
|
if ((address >= 0x50) && (address <= 0x56))
|
||||||
{
|
{
|
||||||
/* shifted 4-bit input (xxxx00) */
|
/* shifted 4-bit input (xxxx00) */
|
||||||
uint8 bits = (scd.regs[0x4e>>1].w >> (((address & 6) ^ 6) << 1)) << 2;
|
uint8 bits = (scd.regs[0x4e>>1].w >> (((address & 6) ^ 6) << 1)) << 2;
|
||||||
@ -663,8 +676,15 @@ static unsigned int scd_read_word(unsigned int address)
|
|||||||
s68k_poll_detect(3 << (address & 0x1e));
|
s68k_poll_detect(3 << (address & 0x1e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Subcode buffer */
|
||||||
|
else if (address & 0x100)
|
||||||
|
{
|
||||||
|
/* 64 x 16-bit mirrored */
|
||||||
|
address &= 0x17f;
|
||||||
|
}
|
||||||
|
|
||||||
/* default registers */
|
/* default registers */
|
||||||
return scd.regs[(address >> 1) & 0xff].w;
|
return scd.regs[address >> 1].w;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void word_ram_switch(uint8 mode)
|
INLINE void word_ram_switch(uint8 mode)
|
||||||
@ -731,8 +751,8 @@ INLINE void word_ram_switch(uint8 mode)
|
|||||||
|
|
||||||
static void scd_write_byte(unsigned int address, unsigned int data)
|
static void scd_write_byte(unsigned int address, unsigned int data)
|
||||||
{
|
{
|
||||||
/* PCM area (8K) is mirrored into $FF0000-$FF7FFF */
|
/* PCM area (8K) mirrored into $xF0000-$xF7FFF */
|
||||||
if (address < 0xff8000)
|
if (!(address & 0x8000))
|
||||||
{
|
{
|
||||||
/* get /LDS only */
|
/* get /LDS only */
|
||||||
if (address & 1)
|
if (address & 1)
|
||||||
@ -1012,8 +1032,8 @@ static void scd_write_byte(unsigned int address, unsigned int data)
|
|||||||
|
|
||||||
static void scd_write_word(unsigned int address, unsigned int data)
|
static void scd_write_word(unsigned int address, unsigned int data)
|
||||||
{
|
{
|
||||||
/* PCM area (8K) is mirrored into $FF0000-$FF7FFF */
|
/* PCM area (8K) mirrored into $xF0000-$xF7FFF */
|
||||||
if (address < 0xff8000)
|
if (!(address & 0x8000))
|
||||||
{
|
{
|
||||||
/* get /LDS only */
|
/* get /LDS only */
|
||||||
pcm_write((address >> 1) & 0x1fff, data);
|
pcm_write((address >> 1) & 0x1fff, data);
|
||||||
|
145
core/loadrom.c
145
core/loadrom.c
@ -2,7 +2,7 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* ROM Loading Support
|
* ROM Loading Support
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
@ -389,11 +389,11 @@ void getrominfo(char *romheader)
|
|||||||
* Return loaded size (-1 if already loaded)
|
* Return loaded size (-1 if already loaded)
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int load_bios(void)
|
int load_bios(int system)
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
switch (system_hw)
|
switch (system)
|
||||||
{
|
{
|
||||||
case SYSTEM_MCD:
|
case SYSTEM_MCD:
|
||||||
{
|
{
|
||||||
@ -532,10 +532,11 @@ int load_rom(char *filename)
|
|||||||
int i, size;
|
int i, size;
|
||||||
|
|
||||||
#ifdef USE_DYNAMIC_ALLOC
|
#ifdef USE_DYNAMIC_ALLOC
|
||||||
/* allocate memory for Cartridge /CD hardware buffer if required */
|
if (!ext)
|
||||||
if (ext == NULL)
|
|
||||||
{
|
{
|
||||||
|
/* allocate memory for Cartridge / CD hardware if required */
|
||||||
ext = (external_t *)malloc(sizeof(external_t));
|
ext = (external_t *)malloc(sizeof(external_t));
|
||||||
|
if (!ext) return (0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -550,30 +551,28 @@ int load_rom(char *filename)
|
|||||||
cdd.loaded = 0;
|
cdd.loaded = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* auto-detect CD image files */
|
/* auto-detect CD image file */
|
||||||
size = cdd_load(filename, (char *)(cart.rom));
|
size = cdd_load(filename, (char *)(cart.rom));
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
{
|
{
|
||||||
/* error opening file */
|
/* error opening file */
|
||||||
return 0;
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size > 0)
|
/* CD image file ? */
|
||||||
|
if (size)
|
||||||
{
|
{
|
||||||
/* CD image file loaded */
|
/* enable CD hardware */
|
||||||
system_hw = SYSTEM_MCD;
|
system_hw = SYSTEM_MCD;
|
||||||
|
|
||||||
|
/* boot from CD hardware */
|
||||||
|
scd.cartridge.boot = 0x00;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* load file into ROM buffer */
|
/* load file into ROM buffer */
|
||||||
char extension[4];
|
char extension[4];
|
||||||
size = load_archive(filename, cart.rom, sizeof(cart.rom), extension);
|
size = load_archive(filename, cart.rom, cdd.loaded ? 0x800000 : MAXROMSIZE, extension);
|
||||||
if (!size)
|
|
||||||
{
|
|
||||||
/* mark all BOOTROM as unloaded since they could have been overwritten */
|
|
||||||
system_bios &= ~(0x10 | SYSTEM_SMS | SYSTEM_GG);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* mark BOOTROM as unloaded if they have been overwritten by cartridge ROM */
|
/* mark BOOTROM as unloaded if they have been overwritten by cartridge ROM */
|
||||||
if (size > 0x800000)
|
if (size > 0x800000)
|
||||||
@ -586,8 +585,16 @@ int load_rom(char *filename)
|
|||||||
/* Master System or Game Gear BIOS ROM are loaded within $400000-$4FFFFF area */
|
/* Master System or Game Gear BIOS ROM are loaded within $400000-$4FFFFF area */
|
||||||
system_bios &= ~(SYSTEM_SMS | SYSTEM_GG);
|
system_bios &= ~(SYSTEM_SMS | SYSTEM_GG);
|
||||||
}
|
}
|
||||||
|
else if (size <= 0)
|
||||||
|
{
|
||||||
|
/* mark all BOOTROM as unloaded since they could have been overwritten */
|
||||||
|
system_bios &= ~(0x10 | SYSTEM_SMS | SYSTEM_GG);
|
||||||
|
|
||||||
/* convert lower case to upper case */
|
/* error loading file */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* convert lower case file extension to upper case */
|
||||||
*(uint32 *)(extension) &= 0xdfdfdfdf;
|
*(uint32 *)(extension) &= 0xdfdfdfdf;
|
||||||
|
|
||||||
/* auto-detect system hardware from ROM file extension */
|
/* auto-detect system hardware from ROM file extension */
|
||||||
@ -608,7 +615,7 @@ int load_rom(char *filename)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Mega Drive hardware (Genesis mode) */
|
/* default is Mega Drive / Genesis hardware (16-bit mode) */
|
||||||
system_hw = SYSTEM_MD;
|
system_hw = SYSTEM_MD;
|
||||||
|
|
||||||
/* decode .MDX format */
|
/* decode .MDX format */
|
||||||
@ -641,7 +648,7 @@ int load_rom(char *filename)
|
|||||||
size -= 512;
|
size -= 512;
|
||||||
memcpy (cart.rom, cart.rom + 512, size);
|
memcpy (cart.rom, cart.rom + 512, size);
|
||||||
|
|
||||||
/* assume interleaved Genesis ROM format (.smd) */
|
/* assume interleaved Mega Drive / Genesis ROM format (.smd) */
|
||||||
if (system_hw == SYSTEM_MD)
|
if (system_hw == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
for (i = 0; i < (size / 0x4000); i++)
|
for (i = 0; i < (size / 0x4000); i++)
|
||||||
@ -661,26 +668,9 @@ int load_rom(char *filename)
|
|||||||
/* set console region */
|
/* set console region */
|
||||||
get_region((char *)(cart.rom));
|
get_region((char *)(cart.rom));
|
||||||
|
|
||||||
/* CD image file */
|
|
||||||
if (system_hw == SYSTEM_MCD)
|
|
||||||
{
|
|
||||||
/* load CD BOOT ROM */
|
|
||||||
if (!load_bios())
|
|
||||||
{
|
|
||||||
/* unmount CD image */
|
|
||||||
cdd_unload();
|
|
||||||
|
|
||||||
/* error loading CD BOOT ROM */
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* boot from CD */
|
|
||||||
scd.cartridge.boot = 0x00;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef LSB_FIRST
|
#ifdef LSB_FIRST
|
||||||
/* 16-bit ROM specific */
|
/* 16-bit ROM specific */
|
||||||
else if (system_hw == SYSTEM_MD)
|
if (system_hw == SYSTEM_MD)
|
||||||
{
|
{
|
||||||
/* Byteswap ROM to optimize 16-bit access */
|
/* Byteswap ROM to optimize 16-bit access */
|
||||||
for (i = 0; i < cart.romsize; i += 2)
|
for (i = 0; i < cart.romsize; i += 2)
|
||||||
@ -702,13 +692,27 @@ int load_rom(char *filename)
|
|||||||
/* Save auto-detected system hardware */
|
/* Save auto-detected system hardware */
|
||||||
romtype = system_hw;
|
romtype = system_hw;
|
||||||
|
|
||||||
|
/* CD image file */
|
||||||
|
if (system_hw == SYSTEM_MCD)
|
||||||
|
{
|
||||||
|
/* try to load CD BOOTROM for selected region */
|
||||||
|
if (!load_bios(SYSTEM_MCD))
|
||||||
|
{
|
||||||
|
/* unmount CD image */
|
||||||
|
cdd_unload();
|
||||||
|
|
||||||
|
/* error booting from CD */
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* CD BOOTROM */
|
/* CD BOOTROM */
|
||||||
if (strstr(rominfo.ROMType, "BR") != NULL)
|
else if (strstr(rominfo.ROMType, "BR") != NULL)
|
||||||
{
|
{
|
||||||
/* enable CD hardware */
|
/* enable CD hardware */
|
||||||
system_hw = SYSTEM_MCD;
|
system_hw = SYSTEM_MCD;
|
||||||
|
|
||||||
/* boot from CD */
|
/* boot from CD hardware */
|
||||||
scd.cartridge.boot = 0x00;
|
scd.cartridge.boot = 0x00;
|
||||||
|
|
||||||
/* copy ROM to BOOTROM area */
|
/* copy ROM to BOOTROM area */
|
||||||
@ -721,7 +725,26 @@ int load_rom(char *filename)
|
|||||||
system_bios = (system_bios & 0xf0) | (region_code >> 4);
|
system_bios = (system_bios & 0xf0) | (region_code >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ROM cartridges with CD support */
|
/* ROM cartridge with CD loaded */
|
||||||
|
else if (cdd.loaded)
|
||||||
|
{
|
||||||
|
/* try to load CD BOOTROM */
|
||||||
|
if (load_bios(SYSTEM_MCD))
|
||||||
|
{
|
||||||
|
/* enable CD hardware */
|
||||||
|
system_hw = SYSTEM_MCD;
|
||||||
|
|
||||||
|
/* boot from cartridge */
|
||||||
|
scd.cartridge.boot = 0x40;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* unmount CD image */
|
||||||
|
cdd_unload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ROM cartridge with CD support */
|
||||||
else if ((strstr(rominfo.domestic,"FLUX") != NULL) ||
|
else if ((strstr(rominfo.domestic,"FLUX") != NULL) ||
|
||||||
(strstr(rominfo.domestic,"WONDER LIBRARY") != NULL) ||
|
(strstr(rominfo.domestic,"WONDER LIBRARY") != NULL) ||
|
||||||
(strstr(rominfo.product,"T-5740") != NULL))
|
(strstr(rominfo.product,"T-5740") != NULL))
|
||||||
@ -729,33 +752,23 @@ int load_rom(char *filename)
|
|||||||
/* check if console hardware is set to AUTO */
|
/* check if console hardware is set to AUTO */
|
||||||
if (!config.system)
|
if (!config.system)
|
||||||
{
|
{
|
||||||
/* auto-enable CD hardware */
|
|
||||||
system_hw = SYSTEM_MCD;
|
|
||||||
|
|
||||||
/* try to load CD BOOTROM */
|
/* try to load CD BOOTROM */
|
||||||
if (load_bios())
|
if (load_bios(SYSTEM_MCD))
|
||||||
{
|
{
|
||||||
char fname[256];
|
char fname[256];
|
||||||
int len = strlen(filename);
|
int len = strlen(filename);
|
||||||
|
|
||||||
|
/* automatically try to load associated .iso file */
|
||||||
|
while ((len && (filename[len] != '.')) || (len > 251)) len--;
|
||||||
|
strncpy(fname, filename, len);
|
||||||
|
strcpy(&fname[len], ".iso");
|
||||||
|
cdd_load(fname, (char *)cdc.ram);
|
||||||
|
|
||||||
|
/* enable CD hardware */
|
||||||
|
system_hw = SYSTEM_MCD;
|
||||||
|
|
||||||
/* boot from cartridge */
|
/* boot from cartridge */
|
||||||
scd.cartridge.boot = 0x40;
|
scd.cartridge.boot = 0x40;
|
||||||
|
|
||||||
/* change ROM filename extension to .iso */
|
|
||||||
while (len && (filename[len-1] != '.')) len--;
|
|
||||||
if (len < 253)
|
|
||||||
{
|
|
||||||
strncpy(fname, filename, len);
|
|
||||||
strcpy(&fname[len], "iso");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* automatically load associated .iso image */
|
|
||||||
cdd_load(fname, (char *)cdc.ram);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* if not found, disable CD hardware */
|
|
||||||
system_hw = SYSTEM_MD;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -980,19 +993,19 @@ void get_region(char *romheader)
|
|||||||
if (system_hw == SYSTEM_MCD)
|
if (system_hw == SYSTEM_MCD)
|
||||||
{
|
{
|
||||||
/* security code */
|
/* security code */
|
||||||
switch (romheader[0x20b])
|
switch ((unsigned char)romheader[0x20b])
|
||||||
{
|
{
|
||||||
case 0x7a:
|
|
||||||
region_code = REGION_USA;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x64:
|
case 0x64:
|
||||||
region_code = REGION_EUROPE;
|
region_code = REGION_EUROPE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case 0xa1:
|
||||||
region_code = REGION_JAPAN_NTSC;
|
region_code = REGION_JAPAN_NTSC;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
region_code = REGION_USA;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* ROM Loading Support
|
* ROM Loading Support
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
@ -64,7 +64,7 @@ extern ROMINFO rominfo;
|
|||||||
extern uint8 romtype;
|
extern uint8 romtype;
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
extern int load_bios(void);
|
extern int load_bios(int system);
|
||||||
extern int load_rom(char *filename);
|
extern int load_rom(char *filename);
|
||||||
extern void get_region(char *romheader);
|
extern void get_region(char *romheader);
|
||||||
extern char *get_company(void);
|
extern char *get_company(void);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX configuration file support
|
* Genesis Plus GX configuration file support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2014)
|
* Copyright Eke-Eke (2007-2015)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -259,7 +259,10 @@ void config_default(void)
|
|||||||
/* try to restore user config */
|
/* try to restore user config */
|
||||||
int loaded = config_load();
|
int loaded = config_load();
|
||||||
|
|
||||||
#ifndef HW_RVL
|
#ifdef HW_RVL
|
||||||
|
/* initialize WPAD timeout */
|
||||||
|
WPAD_SetIdleTimeout(config.autosleep ? 300 : 1800);
|
||||||
|
#else
|
||||||
/* check if component cable was detected */
|
/* check if component cable was detected */
|
||||||
if (VIDEO_HaveComponentCable())
|
if (VIDEO_HaveComponentCable())
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX configuration file support
|
* Genesis Plus GX configuration file support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2014)
|
* Copyright Eke-Eke (2007-2015)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
@ -1128,7 +1128,6 @@ void gx_input_Init(void)
|
|||||||
PAD_Init();
|
PAD_Init();
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
WPAD_Init();
|
WPAD_Init();
|
||||||
WPAD_SetIdleTimeout(config.autosleep ? 300 : 1800);
|
|
||||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||||
WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
|
WPAD_SetVRes(WPAD_CHAN_ALL,640,480);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user