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

« back to all changes in this revision

Viewing changes to src/mame/drivers/gunbustr.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:
1
1
/****************************************************************************
2
2
 
3
 
    Gunbuster                           (c) 1992 Taito
 
3
    Gunbuster (c) 1992 Taito
4
4
 
5
5
    Driver by Bryan McPhail & David Graves.
6
6
 
39
39
 
40
40
        No networked machine support
41
41
 
42
 
        Coin lockout not working (see gunbustr_input_w): perhaps this
43
 
        was a prototype version without proper coin handling?
44
 
 
45
42
***************************************************************************/
46
43
 
47
44
#include "emu.h"
66
63
        device_set_input_line(device, 4, HOLD_LINE);
67
64
}
68
65
 
69
 
static WRITE32_HANDLER( gunbustr_palette_w )
 
66
WRITE32_MEMBER(gunbustr_state::gunbustr_palette_w)
70
67
{
71
68
        int a;
72
 
        COMBINE_DATA(&space->machine().generic.paletteram.u32[offset]);
73
 
 
74
 
        a = space->machine().generic.paletteram.u32[offset] >> 16;
75
 
        palette_set_color_rgb(space->machine(),offset*2,pal5bit(a >> 10),pal5bit(a >> 5),pal5bit(a >> 0));
76
 
 
77
 
        a = space->machine().generic.paletteram.u32[offset] &0xffff;
78
 
        palette_set_color_rgb(space->machine(),offset*2+1,pal5bit(a >> 10),pal5bit(a >> 5),pal5bit(a >> 0));
79
 
}
80
 
 
81
 
static CUSTOM_INPUT( coin_word_r )
82
 
{
83
 
        gunbustr_state *state = field.machine().driver_data<gunbustr_state>();
84
 
        return state->m_coin_word;
85
 
}
86
 
 
87
 
static WRITE32_HANDLER( gunbustr_input_w )
88
 
{
89
 
        gunbustr_state *state = space->machine().driver_data<gunbustr_state>();
90
 
 
91
 
#if 0
92
 
{
93
 
char t[64];
94
 
COMBINE_DATA(&state->m_mem[offset]);
95
 
 
96
 
sprintf(t,"%08x %08x",state->m_mem[0],state->m_mem[1]);
97
 
popmessage(t);
98
 
}
99
 
#endif
100
 
 
 
69
        COMBINE_DATA(&m_generic_paletteram_32[offset]);
 
70
 
 
71
        a = m_generic_paletteram_32[offset] >> 16;
 
72
        palette_set_color_rgb(machine(),offset*2,pal5bit(a >> 10),pal5bit(a >> 5),pal5bit(a >> 0));
 
73
 
 
74
        a = m_generic_paletteram_32[offset] &0xffff;
 
75
        palette_set_color_rgb(machine(),offset*2+1,pal5bit(a >> 10),pal5bit(a >> 5),pal5bit(a >> 0));
 
76
}
 
77
 
 
78
CUSTOM_INPUT_MEMBER(gunbustr_state::coin_word_r)
 
79
{
 
80
        return m_coin_word;
 
81
}
 
82
 
 
83
WRITE32_MEMBER(gunbustr_state::gunbustr_input_w)
 
84
{
101
85
        switch (offset)
102
86
        {
103
87
                case 0x00:
104
88
                {
105
 
                        if (ACCESSING_BITS_24_31)       /* $400000 is watchdog */
 
89
                        if (ACCESSING_BITS_24_31)
106
90
                        {
107
 
                                watchdog_reset(space->machine());
 
91
                                /* $400000 is watchdog */
 
92
                                machine().watchdog_reset();
108
93
                        }
109
94
 
110
95
                        if (ACCESSING_BITS_0_7)
111
96
                        {
112
 
                                eeprom_device *eeprom = space->machine().device<eeprom_device>("eeprom");
 
97
                                eeprom_device *eeprom = machine().device<eeprom_device>("eeprom");
113
98
                                eeprom->set_clock_line((data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
114
99
                                eeprom->write_bit(data & 0x40);
115
100
                                eeprom->set_cs_line((data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
116
 
                                return;
117
101
                        }
118
 
                        return;
 
102
                        break;
119
103
                }
120
104
 
121
105
                case 0x01:
122
106
                {
123
107
                        if (ACCESSING_BITS_24_31)
124
108
                        {
125
 
                                /* game does not write a separate counter for coin 2!
126
 
                   It should disable both coins when 9 credits reached
127
 
                   see code $1d8a-f6... but for some reason it's not */
128
 
                                coin_lockout_w(space->machine(), 0, data & 0x01000000);
129
 
                                coin_lockout_w(space->machine(), 1, data & 0x02000000);
130
 
                                coin_counter_w(space->machine(), 0, data & 0x04000000);
131
 
                                coin_counter_w(space->machine(), 1, data & 0x04000000);
132
 
                                state->m_coin_word = (data >> 16) &0xffff;
 
109
                                if (m_coin_lockout)
 
110
                                {
 
111
                                        coin_lockout_w(machine(), 0, ~data & 0x01000000);
 
112
                                        coin_lockout_w(machine(), 1, ~data & 0x02000000);
 
113
                                }
 
114
 
 
115
                                // game does not write a separate counter for coin 2! maybe in linked mode?
 
116
                                coin_counter_w(machine(), 0, data & 0x04000000);
 
117
                                coin_counter_w(machine(), 1, data & 0x04000000);
 
118
                                m_coin_word = (data >> 16) &0xffff;
133
119
                        }
134
 
//logerror("CPU #0 PC %06x: write input %06x\n",cpu_get_pc(&space->device()),offset);
 
120
                        //logerror("CPU #0 PC %06x: write input %06x\n",cpu_get_pc(&device()),offset);
 
121
                        break;
135
122
                }
136
123
        }
137
124
}
138
125
 
139
 
static WRITE32_HANDLER( motor_control_w )
140
 
{
141
 
/*
142
 
    Standard value poked into MSW is 0x3c00
143
 
    (0x2000 and zero are written at startup)
144
 
 
145
 
*/
146
 
        if (data & 0x1000000)
147
 
        {
148
 
        output_set_value("Player1_Gun_Recoil",1);
149
 
        }
150
 
        else
151
 
        {
152
 
        output_set_value("Player1_Gun_Recoil",0);
153
 
        }
154
 
 
155
 
        if (data & 0x10000)
156
 
        {
157
 
        output_set_value("Player2_Gun_Recoil",1);
158
 
        }
159
 
        else
160
 
        {
161
 
        output_set_value("Player2_Gun_Recoil",0);
162
 
        }
163
 
 
164
 
        if (data & 0x40000)
165
 
        {
166
 
        output_set_value("Hit_lamp",1);
167
 
        }
168
 
        else
169
 
        {
170
 
        output_set_value("Hit_lamp",0);
171
 
        }
172
 
 
173
 
}
174
 
 
175
 
 
176
 
 
177
 
static READ32_HANDLER( gunbustr_gun_r )
178
 
{
179
 
        return ( input_port_read(space->machine(), "LIGHT0_X") << 24) | (input_port_read(space->machine(), "LIGHT0_Y") << 16) |
180
 
                 ( input_port_read(space->machine(), "LIGHT1_X") << 8)  |  input_port_read(space->machine(), "LIGHT1_Y");
181
 
}
182
 
 
183
 
static WRITE32_HANDLER( gunbustr_gun_w )
 
126
WRITE32_MEMBER(gunbustr_state::motor_control_w)
 
127
{
 
128
    // Standard value poked into MSW is 0x3c00
 
129
    // (0x2000 and zero are written at startup)
 
130
        output_set_value("Player1_Gun_Recoil", (data & 0x1000000) ? 1 : 0);
 
131
        output_set_value("Player2_Gun_Recoil", (data & 0x10000) ? 1 : 0);
 
132
        output_set_value("Hit_lamp", (data & 0x40000) ? 1 : 0);
 
133
}
 
134
 
 
135
 
 
136
 
 
137
READ32_MEMBER(gunbustr_state::gunbustr_gun_r)
 
138
{
 
139
        return ( ioport("LIGHT0_X")->read() << 24) | (ioport("LIGHT0_Y")->read() << 16) |
 
140
                        ( ioport("LIGHT1_X")->read() << 8)  |  ioport("LIGHT1_Y")->read();
 
141
}
 
142
 
 
143
WRITE32_MEMBER(gunbustr_state::gunbustr_gun_w)
184
144
{
185
145
        /* 10000 cycle delay is arbitrary */
186
 
        space->machine().scheduler().timer_set(downcast<cpu_device *>(&space->device())->cycles_to_attotime(10000), FUNC(gunbustr_interrupt5));
 
146
        machine().scheduler().timer_set(downcast<cpu_device *>(&space.device())->cycles_to_attotime(10000), FUNC(gunbustr_interrupt5));
187
147
}
188
148
 
189
149
 
191
151
             MEMORY STRUCTURES
192
152
***********************************************************/
193
153
 
194
 
static ADDRESS_MAP_START( gunbustr_map, AS_PROGRAM, 32 )
 
154
static ADDRESS_MAP_START( gunbustr_map, AS_PROGRAM, 32, gunbustr_state )
195
155
        AM_RANGE(0x000000, 0x0fffff) AM_ROM
196
 
        AM_RANGE(0x200000, 0x21ffff) AM_RAM AM_BASE_MEMBER(gunbustr_state, m_ram)                                                                               /* main CPUA ram */
197
 
        AM_RANGE(0x300000, 0x301fff) AM_RAM AM_BASE_SIZE_MEMBER(gunbustr_state, m_spriteram, m_spriteram_size)                          /* Sprite ram */
 
156
        AM_RANGE(0x200000, 0x21ffff) AM_RAM AM_SHARE("ram")                                                                             /* main CPUA ram */
 
157
        AM_RANGE(0x300000, 0x301fff) AM_RAM AM_SHARE("spriteram")                               /* Sprite ram */
198
158
        AM_RANGE(0x380000, 0x380003) AM_WRITE(motor_control_w)                                                                                  /* motor, lamps etc. */
199
159
        AM_RANGE(0x390000, 0x3907ff) AM_RAM AM_SHARE("f3_shared")                                                                               /* Sound shared ram */
200
160
        AM_RANGE(0x400000, 0x400003) AM_READ_PORT("P1_P2")
201
161
        AM_RANGE(0x400004, 0x400007) AM_READ_PORT("SYSTEM")
202
162
        AM_RANGE(0x400000, 0x400007) AM_WRITE(gunbustr_input_w)                                                                                 /* eerom etc. */
203
163
        AM_RANGE(0x500000, 0x500003) AM_READWRITE(gunbustr_gun_r, gunbustr_gun_w)                                               /* gun coord read */
204
 
        AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE("tc0480scp", tc0480scp_long_r, tc0480scp_long_w)
205
 
        AM_RANGE(0x830000, 0x83002f) AM_DEVREADWRITE("tc0480scp", tc0480scp_ctrl_long_r, tc0480scp_ctrl_long_w)
206
 
        AM_RANGE(0x900000, 0x901fff) AM_RAM_WRITE(gunbustr_palette_w) AM_BASE_GENERIC(paletteram)                       /* Palette ram */
 
164
        AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_long_r, tc0480scp_long_w)
 
165
        AM_RANGE(0x830000, 0x83002f) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_ctrl_long_r, tc0480scp_ctrl_long_w)
 
166
        AM_RANGE(0x900000, 0x901fff) AM_RAM_WRITE(gunbustr_palette_w) AM_SHARE("paletteram")                    /* Palette ram */
207
167
        AM_RANGE(0xc00000, 0xc03fff) AM_RAM                                                                                                                             /* network ram ?? */
208
168
ADDRESS_MAP_END
209
169
 
264
224
        PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_UNKNOWN )
265
225
        PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_UNKNOWN )
266
226
        PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNKNOWN )
267
 
        PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_word_r, NULL)
 
227
        PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, gunbustr_state,coin_word_r, NULL)
268
228
 
269
229
        /* Light gun inputs */
270
230
 
332
292
 
333
293
static const tc0480scp_interface gunbustr_tc0480scp_intf =
334
294
{
335
 
        1, 2,           /* gfxnum, txnum */
336
 
        0,              /* pixels */
 
295
        1, 2,                   /* gfxnum, txnum */
 
296
        0,                              /* pixels */
337
297
        0x20, 0x07,             /* x_offset, y_offset */
338
 
        -1, -1,         /* text_xoff, text_yoff */
339
 
        -1, 0,          /* flip_xoff, flip_yoff */
340
 
        0               /* col_base */
 
298
        -1, -1,                 /* text_xoff, text_yoff */
 
299
        -1, 0,                  /* flip_xoff, flip_yoff */
 
300
        0                               /* col_base */
341
301
};
342
302
 
343
303
static MACHINE_CONFIG_START( gunbustr, gunbustr_state )
344
304
 
345
305
        /* basic machine hardware */
346
 
        MCFG_CPU_ADD("maincpu", M68EC020, 16000000)     /* 16 MHz */
 
306
        MCFG_CPU_ADD("maincpu", M68EC020, XTAL_16MHz)
347
307
        MCFG_CPU_PROGRAM_MAP(gunbustr_map)
348
308
        MCFG_CPU_VBLANK_INT("screen", gunbustr_interrupt) /* VBL */
349
309
 
401
361
        ROM_LOAD16_BYTE( "d27-10.bin", 0x600000, 0x100000, CRC(ed894fe1) SHA1(5bf2fb6abdcf25bc525a2c3b29dbf7aca0b18fea) ) // -std-
402
362
 
403
363
        ROM_REGION16_BE( 0x80, "eeprom", 0 )
404
 
        ROM_LOAD16_WORD( "eeprom-gunbustr.bin", 0x0000, 0x0080, CRC(af7dc017) SHA1(5ff106cccd2679025cdd81fbc133d32148e2818c) )
 
364
        ROM_LOAD16_WORD( "eeprom-gunbustr.bin", 0x0000, 0x0080, CRC(ef3685a1) SHA1(899b4b6dd2fd78be3a2ce00a2ef1840de9f122c3) )
405
365
ROM_END
406
366
 
407
367
ROM_START( gunbustru )
435
395
        ROM_LOAD16_BYTE( "d27-10.bin", 0x600000, 0x100000, CRC(ed894fe1) SHA1(5bf2fb6abdcf25bc525a2c3b29dbf7aca0b18fea) ) // -std-
436
396
 
437
397
        ROM_REGION16_BE( 0x80, "eeprom", 0 )
438
 
        ROM_LOAD16_WORD( "eeprom-gunbustr.bin", 0x0000, 0x0080, CRC(af7dc017) SHA1(5ff106cccd2679025cdd81fbc133d32148e2818c) )
 
398
        ROM_LOAD16_WORD( "eeprom-gunbustr.bin", 0x0000, 0x0080, CRC(ef3685a1) SHA1(899b4b6dd2fd78be3a2ce00a2ef1840de9f122c3) )
439
399
ROM_END
440
400
 
441
401
ROM_START( gunbustrj )
469
429
        ROM_LOAD16_BYTE( "d27-10.bin", 0x600000, 0x100000, CRC(ed894fe1) SHA1(5bf2fb6abdcf25bc525a2c3b29dbf7aca0b18fea) ) // -std-
470
430
 
471
431
        ROM_REGION16_BE( 0x80, "eeprom", 0 )
472
 
        ROM_LOAD16_WORD( "eeprom-gunbustr.bin", 0x0000, 0x0080, CRC(af7dc017) SHA1(5ff106cccd2679025cdd81fbc133d32148e2818c) )
 
432
        ROM_LOAD16_WORD( "eeprom-gunbustr.bin", 0x0000, 0x0080, CRC(ef3685a1) SHA1(899b4b6dd2fd78be3a2ce00a2ef1840de9f122c3) )
473
433
ROM_END
474
434
 
475
 
static READ32_HANDLER( main_cycle_r )
 
435
READ32_MEMBER(gunbustr_state::main_cycle_r)
476
436
{
477
 
        gunbustr_state *state = space->machine().driver_data<gunbustr_state>();
478
 
        if (cpu_get_pc(&space->device())==0x55a && (state->m_ram[0x3acc/4]&0xff000000)==0)
479
 
                device_spin_until_interrupt(&space->device());
 
437
        if (cpu_get_pc(&space.device())==0x55a && (m_ram[0x3acc/4]&0xff000000)==0)
 
438
                device_spin_until_interrupt(&space.device());
480
439
 
481
 
        return state->m_ram[0x3acc/4];
 
440
        return m_ram[0x3acc/4];
482
441
}
483
442
 
484
443
static DRIVER_INIT( gunbustr )
485
444
{
486
445
        /* Speedup handler */
487
 
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x203acc, 0x203acf, FUNC(main_cycle_r));
 
446
        gunbustr_state *state = machine.driver_data<gunbustr_state>();
 
447
        state->m_maincpu->memory().space(AS_PROGRAM)->install_read_handler(0x203acc, 0x203acf, read32_delegate(FUNC(gunbustr_state::main_cycle_r),state));
 
448
}
 
449
 
 
450
static DRIVER_INIT( gunbustrj )
 
451
{
 
452
        DRIVER_INIT_CALL(gunbustr);
 
453
 
 
454
        // no coin lockout, perhaps this was a prototype version without proper coin handling?
 
455
        gunbustr_state *state = machine.driver_data<gunbustr_state>();
 
456
        state->m_coin_lockout = false;
488
457
}
489
458
 
490
459
GAME( 1992, gunbustr,  0,        gunbustr, gunbustr, gunbustr, ORIENTATION_FLIP_X, "Taito Corporation Japan", "Gunbuster (World)", 0 )
491
460
GAME( 1992, gunbustru, gunbustr, gunbustr, gunbustr, gunbustr, ORIENTATION_FLIP_X, "Taito America Corporation", "Gunbuster (US)", 0 )
492
 
GAME( 1992, gunbustrj, gunbustr, gunbustr, gunbustr, gunbustr, ORIENTATION_FLIP_X, "Taito Corporation", "Gunbuster (Japan)", 0 )
 
461
GAME( 1992, gunbustrj, gunbustr, gunbustr, gunbustr, gunbustrj,ORIENTATION_FLIP_X, "Taito Corporation", "Gunbuster (Japan)", 0 )