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

« back to all changes in this revision

Viewing changes to src/mame/machine/galaxold.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:
42
42
        cputag_set_input_line(device->machine(), "maincpu", drvstate->m_irq_line, state ? CLEAR_LINE : ASSERT_LINE);
43
43
}
44
44
 
45
 
WRITE8_HANDLER( galaxold_nmi_enable_w )
 
45
WRITE8_MEMBER(galaxold_state::galaxold_nmi_enable_w)
46
46
{
47
 
    ttl7474_device *target = space->machine().device<ttl7474_device>("7474_9m_1");
 
47
    ttl7474_device *target = machine().device<ttl7474_device>("7474_9m_1");
48
48
        target->preset_w(data ? 1 : 0);
49
49
}
50
50
 
101
101
        device_set_irq_callback(machine.device("maincpu"), hunchbkg_irq_callback);
102
102
}
103
103
 
104
 
WRITE8_HANDLER( galaxold_coin_lockout_w )
105
 
{
106
 
        coin_lockout_global_w(space->machine(), ~data & 1);
107
 
}
108
 
 
109
 
 
110
 
WRITE8_HANDLER( galaxold_coin_counter_w )
111
 
{
112
 
        coin_counter_w(space->machine(), offset, data & 0x01);
113
 
}
114
 
 
115
 
WRITE8_HANDLER( galaxold_coin_counter_1_w )
116
 
{
117
 
        coin_counter_w(space->machine(), 1, data & 0x01);
118
 
}
119
 
 
120
 
WRITE8_HANDLER( galaxold_coin_counter_2_w )
121
 
{
122
 
        coin_counter_w(space->machine(), 2, data & 0x01);
123
 
}
124
 
 
125
 
 
126
 
WRITE8_HANDLER( galaxold_leds_w )
127
 
{
128
 
        set_led_status(space->machine(), offset,data & 1);
 
104
WRITE8_MEMBER(galaxold_state::galaxold_coin_lockout_w)
 
105
{
 
106
        coin_lockout_global_w(machine(), ~data & 1);
 
107
}
 
108
 
 
109
 
 
110
WRITE8_MEMBER(galaxold_state::galaxold_coin_counter_w)
 
111
{
 
112
        coin_counter_w(machine(), offset, data & 0x01);
 
113
}
 
114
 
 
115
WRITE8_MEMBER(galaxold_state::galaxold_coin_counter_1_w)
 
116
{
 
117
        coin_counter_w(machine(), 1, data & 0x01);
 
118
}
 
119
 
 
120
WRITE8_MEMBER(galaxold_state::galaxold_coin_counter_2_w)
 
121
{
 
122
        coin_counter_w(machine(), 2, data & 0x01);
 
123
}
 
124
 
 
125
 
 
126
WRITE8_MEMBER(galaxold_state::galaxold_leds_w)
 
127
{
 
128
        set_led_status(machine(), offset,data & 1);
129
129
}
130
130
 
131
131
 
132
132
#ifdef UNUSED_FUNCTION
133
 
static READ8_HANDLER( checkmaj_protection_r )
 
133
READ8_MEMBER(galaxold_state::checkmaj_protection_r)
134
134
{
135
 
        switch (cpu_get_pc(&space->device()))
 
135
        switch (cpu_get_pc(&space.device()))
136
136
        {
137
137
        case 0x0f15:  return 0xf5;
138
138
        case 0x0f8f:  return 0x7c;
141
141
        case 0x10f1:  return 0xaa;
142
142
        case 0x1402:  return 0xaa;
143
143
        default:
144
 
                logerror("Unknown protection read. PC=%04X\n",cpu_get_pc(&space->device()));
 
144
                logerror("Unknown protection read. PC=%04X\n",cpu_get_pc(&space.device()));
145
145
        }
146
146
 
147
147
        return 0;
149
149
 
150
150
 
151
151
/* Zig Zag can swap ROMs 2 and 3 as a form of copy protection */
152
 
WRITE8_HANDLER( zigzag_sillyprotection_w )
 
152
WRITE8_MEMBER(galaxold_state::zigzag_sillyprotection_w)
153
153
{
154
154
        if (data)
155
155
        {
156
156
                /* swap ROM 2 and 3! */
157
 
                memory_set_bank(space->machine(), "bank1", 1);
158
 
                memory_set_bank(space->machine(), "bank2", 0);
 
157
                membank("bank1")->set_entry(1);
 
158
                membank("bank2")->set_entry(0);
159
159
        }
160
160
        else
161
161
        {
162
 
                memory_set_bank(space->machine(), "bank1", 0);
163
 
                memory_set_bank(space->machine(), "bank2", 1);
 
162
                membank("bank1")->set_entry(0);
 
163
                membank("bank2")->set_entry(1);
164
164
        }
165
165
}
166
166
 
167
167
DRIVER_INIT( zigzag )
168
168
{
169
 
        UINT8 *RAM = machine.region("maincpu")->base();
170
 
        memory_configure_bank(machine, "bank1", 0, 2, &RAM[0x2000], 0x1000);
171
 
        memory_configure_bank(machine, "bank2", 0, 2, &RAM[0x2000], 0x1000);
172
 
        memory_set_bank(machine, "bank1", 0);
173
 
        memory_set_bank(machine, "bank2", 1);
 
169
        UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
 
170
        machine.root_device().membank("bank1")->configure_entries(0, 2, &RAM[0x2000], 0x1000);
 
171
        machine.root_device().membank("bank2")->configure_entries(0, 2, &RAM[0x2000], 0x1000);
 
172
        machine.root_device().membank("bank1")->set_entry(0);
 
173
        machine.root_device().membank("bank2")->set_entry(1);
174
174
}
175
175
 
176
176
 
177
177
 
178
 
static READ8_HANDLER( dingo_3000_r )
 
178
READ8_MEMBER(galaxold_state::dingo_3000_r)
179
179
{
180
180
        return 0xaa;
181
181
}
182
182
 
183
 
static READ8_HANDLER( dingo_3035_r )
 
183
READ8_MEMBER(galaxold_state::dingo_3035_r)
184
184
{
185
185
        return 0x8c;
186
186
}
187
187
 
188
 
static READ8_HANDLER( dingoe_3001_r )
 
188
READ8_MEMBER(galaxold_state::dingoe_3001_r)
189
189
{
190
190
        return 0xaa;
191
191
}
194
194
DRIVER_INIT( dingoe )
195
195
{
196
196
        offs_t i;
197
 
        UINT8 *rom = machine.region("maincpu")->base();
 
197
        UINT8 *rom = machine.root_device().memregion("maincpu")->base();
198
198
 
199
199
        for (i = 0; i < 0x3000; i++)
200
200
        {
223
223
#endif
224
224
 
225
225
 
226
 
READ8_HANDLER( scramblb_protection_1_r )
 
226
READ8_MEMBER(galaxold_state::scramblb_protection_1_r)
227
227
{
228
 
        switch (cpu_get_pc(&space->device()))
 
228
        switch (cpu_get_pc(&space.device()))
229
229
        {
230
230
        case 0x01da: return 0x80;
231
231
        case 0x01e4: return 0x00;
232
232
        default:
233
 
                logerror("%04x: read protection 1\n",cpu_get_pc(&space->device()));
 
233
                logerror("%04x: read protection 1\n",cpu_get_pc(&space.device()));
234
234
                return 0;
235
235
        }
236
236
}
237
237
 
238
 
READ8_HANDLER( scramblb_protection_2_r )
 
238
READ8_MEMBER(galaxold_state::scramblb_protection_2_r)
239
239
{
240
 
        switch (cpu_get_pc(&space->device()))
 
240
        switch (cpu_get_pc(&space.device()))
241
241
        {
242
242
        case 0x01ca: return 0x90;
243
243
        default:
244
 
                logerror("%04x: read protection 2\n",cpu_get_pc(&space->device()));
 
244
                logerror("%04x: read protection 2\n",cpu_get_pc(&space.device()));
245
245
                return 0;
246
246
        }
247
247
}
248
248
 
249
249
 
250
 
WRITE8_HANDLER( _4in1_bank_w )
 
250
WRITE8_MEMBER(galaxold_state::_4in1_bank_w)
251
251
{
252
 
        galaxold_state *state = space->machine().driver_data<galaxold_state>();
253
 
        state->m__4in1_bank = data & 0x03;
254
 
        galaxold_gfxbank_w(space, 0, state->m__4in1_bank);
255
 
        memory_set_bank(space->machine(), "bank1", state->m__4in1_bank);
 
252
        m__4in1_bank = data & 0x03;
 
253
        galaxold_gfxbank_w(space, 0, m__4in1_bank);
 
254
        membank("bank1")->set_entry(m__4in1_bank);
256
255
}
257
256
 
258
 
CUSTOM_INPUT( _4in1_fake_port_r )
 
257
CUSTOM_INPUT_MEMBER(galaxold_state::_4in1_fake_port_r)
259
258
{
260
 
        galaxold_state *state = field.machine().driver_data<galaxold_state>();
261
259
        static const char *const portnames[] = { "FAKE1", "FAKE2", "FAKE3", "FAKE4" };
262
260
        int bit_mask = (FPTR)param;
263
261
 
264
 
        return (input_port_read(field.machine(), portnames[state->m__4in1_bank]) & bit_mask) ? 0x01 : 0x00;
 
262
        return (ioport(portnames[m__4in1_bank])->read() & bit_mask) ? 0x01 : 0x00;
265
263
}
266
264
 
267
265
#ifdef UNUSED_FUNCTION
303
301
 
304
302
DRIVER_INIT( mooncrst )
305
303
{
306
 
        offs_t i, len = machine.region("maincpu")->bytes();
307
 
        UINT8 *rom = machine.region("maincpu")->base();
 
304
        offs_t i, len = machine.root_device().memregion("maincpu")->bytes();
 
305
        UINT8 *rom = machine.root_device().memregion("maincpu")->base();
308
306
 
309
307
 
310
308
        for (i = 0;i < len;i++)
322
320
{
323
321
        offs_t i;
324
322
        address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
325
 
        UINT8 *rom = machine.region("maincpu")->base();
 
323
        UINT8 *rom = machine.root_device().memregion("maincpu")->base();
326
324
        UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000);
327
325
 
328
326
        space->set_decrypted_region(0x0000, 0x7fff, decrypt);
380
378
                { 1,4,1,4 }
381
379
        };
382
380
 
383
 
        offs_t i, len = machine.region("maincpu")->bytes();
384
 
        UINT8 *rom = machine.region("maincpu")->base();
 
381
        offs_t i, len = machine.root_device().memregion("maincpu")->bytes();
 
382
        UINT8 *rom = machine.root_device().memregion("maincpu")->base();
385
383
 
386
384
 
387
385
        for (i = 0; i < len; i++)
401
399
{
402
400
        galaxold_state *state = machine.driver_data<galaxold_state>();
403
401
        address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
404
 
        offs_t i, len = machine.region("maincpu")->bytes();
405
 
        UINT8 *RAM = machine.region("maincpu")->base();
 
402
        offs_t i, len = state->memregion("maincpu")->bytes();
 
403
        UINT8 *RAM = state->memregion("maincpu")->base();
406
404
 
407
405
        /* Decrypt Program Roms */
408
406
        for (i = 0; i < len; i++)
409
407
                RAM[i] = RAM[i] ^ (i & 0xff);
410
408
 
411
409
        /* games are banked at 0x0000 - 0x3fff */
412
 
        memory_configure_bank(machine, "bank1", 0, 4, &RAM[0x10000], 0x4000);
 
410
        state->membank("bank1")->configure_entries(0, 4, &RAM[0x10000], 0x4000);
413
411
 
414
 
        _4in1_bank_w(space, 0, 0); /* set the initial CPU bank */
 
412
        state->_4in1_bank_w(*space, 0, 0); /* set the initial CPU bank */
415
413
 
416
414
        state_save_register_global(machine, state->m__4in1_bank);
417
415
}
418
416
 
419
417
INTERRUPT_GEN( hunchbks_vh_interrupt )
420
418
{
421
 
        generic_pulse_irq_line_and_vector(device,0,0x03);
 
419
        generic_pulse_irq_line_and_vector(device,0,0x03,1);
422
420
}
423
421
 
424
422
DRIVER_INIT( ladybugg )
425
423
{
426
 
/* Doesn't actually use the bank, but it mustn't have a coin lock! */
427
 
machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x6002, 0x6002, FUNC(galaxold_gfxbank_w));
 
424
        galaxold_state *state = machine.driver_data<galaxold_state>();
 
425
        /* Doesn't actually use the bank, but it mustn't have a coin lock! */
 
426
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x6002, 0x6002, write8_delegate(FUNC(galaxold_state::galaxold_gfxbank_w),state));
428
427
}