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

« back to all changes in this revision

Viewing changes to src/mame/drivers/m14.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:
58
58
{
59
59
public:
60
60
        m14_state(const machine_config &mconfig, device_type type, const char *tag)
61
 
                : driver_device(mconfig, type, tag) { }
 
61
                : driver_device(mconfig, type, tag) ,
 
62
                m_video_ram(*this, "video_ram"),
 
63
                m_color_ram(*this, "color_ram"){ }
62
64
 
63
65
        /* video-related */
64
66
        tilemap_t  *m_m14_tilemap;
65
 
        UINT8 *  m_video_ram;
66
 
        UINT8 *  m_color_ram;
 
67
        required_shared_ptr<UINT8> m_video_ram;
 
68
        required_shared_ptr<UINT8> m_color_ram;
67
69
 
68
70
        /* input-related */
69
71
        UINT8 m_hop_mux;
70
72
 
71
73
        /* devices */
72
74
        device_t *m_maincpu;
 
75
        DECLARE_WRITE8_MEMBER(m14_vram_w);
 
76
        DECLARE_WRITE8_MEMBER(m14_cram_w);
 
77
        DECLARE_READ8_MEMBER(m14_rng_r);
 
78
        DECLARE_READ8_MEMBER(input_buttons_r);
 
79
        DECLARE_WRITE8_MEMBER(test_w);
 
80
        DECLARE_WRITE8_MEMBER(hopper_w);
 
81
        DECLARE_INPUT_CHANGED_MEMBER(left_coin_inserted);
 
82
        DECLARE_INPUT_CHANGED_MEMBER(right_coin_inserted);
73
83
};
74
84
 
75
85
 
129
139
}
130
140
 
131
141
 
132
 
static WRITE8_HANDLER( m14_vram_w )
 
142
WRITE8_MEMBER(m14_state::m14_vram_w)
133
143
{
134
 
        m14_state *state = space->machine().driver_data<m14_state>();
135
144
 
136
 
        state->m_video_ram[offset] = data;
137
 
        state->m_m14_tilemap->mark_tile_dirty(offset);
 
145
        m_video_ram[offset] = data;
 
146
        m_m14_tilemap->mark_tile_dirty(offset);
138
147
}
139
148
 
140
 
static WRITE8_HANDLER( m14_cram_w )
 
149
WRITE8_MEMBER(m14_state::m14_cram_w)
141
150
{
142
 
        m14_state *state = space->machine().driver_data<m14_state>();
143
151
 
144
 
        state->m_color_ram[offset] = data;
145
 
        state->m_m14_tilemap->mark_tile_dirty(offset);
 
152
        m_color_ram[offset] = data;
 
153
        m_m14_tilemap->mark_tile_dirty(offset);
146
154
}
147
155
 
148
156
/*************************************
151
159
 *
152
160
 *************************************/
153
161
 
154
 
static READ8_HANDLER( m14_rng_r )
 
162
READ8_MEMBER(m14_state::m14_rng_r)
155
163
{
156
164
        /* graphic artifacts happens if this doesn't return random values. */
157
 
        return (space->machine().rand() & 0x0f) | 0xf0; /* | (input_port_read(space->machine(), "IN1") & 0x80)*/;
 
165
        return (machine().rand() & 0x0f) | 0xf0; /* | (ioport("IN1")->read() & 0x80)*/;
158
166
}
159
167
 
160
168
/* Here routes the hopper & the inputs */
161
 
static READ8_HANDLER( input_buttons_r )
 
169
READ8_MEMBER(m14_state::input_buttons_r)
162
170
{
163
 
        m14_state *state = space->machine().driver_data<m14_state>();
164
171
 
165
 
        if (state->m_hop_mux)
 
172
        if (m_hop_mux)
166
173
        {
167
 
                state->m_hop_mux = 0;
 
174
                m_hop_mux = 0;
168
175
                return 0; //0x43 status bits
169
176
        }
170
177
        else
171
 
                return input_port_read(space->machine(), "IN0");
 
178
                return ioport("IN0")->read();
172
179
}
173
180
 
174
181
#if 0
175
 
static WRITE8_HANDLER( test_w )
 
182
WRITE8_MEMBER(m14_state::test_w)
176
183
{
177
184
        static UINT8 x[5];
178
185
 
182
189
}
183
190
#endif
184
191
 
185
 
static WRITE8_HANDLER( hopper_w )
 
192
WRITE8_MEMBER(m14_state::hopper_w)
186
193
{
187
 
        m14_state *state = space->machine().driver_data<m14_state>();
188
194
 
189
195
        /* ---- x--- coin out */
190
196
        /* ---- --x- hopper/input mux? */
191
 
        state->m_hop_mux = data & 2;
 
197
        m_hop_mux = data & 2;
192
198
        //popmessage("%02x",data);
193
199
}
194
200
 
198
204
 *
199
205
 *************************************/
200
206
 
201
 
static ADDRESS_MAP_START( m14_map, AS_PROGRAM, 8 )
 
207
static ADDRESS_MAP_START( m14_map, AS_PROGRAM, 8, m14_state )
202
208
        AM_RANGE(0x0000, 0x1fff) AM_ROM
203
209
        AM_RANGE(0x2000, 0x23ff) AM_RAM
204
 
        AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(m14_vram_w) AM_BASE_MEMBER(m14_state, m_video_ram)
205
 
        AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(m14_cram_w) AM_BASE_MEMBER(m14_state, m_color_ram)
 
210
        AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(m14_vram_w) AM_SHARE("video_ram")
 
211
        AM_RANGE(0xe400, 0xe7ff) AM_RAM_WRITE(m14_cram_w) AM_SHARE("color_ram")
206
212
ADDRESS_MAP_END
207
213
 
208
 
static ADDRESS_MAP_START( m14_io_map, AS_IO, 8 )
 
214
static ADDRESS_MAP_START( m14_io_map, AS_IO, 8, m14_state )
209
215
        ADDRESS_MAP_GLOBAL_MASK(0xff)
210
216
        AM_RANGE(0xf8, 0xf8) AM_READ_PORT("AN_PADDLE") AM_WRITENOP
211
217
        AM_RANGE(0xf9, 0xf9) AM_READ(input_buttons_r) AM_WRITENOP
220
226
 *
221
227
 *************************************/
222
228
 
223
 
static INPUT_CHANGED( left_coin_inserted )
 
229
INPUT_CHANGED_MEMBER(m14_state::left_coin_inserted)
224
230
{
225
 
        m14_state *state = field.machine().driver_data<m14_state>();
226
231
        /* left coin insertion causes a rst6.5 (vector 0x34) */
227
232
        if (newval)
228
 
                device_set_input_line(state->m_maincpu, I8085_RST65_LINE, HOLD_LINE);
 
233
                device_set_input_line(m_maincpu, I8085_RST65_LINE, HOLD_LINE);
229
234
}
230
235
 
231
 
static INPUT_CHANGED( right_coin_inserted )
 
236
INPUT_CHANGED_MEMBER(m14_state::right_coin_inserted)
232
237
{
233
 
        m14_state *state = field.machine().driver_data<m14_state>();
234
238
        /* right coin insertion causes a rst5.5 (vector 0x2c) */
235
239
        if (newval)
236
 
                device_set_input_line(state->m_maincpu, I8085_RST55_LINE, HOLD_LINE);
 
240
                device_set_input_line(m_maincpu, I8085_RST55_LINE, HOLD_LINE);
237
241
}
238
242
 
239
243
static INPUT_PORTS_START( m14 )
287
291
        PORT_DIPSETTING(    0x80, DEF_STR( On ) )
288
292
 
289
293
        PORT_START("FAKE")
290
 
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) PORT_CHANGED(left_coin_inserted, 0) //coin x 5
291
 
        PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1) PORT_CHANGED(right_coin_inserted, 0) //coin x 1
 
294
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, m14_state,left_coin_inserted, 0) //coin x 5
 
295
        PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, m14_state,right_coin_inserted, 0) //coin x 1
292
296
INPUT_PORTS_END
293
297
 
294
298
static const gfx_layout charlayout =