summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/uapce.cpp
blob: 926aa8c32889ec66caaa1b2b62d029b649827298 (plain) (blame)
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
// license:BSD-3-Clause
// copyright-holders:Mariusz Wojcieszek
/*

    United Amusements PC-Engine based hardware
    Driver by Mariusz Wojcieszek
    Thanks for Charles MacDonald for hardware docs

 Overview

 The system consists of a stock PC-Engine console, JAMMA interface board,
 and several cables to connect certain pins from the PCE backplane connector
 and pad connector to the interface board.

 History

 In 1989 United Amusements (a large operator of arcades in the US at that
 time) developed a JAMMA interface for the PC-Engine with NEC's blessing. NEC
 pulled funding for the project before mass production began, and it never
 took off.

 Driver notes:
 - game time is controlled using software loop - with current clock it takes lots
   of time until credit expires. Should Z80 clock be raised?
 - tone played by jamma if board is not emulated

 A kit owned by collector has following contents:
 -x1 NOS boxed NEC arcade unit with all connectors
 -x1 NOS boxed Keith Courage (custom/prototype PCB) with NOS marquee
 -x1 Pacland standard Hucard WITH arcade cabinet marquee (this proves that while this is a standard card, it was sold by United Amusements with the intention of being used in the arcade unit)
 -x1 Alien Crush standard Hucard with arcade "how to play" placard. Same as above.... proof this was sold for the arcade unit and not as a home card
 -x1 Ninja Warriors standard Hucard
 -x1 Victory Run standardd Hucard
 -x1 Plexiglass control panel overlay (used)

In the February 1990 issue of Video Games & Computer Entertainment magazine, there was a list of
all of the available UA produced Hu-Cards (at the current time of the article was published).
The article mentions that the UA Hu-Cards were not compatible with the TG-16 gaming console.
- Keith Courage in the Alpha Zones
- World Class Baseball
- Blazing Lazers
- Alien Crush
- China Warrior

Blazing Lazers dump notes:
----------------------------------------------------------------------------
Game software
----------------------------------------------------------------------------

An EPROM-based HuCard manufactured by NEC (PCB ID: PWD-703) is used to
store the game program. It supports four uPD27C2001 (256Kx8) EPROMs as
well as 27C010s for total ROM capacity of 1MB down to 128K in various
configurations.

Jumper settings:

J1
Pos. 1 : Map IC1 to 000000-03FFFF (256K)
Pos. 2 : Map IC1 to 000000-01FFFF (128K)

J2
Pos. 1 : Map IC2 to 040000-07FFFF (256K)
Pos. 2 : Map IC2 to 080000-09FFFF (128K)
Pos. 3 : Map IC2 to 020000-03FFFF (128K)

J3
Pos. 1 : Map IC3 to 080000-0BFFFF (256K)
Pos. 2 : Map IC3 to 080000-09FFFF (128K)
Pos. 3 : Map IC3 to 040000-05FFFF (128K)

J4
Pos. 1 : Map IC4 to 0C0000-0FFFFF (256K)
Pos. 2 : Map IC4 to 0A0000-0BFFFF (128K)
Pos. 3 : Map IC4 to 060000-07FFFF (128K)

The board came with three EPROMs in the following configuration:

IC1 is a 27C010 mapped to 000000-01FFFF
IC2 is a 27C010 mapped to 020000-03FFFF
IC3 is a 27C010 mapped to 080000-09FFFF
IC4 is unpopulated

The software was a modified version of "Blazing Lazers", identical to the
USA retail version with the region check (offsets 0 through $18) patched
with NOP to remove it. The interface board is connected to a PC-Engine
console rather than a TurboGrafx-16, which would cause the region check to
fail.


Keith Courage In Alpha Zones: dump was made from PC-Engine game dump of US version,
 with region check nop'ed out.
Alien Crush & Pac_Land: dumps made from PC-Engine dumps of JP versions
*/

#include "emu.h"
#include "machine/pcecommn.h"

#include "cpu/h6280/h6280.h"
#include "cpu/z80/z80.h"
#include "video/huc6260.h"
#include "video/huc6270.h"
#include "sound/c6280.h"
#include "sound/discrete.h"

#include "screen.h"
#include "speaker.h"


class uapce_state : public pce_common_state
{
public:
	uapce_state(const machine_config &mconfig, device_type type, const char *tag)
		: pce_common_state(mconfig, type, tag),
		m_discrete(*this, "discrete") { }

	uint8_t m_jamma_if_control_latch;
	DECLARE_WRITE8_MEMBER(jamma_if_control_latch_w);
	DECLARE_READ8_MEMBER(jamma_if_control_latch_r);
	DECLARE_READ8_MEMBER(jamma_if_read_dsw);
	virtual uint8_t joy_read() override;
	virtual void machine_reset() override;
	required_device<discrete_device> m_discrete;
	void uapce(machine_config &config);
	void pce_io(address_map &map);
	void pce_mem(address_map &map);
	void z80_map(address_map &map);
};

#define UAPCE_SOUND_EN  NODE_10
#define UAPCE_TONE_752  NODE_11

static DISCRETE_SOUND_START(uapce)
	DISCRETE_INPUT_LOGIC(UAPCE_SOUND_EN)
	DISCRETE_SQUAREWFIX(UAPCE_TONE_752, UAPCE_SOUND_EN, 752, DEFAULT_TTL_V_LOGIC_1, 50, DEFAULT_TTL_V_LOGIC_1, 0)   // 752Hz
	DISCRETE_OUTPUT(UAPCE_TONE_752, 100)
DISCRETE_SOUND_END


WRITE8_MEMBER(uapce_state::jamma_if_control_latch_w)
{
	uint8_t diff = data ^ m_jamma_if_control_latch;
	m_jamma_if_control_latch = data;

/*  D7 : Controls relay which connects the PCE R-AUDIO output to the common audio path.
    (1= Relay closed, 0= Relay open) */
	machine().sound().system_enable( (data >> 7) & 1 );

/* D6 : Output to JAMMA connector KEY pin. Connected to /RESET on the PCE backplane connector.
    (1= /RESET not asserted, 0= /RESET asserted) */

	if ( diff & 0x40 )
	{
		m_maincpu->set_input_line(INPUT_LINE_RESET, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE);
	}

/* D5 : Connected to a TIP31 which may control the coin meter:
      B = Latched D5
      C = JAMMA pin 'z'
      E = Ground

   Pin 'z' is a normally ground connection, but on this board it is isolated from ground.
   The wiring harness also has the corresponding wire separate from the others. */
	machine().bookkeeping().coin_counter_w(0, BIT(data,5));

/* D4 : Connects the START1 switch input from the JAMMA connector to the
    "RUN" key input of the control pad multiplexer.
    (1= "RUN" input connected to START1 switch, 0= "RUN" input always '1') */

/* D3 : Controls the RESET input of timer B of a 556 IC, enabling a
      752 Hz (D-3) square wave to be output on the common audio path.
      (1= Tone output ON, 0= Tone output OFF) */

	m_discrete->write(space, UAPCE_SOUND_EN, BIT(data,3));

/* D2 : Not latched, though software writes to this bit like it is. */

/* D1 : Not latched. */

/* D0 : Not latched. */
}

READ8_MEMBER(uapce_state::jamma_if_control_latch_r)
{
	return m_jamma_if_control_latch & 0x08;
}

READ8_MEMBER(uapce_state::jamma_if_read_dsw)
{
	uint8_t dsw_val;

	dsw_val = ioport("DSW" )->read();

	if ( BIT( offset, 7 ) == 0 )
	{
		dsw_val >>= 7;
	}
	else if ( BIT( offset, 6 ) == 0 )
	{
		dsw_val >>= 6;
	}
	else if ( BIT( offset, 5 ) == 0 )
	{
		dsw_val >>= 5;
	}
	else if ( BIT( offset, 4 ) == 0 )
	{
		dsw_val >>= 4;
	}
	else if ( BIT( offset, 3 ) == 0 )
	{
		dsw_val >>= 3;
	}
	else if ( BIT( offset, 2 ) == 0 )
	{
		dsw_val >>= 2;
	}
	else if ( BIT( offset, 1 ) == 0 )
	{
		dsw_val >>= 1;
	}
	else if ( BIT( offset, 0 ) == 0 )
	{
		dsw_val >>= 0;
	}

	return dsw_val & 1;
}

uint8_t uapce_state::joy_read()
{
	if ( m_jamma_if_control_latch & 0x10 )
	{
		return ioport("JOY" )->read();
	}
	else
	{
		return ioport("JOY" )->read() | 0x08;
	}
}

void uapce_state::machine_reset()
{
	m_jamma_if_control_latch = 0;
}

void uapce_state::z80_map(address_map &map)
{
	map(0x0000, 0x07FF).rom();
	map(0x0800, 0x0FFF).ram();
	map(0x1000, 0x17FF).w(this, FUNC(uapce_state::jamma_if_control_latch_w));
	map(0x1800, 0x1FFF).r(this, FUNC(uapce_state::jamma_if_read_dsw));
	map(0x2000, 0x27FF).portr("COIN");
	map(0x2800, 0x2FFF).r(this, FUNC(uapce_state::jamma_if_control_latch_r));
}


static INPUT_PORTS_START( uapce )
	PCE_STANDARD_INPUT_PORT_P1

	PORT_START( "DSW" )
	PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
	PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
	PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
	PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
	PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
	PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
	PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
	PORT_DIPSETTING(    0x01, DEF_STR( 1C_4C ) )
	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
	PORT_DIPNAME( 0x38, 0x10, "Time" )
	PORT_DIPSETTING(    0x00, "Untimed Play" )
	PORT_DIPSETTING(    0x08, "1 minute Timed Play" )
	PORT_DIPSETTING(    0x10, "3 minute Timed Play" )
	PORT_DIPSETTING(    0x18, "5 minute Timed Play" )
	PORT_DIPSETTING(    0x20, "7 minute Timed Play" )
	PORT_DIPSETTING(    0x28, "10 minute Timed Play" )
	PORT_DIPSETTING(    0x30, "12 minute Timed Play" )
	PORT_DIPSETTING(    0x38, "20 minute Timed Play" )
	PORT_DIPNAME( 0x40, 0x40, "Buy-In Feature" )
	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
	PORT_DIPSETTING(    0x00, DEF_STR( On ) )

	PORT_START( "COIN" )
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1)
INPUT_PORTS_END

void uapce_state::pce_mem(address_map &map)
{
	map(0x000000, 0x09FFFF).rom();
	map(0x1F0000, 0x1F1FFF).ram().mirror(0x6000);
	map(0x1FE000, 0x1FE3FF).rw("huc6270", FUNC(huc6270_device::read), FUNC(huc6270_device::write));
	map(0x1FE400, 0x1FE7FF).rw(m_huc6260, FUNC(huc6260_device::read), FUNC(huc6260_device::write));
	map(0x1FE800, 0x1FEBFF).rw("c6280", FUNC(c6280_device::c6280_r), FUNC(c6280_device::c6280_w));
	map(0x1FEC00, 0x1FEFFF).rw(m_maincpu, FUNC(h6280_device::timer_r), FUNC(h6280_device::timer_w));
	map(0x1FF000, 0x1FF3FF).rw(this, FUNC(uapce_state::pce_joystick_r), FUNC(uapce_state::pce_joystick_w));
	map(0x1FF400, 0x1FF7FF).rw(m_maincpu, FUNC(h6280_device::irq_status_r), FUNC(h6280_device::irq_status_w));
}

void uapce_state::pce_io(address_map &map)
{
	map(0x00, 0x03).rw("huc6270", FUNC(huc6270_device::read), FUNC(huc6270_device::write));
}


MACHINE_CONFIG_START(uapce_state::uapce)
	/* basic machine hardware */
	MCFG_DEVICE_ADD("maincpu", H6280, PCE_MAIN_CLOCK/3)
	MCFG_DEVICE_PROGRAM_MAP(pce_mem)
	MCFG_DEVICE_IO_MAP(pce_io)

	MCFG_DEVICE_ADD("sub", Z80, 1400000)
	MCFG_DEVICE_PROGRAM_MAP(z80_map)

	MCFG_QUANTUM_TIME(attotime::from_hz(60))

	/* video hardware */
	MCFG_SCREEN_ADD("screen", RASTER)
	MCFG_SCREEN_RAW_PARAMS(PCE_MAIN_CLOCK, huc6260_device::WPF, 64, 64 + 1024 + 64, huc6260_device::LPF, 18, 18 + 242)
	MCFG_SCREEN_UPDATE_DRIVER( pce_common_state, screen_update )
	MCFG_SCREEN_PALETTE("huc6260:palette")

	MCFG_DEVICE_ADD( "huc6260", HUC6260, PCE_MAIN_CLOCK )
	MCFG_HUC6260_NEXT_PIXEL_DATA_CB(READ16("huc6270", huc6270_device, next_pixel))
	MCFG_HUC6260_TIME_TIL_NEXT_EVENT_CB(READ16("huc6270", huc6270_device, time_until_next_event))
	MCFG_HUC6260_VSYNC_CHANGED_CB(WRITELINE("huc6270", huc6270_device, vsync_changed))
	MCFG_HUC6260_HSYNC_CHANGED_CB(WRITELINE("huc6270", huc6270_device, hsync_changed))
	MCFG_DEVICE_ADD( "huc6270", HUC6270, 0 )
	MCFG_HUC6270_VRAM_SIZE(0x10000)
	MCFG_HUC6270_IRQ_CHANGED_CB(INPUTLINE("maincpu", 0))

	MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
	MCFG_DEVICE_ADD("c6280", C6280, PCE_MAIN_CLOCK/6)
	MCFG_C6280_CPU("maincpu")
	MCFG_SOUND_ROUTE(0, "lspeaker", 0.5)
	MCFG_SOUND_ROUTE(1, "rspeaker", 0.5)

	MCFG_DEVICE_ADD("discrete", DISCRETE)
	MCFG_DISCRETE_INTF(uapce)
	MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
MACHINE_CONFIG_END

ROM_START(blazlaz)
	ROM_REGION( 0x0a0000, "maincpu", 0 )
	ROM_LOAD( "ic1.bin", 0x000000, 0x020000, CRC(c86d44fe) SHA1(070512918e4d305db48bbda374eaff2d121909c5) )
	ROM_LOAD( "ic2.bin", 0x020000, 0x020000, CRC(fb813309) SHA1(60d1ea45717a04d776b6837377467e81431f9bc6) )
	ROM_LOAD( "ic3.bin", 0x080000, 0x020000, CRC(d30a2ecf) SHA1(8328b303e2ffeb694b472719e59044d41471725f) )

	ROM_REGION( 0x800, "sub", 0 )
	ROM_LOAD( "u1.bin", 0x0000, 0x800, CRC(f5e538a9) SHA1(19ac9525c9ad6bea1789cc9e63cdb7fe949867d9) )
ROM_END

ROM_START(keith)
	ROM_REGION( 0x0a0000, "maincpu", 0 )
	ROM_LOAD( "keith.ic1", 0x000000, 0x020000, BAD_DUMP CRC(d49d4e0d) SHA1(4ff8e7025dd1023e54a0f5bac52d7cecb7cb1430) )
	ROM_LOAD( "keith.ic2", 0x020000, 0x020000, BAD_DUMP CRC(133e5c8b) SHA1(8ebacd7b3887d10b28d8c672396c8850e8c0cdaf) )

	ROM_REGION( 0x800, "sub", 0 )
	ROM_LOAD( "u1.bin", 0x0000, 0x800, CRC(f5e538a9) SHA1(19ac9525c9ad6bea1789cc9e63cdb7fe949867d9) )
ROM_END

ROM_START(aliencr)
	ROM_REGION( 0x0a0000, "maincpu", 0 )
	ROM_LOAD( "aliencr.bin", 0x000000, 0x040000, CRC(60edf4e1) SHA1(a1e6ad82b66a82c25e0a9e25fb8be370f49c8c2d) )

	ROM_REGION( 0x800, "sub", 0 )
	ROM_LOAD( "u1.bin", 0x0000, 0x800, CRC(f5e538a9) SHA1(19ac9525c9ad6bea1789cc9e63cdb7fe949867d9) )
ROM_END

ROM_START(paclandp)
	ROM_REGION( 0x0a0000, "maincpu", 0 )
	ROM_LOAD( "paclandp.bin", 0x000000, 0x040000, CRC(14fad3ba) SHA1(fc0166da82ed3cf4a4e06fc6c73fd3184ba8bb3b) )

	ROM_REGION( 0x800, "sub", 0 )
	ROM_LOAD( "u1.bin", 0x0000, 0x800, CRC(f5e538a9) SHA1(19ac9525c9ad6bea1789cc9e63cdb7fe949867d9) )
ROM_END

GAME( 1989, blazlaz, 0, uapce, uapce, uapce_state, pce_common, ROT0, "Hudson Soft", "Blazing Lazers (United Amusements PC Engine)",                         MACHINE_IMPERFECT_SOUND )
GAME( 1989, keith,   0, uapce, uapce, uapce_state, pce_common, ROT0, "Hudson Soft", "Keith Courage In Alpha Zones (United Amusements PC Engine)",           MACHINE_IMPERFECT_SOUND )
GAME( 1989, aliencr, 0, uapce, uapce, uapce_state, pce_common, ROT0, "Hudson Soft", "Alien Crush (United Amusements PC Engine)",                            MACHINE_IMPERFECT_SOUND )
GAME( 1989, paclandp,0, uapce, uapce, uapce_state, pce_common, ROT0, "Namco",       "Pac-Land (United Amusements PC Engine)",                               MACHINE_IMPERFECT_SOUND )