Skip to content

Commit 2b8f6e7

Browse files
authored
Merge pull request #776 from awjackson/mapper92
Reimplement mapper 92 correctly
2 parents eb5ca2e + f15fb4f commit 2b8f6e7

File tree

4 files changed

+29
-34
lines changed

4 files changed

+29
-34
lines changed

src/boards/18.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
* You should have received a copy of the GNU General Public License
1717
* along with this program; if not, write to the Free Software
1818
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+
*
20+
* The Moero!! Pro Yakyuu series have an ADPCM chip with internal ROM,
21+
* used for voice samples (not dumped, so emulation isn't possible)
1922
*/
2023

2124
#include "mapinc.h"

src/boards/72.cpp

+23-7
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
* along with this program; if not, write to the Free Software
1818
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1919
*
20-
* Moero!! Pro Tennis have ADPCM codec on-board, PROM isn't dumped, emulation isn't
21-
* possible just now.
20+
* Moero!! Pro Tennis and Moero!! Pro Yakyuu '88 Ketteiban have an ADPCM chip with
21+
* internal ROM, used for voice samples (not dumped, so emulation isn't possible)
2222
*/
2323

2424
#include "mapinc.h"
2525

2626
static uint8 preg, creg;
27+
static void (*Sync)(void);
2728

2829
static SFORMAT StateRegs[] =
2930
{
@@ -32,32 +33,47 @@ static SFORMAT StateRegs[] =
3233
{ 0 }
3334
};
3435

35-
static void Sync(void) {
36+
static void M72Sync(void) {
3637
setprg16(0x8000, preg);
3738
setprg16(0xC000, ~0);
3839
setchr8(creg);
3940
}
4041

41-
static DECLFW(M72Write) {
42+
static void M92Sync(void) {
43+
setprg16(0x8000, 0);
44+
setprg16(0xC000, preg);
45+
setchr8(creg);
46+
}
47+
48+
static DECLFW(Write) {
4249
if (V & 0x80)
4350
preg = V & 0xF;
4451
if (V & 0x40)
4552
creg = V & 0xF;
4653
Sync();
4754
}
4855

49-
static void M72Power(void) {
56+
static void Power(void) {
5057
Sync();
5158
SetReadHandler(0x8000, 0xFFFF, CartBR);
52-
SetWriteHandler(0x6000, 0xFFFF, M72Write);
59+
SetWriteHandler(0x8000, 0xFFFF, Write);
5360
}
5461

5562
static void StateRestore(int version) {
5663
Sync();
5764
}
5865

5966
void Mapper72_Init(CartInfo *info) {
60-
info->Power = M72Power;
67+
Sync = M72Sync;
68+
info->Power = Power;
69+
GameStateRestore = StateRestore;
70+
71+
AddExState(&StateRegs, ~0, 0, 0);
72+
}
73+
74+
void Mapper92_Init(CartInfo *info) {
75+
Sync = M92Sync;
76+
info->Power = Power;
6177
GameStateRestore = StateRestore;
6278

6379
AddExState(&StateRegs, ~0, 0, 0);

src/boards/addrlatch.cpp

+1-26
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ void Mapper59_Init(CartInfo *info) {
181181
}
182182

183183
//------------------ Map 061 ---------------------------
184+
184185
static void M61Sync(void) {
185186
if (((latche & 0x10) << 1) ^ (latche & 0x20)) {
186187
setprg16(0x8000, ((latche & 0xF) << 1) | (((latche & 0x20) >> 4)));
@@ -195,32 +196,6 @@ void Mapper61_Init(CartInfo *info) {
195196
Latch_Init(info, M61Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
196197
}
197198

198-
//------------------ Map 092 ---------------------------
199-
// Another two-in-one mapper, two Jaleco carts uses similar
200-
// hardware, but with different wiring.
201-
// Original code provided by LULU
202-
// Additionally, PCB contains DSP extra sound chip, used for voice samples (unemulated)
203-
204-
static void M92Sync(void) {
205-
uint8 reg = latche & 0xF0;
206-
setprg16(0x8000, 0);
207-
if (latche >= 0x9000) {
208-
switch (reg) {
209-
case 0xD0: setprg16(0xc000, latche & 15); break;
210-
case 0xE0: setchr8(latche & 15); break;
211-
}
212-
} else {
213-
switch (reg) {
214-
case 0xB0: setprg16(0xc000, latche & 15); break;
215-
case 0x70: setchr8(latche & 15); break;
216-
}
217-
}
218-
}
219-
220-
void Mapper92_Init(CartInfo *info) {
221-
Latch_Init(info, M92Sync, NULL, 0x80B0, 0x8000, 0xFFFF, 0);
222-
}
223-
224199
//------------------ Map 174 ---------------------------
225200

226201
static void M174Sync(void) {

src/boards/datalatch.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ void Mapper78_Init(CartInfo *info) {
309309
}
310310

311311
//------------------ Map 86 ---------------------------
312-
312+
// Moero!! Pro Yakyuu has an ADPCM chip with internal ROM,
313+
// used for voice samples (not dumped, so emulation isn't possible)
313314
static void M86Sync(void) {
314315
setprg32(0x8000, (latche >> 4) & 3);
315316
setchr8((latche & 3) | ((latche >> 4) & 4));

0 commit comments

Comments
 (0)