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

« back to all changes in this revision

Viewing changes to src/mame/drivers/galaxi.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:
49
49
{
50
50
public:
51
51
        galaxi_state(const machine_config &mconfig, device_type type, const char *tag)
52
 
                : driver_device(mconfig, type, tag) { }
 
52
                : driver_device(mconfig, type, tag) ,
 
53
                m_bg1_ram(*this, "bg1_ram"),
 
54
                m_bg2_ram(*this, "bg2_ram"),
 
55
                m_bg3_ram(*this, "bg3_ram"),
 
56
                m_bg4_ram(*this, "bg4_ram"),
 
57
                m_fg_ram(*this, "fg_ram"){ }
53
58
 
54
59
        /* memory pointers */
55
 
        UINT16 *  m_bg1_ram;
56
 
        UINT16 *  m_bg2_ram;
57
 
        UINT16 *  m_bg3_ram;
58
 
        UINT16 *  m_bg4_ram;
59
 
        UINT16 *  m_fg_ram;
 
60
        required_shared_ptr<UINT16> m_bg1_ram;
 
61
        required_shared_ptr<UINT16> m_bg2_ram;
 
62
        required_shared_ptr<UINT16> m_bg3_ram;
 
63
        required_shared_ptr<UINT16> m_bg4_ram;
 
64
        required_shared_ptr<UINT16> m_fg_ram;
60
65
//  UINT16 *  m_paletteram;   // currently this uses generic palette handling
61
66
//  UINT16 *  m_nvram;        // currently this uses generic nvram handling
62
67
 
71
76
        int       m_hopper;
72
77
        int       m_ticket;
73
78
        UINT16    m_out[3];
 
79
        DECLARE_WRITE16_MEMBER(galaxi_bg1_w);
 
80
        DECLARE_WRITE16_MEMBER(galaxi_bg2_w);
 
81
        DECLARE_WRITE16_MEMBER(galaxi_bg3_w);
 
82
        DECLARE_WRITE16_MEMBER(galaxi_bg4_w);
 
83
        DECLARE_WRITE16_MEMBER(galaxi_fg_w);
 
84
        DECLARE_WRITE16_MEMBER(galaxi_500000_w);
 
85
        DECLARE_WRITE16_MEMBER(galaxi_500002_w);
 
86
        DECLARE_WRITE16_MEMBER(galaxi_500004_w);
 
87
        DECLARE_CUSTOM_INPUT_MEMBER(ticket_r);
 
88
        DECLARE_CUSTOM_INPUT_MEMBER(hopper_r);
74
89
};
75
90
 
76
91
 
113
128
        SET_TILE_INFO(1, code, 0x20 + (code >> 12), 0);
114
129
}
115
130
 
116
 
static WRITE16_HANDLER( galaxi_bg1_w )
117
 
{
118
 
        galaxi_state *state = space->machine().driver_data<galaxi_state>();
119
 
        COMBINE_DATA(&state->m_bg1_ram[offset]);
120
 
        state->m_bg1_tmap->mark_tile_dirty(offset);
121
 
}
122
 
 
123
 
static WRITE16_HANDLER( galaxi_bg2_w )
124
 
{
125
 
        galaxi_state *state = space->machine().driver_data<galaxi_state>();
126
 
        COMBINE_DATA(&state->m_bg2_ram[offset]);
127
 
        state->m_bg2_tmap->mark_tile_dirty(offset);
128
 
}
129
 
 
130
 
static WRITE16_HANDLER( galaxi_bg3_w )
131
 
{
132
 
        galaxi_state *state = space->machine().driver_data<galaxi_state>();
133
 
        COMBINE_DATA(&state->m_bg3_ram[offset]);
134
 
        state->m_bg3_tmap->mark_tile_dirty(offset);
135
 
}
136
 
 
137
 
static WRITE16_HANDLER( galaxi_bg4_w )
138
 
{
139
 
        galaxi_state *state = space->machine().driver_data<galaxi_state>();
140
 
        COMBINE_DATA(&state->m_bg4_ram[offset]);
141
 
        state->m_bg4_tmap->mark_tile_dirty(offset);
142
 
}
143
 
 
144
 
static WRITE16_HANDLER( galaxi_fg_w )
145
 
{
146
 
        galaxi_state *state = space->machine().driver_data<galaxi_state>();
147
 
        COMBINE_DATA(&state->m_fg_ram[offset]);
148
 
        state->m_fg_tmap->mark_tile_dirty(offset);
 
131
WRITE16_MEMBER(galaxi_state::galaxi_bg1_w)
 
132
{
 
133
        COMBINE_DATA(&m_bg1_ram[offset]);
 
134
        m_bg1_tmap->mark_tile_dirty(offset);
 
135
}
 
136
 
 
137
WRITE16_MEMBER(galaxi_state::galaxi_bg2_w)
 
138
{
 
139
        COMBINE_DATA(&m_bg2_ram[offset]);
 
140
        m_bg2_tmap->mark_tile_dirty(offset);
 
141
}
 
142
 
 
143
WRITE16_MEMBER(galaxi_state::galaxi_bg3_w)
 
144
{
 
145
        COMBINE_DATA(&m_bg3_ram[offset]);
 
146
        m_bg3_tmap->mark_tile_dirty(offset);
 
147
}
 
148
 
 
149
WRITE16_MEMBER(galaxi_state::galaxi_bg4_w)
 
150
{
 
151
        COMBINE_DATA(&m_bg4_ram[offset]);
 
152
        m_bg4_tmap->mark_tile_dirty(offset);
 
153
}
 
154
 
 
155
WRITE16_MEMBER(galaxi_state::galaxi_fg_w)
 
156
{
 
157
        COMBINE_DATA(&m_fg_ram[offset]);
 
158
        m_fg_tmap->mark_tile_dirty(offset);
149
159
}
150
160
 
151
161
static VIDEO_START(galaxi)
208
218
//  popmessage("%04x %04x %04x", state->m_out[0], state->m_out[1], state->m_out[2]);
209
219
}
210
220
 
211
 
static WRITE16_HANDLER( galaxi_500000_w )
212
 
{
213
 
        galaxi_state *state = space->machine().driver_data<galaxi_state>();
214
 
        COMBINE_DATA(&state->m_out[0]);
215
 
        show_out(space->machine());
216
 
}
217
 
 
218
 
static WRITE16_HANDLER( galaxi_500002_w )
219
 
{
220
 
        galaxi_state *state = space->machine().driver_data<galaxi_state>();
221
 
        COMBINE_DATA(&state->m_out[1]);
222
 
        show_out(space->machine());
223
 
}
224
 
 
225
 
static WRITE16_HANDLER( galaxi_500004_w )
226
 
{
227
 
        galaxi_state *state = space->machine().driver_data<galaxi_state>();
 
221
WRITE16_MEMBER(galaxi_state::galaxi_500000_w)
 
222
{
 
223
        COMBINE_DATA(&m_out[0]);
 
224
        show_out(machine());
 
225
}
 
226
 
 
227
WRITE16_MEMBER(galaxi_state::galaxi_500002_w)
 
228
{
 
229
        COMBINE_DATA(&m_out[1]);
 
230
        show_out(machine());
 
231
}
 
232
 
 
233
WRITE16_MEMBER(galaxi_state::galaxi_500004_w)
 
234
{
228
235
 
229
236
        if (ACCESSING_BITS_0_7)
230
237
        {
250
257
        }
251
258
        if (ACCESSING_BITS_8_15)
252
259
        {
253
 
                state->m_ticket = data & 0x0100;
254
 
                state->m_hopper = data & 0x1000;
255
 
                coin_counter_w(space->machine(), 0, data & 0x2000);     // coins
 
260
                m_ticket = data & 0x0100;
 
261
                m_hopper = data & 0x1000;
 
262
                coin_counter_w(machine(), 0, data & 0x2000);    // coins
256
263
        }
257
264
 
258
 
        COMBINE_DATA(&state->m_out[2]);
259
 
        show_out(space->machine());
260
 
}
261
 
 
262
 
static CUSTOM_INPUT( ticket_r )
263
 
{
264
 
        galaxi_state *state = field.machine().driver_data<galaxi_state>();
265
 
        return state->m_ticket && !(field.machine().primary_screen->frame_number() % 10);
266
 
}
267
 
 
268
 
static CUSTOM_INPUT( hopper_r )
269
 
{
270
 
        galaxi_state *state = field.machine().driver_data<galaxi_state>();
271
 
        return state->m_hopper && !(field.machine().primary_screen->frame_number() % 10);
272
 
}
273
 
 
274
 
 
275
 
static ADDRESS_MAP_START( galaxi_map, AS_PROGRAM, 16 )
 
265
        COMBINE_DATA(&m_out[2]);
 
266
        show_out(machine());
 
267
}
 
268
 
 
269
CUSTOM_INPUT_MEMBER(galaxi_state::ticket_r)
 
270
{
 
271
        return m_ticket && !(machine().primary_screen->frame_number() % 10);
 
272
}
 
273
 
 
274
CUSTOM_INPUT_MEMBER(galaxi_state::hopper_r)
 
275
{
 
276
        return m_hopper && !(machine().primary_screen->frame_number() % 10);
 
277
}
 
278
 
 
279
 
 
280
static ADDRESS_MAP_START( galaxi_map, AS_PROGRAM, 16, galaxi_state )
276
281
        AM_RANGE(0x000000, 0x03ffff) AM_ROM
277
282
 
278
 
        AM_RANGE(0x100000, 0x1003ff) AM_RAM_WRITE(galaxi_bg1_w) AM_BASE_MEMBER(galaxi_state, m_bg1_ram)
279
 
        AM_RANGE(0x100400, 0x1007ff) AM_RAM_WRITE(galaxi_bg2_w) AM_BASE_MEMBER(galaxi_state, m_bg2_ram)
280
 
        AM_RANGE(0x100800, 0x100bff) AM_RAM_WRITE(galaxi_bg3_w) AM_BASE_MEMBER(galaxi_state, m_bg3_ram)
281
 
        AM_RANGE(0x100c00, 0x100fff) AM_RAM_WRITE(galaxi_bg4_w) AM_BASE_MEMBER(galaxi_state, m_bg4_ram)
 
283
        AM_RANGE(0x100000, 0x1003ff) AM_RAM_WRITE(galaxi_bg1_w) AM_SHARE("bg1_ram")
 
284
        AM_RANGE(0x100400, 0x1007ff) AM_RAM_WRITE(galaxi_bg2_w) AM_SHARE("bg2_ram")
 
285
        AM_RANGE(0x100800, 0x100bff) AM_RAM_WRITE(galaxi_bg3_w) AM_SHARE("bg3_ram")
 
286
        AM_RANGE(0x100c00, 0x100fff) AM_RAM_WRITE(galaxi_bg4_w) AM_SHARE("bg4_ram")
282
287
 
283
 
        AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(galaxi_fg_w ) AM_BASE_MEMBER(galaxi_state, m_fg_ram)
 
288
        AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(galaxi_fg_w ) AM_SHARE("fg_ram")
284
289
        AM_RANGE(0x102000, 0x1047ff) AM_READNOP // unknown
285
290
 
286
 
        AM_RANGE(0x300000, 0x3007ff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE_GENERIC(paletteram)
 
291
        AM_RANGE(0x300000, 0x3007ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
287
292
 
288
293
        AM_RANGE(0x500000, 0x500001) AM_READ_PORT("INPUTS")
289
294
        AM_RANGE(0x500000, 0x500001) AM_WRITE(galaxi_500000_w)
290
295
        AM_RANGE(0x500002, 0x500003) AM_WRITE(galaxi_500002_w)
291
296
        AM_RANGE(0x500004, 0x500005) AM_WRITE(galaxi_500004_w)
292
297
 
293
 
        AM_RANGE(0x700000, 0x700001) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff)
 
298
        AM_RANGE(0x700000, 0x700001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
294
299
 
295
300
        AM_RANGE(0x600000, 0x607fff) AM_RAM AM_SHARE("nvram")   // 2x DS1230Y (non volatile SRAM)
296
301
ADDRESS_MAP_END
308
313
        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_POKER_HOLD5 )
309
314
        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_START1 )
310
315
        PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT )
311
 
        PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM( hopper_r, (void *)0 )       // hopper sensor
 
316
        PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxi_state,hopper_r, (void *)0 )       // hopper sensor
312
317
        PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(5)   // coin a
313
318
        PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(5)   // coin b (token)
314
319
        PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_COIN3 )   // pin 25LC
315
 
        PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( ticket_r, (void *)0 )      // ticket sensor
 
320
        PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxi_state,ticket_r, (void *)0 )      // ticket sensor
316
321
        PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_SPECIAL ) // hopper out (pin 14LS)
317
322
        PORT_SERVICE_NO_TOGGLE( 0x2000, IP_ACTIVE_HIGH )        // test
318
323
        PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_SPECIAL ) // (pin 26LC)
328
333
        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_POKER_HOLD5 )
329
334
        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_START1 )
330
335
        PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT )
331
 
        PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( hopper_r, (void *)0 )      // hopper sensor
 
336
        PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL )PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxi_state,hopper_r, (void *)0 )       // hopper sensor
332
337
        PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(5)   // coin a
333
338
        PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(5)   // coin b (token)
334
339
        PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Hopper Refill") PORT_CODE(KEYCODE_H)
335
 
        PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( ticket_r, (void *)0 )      // ticket sensor
 
340
        PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxi_state,ticket_r, (void *)0 )      // ticket sensor
336
341
        PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_SPECIAL ) // hopper out (pin 14LS)
337
342
        PORT_SERVICE_NO_TOGGLE( 0x2000, IP_ACTIVE_HIGH )        // test
338
343
        PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_GAMBLE_KEYOUT )   // (pin 26LC)
436
441
        MCFG_SOUND_MODIFY("oki")
437
442
 
438
443
        /* ADPCM samples are recorded with extremely low volume */
 
444
        MCFG_SOUND_ROUTES_RESET()
439
445
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 4.0)
440
446
MACHINE_CONFIG_END
441
447