This commit is contained in:
twinaphex 2015-08-27 07:17:21 +02:00
commit 29ee7e1244
10 changed files with 124 additions and 112 deletions

View File

@ -20,10 +20,11 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
* improved savestate format
* improved Sub-CPU synchronization with Main-CPU (fixes "Soul Star")
* improved Main-CPU & Sub-CPU idle loop detection (fixes "Super League CD")
* disabled 68k and Z80 access to PRG-RAM when SUB-CPU is running (fixes USA version of Dungeon Explorer )
* disabled 68k and Z80 access to PRG-RAM when SUB-CPU is running (fixes "Dungeon Explorer")
* disabled CD hardware reset on Soft-Reset (verified on real hardware)
* fixed DATA track minimal length (fixes BIOS refusing to boot small homebrew demos)
* fixed CDD "no disc" status code (fixes boot sequence loading time when no disc is loaded)
* fixed AUDIO tracks length calculation when using separated files (WAV/OGG/BIN) with INDEX pause defined in CUE file
* fixed OGG file seeking when using with CUE file
* fixed PRG-RAM access from MAIN-CPU side on system reset
* fixed state loading bug when SUB-CPU interrupt is pending
@ -76,7 +77,8 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
* added Sega Graphic Board support (thanks to SMS Power)
* added Master Tap emulation (multi-player support in Boom homebrew)
* added gamepad type auto-detection
* added support for XE-1AP analog controller on both ports
* added support for XE-1AP controller on both ports
* improved XE-1AP controller emulation
* improved HVC latch behavior for gun emulation (fixes "Gunfight - 3 in 1" randomization when using Justifier)
* fixed TeamPlayer emulation (fixes multitap detection in Gauntlet 4)

View File

@ -180,6 +180,7 @@ static const md_entry_t rom_database[] =
/* Thunderbolt II (uses 16-bits reads) */
{0x0000,0x1585,0x40,0x40,{{0x55,0x0f,0xaa,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r_16,NULL}},
/* Chaoji Puke - Super Poker (correct ROM dump, original release is an overdump) */
{0xffff,0xd7b0,0x40,0x40,{{0x55,0x0f,0xaa,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}},
/* Super Bubble Bobble */
@ -569,18 +570,18 @@ void md_cart_init(void)
if (strstr(rominfo.consoletype,"SEGA SSF"))
{
/* Everdrive extended SSF mapper */
cart.hw.bankshift = 1;
/* specific !TIME handler */
cart.hw.time_w = mapper_512k_w;
/* cartridge ROM mapping is reinitialized on /VRES */
cart.hw.bankshift = 1;
}
else if (strstr(rominfo.domestic,"SUPER STREET FIGHTER2"))
{
/* SSF2 mapper */
cart.hw.bankshift = 1;
/* specific !TIME handler */
cart.hw.time_w = mapper_ssf2_w;
/* cartridge ROM mapping is reinitialized on /VRES */
cart.hw.bankshift = 1;
}
else if (strstr(rominfo.product,"T-5740"))
{
@ -605,6 +606,18 @@ void md_cart_init(void)
/* no !TIME handler */
cart.hw.time_w = m68k_unused_8_w;
/* cartridge ROM is mapped to $3C0000-$3FFFFF on reset */
for (i=0x3c; i<0x40; i++)
{
m68k.memory_map[i].base = cart.rom + (i << 16);
m68k.memory_map[i].read8 = NULL;
m68k.memory_map[i].read16 = NULL;
m68k.memory_map[i].write8 = m68k_unused_8_w;
m68k.memory_map[i].write16 = m68k_unused_16_w;
zbank_memory_map[i].read = NULL;
zbank_memory_map[i].write = m68k_unused_8_w;
}
}
else if (strstr(rominfo.ROMType,"SF") && strstr(rominfo.product,"002"))
{
@ -627,13 +640,13 @@ void md_cart_init(void)
cart.hw.time_r = mapper_sf004_r;
cart.hw.time_w = m68k_unused_8_w;
/* first 256K ROM bank is initially mirrored into $000000-$1FFFFF */
/* first 256K ROM bank is mirrored into $000000-$1FFFFF on reset */
for (i=0x00; i<0x20; i++)
{
m68k.memory_map[i].base = cart.rom + ((i & 0x03) << 16);
}
/* 32K static RAM is mapped to $200000-$2FFFFF (disabled on startup) */
/* 32K static RAM mapped to $200000-$2FFFFF is disabled on reset */
for (i=0x20; i<0x30; i++)
{
m68k.memory_map[i].base = sram.sram;
@ -929,7 +942,6 @@ static void mapper_512k_w(uint32 address, uint32 data)
/* 512K ROM paging */
uint8 *src = cart.rom + (data << 19);
/* cartridge area ($000000-$3FFFFF) is divided into 8 x 512K banks */
address = (address << 2) & 0x38;

View File

@ -582,8 +582,8 @@ int cdd_load(char *filename, char *header)
}
else
{
/* current track start time (based on previous track end time + current file absolute time + PREGAP length) */
cdd.toc.tracks[cdd.toc.last].start = cdd.toc.end + bb + ss*75 + mm*60*75 + pregap;
/* current file start time (based on previous track end time + PREGAP length) */
cdd.toc.tracks[cdd.toc.last].start = cdd.toc.end + pregap;
/* adjust current track file read offset with previous track end time (only used for AUDIO track) */
cdd.toc.tracks[cdd.toc.last].offset += cdd.toc.end * 2352;
@ -630,6 +630,9 @@ int cdd_load(char *filename, char *header)
fseek(cdd.toc.tracks[cdd.toc.last].fd, 0, SEEK_SET);
}
/* adjust track start time (based on current file start time + index absolute time) */
cdd.toc.tracks[cdd.toc.last].start += (bb + ss*75 + mm*60*75);
/* update TOC end */
cdd.toc.end = cdd.toc.tracks[cdd.toc.last].end;
}
@ -1218,7 +1221,7 @@ void cdd_update(void)
#ifdef LOG_CDD
error("LBA = %d (track n°%d)(latency=%d)\n", cdd.lba, cdd.index, cdd.latency);
#endif
/* seeking disc */
if (cdd.status == CD_SEEK)
{
@ -1230,7 +1233,7 @@ void cdd_update(void)
}
/* drive is ready */
cdd.status = CD_READY;
cdd.status = CD_PAUSE;
}
/* reading disc */
@ -1460,12 +1463,12 @@ void cdd_process(void)
/* no audio track playing */
scd.regs[0x36>>1].byte.h = 0x01;
/* RS1-RS8 ignored, expects 0x0 (?) in RS0 once */
scd.regs[0x38>>1].w = 0x0000;
/* RS1-RS8 ignored, expects 0x0 (drive busy ?) in RS0 once */
scd.regs[0x38>>1].w = CD_BUSY << 8;
scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].w = 0x000f;
scd.regs[0x40>>1].w = ~CD_BUSY & 0x0f;
return;
}
@ -1765,7 +1768,7 @@ void cdd_process(void)
scd.regs[0x36>>1].byte.h = 0x01;
/* update status (RS1-RS8 unchanged) */
cdd.status = scd.regs[0x38>>1].byte.h = CD_READY;
cdd.status = scd.regs[0x38>>1].byte.h = CD_PAUSE;
break;
}
@ -1808,7 +1811,7 @@ void cdd_process(void)
scd.regs[0x36>>1].byte.h = 0x01;
/* update status (RS1-RS8 unchanged) */
cdd.status = scd.regs[0x38>>1].byte.h = CD_READY;
cdd.status = scd.regs[0x38>>1].byte.h = CD_PAUSE;
break;
}
@ -1820,12 +1823,12 @@ void cdd_process(void)
/* update status */
cdd.status = cdd.loaded ? CD_STOP : NO_DISC;
/* RS1-RS8 ignored, expects 0x0 (?) in RS0 once */
scd.regs[0x38>>1].w = 0x0000;
/* RS1-RS8 ignored, expects 0x0 (drive busy ?) in RS0 once */
scd.regs[0x38>>1].w = CD_BUSY << 8;
scd.regs[0x3a>>1].w = 0x0000;
scd.regs[0x3c>>1].w = 0x0000;
scd.regs[0x3e>>1].w = 0x0000;
scd.regs[0x40>>1].w = 0x000f;
scd.regs[0x40>>1].w = ~CD_BUSY & 0x0f;
#ifdef CD_TRAY_CALLBACK
CD_TRAY_CALLBACK

View File

@ -49,10 +49,11 @@
#define cdd scd.cdd_hw
/* CDD status */
#define CD_BUSY 0x00
#define CD_PLAY 0x01
#define CD_SEEK 0x02
#define CD_SCAN 0x03
#define CD_READY 0x04
#define CD_PAUSE 0x04
#define CD_OPEN 0x05
#define CD_STOP 0x09
#define NO_DISC 0x0B

View File

@ -2,8 +2,8 @@
* Genesis Plus
* Input peripherals support
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:

View File

@ -2,8 +2,8 @@
* Genesis Plus
* Input peripherals support
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -102,12 +102,14 @@
#define INPUT_PICO_RED (0x0010)
/* XE-1AP specific bitmask */
#define INPUT_XE_E1 (0x0800)
#define INPUT_XE_E2 (0x0400)
#define INPUT_XE_START (0x0200)
#define INPUT_XE_SELECT (0x0100)
#define INPUT_XE_A (0x0080)
#define INPUT_XE_B (0x0040)
#define INPUT_XE_E1 (0x2000)
#define INPUT_XE_E2 (0x1000)
#define INPUT_XE_START (0x0800)
#define INPUT_XE_SELECT (0x0400)
#define INPUT_XE_A (0x0200)
#define INPUT_XE_B (0x0100)
#define INPUT_XE_A2 (0x0080)
#define INPUT_XE_B2 (0x0040)
#define INPUT_XE_C (0x0020)
#define INPUT_XE_D (0x0010)

View File

@ -2,7 +2,7 @@
* Genesis Plus
* XE-1AP analog controller support
*
* Copyright (C) 2011-2014 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2011-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -38,6 +38,8 @@
#include "shared.h"
#define XE_1AP_LATENCY 3
static struct
{
uint8 State;
@ -52,109 +54,99 @@ void xe_1ap_reset(int index)
input.analog[index+1][0] = 128;
index >>= 2;
xe_1ap[index].State = 0x40;
xe_1ap[index].Counter = 0;
xe_1ap[index].Counter = 11;
xe_1ap[index].Latency = 0;
}
INLINE unsigned char xe_1ap_read(int index)
{
unsigned int temp = 0x40;
unsigned char data;
unsigned int port = index << 2;
/* Left Stick X & Y analog values (bidirectional) */
int x = input.analog[port][0];
int y = input.analog[port][1];
/* Right Stick X or Y value (unidirectional) */
int z = input.analog[port+1][0];
/* Buttons status (active low) */
uint16 pad = ~input.pad[port];
/* Current internal cycle (0-7) */
unsigned int cycle = xe_1ap[index].Counter & 7;
/* Current 4-bit data cycle */
/* There are eight internal data cycle for each 5 acquisition sequence */
/* First 4 return the same 4-bit data, next 4 return next 4-bit data */
switch (xe_1ap[index].Counter >> 2)
/* Current data transfer cycle */
switch (xe_1ap[index].Counter)
{
case 0:
temp |= ((pad >> 8) & 0x0F); /* E1 E2 Start Select */
case 0: /* E1 E2 Start Select buttons status (active low) */
data = (~input.pad[port] >> 10) & 0x0F;
break;
case 1:
temp |= ((pad >> 4) & 0x0F); /* A B C D */
case 1: /* A/A' B/B' C D buttons status (active low) */
data = ((~input.pad[port] >> 4) & 0x0F) & ~((input.pad[port] >> 6) & 0x0C);
break;
case 2:
temp |= ((x >> 4) & 0x0F);
case 2: /* CH0 high (Analog Stick Left/Right direction) */
data = (input.analog[port][0] >> 4) & 0x0F;
break;
case 3:
temp |= ((y >> 4) & 0x0F);
case 3: /* CH1 high (Analog Stick Up/Down direction) */
data = (input.analog[port][1] >> 4) & 0x0F;
break;
case 4:
case 4: /* CH2 high (N/A) */
data = 0x0;
break;
case 5:
temp |= ((z >> 4) & 0x0F);
case 5: /* CH3 high (Throttle vertical or horizontal direction) */
data = (input.analog[port+1][0] >> 4) & 0x0F;
break;
case 6:
temp |= (x & 0x0F);
case 6: /* CH0 low (Analog Stick Left/Right direction) */
data = input.analog[port][0] & 0x0F;
break;
case 7:
temp |= (y & 0x0F);
case 7: /* CH1 low (Analog Stick Up/Down direction)*/
data = input.analog[port][1] & 0x0F;
break;
case 8:
case 8: /* CH2 low (N/A) */
data = 0x0;
break;
case 9:
temp |= (z & 0x0F);
case 9: /* CH3 low (Throttle vertical or horizontal direction) */
data = input.analog[port+1][0] & 0x0F;
break;
case 10: /* A B A' B' buttons status (active low) */
data = (~input.pad[port] >> 6) & 0x0F;
break;
default: /* N/A */
data = 0x0F;
break;
}
/* TL indicates which part of data is returned (0=1st part, 1=2nd part) */
temp |= ((cycle & 4) << 2);
/* TL indicates current data cycle (0=1st cycle, 1=2nd cycle, etc) */
data |= ((xe_1ap[index].Counter & 1) << 4);
/* TR indicates if data is ready (0=ready, 1=not ready) */
/* Fastest One input routine actually expects this bit to switch between 0 & 1 */
/* so we make the first read of a data cycle return 1 then 0 for remaining reads */
temp |= (!(cycle & 3) << 5);
/* TR indicates if data is valid (0=valid, 1=not ready) */
/* Some games expect this bit to switch between 0 and 1 */
/* so we actually keep it high for some reads after the */
/* data cycle has been initialized or incremented */
if (xe_1ap[index].Latency)
{
if (xe_1ap[index].Latency > 1)
{
/* data is not ready */
data |= 0x20;
}
/* Automatically increment data cycle on each read (within current acquisition sequence) */
cycle = (cycle + 1) & 7;
/* decrement internal latency */
xe_1ap[index].Latency--;
}
else if (xe_1ap[index].Counter <= 10)
{
/* next data cycle */
xe_1ap[index].Counter++;
/* Update internal cycle counter */
xe_1ap[index].Counter = (xe_1ap[index].Counter & ~7) | cycle;
/* reinitialize internal latency */
xe_1ap[index].Latency = XE_1AP_LATENCY;
}
/* Update internal latency on each read */
xe_1ap[index].Latency++;
return temp;
return data;
}
INLINE void xe_1ap_write(int index, unsigned char data, unsigned char mask)
{
/* update bits set as output only */
/* only update bits set as output */
data = (xe_1ap[index].State & ~mask) | (data & mask);
/* look for TH 1->0 transitions */
if (!(data & 0x40) && (xe_1ap[index].State & 0x40))
{
/* reset acquisition cycle */
xe_1ap[index].Latency = xe_1ap[index].Counter = 0;
}
else
{
/* some games immediately write new data to TH */
/* so we make sure first sequence has actually been handled */
if (xe_1ap[index].Latency > 2)
{
/* next acquisition sequence */
xe_1ap[index].Counter = (xe_1ap[index].Counter & ~7) + 8;
/* reset data acquisition cycle */
xe_1ap[index].Counter = 0;
/* 5 sequence max with 8 cycles each */
if (xe_1ap[index].Counter > 32)
{
xe_1ap[index].Counter = 32;
}
}
/* initialize internal latency */
xe_1ap[index].Latency = XE_1AP_LATENCY;
}
/* update internal state */

View File

@ -2,7 +2,7 @@
* Genesis Plus
* XE-1AP analog controller support
*
* Copyright (C) 2011-2014 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2011-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:

View File

@ -4,8 +4,8 @@
*
* Support for SG-1000 (TMS99xx & 315-5066), Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -360,8 +360,8 @@ void vdp_reset(void)
}
}
/* H-INT should be disabled on startup (fixes GG Terminator 2: Judgement Day) */
vdp_reg_w(10, 0xFF, 0);
/* H-INT is disabled on startup (verified on VA4 MD1 with 315-5313 VDP) */
reg[10] = 0xFF;
/* Master System specific */
if ((system_hw & SYSTEM_SMS) && (!(config.bios & 1) || !(system_bios & SYSTEM_SMS)))
@ -1396,7 +1396,7 @@ unsigned int vdp_hvc_r(unsigned int cycles)
}
else
{
/* Mode 4: by default, VCounter runs normally & H counter is frozen */
/* Mode 4: by default, VCounter runs normally & HCounter is frozen */
data &= 0xff;
}
}

View File

@ -4,8 +4,8 @@
*
* Support for SG-1000 (TMS99xx & 315-5066), Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: