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

« back to all changes in this revision

Viewing changes to src/mame/drivers/sprint4.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#define PIXEL_CLOCK    (MASTER_CLOCK / 2)
18
18
 
19
19
 
20
 
static CUSTOM_INPUT( get_lever )
21
 
{
22
 
        sprint4_state *state = field.machine().driver_data<sprint4_state>();
23
 
        int n = (FPTR) param;
24
 
 
25
 
        return 4 * state->m_gear[n] > state->m_da_latch;
26
 
}
27
 
 
28
 
 
29
 
static CUSTOM_INPUT( get_wheel )
30
 
{
31
 
        sprint4_state *state = field.machine().driver_data<sprint4_state>();
32
 
        int n = (FPTR) param;
33
 
 
34
 
        return 8 * state->m_steer_FF1[n] + 8 * state->m_steer_FF2[n] > state->m_da_latch;
35
 
}
36
 
 
37
 
 
38
 
static CUSTOM_INPUT( get_collision )
39
 
{
40
 
        sprint4_state *state = field.machine().driver_data<sprint4_state>();
41
 
        int n = (FPTR) param;
42
 
 
43
 
        return state->m_collision[n];
 
20
CUSTOM_INPUT_MEMBER(sprint4_state::get_lever)
 
21
{
 
22
        int n = (FPTR) param;
 
23
 
 
24
        return 4 * m_gear[n] > m_da_latch;
 
25
}
 
26
 
 
27
 
 
28
CUSTOM_INPUT_MEMBER(sprint4_state::get_wheel)
 
29
{
 
30
        int n = (FPTR) param;
 
31
 
 
32
        return 8 * m_steer_FF1[n] + 8 * m_steer_FF2[n] > m_da_latch;
 
33
}
 
34
 
 
35
 
 
36
CUSTOM_INPUT_MEMBER(sprint4_state::get_collision)
 
37
{
 
38
        int n = (FPTR) param;
 
39
 
 
40
        return m_collision[n];
44
41
}
45
42
 
46
43
 
53
50
 
54
51
        UINT8 wheel[4] =
55
52
        {
56
 
                input_port_read(machine, "WHEEL1"),
57
 
                input_port_read(machine, "WHEEL2"),
58
 
                input_port_read(machine, "WHEEL3"),
59
 
                input_port_read(machine, "WHEEL4")
 
53
                state->ioport("WHEEL1")->read(),
 
54
                state->ioport("WHEEL2")->read(),
 
55
                state->ioport("WHEEL3")->read(),
 
56
                state->ioport("WHEEL4")->read()
60
57
        };
61
58
        UINT8 lever[4] =
62
59
        {
63
 
                input_port_read(machine, "LEVER1"),
64
 
                input_port_read(machine, "LEVER2"),
65
 
                input_port_read(machine, "LEVER3"),
66
 
                input_port_read(machine, "LEVER4")
 
60
                machine.root_device().ioport("LEVER1")->read(),
 
61
                machine.root_device().ioport("LEVER2")->read(),
 
62
                machine.root_device().ioport("LEVER3")->read(),
 
63
                machine.root_device().ioport("LEVER4")->read()
67
64
        };
68
65
 
69
66
        int i;
102
99
 
103
100
        /* NMI and watchdog are disabled during service mode */
104
101
 
105
 
        watchdog_enable(machine, input_port_read(machine, "IN0") & 0x40);
 
102
        machine.watchdog_enable(machine.root_device().ioport("IN0")->read() & 0x40);
106
103
 
107
 
        if (input_port_read(machine, "IN0") & 0x40)
 
104
        if (machine.root_device().ioport("IN0")->read() & 0x40)
108
105
                cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
109
106
 
110
107
        machine.scheduler().timer_set(machine.primary_screen->time_until_pos(scanline), FUNC(nmi_callback), scanline);
128
125
}
129
126
 
130
127
 
131
 
static READ8_HANDLER( sprint4_wram_r )
 
128
READ8_MEMBER(sprint4_state::sprint4_wram_r)
132
129
{
133
 
        sprint4_state *state = space->machine().driver_data<sprint4_state>();
134
 
        UINT8 *videoram = state->m_videoram;
 
130
        UINT8 *videoram = m_videoram;
135
131
        return videoram[0x380 + offset];
136
132
}
137
133
 
138
134
 
139
 
static READ8_HANDLER( sprint4_analog_r )
140
 
{
141
 
        return (input_port_read(space->machine(), "ANALOG") << (~offset & 7)) & 0x80;
142
 
}
143
 
static READ8_HANDLER( sprint4_coin_r )
144
 
{
145
 
        return (input_port_read(space->machine(), "COIN") << (~offset & 7)) & 0x80;
146
 
}
147
 
static READ8_HANDLER( sprint4_collision_r )
148
 
{
149
 
        return (input_port_read(space->machine(), "COLLISION") << (~offset & 7)) & 0x80;
150
 
}
151
 
 
152
 
 
153
 
static READ8_HANDLER( sprint4_options_r )
154
 
{
155
 
        return (input_port_read(space->machine(), "DIP") >> (2 * (offset & 3))) & 3;
156
 
}
157
 
 
158
 
 
159
 
static WRITE8_HANDLER( sprint4_wram_w )
160
 
{
161
 
        sprint4_state *state = space->machine().driver_data<sprint4_state>();
162
 
        UINT8 *videoram = state->m_videoram;
 
135
READ8_MEMBER(sprint4_state::sprint4_analog_r)
 
136
{
 
137
        return (ioport("ANALOG")->read() << (~offset & 7)) & 0x80;
 
138
}
 
139
READ8_MEMBER(sprint4_state::sprint4_coin_r)
 
140
{
 
141
        return (ioport("COIN")->read() << (~offset & 7)) & 0x80;
 
142
}
 
143
READ8_MEMBER(sprint4_state::sprint4_collision_r)
 
144
{
 
145
        return (ioport("COLLISION")->read() << (~offset & 7)) & 0x80;
 
146
}
 
147
 
 
148
 
 
149
READ8_MEMBER(sprint4_state::sprint4_options_r)
 
150
{
 
151
        return (ioport("DIP")->read() >> (2 * (offset & 3))) & 3;
 
152
}
 
153
 
 
154
 
 
155
WRITE8_MEMBER(sprint4_state::sprint4_wram_w)
 
156
{
 
157
        UINT8 *videoram = m_videoram;
163
158
        videoram[0x380 + offset] = data;
164
159
}
165
160
 
166
161
 
167
 
static WRITE8_HANDLER( sprint4_collision_reset_w )
168
 
{
169
 
        sprint4_state *state = space->machine().driver_data<sprint4_state>();
170
 
        state->m_collision[(offset >> 1) & 3] = 0;
171
 
}
172
 
 
173
 
 
174
 
static WRITE8_HANDLER( sprint4_da_latch_w )
175
 
{
176
 
        sprint4_state *state = space->machine().driver_data<sprint4_state>();
177
 
        state->m_da_latch = data & 15;
178
 
}
179
 
 
180
 
 
181
 
static WRITE8_HANDLER( sprint4_lamp_w )
182
 
{
183
 
        set_led_status(space->machine(), (offset >> 1) & 3, offset & 1);
 
162
WRITE8_MEMBER(sprint4_state::sprint4_collision_reset_w)
 
163
{
 
164
        m_collision[(offset >> 1) & 3] = 0;
 
165
}
 
166
 
 
167
 
 
168
WRITE8_MEMBER(sprint4_state::sprint4_da_latch_w)
 
169
{
 
170
        m_da_latch = data & 15;
 
171
}
 
172
 
 
173
 
 
174
WRITE8_MEMBER(sprint4_state::sprint4_lamp_w)
 
175
{
 
176
        set_led_status(machine(), (offset >> 1) & 3, offset & 1);
184
177
}
185
178
 
186
179
 
187
180
#ifdef UNUSED_FUNCTION
188
 
static WRITE8_HANDLER( sprint4_lockout_w )
 
181
WRITE8_MEMBER(sprint4_state::sprint4_lockout_w)
189
182
{
190
 
        coin_lockout_global_w(space->machine(), ~offset & 1);
 
183
        coin_lockout_global_w(machine(), ~offset & 1);
191
184
}
192
185
#endif
193
186
 
230
223
}
231
224
 
232
225
 
233
 
static ADDRESS_MAP_START( sprint4_cpu_map, AS_PROGRAM, 8 )
 
226
static ADDRESS_MAP_START( sprint4_cpu_map, AS_PROGRAM, 8, sprint4_state )
234
227
 
235
228
        ADDRESS_MAP_GLOBAL_MASK(0x3fff)
236
229
 
237
230
        AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x700) AM_READWRITE(sprint4_wram_r, sprint4_wram_w)
238
 
        AM_RANGE(0x0800, 0x0bff) AM_MIRROR(0x400) AM_RAM_WRITE(sprint4_video_ram_w) AM_BASE_MEMBER(sprint4_state, m_videoram)
 
231
        AM_RANGE(0x0800, 0x0bff) AM_MIRROR(0x400) AM_RAM_WRITE(sprint4_video_ram_w) AM_SHARE("videoram")
239
232
 
240
233
        AM_RANGE(0x0000, 0x0007) AM_MIRROR(0x718) AM_READ(sprint4_analog_r)
241
234
        AM_RANGE(0x0020, 0x0027) AM_MIRROR(0x718) AM_READ(sprint4_coin_r)
245
238
        AM_RANGE(0x1000, 0x17ff) AM_READ_PORT("IN0")
246
239
        AM_RANGE(0x1800, 0x1fff) AM_READ_PORT("IN1")
247
240
 
248
 
        AM_RANGE(0x0000, 0x0000) AM_MIRROR(0x71f) AM_DEVWRITE("discrete", sprint4_attract_w)
 
241
        AM_RANGE(0x0000, 0x0000) AM_MIRROR(0x71f) AM_DEVWRITE_LEGACY("discrete", sprint4_attract_w)
249
242
        AM_RANGE(0x0020, 0x0027) AM_MIRROR(0x718) AM_WRITE(sprint4_collision_reset_w)
250
243
        AM_RANGE(0x0040, 0x0041) AM_MIRROR(0x718) AM_WRITE(sprint4_da_latch_w)
251
 
        AM_RANGE(0x0042, 0x0043) AM_MIRROR(0x718) AM_DEVWRITE("discrete", sprint4_bang_w)
 
244
        AM_RANGE(0x0042, 0x0043) AM_MIRROR(0x718) AM_DEVWRITE_LEGACY("discrete", sprint4_bang_w)
252
245
        AM_RANGE(0x0044, 0x0045) AM_MIRROR(0x718) AM_WRITE(watchdog_reset_w)
253
246
        AM_RANGE(0x0060, 0x0067) AM_MIRROR(0x710) AM_WRITE(sprint4_lamp_w)
254
 
        AM_RANGE(0x0068, 0x0069) AM_MIRROR(0x710) AM_DEVWRITE("discrete", sprint4_screech_1_w)
255
 
        AM_RANGE(0x006a, 0x006b) AM_MIRROR(0x710) AM_DEVWRITE("discrete", sprint4_screech_2_w)
256
 
        AM_RANGE(0x006c, 0x006d) AM_MIRROR(0x710) AM_DEVWRITE("discrete", sprint4_screech_3_w)
257
 
        AM_RANGE(0x006e, 0x006f) AM_MIRROR(0x710) AM_DEVWRITE("discrete", sprint4_screech_4_w)
 
247
        AM_RANGE(0x0068, 0x0069) AM_MIRROR(0x710) AM_DEVWRITE_LEGACY("discrete", sprint4_screech_1_w)
 
248
        AM_RANGE(0x006a, 0x006b) AM_MIRROR(0x710) AM_DEVWRITE_LEGACY("discrete", sprint4_screech_2_w)
 
249
        AM_RANGE(0x006c, 0x006d) AM_MIRROR(0x710) AM_DEVWRITE_LEGACY("discrete", sprint4_screech_3_w)
 
250
        AM_RANGE(0x006e, 0x006f) AM_MIRROR(0x710) AM_DEVWRITE_LEGACY("discrete", sprint4_screech_4_w)
258
251
 
259
252
        AM_RANGE(0x2000, 0x27ff) AM_NOP /* diagnostic ROM */
260
253
        AM_RANGE(0x2800, 0x3fff) AM_ROM
266
259
 
267
260
        PORT_START("IN0")
268
261
        PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
269
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
 
262
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
270
263
 
271
264
        PORT_START("IN1")
272
265
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE)
273
266
 
274
267
        PORT_START("COLLISION")
275
268
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 1 Gas") PORT_PLAYER(1)
276
 
        PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)0 )
 
269
        PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_collision, (void *)0 )
277
270
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 2 Gas") PORT_PLAYER(2)
278
 
        PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)1 )
 
271
        PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_collision, (void *)1 )
279
272
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 3 Gas") PORT_PLAYER(3)
280
 
        PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)2 )
 
273
        PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_collision, (void *)2 )
281
274
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 4 Gas") PORT_PLAYER(4)
282
 
        PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)3 )
 
275
        PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_collision, (void *)3 )
283
276
 
284
277
        PORT_START("COIN")
285
278
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
310
303
        PORT_DIPSETTING(    0xe0, "150 seconds" )
311
304
 
312
305
        PORT_START("ANALOG")
313
 
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_wheel, (void *)0)
314
 
        PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_lever, (void *)0)
315
 
        PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_wheel, (void *)1)
316
 
        PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_lever, (void *)1)
317
 
        PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_wheel, (void *)2)
318
 
        PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_lever, (void *)2)
319
 
        PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_wheel, (void *)3)
320
 
        PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_lever, (void *)3)
 
306
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_wheel, (void *)0)
 
307
        PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_lever, (void *)0)
 
308
        PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_wheel, (void *)1)
 
309
        PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_lever, (void *)1)
 
310
        PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_wheel, (void *)2)
 
311
        PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_lever, (void *)2)
 
312
        PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_wheel, (void *)3)
 
313
        PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_lever, (void *)3)
321
314
 
322
315
        PORT_START("WHEEL1")
323
316
        PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) PORT_PLAYER(1)