1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/***********************************************************************************************************
NES/Famicom cartridge emulation for PCBs mostly based on discrete components
Here we emulate the following PCBs
* PCB with IC 74x161x161x32 [mapper 70 & 152]
* PCB with IC 74x139x74 [mapper 87]
* PCB with IC 74x377 [mapper 11]
* PCB with IC 74x161x138 [mapper 38]
***********************************************************************************************************/
#include "emu.h"
#include "discrete.h"
#ifdef NES_PCB_DEBUG
#define VERBOSE 1
#else
#define VERBOSE 0
#endif
#define LOG_MMC(x) do { if (VERBOSE) logerror x; } while (0)
//-------------------------------------------------
// constructor
//-------------------------------------------------
DEFINE_DEVICE_TYPE(NES_74X161X161X32, nes_74x161x161x32_device, "nes_74x161", "NES Cart Discrete Logic (74*161/161/32) PCB")
DEFINE_DEVICE_TYPE(NES_74X139X74, nes_74x139x74_device, "nes_74x139", "NES Cart Discrete Logic (74*139/74) PCB")
DEFINE_DEVICE_TYPE(NES_74X377, nes_74x377_device, "nes_74x377", "NES Cart Discrete Logic (74*377) PCB")
DEFINE_DEVICE_TYPE(NES_74X161X138, nes_74x161x138_device, "nes_bitcorp_dis", "NES Cart Discrete Logic (74*161/138) PCB")
nes_74x161x161x32_device::nes_74x161x161x32_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_nrom_device(mconfig, NES_74X161X161X32, tag, owner, clock)
{
}
nes_74x139x74_device::nes_74x139x74_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_nrom_device(mconfig, NES_74X139X74, tag, owner, clock)
{
}
nes_74x377_device::nes_74x377_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_nrom_device(mconfig, NES_74X377, tag, owner, clock)
{
}
nes_74x161x138_device::nes_74x161x138_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_nrom_device(mconfig, NES_74X161X138, tag, owner, clock)
{
}
void nes_74x161x161x32_device::pcb_reset()
{
prg16_89ab(0);
prg16_cdef(m_prg_chunks - 1);
chr8(0, m_chr_source);
if (m_pcb_ctrl_mirror)
set_nt_mirroring(PPU_MIRROR_LOW);
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
/*-------------------------------------------------
Discrete Logic board IC 74x161x161x32
There are two variants (one with hardwired mirroring, the
other with a mirroring control), making necessary two distinct
mappers & pcb_id
iNES: mappers 70 & 152
-------------------------------------------------*/
// there are two 'variants' depending on hardwired or mapper ctrl mirroring
void nes_74x161x161x32_device::write_h(offs_t offset, u8 data)
{
LOG_MMC(("74x161x161x32 write_h, offset: %04x, data: %02x\n", offset, data));
// this pcb is subject to bus conflict
data = account_bus_conflict(offset, data);
if (m_pcb_ctrl_mirror)
set_nt_mirroring(BIT(data, 7) ? PPU_MIRROR_HIGH : PPU_MIRROR_LOW);
chr8(data, CHRROM);
prg16_89ab(data >> 4);
}
/*-------------------------------------------------
Discrete Logic board IC 74x139x74 by Konami & Jaleco
iNES: mapper 87
-------------------------------------------------*/
void nes_74x139x74_device::write_m(offs_t offset, u8 data)
{
LOG_MMC(("74x139x74 write_m, offset: %04x, data: %02x\n", offset, data));
chr8(bitswap<2>(data, 0, 1), CHRROM);
}
/*-------------------------------------------------
Discrete Logic board IC 74x377 by Color Dreams / Nina-007 emulation
Games: many Color Dreams and Wisdom Tree titles
iNES: mapper 11
In MAME: Supported
Note: bit2 & bit3 are actually related to CIC lockout
defeating, and real Color Dreams titles use only
bit0 & bit1 for PRG switching. Our usage allows for support
of extended PRG games (e.g. homebrew)
-------------------------------------------------*/
void nes_74x377_device::write_h(offs_t offset, u8 data)
{
LOG_MMC(("74x377 write_h, offset: %04x, data: %02x\n", offset, data));
// this pcb is subject to bus conflict, but not the prototype of Secret Scout, which actually breaks in case of conflict...
data = account_bus_conflict(offset, data);
chr8(data >> 4, m_chr_source);
prg32(data & 0x0f);
}
/*-------------------------------------------------
Discrete Logic board IC 74x161x138
Games: Crime Busters
iNES: mapper 38
-------------------------------------------------*/
void nes_74x161x138_device::write_m(offs_t offset, u8 data)
{
LOG_MMC(("74x161x138 write_m, offset: %04x, data: %02x\n", offset, data));
chr8(data >> 2, CHRROM);
prg32(data);
}
|