mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-14 06:45:09 +01:00
This commit is contained in:
commit
29ee7e1244
@ -20,10 +20,11 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
|||||||
* improved savestate format
|
* improved savestate format
|
||||||
* improved Sub-CPU synchronization with Main-CPU (fixes "Soul Star")
|
* improved Sub-CPU synchronization with Main-CPU (fixes "Soul Star")
|
||||||
* improved Main-CPU & Sub-CPU idle loop detection (fixes "Super League CD")
|
* 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)
|
* 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 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 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 OGG file seeking when using with CUE file
|
||||||
* fixed PRG-RAM access from MAIN-CPU side on system reset
|
* fixed PRG-RAM access from MAIN-CPU side on system reset
|
||||||
* fixed state loading bug when SUB-CPU interrupt is pending
|
* 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 Sega Graphic Board support (thanks to SMS Power)
|
||||||
* added Master Tap emulation (multi-player support in Boom homebrew)
|
* added Master Tap emulation (multi-player support in Boom homebrew)
|
||||||
* added gamepad type auto-detection
|
* 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)
|
* 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)
|
* fixed TeamPlayer emulation (fixes multitap detection in Gauntlet 4)
|
||||||
|
|
||||||
|
@ -180,6 +180,7 @@ static const md_entry_t rom_database[] =
|
|||||||
/* Thunderbolt II (uses 16-bits reads) */
|
/* 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}},
|
{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) */
|
/* 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}},
|
{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 */
|
/* Super Bubble Bobble */
|
||||||
@ -569,18 +570,18 @@ void md_cart_init(void)
|
|||||||
if (strstr(rominfo.consoletype,"SEGA SSF"))
|
if (strstr(rominfo.consoletype,"SEGA SSF"))
|
||||||
{
|
{
|
||||||
/* Everdrive extended SSF mapper */
|
/* Everdrive extended SSF mapper */
|
||||||
cart.hw.bankshift = 1;
|
|
||||||
|
|
||||||
/* specific !TIME handler */
|
|
||||||
cart.hw.time_w = mapper_512k_w;
|
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"))
|
else if (strstr(rominfo.domestic,"SUPER STREET FIGHTER2"))
|
||||||
{
|
{
|
||||||
/* SSF2 mapper */
|
/* SSF2 mapper */
|
||||||
cart.hw.bankshift = 1;
|
|
||||||
|
|
||||||
/* specific !TIME handler */
|
|
||||||
cart.hw.time_w = mapper_ssf2_w;
|
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"))
|
else if (strstr(rominfo.product,"T-5740"))
|
||||||
{
|
{
|
||||||
@ -605,6 +606,18 @@ void md_cart_init(void)
|
|||||||
|
|
||||||
/* no !TIME handler */
|
/* no !TIME handler */
|
||||||
cart.hw.time_w = m68k_unused_8_w;
|
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"))
|
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_r = mapper_sf004_r;
|
||||||
cart.hw.time_w = m68k_unused_8_w;
|
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++)
|
for (i=0x00; i<0x20; i++)
|
||||||
{
|
{
|
||||||
m68k.memory_map[i].base = cart.rom + ((i & 0x03) << 16);
|
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++)
|
for (i=0x20; i<0x30; i++)
|
||||||
{
|
{
|
||||||
m68k.memory_map[i].base = sram.sram;
|
m68k.memory_map[i].base = sram.sram;
|
||||||
@ -929,7 +942,6 @@ static void mapper_512k_w(uint32 address, uint32 data)
|
|||||||
/* 512K ROM paging */
|
/* 512K ROM paging */
|
||||||
uint8 *src = cart.rom + (data << 19);
|
uint8 *src = cart.rom + (data << 19);
|
||||||
|
|
||||||
|
|
||||||
/* cartridge area ($000000-$3FFFFF) is divided into 8 x 512K banks */
|
/* cartridge area ($000000-$3FFFFF) is divided into 8 x 512K banks */
|
||||||
address = (address << 2) & 0x38;
|
address = (address << 2) & 0x38;
|
||||||
|
|
||||||
|
@ -582,8 +582,8 @@ int cdd_load(char *filename, char *header)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* current track start time (based on previous track end time + current file absolute time + PREGAP length) */
|
/* current file start time (based on previous track end time + PREGAP length) */
|
||||||
cdd.toc.tracks[cdd.toc.last].start = cdd.toc.end + bb + ss*75 + mm*60*75 + pregap;
|
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) */
|
/* 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;
|
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);
|
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 */
|
/* update TOC end */
|
||||||
cdd.toc.end = cdd.toc.tracks[cdd.toc.last].end;
|
cdd.toc.end = cdd.toc.tracks[cdd.toc.last].end;
|
||||||
}
|
}
|
||||||
@ -1230,7 +1233,7 @@ void cdd_update(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* drive is ready */
|
/* drive is ready */
|
||||||
cdd.status = CD_READY;
|
cdd.status = CD_PAUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reading disc */
|
/* reading disc */
|
||||||
@ -1460,12 +1463,12 @@ void cdd_process(void)
|
|||||||
/* no audio track playing */
|
/* no audio track playing */
|
||||||
scd.regs[0x36>>1].byte.h = 0x01;
|
scd.regs[0x36>>1].byte.h = 0x01;
|
||||||
|
|
||||||
/* RS1-RS8 ignored, expects 0x0 (?) in RS0 once */
|
/* RS1-RS8 ignored, expects 0x0 (drive busy ?) in RS0 once */
|
||||||
scd.regs[0x38>>1].w = 0x0000;
|
scd.regs[0x38>>1].w = CD_BUSY << 8;
|
||||||
scd.regs[0x3a>>1].w = 0x0000;
|
scd.regs[0x3a>>1].w = 0x0000;
|
||||||
scd.regs[0x3c>>1].w = 0x0000;
|
scd.regs[0x3c>>1].w = 0x0000;
|
||||||
scd.regs[0x3e>>1].w = 0x0000;
|
scd.regs[0x3e>>1].w = 0x0000;
|
||||||
scd.regs[0x40>>1].w = 0x000f;
|
scd.regs[0x40>>1].w = ~CD_BUSY & 0x0f;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1765,7 +1768,7 @@ void cdd_process(void)
|
|||||||
scd.regs[0x36>>1].byte.h = 0x01;
|
scd.regs[0x36>>1].byte.h = 0x01;
|
||||||
|
|
||||||
/* update status (RS1-RS8 unchanged) */
|
/* 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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1808,7 +1811,7 @@ void cdd_process(void)
|
|||||||
scd.regs[0x36>>1].byte.h = 0x01;
|
scd.regs[0x36>>1].byte.h = 0x01;
|
||||||
|
|
||||||
/* update status (RS1-RS8 unchanged) */
|
/* 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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1820,12 +1823,12 @@ void cdd_process(void)
|
|||||||
/* update status */
|
/* update status */
|
||||||
cdd.status = cdd.loaded ? CD_STOP : NO_DISC;
|
cdd.status = cdd.loaded ? CD_STOP : NO_DISC;
|
||||||
|
|
||||||
/* RS1-RS8 ignored, expects 0x0 (?) in RS0 once */
|
/* RS1-RS8 ignored, expects 0x0 (drive busy ?) in RS0 once */
|
||||||
scd.regs[0x38>>1].w = 0x0000;
|
scd.regs[0x38>>1].w = CD_BUSY << 8;
|
||||||
scd.regs[0x3a>>1].w = 0x0000;
|
scd.regs[0x3a>>1].w = 0x0000;
|
||||||
scd.regs[0x3c>>1].w = 0x0000;
|
scd.regs[0x3c>>1].w = 0x0000;
|
||||||
scd.regs[0x3e>>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
|
#ifdef CD_TRAY_CALLBACK
|
||||||
CD_TRAY_CALLBACK
|
CD_TRAY_CALLBACK
|
||||||
|
@ -49,10 +49,11 @@
|
|||||||
#define cdd scd.cdd_hw
|
#define cdd scd.cdd_hw
|
||||||
|
|
||||||
/* CDD status */
|
/* CDD status */
|
||||||
|
#define CD_BUSY 0x00
|
||||||
#define CD_PLAY 0x01
|
#define CD_PLAY 0x01
|
||||||
#define CD_SEEK 0x02
|
#define CD_SEEK 0x02
|
||||||
#define CD_SCAN 0x03
|
#define CD_SCAN 0x03
|
||||||
#define CD_READY 0x04
|
#define CD_PAUSE 0x04
|
||||||
#define CD_OPEN 0x05
|
#define CD_OPEN 0x05
|
||||||
#define CD_STOP 0x09
|
#define CD_STOP 0x09
|
||||||
#define NO_DISC 0x0B
|
#define NO_DISC 0x0B
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Input peripherals support
|
* Input peripherals 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-2014 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
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Input peripherals support
|
* Input peripherals 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-2014 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
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -102,12 +102,14 @@
|
|||||||
#define INPUT_PICO_RED (0x0010)
|
#define INPUT_PICO_RED (0x0010)
|
||||||
|
|
||||||
/* XE-1AP specific bitmask */
|
/* XE-1AP specific bitmask */
|
||||||
#define INPUT_XE_E1 (0x0800)
|
#define INPUT_XE_E1 (0x2000)
|
||||||
#define INPUT_XE_E2 (0x0400)
|
#define INPUT_XE_E2 (0x1000)
|
||||||
#define INPUT_XE_START (0x0200)
|
#define INPUT_XE_START (0x0800)
|
||||||
#define INPUT_XE_SELECT (0x0100)
|
#define INPUT_XE_SELECT (0x0400)
|
||||||
#define INPUT_XE_A (0x0080)
|
#define INPUT_XE_A (0x0200)
|
||||||
#define INPUT_XE_B (0x0040)
|
#define INPUT_XE_B (0x0100)
|
||||||
|
#define INPUT_XE_A2 (0x0080)
|
||||||
|
#define INPUT_XE_B2 (0x0040)
|
||||||
#define INPUT_XE_C (0x0020)
|
#define INPUT_XE_C (0x0020)
|
||||||
#define INPUT_XE_D (0x0010)
|
#define INPUT_XE_D (0x0010)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* XE-1AP analog controller support
|
* 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
|
* 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:
|
||||||
@ -38,6 +38,8 @@
|
|||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
|
#define XE_1AP_LATENCY 3
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
uint8 State;
|
uint8 State;
|
||||||
@ -52,109 +54,99 @@ void xe_1ap_reset(int index)
|
|||||||
input.analog[index+1][0] = 128;
|
input.analog[index+1][0] = 128;
|
||||||
index >>= 2;
|
index >>= 2;
|
||||||
xe_1ap[index].State = 0x40;
|
xe_1ap[index].State = 0x40;
|
||||||
xe_1ap[index].Counter = 0;
|
xe_1ap[index].Counter = 11;
|
||||||
xe_1ap[index].Latency = 0;
|
xe_1ap[index].Latency = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE unsigned char xe_1ap_read(int index)
|
INLINE unsigned char xe_1ap_read(int index)
|
||||||
{
|
{
|
||||||
unsigned int temp = 0x40;
|
unsigned char data;
|
||||||
unsigned int port = index << 2;
|
unsigned int port = index << 2;
|
||||||
|
|
||||||
/* Left Stick X & Y analog values (bidirectional) */
|
/* Current data transfer cycle */
|
||||||
int x = input.analog[port][0];
|
switch (xe_1ap[index].Counter)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: /* E1 E2 Start Select buttons status (active low) */
|
||||||
temp |= ((pad >> 8) & 0x0F); /* E1 E2 Start Select */
|
data = (~input.pad[port] >> 10) & 0x0F;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: /* A/A' B/B' C D buttons status (active low) */
|
||||||
temp |= ((pad >> 4) & 0x0F); /* A B C D */
|
data = ((~input.pad[port] >> 4) & 0x0F) & ~((input.pad[port] >> 6) & 0x0C);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2: /* CH0 high (Analog Stick Left/Right direction) */
|
||||||
temp |= ((x >> 4) & 0x0F);
|
data = (input.analog[port][0] >> 4) & 0x0F;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3: /* CH1 high (Analog Stick Up/Down direction) */
|
||||||
temp |= ((y >> 4) & 0x0F);
|
data = (input.analog[port][1] >> 4) & 0x0F;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4: /* CH2 high (N/A) */
|
||||||
|
data = 0x0;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5: /* CH3 high (Throttle vertical or horizontal direction) */
|
||||||
temp |= ((z >> 4) & 0x0F);
|
data = (input.analog[port+1][0] >> 4) & 0x0F;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6: /* CH0 low (Analog Stick Left/Right direction) */
|
||||||
temp |= (x & 0x0F);
|
data = input.analog[port][0] & 0x0F;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7: /* CH1 low (Analog Stick Up/Down direction)*/
|
||||||
temp |= (y & 0x0F);
|
data = input.analog[port][1] & 0x0F;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8: /* CH2 low (N/A) */
|
||||||
|
data = 0x0;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9: /* CH3 low (Throttle vertical or horizontal direction) */
|
||||||
temp |= (z & 0x0F);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TL indicates which part of data is returned (0=1st part, 1=2nd part) */
|
/* TL indicates current data cycle (0=1st cycle, 1=2nd cycle, etc) */
|
||||||
temp |= ((cycle & 4) << 2);
|
data |= ((xe_1ap[index].Counter & 1) << 4);
|
||||||
|
|
||||||
/* TR indicates if data is ready (0=ready, 1=not ready) */
|
/* TR indicates if data is valid (0=valid, 1=not ready) */
|
||||||
/* Fastest One input routine actually expects this bit to switch between 0 & 1 */
|
/* Some games expect this bit to switch between 0 and 1 */
|
||||||
/* so we make the first read of a data cycle return 1 then 0 for remaining reads */
|
/* so we actually keep it high for some reads after the */
|
||||||
temp |= (!(cycle & 3) << 5);
|
/* 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) */
|
/* decrement internal latency */
|
||||||
cycle = (cycle + 1) & 7;
|
xe_1ap[index].Latency--;
|
||||||
|
}
|
||||||
|
else if (xe_1ap[index].Counter <= 10)
|
||||||
|
{
|
||||||
|
/* next data cycle */
|
||||||
|
xe_1ap[index].Counter++;
|
||||||
|
|
||||||
/* Update internal cycle counter */
|
/* reinitialize internal latency */
|
||||||
xe_1ap[index].Counter = (xe_1ap[index].Counter & ~7) | cycle;
|
xe_1ap[index].Latency = XE_1AP_LATENCY;
|
||||||
|
}
|
||||||
|
|
||||||
/* Update internal latency on each read */
|
return data;
|
||||||
xe_1ap[index].Latency++;
|
|
||||||
|
|
||||||
return temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void xe_1ap_write(int index, unsigned char data, unsigned char mask)
|
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);
|
data = (xe_1ap[index].State & ~mask) | (data & mask);
|
||||||
|
|
||||||
/* look for TH 1->0 transitions */
|
/* look for TH 1->0 transitions */
|
||||||
if (!(data & 0x40) && (xe_1ap[index].State & 0x40))
|
if (!(data & 0x40) && (xe_1ap[index].State & 0x40))
|
||||||
{
|
{
|
||||||
/* reset acquisition cycle */
|
/* reset data acquisition cycle */
|
||||||
xe_1ap[index].Latency = xe_1ap[index].Counter = 0;
|
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;
|
|
||||||
|
|
||||||
/* 5 sequence max with 8 cycles each */
|
/* initialize internal latency */
|
||||||
if (xe_1ap[index].Counter > 32)
|
xe_1ap[index].Latency = XE_1AP_LATENCY;
|
||||||
{
|
|
||||||
xe_1ap[index].Counter = 32;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update internal state */
|
/* update internal state */
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* XE-1AP analog controller support
|
* 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
|
* 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:
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
*
|
*
|
||||||
* Support for SG-1000 (TMS99xx & 315-5066), Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
|
* 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) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2014 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
|
||||||
* provided that the following conditions are met:
|
* 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) */
|
/* H-INT is disabled on startup (verified on VA4 MD1 with 315-5313 VDP) */
|
||||||
vdp_reg_w(10, 0xFF, 0);
|
reg[10] = 0xFF;
|
||||||
|
|
||||||
/* Master System specific */
|
/* Master System specific */
|
||||||
if ((system_hw & SYSTEM_SMS) && (!(config.bios & 1) || !(system_bios & SYSTEM_SMS)))
|
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
|
else
|
||||||
{
|
{
|
||||||
/* Mode 4: by default, VCounter runs normally & H counter is frozen */
|
/* Mode 4: by default, VCounter runs normally & HCounter is frozen */
|
||||||
data &= 0xff;
|
data &= 0xff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
*
|
*
|
||||||
* Support for SG-1000 (TMS99xx & 315-5066), Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
|
* 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) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2014 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
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
Loading…
Reference in New Issue
Block a user