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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
|
// license:BSD-3-Clause
// copyright-holders:Stefan Jokisch
/***************************************************************************
Atari Sprint 4 driver
***************************************************************************/
#include "emu.h"
#include "audio/sprint4.h"
#include "cpu/m6502/m6502.h"
#include "machine/74259.h"
#include "machine/watchdog.h"
#include "sound/discrete.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
namespace {
#define MASTER_CLOCK 12096000
#define HTOTAL 384
#define VTOTAL 262
#define PIXEL_CLOCK (MASTER_CLOCK / 2)
class sprint4_state : public driver_device
{
public:
sprint4_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_watchdog(*this, "watchdog"),
m_discrete(*this, "discrete"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
m_io_wheel(*this, "WHEEL%u", 1U),
m_io_lever(*this, "LEVER%u", 1U),
m_io_in0(*this, "IN0"),
m_io_analog(*this, "ANALOG"),
m_io_coin(*this, "COIN"),
m_io_collision(*this, "COLLISION"),
m_io_dip(*this, "DIP")
{ }
void sprint4(machine_config &config);
template <int N> DECLARE_READ_LINE_MEMBER(lever_r);
template <int N> DECLARE_READ_LINE_MEMBER(wheel_r);
template <int N> DECLARE_READ_LINE_MEMBER(collision_flipflop_r);
private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
void cpu_map(address_map &map);
uint8_t wram_r(offs_t offset);
uint8_t analog_r(offs_t offset);
uint8_t coin_r(offs_t offset);
uint8_t collision_r(offs_t offset);
uint8_t options_r(offs_t offset);
void wram_w(offs_t offset, uint8_t data);
void collision_reset_w(offs_t offset, uint8_t data);
void da_latch_w(uint8_t data);
[[maybe_unused]] void lockout_w(offs_t offset, uint8_t data);
void video_ram_w(offs_t offset, uint8_t data);
void bang_w(uint8_t data);
void attract_w(uint8_t data);
void palette_init(palette_device &palette) const;
TILE_GET_INFO_MEMBER(tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
TIMER_CALLBACK_MEMBER(nmi_callback);
required_device<cpu_device> m_maincpu;
required_device<watchdog_timer_device> m_watchdog;
required_device<discrete_sound_device> m_discrete;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_shared_ptr<uint8_t> m_videoram;
required_ioport_array<4> m_io_wheel;
required_ioport_array<4> m_io_lever;
required_ioport m_io_in0;
required_ioport m_io_analog;
required_ioport m_io_coin;
required_ioport m_io_collision;
required_ioport m_io_dip;
int m_da_latch;
int m_steer_FF1[4];
int m_steer_FF2[4];
int m_gear[4];
uint8_t m_last_wheel[4];
int m_collision[4];
tilemap_t* m_playfield;
bitmap_ind16 m_helper;
emu_timer *m_nmi_timer;
};
template <int N>
READ_LINE_MEMBER(sprint4_state::lever_r)
{
return 4 * m_gear[N] > m_da_latch;
}
template <int N>
READ_LINE_MEMBER(sprint4_state::wheel_r)
{
return 8 * m_steer_FF1[N] + 8 * m_steer_FF2[N] > m_da_latch;
}
template <int N>
READ_LINE_MEMBER(sprint4_state::collision_flipflop_r)
{
return m_collision[N];
}
TIMER_CALLBACK_MEMBER(sprint4_state::nmi_callback)
{
int scanline = param;
/* MAME updates controls only once per frame but the game checks them on every NMI */
/* emulation of steering wheels isn't very accurate */
for (int i = 0; i < 4; i++)
{
uint8_t wheel = uint8_t(m_io_wheel[i]->read());
signed char delta = wheel - m_last_wheel[i];
if (delta < 0)
{
m_steer_FF2[i] = 0;
}
if (delta > 0)
{
m_steer_FF2[i] = 1;
}
m_steer_FF1[i] = (wheel >> 4) & 1;
uint8_t lever = uint8_t(m_io_lever[i]->read());
if (lever & 1) m_gear[i] = 1;
if (lever & 2) m_gear[i] = 2;
if (lever & 4) m_gear[i] = 3;
if (lever & 8) m_gear[i] = 4;
m_last_wheel[i] = wheel;
}
scanline += 64;
if (scanline >= VTOTAL)
{
scanline = 32;
}
/* NMI and watchdog are disabled during service mode */
m_watchdog->watchdog_enable(m_io_in0->read() & 0x40);
if (m_io_in0->read() & 0x40)
m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
m_nmi_timer->adjust(m_screen->time_until_pos(scanline), scanline);
}
void sprint4_state::machine_start()
{
m_nmi_timer = timer_alloc(FUNC(sprint4_state::nmi_callback), this);
save_item(NAME(m_da_latch));
save_item(NAME(m_steer_FF1));
save_item(NAME(m_steer_FF2));
save_item(NAME(m_gear));
save_item(NAME(m_last_wheel));
save_item(NAME(m_collision));
}
void sprint4_state::machine_reset()
{
m_nmi_timer->adjust(m_screen->time_until_pos(32), 32);
memset(m_steer_FF1, 0, sizeof m_steer_FF1);
memset(m_steer_FF2, 0, sizeof m_steer_FF2);
m_gear[0] = 1;
m_gear[1] = 1;
m_gear[2] = 1;
m_gear[3] = 1;
m_da_latch = 0;
}
uint8_t sprint4_state::wram_r(offs_t offset)
{
return m_videoram[0x380 + offset];
}
uint8_t sprint4_state::analog_r(offs_t offset)
{
return (m_io_analog->read() << (~offset & 7)) & 0x80;
}
uint8_t sprint4_state::coin_r(offs_t offset)
{
return (m_io_coin->read() << (~offset & 7)) & 0x80;
}
uint8_t sprint4_state::collision_r(offs_t offset)
{
return (m_io_collision->read() << (~offset & 7)) & 0x80;
}
uint8_t sprint4_state::options_r(offs_t offset)
{
return (m_io_dip->read() >> (2 * (offset & 3))) & 3;
}
void sprint4_state::wram_w(offs_t offset, uint8_t data)
{
m_videoram[0x380 + offset] = data;
}
void sprint4_state::collision_reset_w(offs_t offset, uint8_t data)
{
m_collision[(offset >> 1) & 3] = 0;
}
void sprint4_state::da_latch_w(uint8_t data)
{
m_da_latch = data & 15;
}
void sprint4_state::lockout_w(offs_t offset, uint8_t data)
{
machine().bookkeeping().coin_lockout_global_w(~offset & 1);
}
void sprint4_state::bang_w(uint8_t data)
{
m_discrete->write(SPRINT4_BANG_DATA, data & 0x0f);
}
void sprint4_state::attract_w(uint8_t data)
{
m_discrete->write(SPRINT4_ATTRACT_EN, data & 1);
}
void sprint4_state::palette_init(palette_device &palette) const
{
palette.set_indirect_color(0, rgb_t(0x00, 0x00, 0x00)); // black
palette.set_indirect_color(1, rgb_t(0xfc, 0xdf, 0x80)); // peach
palette.set_indirect_color(2, rgb_t(0xf0, 0x00, 0xf0)); // violet
palette.set_indirect_color(3, rgb_t(0x00, 0xf0, 0x0f)); // green
palette.set_indirect_color(4, rgb_t(0x30, 0x4f, 0xff)); // blue
palette.set_indirect_color(5, rgb_t(0xff, 0xff, 0xff)); // white
palette.set_pen_indirect(0, 0);
palette.set_pen_indirect(2, 0);
palette.set_pen_indirect(4, 0);
palette.set_pen_indirect(6, 0);
palette.set_pen_indirect(8, 0);
palette.set_pen_indirect(1, 1);
palette.set_pen_indirect(3, 2);
palette.set_pen_indirect(5, 3);
palette.set_pen_indirect(7, 4);
palette.set_pen_indirect(9, 5);
}
TILE_GET_INFO_MEMBER(sprint4_state::tile_info)
{
uint8_t code = m_videoram[tile_index];
if ((code & 0x30) == 0x30)
tileinfo.set(0, code & ~0x40, (code >> 6) ^ 3, 0);
else
tileinfo.set(0, code, 4, 0);
}
void sprint4_state::video_start()
{
m_screen->register_screen_bitmap(m_helper);
m_playfield = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sprint4_state::tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
}
uint32_t sprint4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_playfield->draw(screen, bitmap, cliprect, 0, 0);
for (int i = 0; i < 4; i++)
{
int bank = 0;
uint8_t horz = m_videoram[0x390 + 2 * i + 0];
uint8_t attr = m_videoram[0x390 + 2 * i + 1];
uint8_t vert = m_videoram[0x398 + 2 * i + 0];
uint8_t code = m_videoram[0x398 + 2 * i + 1];
if (i & 1)
bank = 32;
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
(code >> 3) | bank,
(attr & 0x80) ? 4 : i,
0, 0,
horz - 15,
vert - 15, 0);
}
return 0;
}
WRITE_LINE_MEMBER(sprint4_state::screen_vblank)
{
// rising edge
if (state)
{
/* check for sprite-playfield collisions */
for (int i = 0; i < 4; i++)
{
int bank = 0;
uint8_t horz = m_videoram[0x390 + 2 * i + 0];
uint8_t vert = m_videoram[0x398 + 2 * i + 0];
uint8_t code = m_videoram[0x398 + 2 * i + 1];
rectangle rect(
horz - 15,
horz - 15 + m_gfxdecode->gfx(1)->width() - 1,
vert - 15,
vert - 15 + m_gfxdecode->gfx(1)->height() - 1);
rect &= m_screen->visible_area();
m_playfield->draw(*m_screen, m_helper, rect, 0, 0);
if (i & 1)
bank = 32;
m_gfxdecode->gfx(1)->transpen(m_helper,rect,
(code >> 3) | bank,
4,
0, 0,
horz - 15,
vert - 15, 1);
for (int y = rect.top(); y <= rect.bottom(); y++)
for (int x = rect.left(); x <= rect.right(); x++)
if (m_palette->pen_indirect(m_helper.pix(y, x)) != 0)
m_collision[i] = 1;
}
/* update sound status */
m_discrete->write(SPRINT4_MOTOR_DATA_1, m_videoram[0x391] & 15);
m_discrete->write(SPRINT4_MOTOR_DATA_2, m_videoram[0x393] & 15);
m_discrete->write(SPRINT4_MOTOR_DATA_3, m_videoram[0x395] & 15);
m_discrete->write(SPRINT4_MOTOR_DATA_4, m_videoram[0x397] & 15);
}
}
void sprint4_state::video_ram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
m_playfield->mark_tile_dirty(offset);
}
void sprint4_state::cpu_map(address_map &map)
{
map.global_mask(0x3fff);
map(0x0080, 0x00ff).mirror(0x700).rw(FUNC(sprint4_state::wram_r), FUNC(sprint4_state::wram_w));
map(0x0800, 0x0bff).mirror(0x400).ram().w(FUNC(sprint4_state::video_ram_w)).share("videoram");
map(0x0000, 0x0007).mirror(0x718).r(FUNC(sprint4_state::analog_r));
map(0x0020, 0x0027).mirror(0x718).r(FUNC(sprint4_state::coin_r));
map(0x0040, 0x0047).mirror(0x718).r(FUNC(sprint4_state::collision_r));
map(0x0060, 0x0063).mirror(0x71c).r(FUNC(sprint4_state::options_r));
map(0x1000, 0x17ff).portr("IN0");
map(0x1800, 0x1fff).portr("IN1");
map(0x0000, 0x0000).mirror(0x71f).w(FUNC(sprint4_state::attract_w));
map(0x0020, 0x0027).mirror(0x718).w(FUNC(sprint4_state::collision_reset_w));
map(0x0040, 0x0041).mirror(0x718).w(FUNC(sprint4_state::da_latch_w));
map(0x0042, 0x0043).mirror(0x718).w(FUNC(sprint4_state::bang_w));
map(0x0044, 0x0045).mirror(0x718).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
map(0x0060, 0x006f).mirror(0x710).w("latch", FUNC(f9334_device::write_a0));
map(0x2000, 0x27ff).noprw(); /* diagnostic ROM */
map(0x2800, 0x3fff).rom();
}
static INPUT_PORTS_START( sprint4 )
PORT_START("IN0")
PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
PORT_START("IN1")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE)
PORT_START("COLLISION")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 1 Gas") PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, collision_flipflop_r<0>)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 2 Gas") PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, collision_flipflop_r<1>)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 3 Gas") PORT_PLAYER(3)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, collision_flipflop_r<2>)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 4 Gas") PORT_PLAYER(4)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, collision_flipflop_r<3>)
PORT_START("COIN")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START3 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN4 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
PORT_START("DIP")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Language ) ) PORT_DIPLOCATION("DIP:8,7")
PORT_DIPSETTING( 0x00, DEF_STR( German ) )
PORT_DIPSETTING( 0x01, DEF_STR( French ) )
PORT_DIPSETTING( 0x02, DEF_STR( Spanish ) )
PORT_DIPSETTING( 0x03, DEF_STR( English ) )
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DIP:6")
PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) )
PORT_DIPNAME( 0x08, 0x08, "Allow Late Entry" ) PORT_DIPLOCATION("DIP:5")
PORT_DIPSETTING( 0x08, DEF_STR( No ) )
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
PORT_DIPNAME( 0xf0, 0xb0, "Play Time" ) PORT_DIPLOCATION("DIP:4,3,2,1")
PORT_DIPSETTING( 0x70, "60 seconds" )
PORT_DIPSETTING( 0xb0, "90 seconds" )
PORT_DIPSETTING( 0xd0, "120 seconds" )
PORT_DIPSETTING( 0xe0, "150 seconds" )
PORT_START("ANALOG")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, wheel_r<0>)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, lever_r<0>)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, wheel_r<1>)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, lever_r<1>)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, wheel_r<2>)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, lever_r<2>)
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, wheel_r<3>)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(sprint4_state, lever_r<3>)
PORT_START("WHEEL1")
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) PORT_PLAYER(1)
PORT_START("WHEEL2")
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) PORT_PLAYER(2)
PORT_START("WHEEL3")
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) PORT_PLAYER(3)
PORT_START("WHEEL4")
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) PORT_PLAYER(4)
PORT_START("LEVER1")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Player 1 Gear 1") PORT_CODE(KEYCODE_Z) PORT_PLAYER(1)
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Player 1 Gear 2") PORT_CODE(KEYCODE_X) PORT_PLAYER(1)
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Player 1 Gear 3") PORT_CODE(KEYCODE_C) PORT_PLAYER(1)
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Player 1 Gear 4") PORT_CODE(KEYCODE_V) PORT_PLAYER(1)
PORT_START("LEVER2")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Player 2 Gear 1") PORT_CODE(KEYCODE_Q) PORT_PLAYER(2)
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Player 2 Gear 2") PORT_CODE(KEYCODE_W) PORT_PLAYER(2)
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Player 2 Gear 3") PORT_CODE(KEYCODE_E) PORT_PLAYER(2)
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Player 2 Gear 4") PORT_CODE(KEYCODE_R) PORT_PLAYER(2)
PORT_START("LEVER3")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Player 3 Gear 1") PORT_CODE(KEYCODE_Y) PORT_PLAYER(3)
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Player 3 Gear 2") PORT_CODE(KEYCODE_U) PORT_PLAYER(3)
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Player 3 Gear 3") PORT_CODE(KEYCODE_I) PORT_PLAYER(3)
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Player 3 Gear 4") PORT_CODE(KEYCODE_O) PORT_PLAYER(3)
PORT_START("LEVER4")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Player 4 Gear 1") PORT_PLAYER(4)
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Player 4 Gear 2") PORT_PLAYER(4)
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Player 4 Gear 3") PORT_PLAYER(4)
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Player 4 Gear 4") PORT_PLAYER(4)
PORT_START("MOTOR1")
PORT_ADJUSTER( 35, "Motor 1 RPM" )
PORT_START("MOTOR2")
PORT_ADJUSTER( 40, "Motor 2 RPM" )
PORT_START("MOTOR3")
PORT_ADJUSTER( 35, "Motor 3 RPM" )
PORT_START("MOTOR4")
PORT_ADJUSTER( 40, "Motor 4 RPM" )
INPUT_PORTS_END
static const gfx_layout car_layout =
{
12, 16,
RGN_FRAC(1,3),
1,
{ 0 },
{
7 + RGN_FRAC(0,3), 6 + RGN_FRAC(0,3), 5 + RGN_FRAC(0,3), 4 + RGN_FRAC(0,3),
7 + RGN_FRAC(1,3), 6 + RGN_FRAC(1,3), 5 + RGN_FRAC(1,3), 4 + RGN_FRAC(1,3),
7 + RGN_FRAC(2,3), 6 + RGN_FRAC(2,3), 5 + RGN_FRAC(2,3), 4 + RGN_FRAC(2,3)
},
{
0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38,
0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78
},
0x80
};
static GFXDECODE_START( gfx_sprint4 )
GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x1, 0, 5 )
GFXDECODE_ENTRY( "gfx2", 0, car_layout, 0, 5 )
GFXDECODE_END
void sprint4_state::sprint4(machine_config &config)
{
/* basic machine hardware */
M6502(config, m_maincpu, PIXEL_CLOCK / 8);
m_maincpu->set_addrmap(AS_PROGRAM, &sprint4_state::cpu_map);
WATCHDOG_TIMER(config, m_watchdog).set_vblank_count(m_screen, 8);
/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(PIXEL_CLOCK, HTOTAL, 0, 256, VTOTAL, 0, 224);
m_screen->set_screen_update(FUNC(sprint4_state::screen_update));
m_screen->screen_vblank().set(FUNC(sprint4_state::screen_vblank));
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_sprint4);
PALETTE(config, m_palette, FUNC(sprint4_state::palette_init), 10, 6);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
f9334_device &latch(F9334(config, "latch")); // at E11
latch.q_out_cb<0>().set_output("led0"); // START LAMP 1
latch.q_out_cb<1>().set_output("led1"); // START LAMP 2
latch.q_out_cb<2>().set_output("led2"); // START LAMP 3
latch.q_out_cb<3>().set_output("led3"); // START LAMP 4
latch.q_out_cb<4>().set("discrete", FUNC(discrete_device::write_line<SPRINT4_SCREECH_EN_1>));
latch.q_out_cb<5>().set("discrete", FUNC(discrete_device::write_line<SPRINT4_SCREECH_EN_2>));
latch.q_out_cb<6>().set("discrete", FUNC(discrete_device::write_line<SPRINT4_SCREECH_EN_3>));
latch.q_out_cb<7>().set("discrete", FUNC(discrete_device::write_line<SPRINT4_SCREECH_EN_4>));
DISCRETE(config, m_discrete, sprint4_discrete);
m_discrete->add_route(0, "lspeaker", 1.0);
m_discrete->add_route(1, "rspeaker", 1.0);
}
ROM_START( sprint4 )
ROM_REGION( 0x4000, "maincpu", 0 )
ROM_LOAD ( "30031.c1", 0x2800, 0x0800, CRC(017ee7c4) SHA1(9386cacc619669c18af31f66691a45af6dafef64) )
ROM_LOAD_NIB_LOW ( "30036-02.n1", 0x3000, 0x0800, CRC(883b9d7c) SHA1(af52ffdd9cd8dfed54013c9b0d3c6e48c7419d17) )
ROM_LOAD_NIB_HIGH( "30037-02.k1", 0x3000, 0x0800, CRC(c297fbd8) SHA1(8cc0f486429e12bee21a5dd1135e799196480044) )
ROM_LOAD ( "30033.e1", 0x3800, 0x0800, CRC(b8b717b7) SHA1(2f6b1a0e9803901d9ba79d1f19a025f6a6134756) )
ROM_REGION( 0x0800, "gfx1", 0 ) /* playfield */
ROM_LOAD( "30027.h5", 0x0000, 0x0800, CRC(3a752e07) SHA1(d990f94b296409d47e8bada98ddbed5f76567e1b) )
ROM_REGION( 0x0c00, "gfx2", 0 ) /* motion */
ROM_LOAD( "30028-01.n6", 0x0000, 0x0400, CRC(3ebcb13f) SHA1(e0b87239081f12f6613d3db6a8cb5b80937df7d7) )
ROM_LOAD( "30029-01.m6", 0x0400, 0x0400, CRC(963a8424) SHA1(d52a0e73c54154531e825153012687bdb85e479a) )
ROM_LOAD( "30030-01.l6", 0x0800, 0x0400, CRC(e94dfc2d) SHA1(9c5b1401c4aadda0a3aee76e4f92e73ae1d35cb7) )
ROM_REGION( 0x0200, "user1", 0 )
ROM_LOAD( "30024-01.p8", 0x0000, 0x0200, CRC(e71d2e22) SHA1(434c3a8237468604cce7feb40e6061d2670013b3) ) /* SYNC */
ROM_END
ROM_START( sprint4a )
ROM_REGION( 0x4000, "maincpu", 0 )
ROM_LOAD ( "30031.c1", 0x2800, 0x0800, CRC(017ee7c4) SHA1(9386cacc619669c18af31f66691a45af6dafef64) )
ROM_LOAD_NIB_LOW ( "30036-02.n1", 0x3000, 0x0800, CRC(883b9d7c) SHA1(af52ffdd9cd8dfed54013c9b0d3c6e48c7419d17) )
ROM_LOAD_NIB_HIGH( "30037-02.k1", 0x3000, 0x0800, CRC(c297fbd8) SHA1(8cc0f486429e12bee21a5dd1135e799196480044) )
ROM_LOAD ( "30033.e1", 0x3800, 0x0800, CRC(b8b717b7) SHA1(2f6b1a0e9803901d9ba79d1f19a025f6a6134756) )
ROM_REGION( 0x0800, "gfx1", 0 ) /* playfield */
ROM_LOAD( "30027.h5", 0x0000, 0x0800, CRC(3a752e07) SHA1(d990f94b296409d47e8bada98ddbed5f76567e1b) )
ROM_REGION( 0x0c00, "gfx2", 0 ) /* motion */
ROM_LOAD( "30028-03.n6", 0x0000, 0x0400, CRC(d3337030) SHA1(3e73fc45bdcaa52dc1aa01489b46240284562ab7) )
ROM_LOAD( "30029-03.m6", 0x0400, 0x0400, NO_DUMP )
ROM_LOAD( "30030-03.l6", 0x0800, 0x0400, CRC(aa1b45ab) SHA1(1ddb64d4ec92a1383866daaefa556499837decd1) )
ROM_REGION( 0x0200, "user1", 0 )
ROM_LOAD( "30024-01.p8", 0x0000, 0x0200, CRC(e71d2e22) SHA1(434c3a8237468604cce7feb40e6061d2670013b3) ) /* SYNC */
ROM_END
} // anonymous namespace
GAME( 1977, sprint4, 0, sprint4, sprint4, sprint4_state, empty_init, ROT180, "Atari", "Sprint 4 (set 1)", MACHINE_SUPPORTS_SAVE ) /* large cars */
GAME( 1977, sprint4a, sprint4, sprint4, sprint4, sprint4_state, empty_init, ROT180, "Atari", "Sprint 4 (set 2)", MACHINE_SUPPORTS_SAVE ) /* small cars */
|