Permalink
Browse files

Aggiunto pieno supporto al Vs. System (ma non al Vs. Dual System).

- Aggiornato il numero della versione.
- Emulato tutto quello che riguarda il Vs. System (PPU alternative,
coins, coin counter, watchdog timer e dip switches).
- Aggiunto il supporto alla mapper 151.
- Aggiunto la gestione di controlli esterni che, per comodità, rimangano
incollati alla finestra principale.
- Migliorato l'utilizzo dell'emu_pause() e della gestione del focus
della finestra principale.
  • Loading branch information...
punesemu committed May 24, 2016
1 parent cd34d41 commit 8b47febd8050cf65f2525efa610fe4e47e01e69a
View
@@ -42,6 +42,7 @@ libcore_a_SOURCES = \
miniz.h \
overscan.c \
overscan.h \
paldef.h \
palette.h \
ppu.c \
ppu.h \
@@ -64,7 +65,8 @@ libcore_a_SOURCES = \
uncompress_selection.h \
unif.c \
unif.h \
version.h
version.h\
vs_system.h
libcore_a_SOURCES += \
mappers/mapper_0.c \
View
@@ -63,6 +63,7 @@ enum lenght_file_name_type {
enum forced_mirroring { UNK_HORIZONTAL, UNK_VERTICAL };
enum max_chips_rom { MAX_CHIPS = 8 };
enum languages { LNG_ENGLISH, LNG_ITALIAN, LNG_RUSSIAN };
enum database_mode { NODIPSWITCH = 0xFF00, NOEXTRA = 0x0000, VSZAPPER = 0x0001 };
#define LENGTH(x) (sizeof(x)/sizeof(*(x)))
View
@@ -61,6 +61,7 @@ typedef struct _config {
#endif
BYTE bck_pause;
WORD language;
WORD dipswitch;
_config_input input;
_config_apu apu;
View
@@ -33,6 +33,8 @@
#include "cheat.h"
#include "info.h"
#include "conf.h"
#include "vs_system.h"
#include "qt.h"
#define mod_cycles_op(op, vl) cpu.cycles op vl
#define r2006_during_rendering()\
@@ -210,19 +212,50 @@ static BYTE cpu_rd_mem(WORD address, BYTE made_tick) {
if (made_tick) {
tick_hw(1);
}
/* controllo se e' consentita la lettura dalla PRG Ram */
if (cpu.prg_ram_rd_active) {
if (address < 0x6000) {
/* leggo */
cpu.openbus = prg.ram.data[address & 0x1FFF];
// Vs System
if ((vs_system.enabled) && (address >= 0x4020)) {
if ((address & 0x4020) == 0x4020) {
vs_system_r4020_clock(rd, before)
}
if (vs_system.special_mode.r5e0x) {
if (address == 0x5E00) {
vs_system.special_mode.index = 0;
} else if (address == 0x5E01) {
cpu.openbus = vs_system.special_mode.r5e0x[(vs_system.special_mode.index++) & 0x1F];
}
} else if (vs_system.special_mode.type == VS_SM_Super_Xevious) {
if (address == 0x54FF) {
cpu.openbus = 0x05;
} else if (address == 0x5678) {
cpu.openbus = vs_system.special_mode.index ? 0x00 : 0x01;
} else if (address == 0x578F) {
cpu.openbus = vs_system.special_mode.index ? 0xD1 : 0x89;
} else if (address == 0x5567) {
vs_system.special_mode.index ^= 1;
cpu.openbus = vs_system.special_mode.index ? 0x37 : 0x3E;
}
}
}
} else {
/*
* se la rom ha una PRG Ram extra allora
* la utilizzo, altrimenti leggo dalla PRG
* Ram normale.
*/
if (!prg.ram_plus) {
cpu.openbus = prg.ram.data[address & 0x1FFF];
// Vs. System
if ((vs_system.enabled == TRUE) && vs_system.shared_mem) {
cpu.openbus = prg.ram.data[address & 0x07FF];
} else {
cpu.openbus = prg.ram.data[address & 0x1FFF];
}
} else {
cpu.openbus = prg.ram_plus_8k[address & 0x1FFF];
}
@@ -298,6 +331,12 @@ static BYTE INLINE ppu_rd_reg(WORD address) {
ppu_openbus_wr(bit5);
ppu_openbus_wr(bit6);
ppu_openbus_wr(bit7);
// Vs. System
if (vs_system.rc2c05.enabled) {
value = (value & 0xE0) | vs_system.rc2c05.r2002;
}
return (value);
}
if (address == 0x2004) {
@@ -609,6 +648,16 @@ static void cpu_wr_mem(WORD address, BYTE value) {
}
if (address < 0x4000) {
address &= 0x2007;
// Vs. System
if (vs_system.rc2c05.enabled) {
if (address == 0x2000) {
address = 0x2001;
} else if (address == 0x2001) {
address = 0x2000;
}
}
/*
* per riuscire a far funzionare contemporaneamente
* Battletoads e Fighting Road (J) senza trick, devo
@@ -687,6 +736,12 @@ static void cpu_wr_mem(WORD address, BYTE value) {
/* controllo se e' attiva la PRG Ram */
if (cpu.prg_ram_wr_active) {
if (address < 0x6000) {
// Vs System
if (vs_system.enabled) {
if ((address >= 0x4020) && ((address & 0x4020) == 0x4020)) {
vs_system_r4020_clock(wr, value)
}
}
/* scrivo */
prg.ram.data[address & 0x1FFF] = value;
} else {
@@ -696,7 +751,12 @@ static void cpu_wr_mem(WORD address, BYTE value) {
* normale.
*/
if (!prg.ram_plus) {
prg.ram.data[address & 0x1FFF] = value;
// Vs. System
if ((vs_system.enabled == TRUE) && vs_system.shared_mem) {
prg.ram.data[address & 0x07FF] = value;
} else {
prg.ram.data[address & 0x1FFF] = value;
}
} else {
prg.ram_plus_8k[address & 0x1FFF] = value;
}
@@ -1816,6 +1876,23 @@ static void INLINE tick_hw(BYTE value) {
irqA12.cycles++;
irqA12.race.C001 = FALSE;
}
if (vs_system.enabled == TRUE) {
if (vs_system.coins.left) {
vs_system.coins.left--;
}
if (vs_system.coins.right) {
vs_system.coins.right--;
}
if (vs_system.coins.service) {
vs_system.coins.service--;
}
if (++vs_system.watchdog.timer == vs_system.watchdog.next) {
vs_system.watchdog.reset = TRUE;
}
vs_system_r4020_timer(rd)
vs_system_r4020_timer(wr)
}
}
}
/* --------------------------------------------------------------------------------------------- */
Oops, something went wrong.

0 comments on commit 8b47feb

Please sign in to comment.