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

« back to all changes in this revision

Viewing changes to src/mame/drivers/pushman.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:
31
31
#include "includes/pushman.h"
32
32
#include "sound/2203intf.h"
33
33
 
34
 
static WRITE16_HANDLER( pushman_flipscreen_w )
 
34
WRITE16_MEMBER(pushman_state::pushman_flipscreen_w)
35
35
{
36
36
        if (ACCESSING_BITS_8_15)
37
37
        {
38
 
                flip_screen_set(space->machine(), data & 0x0200);
39
 
                coin_counter_w(space->machine(), 0, data & 0x4000);
40
 
                coin_counter_w(space->machine(), 1, data & 0x8000);
 
38
                flip_screen_set(data & 0x0200);
 
39
                coin_counter_w(machine(), 0, data & 0x4000);
 
40
                coin_counter_w(machine(), 1, data & 0x8000);
41
41
        }
42
42
}
43
43
 
44
 
static WRITE16_HANDLER( pushman_control_w )
 
44
WRITE16_MEMBER(pushman_state::pushman_control_w)
45
45
{
46
46
        if (ACCESSING_BITS_8_15)
47
 
                soundlatch_w(space, 0, (data >> 8) & 0xff);
 
47
                soundlatch_byte_w(space, 0, (data >> 8) & 0xff);
48
48
}
49
49
 
50
 
static READ16_HANDLER( pushman_68705_r )
 
50
READ16_MEMBER(pushman_state::pushman_68705_r)
51
51
{
52
 
        pushman_state *state = space->machine().driver_data<pushman_state>();
53
52
 
54
53
        if (offset == 0)
55
 
                return state->m_latch;
 
54
                return m_latch;
56
55
 
57
 
        if (offset == 3 && state->m_new_latch)
 
56
        if (offset == 3 && m_new_latch)
58
57
        {
59
 
                state->m_new_latch = 0;
 
58
                m_new_latch = 0;
60
59
                return 0;
61
60
        }
62
 
        if (offset == 3 && !state->m_new_latch)
 
61
        if (offset == 3 && !m_new_latch)
63
62
                return 0xff;
64
63
 
65
 
        return (state->m_shared_ram[2 * offset + 1] << 8) + state->m_shared_ram[2 * offset];
 
64
        return (m_shared_ram[2 * offset + 1] << 8) + m_shared_ram[2 * offset];
66
65
}
67
66
 
68
 
static WRITE16_HANDLER( pushman_68705_w )
 
67
WRITE16_MEMBER(pushman_state::pushman_68705_w)
69
68
{
70
 
        pushman_state *state = space->machine().driver_data<pushman_state>();
71
69
 
72
70
        if (ACCESSING_BITS_8_15)
73
 
                state->m_shared_ram[2 * offset] = data >> 8;
 
71
                m_shared_ram[2 * offset] = data >> 8;
74
72
        if (ACCESSING_BITS_0_7)
75
 
                state->m_shared_ram[2 * offset + 1] = data & 0xff;
 
73
                m_shared_ram[2 * offset + 1] = data & 0xff;
76
74
 
77
75
        if (offset == 1)
78
76
        {
79
 
                device_set_input_line(state->m_mcu, M68705_IRQ_LINE, HOLD_LINE);
80
 
                device_spin(&space->device());
81
 
                state->m_new_latch = 0;
 
77
                device_set_input_line(m_mcu, M68705_IRQ_LINE, HOLD_LINE);
 
78
                device_spin(&space.device());
 
79
                m_new_latch = 0;
82
80
        }
83
81
}
84
82
 
85
83
/* ElSemi - Bouncing balls protection. */
86
 
static READ16_HANDLER( bballs_68705_r )
 
84
READ16_MEMBER(pushman_state::bballs_68705_r)
87
85
{
88
 
        pushman_state *state = space->machine().driver_data<pushman_state>();
89
86
 
90
87
        if (offset == 0)
91
 
                return state->m_latch;
92
 
        if (offset == 3 && state->m_new_latch)
 
88
                return m_latch;
 
89
        if (offset == 3 && m_new_latch)
93
90
        {
94
 
                state->m_new_latch = 0;
 
91
                m_new_latch = 0;
95
92
                return 0;
96
93
        }
97
 
        if (offset == 3 && !state->m_new_latch)
 
94
        if (offset == 3 && !m_new_latch)
98
95
                return 0xff;
99
96
 
100
 
        return (state->m_shared_ram[2 * offset + 1] << 8) + state->m_shared_ram[2 * offset];
 
97
        return (m_shared_ram[2 * offset + 1] << 8) + m_shared_ram[2 * offset];
101
98
}
102
99
 
103
 
static WRITE16_HANDLER( bballs_68705_w )
 
100
WRITE16_MEMBER(pushman_state::bballs_68705_w)
104
101
{
105
 
        pushman_state *state = space->machine().driver_data<pushman_state>();
106
102
 
107
103
        if (ACCESSING_BITS_8_15)
108
 
                state->m_shared_ram[2 * offset] = data >> 8;
 
104
                m_shared_ram[2 * offset] = data >> 8;
109
105
        if (ACCESSING_BITS_0_7)
110
 
                state->m_shared_ram[2 * offset + 1] = data & 0xff;
 
106
                m_shared_ram[2 * offset + 1] = data & 0xff;
111
107
 
112
108
        if (offset == 0)
113
109
        {
114
 
                state->m_latch = 0;
115
 
                if (state->m_shared_ram[0] <= 0xf)
 
110
                m_latch = 0;
 
111
                if (m_shared_ram[0] <= 0xf)
116
112
                {
117
 
                        state->m_latch = state->m_shared_ram[0] << 2;
118
 
                        if (state->m_shared_ram[1])
119
 
                                state->m_latch |= 2;
120
 
                        state->m_new_latch = 1;
 
113
                        m_latch = m_shared_ram[0] << 2;
 
114
                        if (m_shared_ram[1])
 
115
                                m_latch |= 2;
 
116
                        m_new_latch = 1;
121
117
                }
122
 
                else if (state->m_shared_ram[0])
 
118
                else if (m_shared_ram[0])
123
119
                {
124
 
                        if (state->m_shared_ram[1])
125
 
                                state->m_latch |= 2;
126
 
                        state->m_new_latch = 1;
 
120
                        if (m_shared_ram[1])
 
121
                                m_latch |= 2;
 
122
                        m_new_latch = 1;
127
123
                }
128
124
        }
129
125
}
130
126
 
131
127
 
132
 
static READ8_HANDLER( pushman_68000_r )
 
128
READ8_MEMBER(pushman_state::pushman_68000_r)
133
129
{
134
 
        pushman_state *state = space->machine().driver_data<pushman_state>();
135
 
        return state->m_shared_ram[offset];
 
130
        return m_shared_ram[offset];
136
131
}
137
132
 
138
 
static WRITE8_HANDLER( pushman_68000_w )
 
133
WRITE8_MEMBER(pushman_state::pushman_68000_w)
139
134
{
140
 
        pushman_state *state = space->machine().driver_data<pushman_state>();
141
135
 
142
 
        if (offset == 2 && (state->m_shared_ram[2] & 2) == 0 && data & 2)
 
136
        if (offset == 2 && (m_shared_ram[2] & 2) == 0 && data & 2)
143
137
        {
144
 
                state->m_latch = (state->m_shared_ram[1] << 8) | state->m_shared_ram[0];
145
 
                state->m_new_latch = 1;
 
138
                m_latch = (m_shared_ram[1] << 8) | m_shared_ram[0];
 
139
                m_new_latch = 1;
146
140
        }
147
 
        state->m_shared_ram[offset] = data;
 
141
        m_shared_ram[offset] = data;
148
142
}
149
143
 
150
144
/******************************************************************************/
151
145
 
152
 
static ADDRESS_MAP_START( pushman_map, AS_PROGRAM, 16 )
 
146
static ADDRESS_MAP_START( pushman_map, AS_PROGRAM, 16, pushman_state )
153
147
        AM_RANGE(0x000000, 0x01ffff) AM_ROM
154
148
        AM_RANGE(0x060000, 0x060007) AM_READWRITE(pushman_68705_r, pushman_68705_w)
155
 
        AM_RANGE(0xfe0800, 0xfe17ff) AM_RAM AM_BASE_MEMBER(pushman_state, m_spriteram)
 
149
        AM_RANGE(0xfe0800, 0xfe17ff) AM_RAM AM_SHARE("spriteram")
156
150
        AM_RANGE(0xfe4000, 0xfe4001) AM_READ_PORT("INPUTS") AM_WRITE(pushman_flipscreen_w)
157
151
        AM_RANGE(0xfe4002, 0xfe4003) AM_READ_PORT("SYSTEM") AM_WRITE(pushman_control_w)
158
152
        AM_RANGE(0xfe4004, 0xfe4005) AM_READ_PORT("DSW")
159
153
        AM_RANGE(0xfe8000, 0xfe8003) AM_WRITE(pushman_scroll_w)
160
154
        AM_RANGE(0xfe800e, 0xfe800f) AM_WRITENOP /* ? */
161
 
        AM_RANGE(0xfec000, 0xfec7ff) AM_RAM_WRITE(pushman_videoram_w) AM_BASE_MEMBER(pushman_state, m_videoram)
162
 
        AM_RANGE(0xff8000, 0xff87ff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_BASE_GENERIC(paletteram)
 
155
        AM_RANGE(0xfec000, 0xfec7ff) AM_RAM_WRITE(pushman_videoram_w) AM_SHARE("videoram")
 
156
        AM_RANGE(0xff8000, 0xff87ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
163
157
        AM_RANGE(0xffc000, 0xffffff) AM_RAM
164
158
ADDRESS_MAP_END
165
159
 
166
 
static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8 )
 
160
static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, pushman_state )
167
161
        AM_RANGE(0x0000, 0x0007) AM_READWRITE(pushman_68000_r, pushman_68000_w)
168
162
        AM_RANGE(0x0010, 0x007f) AM_RAM
169
163
        AM_RANGE(0x0080, 0x0fff) AM_ROM
170
164
ADDRESS_MAP_END
171
165
 
172
 
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8 )
 
166
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, pushman_state )
173
167
        AM_RANGE(0x0000, 0x7fff) AM_ROM
174
168
        AM_RANGE(0xc000, 0xc7ff) AM_RAM
175
 
        AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
 
169
        AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
176
170
ADDRESS_MAP_END
177
171
 
178
 
static ADDRESS_MAP_START( sound_io_map, AS_IO, 8 )
 
172
static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, pushman_state )
179
173
        ADDRESS_MAP_GLOBAL_MASK(0xff)
180
 
        AM_RANGE(0x00, 0x01) AM_DEVWRITE("ym1", ym2203_w)
181
 
        AM_RANGE(0x80, 0x81) AM_DEVWRITE("ym2", ym2203_w)
 
174
        AM_RANGE(0x00, 0x01) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
 
175
        AM_RANGE(0x80, 0x81) AM_DEVWRITE_LEGACY("ym2", ym2203_w)
182
176
ADDRESS_MAP_END
183
177
 
184
 
static ADDRESS_MAP_START( bballs_map, AS_PROGRAM, 16 )
 
178
static ADDRESS_MAP_START( bballs_map, AS_PROGRAM, 16, pushman_state )
185
179
        ADDRESS_MAP_GLOBAL_MASK(0xfffff)
186
180
        AM_RANGE(0x00000, 0x1ffff) AM_ROM
187
181
        AM_RANGE(0x60000, 0x60007) AM_READWRITE(bballs_68705_r, bballs_68705_w)
188
 
        AM_RANGE(0xe0800, 0xe17ff) AM_RAM AM_BASE_MEMBER(pushman_state, m_spriteram)
 
182
        AM_RANGE(0xe0800, 0xe17ff) AM_RAM AM_SHARE("spriteram")
189
183
        AM_RANGE(0xe4000, 0xe4001) AM_READ_PORT("INPUTS") AM_WRITE(pushman_flipscreen_w)
190
184
        AM_RANGE(0xe4002, 0xe4003) AM_READ_PORT("SYSTEM") AM_WRITE(pushman_control_w)
191
185
        AM_RANGE(0xe4004, 0xe4005) AM_READ_PORT("DSW")
192
186
        AM_RANGE(0xe8000, 0xe8003) AM_WRITE(pushman_scroll_w)
193
187
        AM_RANGE(0xe800e, 0xe800f) AM_WRITENOP /* ? */
194
 
        AM_RANGE(0xec000, 0xec7ff) AM_RAM_WRITE(pushman_videoram_w) AM_BASE_MEMBER(pushman_state, m_videoram)
195
 
        AM_RANGE(0xf8000, 0xf87ff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_BASE_GENERIC(paletteram)
 
188
        AM_RANGE(0xec000, 0xec7ff) AM_RAM_WRITE(pushman_videoram_w) AM_SHARE("videoram")
 
189
        AM_RANGE(0xf8000, 0xf87ff) AM_RAM_WRITE(paletteram_xxxxRRRRGGGGBBBB_word_w) AM_SHARE("paletteram")
196
190
        AM_RANGE(0xfc000, 0xfffff) AM_RAM
197
191
ADDRESS_MAP_END
198
192
 
221
215
        PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
222
216
        PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
223
217
        PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
224
 
        PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_VBLANK ) /* not sure, probably wrong */
 
218
        PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") /* not sure, probably wrong */
225
219
        PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
226
220
        PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
227
221
        PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_SERVICE1 )
288
282
        PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
289
283
        PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
290
284
        PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
291
 
        PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_VBLANK ) /* not sure, probably wrong */
 
285
        PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") /* not sure, probably wrong */
292
286
        PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
293
287
        PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
294
288
        PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_SERVICE1 )