~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to mess/src/mame/drivers/polyplay.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 
3
 
      Poly-Play
4
 
      (c) 1985 by VEB Polytechnik Karl-Marx-Stadt
5
 
 
6
 
      driver by Martin Buchholz (buchholz@mail.uni-greifswald.de)
7
 
 
8
 
      Very special thanks to the following people, each one of them spent
9
 
      some of their spare time to make this driver working:
10
 
      - Juergen Oppermann and Volker Hann for electronical assistance,
11
 
        repair work and ROM dumping.
12
 
      - Jan-Ole Christian from the Videogamemuseum in Berlin, which houses
13
 
        one of the last existing Poly-Play arcade automatons. He also
14
 
        provided me with schematics and service manuals.
15
 
 
16
 
 
17
 
memory map:
18
 
 
19
 
0000 - 03ff OS ROM
20
 
0400 - 07ff Game ROM (used for Abfahrtslauf)
21
 
0800 - 0cff Menu Screen ROM
22
 
 
23
 
0d00 - 0fff work RAM
24
 
 
25
 
1000 - 4fff GAME ROM (pcb 2 - Abfahrtslauf          (1000 - 1bff)
26
 
                              Hirschjagd            (1c00 - 27ff)
27
 
                              Hase und Wolf         (2800 - 3fff)
28
 
                              Schmetterlingsfang    (4000 - 4fff)
29
 
5000 - 8fff GAME ROM (pcb 1 - Schiessbude           (5000 - 5fff)
30
 
                              Autorennen            (6000 - 73ff)
31
 
                              opto-akust. Merkspiel (7400 - 7fff)
32
 
                              Wasserrohrbruch       (8000 - 8fff)
33
 
 
34
 
e800 - ebff character ROM (chr 00..7f) 1 bit per pixel
35
 
ec00 - f7ff character RAM (chr 80..ff) 3 bit per pixel
36
 
f800 - ffff video RAM
37
 
 
38
 
I/O ports:
39
 
 
40
 
read:
41
 
 
42
 
83        IN1
43
 
          used as hardware random number generator
44
 
 
45
 
84        IN0
46
 
          bit 0 = fire button
47
 
          bit 1 = right
48
 
          bit 2 = left
49
 
          bit 3 = up
50
 
          bit 4 = down
51
 
          bit 5 = unused
52
 
          bit 6 = Summe Spiele
53
 
          bit 7 = coinage (+IRQ to make the game acknowledge it)
54
 
 
55
 
85        bit 0-4 = light organ (unemulated :)) )
56
 
          bit 5-7 = sound parameter (unemulated, it's very difficult to
57
 
                    figure out how those work)
58
 
 
59
 
86        ???
60
 
 
61
 
87        PIO Control register
62
 
 
63
 
write:
64
 
80        Sound Channel 1
65
 
81        Sound Channel 2
66
 
82        generates 40 Hz timer for timeout in game title screens
67
 
83        generates main 75 Hz timer interrupt
68
 
 
69
 
The Poly-Play has a simple bookmarking system which can be activated
70
 
setting Bit 6 of PORTA (Summe Spiele) to low. It reads a double word
71
 
from 0c00 and displays it on the screen.
72
 
I currently haven't figured out how the I/O port handling for the book-
73
 
mark system works.
74
 
 
75
 
Uniquely the Poly-Play has a light organ which totally confuses you whilst
76
 
playing the automaton. Bits 1-5 of PORTB control the organ but it's not
77
 
emulated now. ;)
78
 
 
79
 
***************************************************************************/
80
 
 
81
 
#include "emu.h"
82
 
#include "cpu/z80/z80.h"
83
 
#include "sound/samples.h"
84
 
#include "includes/polyplay.h"
85
 
 
86
 
 
87
 
/* I/O Port handling */
88
 
static READ8_HANDLER( polyplay_random_read );
89
 
 
90
 
/* timer handling */
91
 
static TIMER_DEVICE_CALLBACK( polyplay_timer_callback );
92
 
static WRITE8_HANDLER( polyplay_start_timer2 );
93
 
static WRITE8_HANDLER( polyplay_sound_channel );
94
 
 
95
 
 
96
 
/* Polyplay Sound Interface */
97
 
static const samples_interface polyplay_samples_interface =
98
 
{
99
 
        2,
100
 
        NULL,
101
 
        polyplay_sh_start
102
 
};
103
 
 
104
 
 
105
 
static MACHINE_RESET( polyplay )
106
 
{
107
 
        polyplay_state *state = machine.driver_data<polyplay_state>();
108
 
        state->m_channel1_active = 0;
109
 
        state->m_channel1_const = 0;
110
 
        state->m_channel2_active = 0;
111
 
        state->m_channel2_const = 0;
112
 
 
113
 
        polyplay_set_channel1(machine, 0);
114
 
        polyplay_play_channel1(machine, 0);
115
 
        polyplay_set_channel2(machine, 0);
116
 
        polyplay_play_channel2(machine, 0);
117
 
 
118
 
        state->m_timer = machine.device<timer_device>("timer");
119
 
}
120
 
 
121
 
 
122
 
static INTERRUPT_GEN( periodic_interrupt )
123
 
{
124
 
        device_set_input_line_and_vector(device, 0, HOLD_LINE, 0x4e);
125
 
}
126
 
 
127
 
 
128
 
static INTERRUPT_GEN( coin_interrupt )
129
 
{
130
 
        polyplay_state *state = device->machine().driver_data<polyplay_state>();
131
 
 
132
 
        if (input_port_read(device->machine(), "INPUT") & 0x80)
133
 
                state->m_last = 0;
134
 
        else
135
 
        {
136
 
                if (state->m_last == 0)    /* coin inserted */
137
 
                        device_set_input_line_and_vector(device, 0, HOLD_LINE, 0x50);
138
 
 
139
 
                state->m_last = 1;
140
 
        }
141
 
}
142
 
 
143
 
 
144
 
/* memory mapping */
145
 
static ADDRESS_MAP_START( polyplay_map, AS_PROGRAM, 8 )
146
 
        AM_RANGE(0x0000, 0x0bff) AM_ROM
147
 
        AM_RANGE(0x0c00, 0x0fff) AM_RAM
148
 
        AM_RANGE(0x1000, 0x8fff) AM_ROM
149
 
        AM_RANGE(0xe800, 0xebff) AM_ROM AM_REGION("gfx1", 0)
150
 
        AM_RANGE(0xec00, 0xf7ff) AM_RAM_WRITE(polyplay_characterram_w) AM_BASE_MEMBER(polyplay_state, m_characterram)
151
 
        AM_RANGE(0xf800, 0xffff) AM_RAM AM_BASE_MEMBER(polyplay_state, m_videoram)
152
 
ADDRESS_MAP_END
153
 
 
154
 
 
155
 
/* port mapping */
156
 
static ADDRESS_MAP_START( polyplay_io_map, AS_IO, 8 )
157
 
        ADDRESS_MAP_GLOBAL_MASK(0xff)
158
 
        AM_RANGE(0x80, 0x81) AM_WRITE(polyplay_sound_channel)
159
 
        AM_RANGE(0x82, 0x82) AM_WRITE(polyplay_start_timer2)
160
 
        AM_RANGE(0x83, 0x83) AM_READ(polyplay_random_read)
161
 
        AM_RANGE(0x84, 0x84) AM_READ_PORT("INPUT")
162
 
ADDRESS_MAP_END
163
 
 
164
 
 
165
 
static INPUT_PORTS_START( polyplay )
166
 
        PORT_START("INPUT")     /* IN0 */
167
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
168
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
169
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
170
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
171
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
172
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
173
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Bookkeeping Info") PORT_CODE(KEYCODE_F2)
174
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
175
 
INPUT_PORTS_END
176
 
 
177
 
 
178
 
static WRITE8_HANDLER( polyplay_sound_channel )
179
 
{
180
 
        polyplay_state *state = space->machine().driver_data<polyplay_state>();
181
 
        switch(offset) {
182
 
        case 0x00:
183
 
                if (state->m_channel1_const) {
184
 
                        if (data <= 1) {
185
 
                                polyplay_set_channel1(space->machine(), 0);
186
 
                        }
187
 
                        state->m_channel1_const = 0;
188
 
                        polyplay_play_channel1(space->machine(), data*state->m_prescale1);
189
 
 
190
 
                }
191
 
                else {
192
 
                        state->m_prescale1 = (data & 0x20) ? 16 : 1;
193
 
                        if (data & 0x04) {
194
 
                                polyplay_set_channel1(space->machine(), 1);
195
 
                                state->m_channel1_const = 1;
196
 
                        }
197
 
                        if ((data == 0x41) || (data == 0x65) || (data == 0x45)) {
198
 
                                polyplay_set_channel1(space->machine(), 0);
199
 
                                polyplay_play_channel1(space->machine(), 0);
200
 
                        }
201
 
                }
202
 
                break;
203
 
        case 0x01:
204
 
                if (state->m_channel2_const) {
205
 
                        if (data <= 1) {
206
 
                                polyplay_set_channel2(space->machine(), 0);
207
 
                        }
208
 
                        state->m_channel2_const = 0;
209
 
                        polyplay_play_channel2(space->machine(), data*state->m_prescale2);
210
 
 
211
 
                }
212
 
                else {
213
 
                        state->m_prescale2 = (data & 0x20) ? 16 : 1;
214
 
                        if (data & 0x04) {
215
 
                                polyplay_set_channel2(space->machine(), 1);
216
 
                                state->m_channel2_const = 1;
217
 
                        }
218
 
                        if ((data == 0x41) || (data == 0x65) || (data == 0x45)) {
219
 
                                polyplay_set_channel2(space->machine(), 0);
220
 
                                polyplay_play_channel2(space->machine(), 0);
221
 
                        }
222
 
                }
223
 
                break;
224
 
        }
225
 
}
226
 
 
227
 
static WRITE8_HANDLER( polyplay_start_timer2 )
228
 
{
229
 
        polyplay_state *state = space->machine().driver_data<polyplay_state>();
230
 
        if (data == 0x03)
231
 
                state->m_timer->reset();
232
 
 
233
 
        if (data == 0xb5)
234
 
                state->m_timer->adjust(attotime::from_hz(40), 0, attotime::from_hz(40));
235
 
}
236
 
 
237
 
static READ8_HANDLER( polyplay_random_read )
238
 
{
239
 
        return space->machine().rand() & 0xff;
240
 
}
241
 
 
242
 
/* graphic structures */
243
 
static const gfx_layout charlayout_1_bit =
244
 
{
245
 
        8,8,    /* 8*8 characters */
246
 
        128,    /* 128 characters */
247
 
        1,      /* 1 bit per pixel */
248
 
        { 0 },
249
 
        { 0, 1, 2, 3, 4, 5, 6, 7 },
250
 
        { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
251
 
        8*8     /* every char takes 8 consecutive bytes */
252
 
};
253
 
 
254
 
static const gfx_layout charlayout_3_bit =
255
 
{
256
 
        8,8,    /* 8*8 characters */
257
 
        128,    /* 128 characters */
258
 
        3,      /* 3 bit per pixel */
259
 
        { 0, 128*8*8, 128*8*8 + 128*8*8 },    /* offset for each bitplane */
260
 
        { 0, 1, 2, 3, 4, 5, 6, 7 },
261
 
        { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
262
 
        8*8     /* every char takes 8 consecutive bytes */
263
 
};
264
 
 
265
 
static GFXDECODE_START( polyplay )
266
 
        GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout_1_bit, 0, 1 )
267
 
        GFXDECODE_ENTRY( NULL,   0xec00, charlayout_3_bit, 2, 1 )
268
 
GFXDECODE_END
269
 
 
270
 
 
271
 
/* the machine driver */
272
 
 
273
 
static MACHINE_CONFIG_START( polyplay, polyplay_state )
274
 
 
275
 
        /* basic machine hardware */
276
 
        MCFG_CPU_ADD("maincpu", Z80, 9830400/4)
277
 
        MCFG_CPU_PROGRAM_MAP(polyplay_map)
278
 
        MCFG_CPU_IO_MAP(polyplay_io_map)
279
 
        MCFG_CPU_PERIODIC_INT(periodic_interrupt,75)
280
 
        MCFG_CPU_VBLANK_INT("screen", coin_interrupt)
281
 
 
282
 
        MCFG_MACHINE_RESET(polyplay)
283
 
 
284
 
        MCFG_TIMER_ADD("timer", polyplay_timer_callback)
285
 
 
286
 
 
287
 
        /* video hardware */
288
 
        MCFG_SCREEN_ADD("screen", RASTER)
289
 
        MCFG_SCREEN_REFRESH_RATE(50)
290
 
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
291
 
        MCFG_SCREEN_SIZE(64*8, 32*8)
292
 
        MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
293
 
        MCFG_SCREEN_UPDATE(polyplay)
294
 
 
295
 
        MCFG_GFXDECODE(polyplay)
296
 
        MCFG_PALETTE_LENGTH(10)
297
 
 
298
 
        MCFG_PALETTE_INIT(polyplay)
299
 
        MCFG_VIDEO_START(polyplay)
300
 
 
301
 
        /* sound hardware */
302
 
        MCFG_SPEAKER_STANDARD_MONO("mono")
303
 
 
304
 
        MCFG_SOUND_ADD("samples", SAMPLES, 0)
305
 
        MCFG_SOUND_CONFIG(polyplay_samples_interface)
306
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
307
 
MACHINE_CONFIG_END
308
 
 
309
 
 
310
 
/* ROM loading and mapping */
311
 
ROM_START( polyplay )
312
 
        ROM_REGION( 0x10000, "maincpu", 0 )
313
 
        ROM_LOAD( "cpu_0000.37",       0x0000, 0x0400, CRC(87884c5f) SHA1(849c6b3f40496c694a123d6eec268a7128c037f0) )
314
 
        ROM_LOAD( "cpu_0400.36",       0x0400, 0x0400, CRC(d5c84829) SHA1(baa8790e77db66e1e543b3a0e5390cc71256de2f) )
315
 
        ROM_LOAD( "cpu_0800.35",       0x0800, 0x0400, CRC(5f36d08e) SHA1(08ecf8143e818a9844b4f168e68629d6d4481a8a) )
316
 
        ROM_LOAD( "2_-_1000.14",       0x1000, 0x0400, CRC(950dfcdb) SHA1(74170d5c99d1ea61fe37d1fe023dca96efb1ca69) )
317
 
        ROM_LOAD( "2_-_1400.10",       0x1400, 0x0400, CRC(829f74ca) SHA1(4df9d3c24e1bc4c2c953dce9530e43a00ecf67fc) )
318
 
        ROM_LOAD( "2_-_1800.6",        0x1800, 0x0400, CRC(b69306f5) SHA1(66d7c3cf76782a5b6eafa3e1513ecc9a9df0e0e1) )
319
 
        ROM_LOAD( "2_-_1c00.2",        0x1c00, 0x0400, CRC(aede2280) SHA1(0a01394ab70d07d666e955c87a08cb4d4945767e) )
320
 
        ROM_LOAD( "2_-_2000.15",       0x2000, 0x0400, CRC(6c7ad0d8) SHA1(df959d1e43fde96b5e21e3c53b397209a98ea423) )
321
 
        ROM_LOAD( "2_-_2400.11",       0x2400, 0x0400, CRC(bc7462f0) SHA1(01ca680c74b92b9ba5a85f98e0933ef1e754bfc1) )
322
 
        ROM_LOAD( "2_-_2800.7",        0x2800, 0x0400, CRC(9ccf1958) SHA1(6bdf04d7796074af7327fab6717b52736540f97c) )
323
 
        ROM_LOAD( "2_-_2c00.3",        0x2c00, 0x0400, CRC(21827930) SHA1(71d27d68f6973a59996102381f8754d9b353c65a) )
324
 
        ROM_LOAD( "2_-_3000.16",       0x3000, 0x0400, CRC(b3b3c0ec) SHA1(a94cd9794d59ea2f9ddd8bef86e6e3a269b276ad) )
325
 
        ROM_LOAD( "2_-_3400.12",       0x3400, 0x0400, CRC(bd416cd0) SHA1(57391cc4a417468455b45014969067629fd629b8) )
326
 
        ROM_LOAD( "2_-_3800.8",        0x3800, 0x0400, CRC(1c470b7c) SHA1(f7c71ee1752ecd4f30a35f14ee392b37febefb9c) )
327
 
        ROM_LOAD( "2_-_3c00.4",        0x3c00, 0x0400, CRC(b8354a19) SHA1(58ea7798ecc1be987b1217f4078c7cb366622dd3) )
328
 
        ROM_LOAD( "2_-_4000.17",       0x4000, 0x0400, CRC(1e01041e) SHA1(ff63e4bb924d1c26e445a28c5f8cbc696b4b9f5a) )
329
 
        ROM_LOAD( "2_-_4400.13",       0x4400, 0x0400, CRC(fe4d8959) SHA1(233f97956f4c819558d5d38034d92edc0e86a0de) )
330
 
        ROM_LOAD( "2_-_4800.9",        0x4800, 0x0400, CRC(c45f1d9d) SHA1(f3373f1f5a3c6099fd38e65f66e024ef042a984c) )
331
 
        ROM_LOAD( "2_-_4c00.5",        0x4c00, 0x0400, CRC(26950ad6) SHA1(881f5f0f4806ba6f21d0b28a70fc43363d51419b) )
332
 
        ROM_LOAD( "1_-_5000.30",       0x5000, 0x0400, CRC(9f5e2ba1) SHA1(58c696afbda8932f5e401b0a82b2de5cdfc2d1fb) )
333
 
        ROM_LOAD( "1_-_5400.26",       0x5400, 0x0400, CRC(b5f9a780) SHA1(eb785b7668f6af0a9df84cbd1905173869377e6c) )
334
 
        ROM_LOAD( "1_-_5800.22",       0x5800, 0x0400, CRC(d973ad12) SHA1(81cc5e19e83f2e5b10b885583c250a2ff66bafe5) )
335
 
        ROM_LOAD( "1_-_5c00.18",       0x5c00, 0x0400, CRC(9c22ea79) SHA1(e25ed745589a83e297dba936a6e5979f1b31b2d5) )
336
 
        ROM_LOAD( "1_-_6000.31",       0x6000, 0x0400, CRC(245c49ca) SHA1(12e5a032327fb45b2a240aff11b0c5d1798932f4) )
337
 
        ROM_LOAD( "1_-_6400.27",       0x6400, 0x0400, CRC(181e427e) SHA1(6b65409cd8410e632093662f5de2989dd9134620) )
338
 
        ROM_LOAD( "1_-_6800.23",       0x6800, 0x0400, CRC(8a6c1f97) SHA1(bf9d4dda8ac933a4a700f52540dcd1197f0a64eb) )
339
 
        ROM_LOAD( "1_-_6c00.19",       0x6c00, 0x0400, CRC(77901dc9) SHA1(b1132e06011aa8f7a95c43f447cd422f01139bb1) )
340
 
        ROM_LOAD( "1_-_7000.32",       0x7000, 0x0400, CRC(83ffbe57) SHA1(1e06408f7b4c9a4e5cadab58f6efbc03a5bedc1e) )
341
 
        ROM_LOAD( "1_-_7400.28",       0x7400, 0x0400, CRC(e2a66531) SHA1(1c9eb54e9c8a13f26335d8fb79fe5e39c28b3255) )
342
 
        ROM_LOAD( "1_-_7800.24",       0x7800, 0x0400, CRC(1d0803ef) SHA1(15a1996f9262f26cf531f329e086b10b3c25ce92) )
343
 
        ROM_LOAD( "1_-_7c00.20",       0x7c00, 0x0400, CRC(17dfa7e4) SHA1(afb471dc6cb2faccfb4305540f75162fcee3d622) )
344
 
        ROM_LOAD( "1_-_8000.33",       0x8000, 0x0400, CRC(6ee02375) SHA1(fbf797b655639ee442804a30fd3a06bbf261999a) )
345
 
        ROM_LOAD( "1_-_8400.29",       0x8400, 0x0400, CRC(9db09598) SHA1(8eb385542a617b23caad3ce7bbdd9714c1dd684f) )
346
 
        ROM_LOAD( "1_-_8800.25",       0x8800, 0x0400, CRC(ca2f963f) SHA1(34295f02bfd1bca141d650bbbbc1989e01c67b2f) )
347
 
        ROM_LOAD( "1_-_8c00.21",       0x8c00, 0x0400, CRC(0c7dec2d) SHA1(48d776b97c1eca851f89b0c5df4d5765d9aa0319) )
348
 
 
349
 
        ROM_REGION( 0x800, "gfx1", 0 )
350
 
        ROM_LOAD( "char.1",            0x0000, 0x0400, CRC(5242dd6b) SHA1(ba8f317df62fe4360757333215ce3c8223c68c4e) )
351
 
ROM_END
352
 
 
353
 
 
354
 
static TIMER_DEVICE_CALLBACK( polyplay_timer_callback )
355
 
{
356
 
        cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0x4c);
357
 
}
358
 
 
359
 
/* game driver */
360
 
GAME( 1985, polyplay, 0, polyplay, polyplay, 0, ROT0, "VEB Polytechnik Karl-Marx-Stadt", "Poly-Play", 0 )