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

« back to all changes in this revision

Viewing changes to src/mame/drivers/snowbros.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:
38
38
  Hyper Pacman addition by David Haywood
39
39
   + some bits by Nicola Salmoria
40
40
 
 
41
 !!DO NOT TRUST THE SERVICE MODES FOR DIPSWITCH SETTINGS!!
41
42
 
42
43
Stephh's notes (hyperpac):
43
44
 
74
75
#include "cpu/mcs51/mcs51.h" // for semicom mcu
75
76
 
76
77
 
77
 
static WRITE16_HANDLER( snowbros_flipscreen_w )
 
78
WRITE16_MEMBER(snowbros_state::snowbros_flipscreen_w)
78
79
{
79
80
        if (ACCESSING_BITS_8_15)
80
 
                flip_screen_set(space->machine(), ~data & 0x8000);
 
81
                flip_screen_set(~data & 0x8000);
81
82
}
82
83
 
83
84
 
104
105
 
105
106
 
106
107
 
107
 
static WRITE16_HANDLER( snowbros_irq4_ack_w )
108
 
{
109
 
        cputag_set_input_line(space->machine(), "maincpu", 4, CLEAR_LINE);
110
 
}
111
 
 
112
 
static WRITE16_HANDLER( snowbros_irq3_ack_w )
113
 
{
114
 
        cputag_set_input_line(space->machine(), "maincpu", 3, CLEAR_LINE);
115
 
}
116
 
 
117
 
static WRITE16_HANDLER( snowbros_irq2_ack_w )
118
 
{
119
 
        cputag_set_input_line(space->machine(), "maincpu", 2, CLEAR_LINE);
 
108
WRITE16_MEMBER(snowbros_state::snowbros_irq4_ack_w)
 
109
{
 
110
        cputag_set_input_line(machine(), "maincpu", 4, CLEAR_LINE);
 
111
}
 
112
 
 
113
WRITE16_MEMBER(snowbros_state::snowbros_irq3_ack_w)
 
114
{
 
115
        cputag_set_input_line(machine(), "maincpu", 3, CLEAR_LINE);
 
116
}
 
117
 
 
118
WRITE16_MEMBER(snowbros_state::snowbros_irq2_ack_w)
 
119
{
 
120
        cputag_set_input_line(machine(), "maincpu", 2, CLEAR_LINE);
120
121
}
121
122
 
122
123
static TIMER_DEVICE_CALLBACK( snowbros_irq )
172
173
 
173
174
/* Sound Routines */
174
175
 
175
 
static READ16_HANDLER( snowbros_68000_sound_r )
 
176
READ16_MEMBER(snowbros_state::snowbros_68000_sound_r)
176
177
{
177
 
        return soundlatch_r(space,offset);
 
178
        return soundlatch_byte_r(space,offset);
178
179
}
179
180
 
180
181
 
181
 
static WRITE16_HANDLER( snowbros_68000_sound_w )
 
182
WRITE16_MEMBER(snowbros_state::snowbros_68000_sound_w)
182
183
{
183
184
        if (ACCESSING_BITS_0_7)
184
185
        {
185
 
                soundlatch_w(space, offset, data & 0xff);
186
 
                cputag_set_input_line(space->machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
 
186
                soundlatch_byte_w(space, offset, data & 0xff);
 
187
                cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
187
188
        }
188
189
}
189
190
 
190
 
static WRITE16_HANDLER( semicom_soundcmd_w )
 
191
WRITE16_MEMBER(snowbros_state::semicom_soundcmd_w)
191
192
{
192
 
        if (ACCESSING_BITS_0_7) soundlatch_w(space,0,data & 0xff);
 
193
        if (ACCESSING_BITS_0_7) soundlatch_byte_w(space,0,data & 0xff);
193
194
}
194
195
 
195
196
/* Snow Bros Memory Map */
196
197
 
197
 
static ADDRESS_MAP_START( snowbros_map, AS_PROGRAM, 16 )
 
198
static ADDRESS_MAP_START( snowbros_map, AS_PROGRAM, 16, snowbros_state )
198
199
        AM_RANGE(0x000000, 0x03ffff) AM_ROM
199
200
        AM_RANGE(0x100000, 0x103fff) AM_RAM
200
201
        AM_RANGE(0x200000, 0x200001) AM_WRITE(watchdog_reset16_w)
203
204
        AM_RANGE(0x500000, 0x500001) AM_READ_PORT("DSW1")
204
205
        AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW2")
205
206
        AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
206
 
        AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
207
 
        AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w)
 
207
        AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
 
208
        AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w)
208
209
        AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)      /* IRQ 4 acknowledge */
209
210
        AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)      /* IRQ 3 acknowledge */
210
211
        AM_RANGE(0xa00000, 0xa00001) AM_WRITE(snowbros_irq2_ack_w)      /* IRQ 2 acknowledge */
211
212
ADDRESS_MAP_END
212
213
 
213
 
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8 )
 
214
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, snowbros_state )
214
215
        AM_RANGE(0x0000, 0x7fff) AM_ROM
215
216
        AM_RANGE(0x8000, 0x87ff) AM_RAM
216
217
ADDRESS_MAP_END
217
218
 
218
 
static ADDRESS_MAP_START( sound_io_map, AS_IO, 8 )
 
219
static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, snowbros_state )
219
220
        ADDRESS_MAP_GLOBAL_MASK(0xff)
220
 
        AM_RANGE(0x02, 0x03) AM_DEVREADWRITE("ymsnd", ym3812_r, ym3812_w)
221
 
        AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_r, soundlatch_w)   /* goes back to the main CPU, checked during boot */
 
221
        AM_RANGE(0x02, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r, ym3812_w)
 
222
        AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_byte_r, soundlatch_byte_w) /* goes back to the main CPU, checked during boot */
222
223
ADDRESS_MAP_END
223
224
 
224
225
 
225
226
 
226
 
static READ8_HANDLER( prot_io_r )
 
227
READ8_MEMBER(snowbros_state::prot_io_r)
227
228
{
228
229
        // never read?
229
230
        return 0x00;
231
232
 
232
233
 
233
234
// probably not endian safe
234
 
static WRITE8_HANDLER( prot_io_w )
 
235
WRITE8_MEMBER(snowbros_state::prot_io_w)
235
236
{
236
 
        snowbros_state *state = space->machine().driver_data<snowbros_state>();
237
237
        switch (offset)
238
238
        {
239
239
                case 0x00:
240
240
                {
241
 
                        UINT16 word = state->m_hyperpac_ram[(0xe000/2)+state->m_semicom_prot_offset];
 
241
                        UINT16 word = m_hyperpac_ram[(0xe000/2)+m_semicom_prot_offset];
242
242
                        word = (word & 0xff00) | (data << 0);
243
 
                        state->m_hyperpac_ram[(0xe000/2)+state->m_semicom_prot_offset] = word;
 
243
                        m_hyperpac_ram[(0xe000/2)+m_semicom_prot_offset] = word;
244
244
                        break;
245
245
                }
246
246
 
247
247
                case 0x01:
248
248
                {
249
 
                        UINT16 word = state->m_hyperpac_ram[(0xe000/2)+state->m_semicom_prot_offset];
 
249
                        UINT16 word = m_hyperpac_ram[(0xe000/2)+m_semicom_prot_offset];
250
250
                        word = (word & 0x00ff) | (data << 8);
251
 
                        state->m_hyperpac_ram[(0xe000/2)+state->m_semicom_prot_offset] = word;
 
251
                        m_hyperpac_ram[(0xe000/2)+m_semicom_prot_offset] = word;
252
252
                        break;
253
253
                }
254
254
 
255
255
                case 0x02: // offset
256
256
                {
257
 
                        state->m_semicom_prot_offset = data;
 
257
                        m_semicom_prot_offset = data;
258
258
                        break;
259
259
                }
260
260
 
267
267
}
268
268
 
269
269
/* Semicom AT89C52 MCU */
270
 
static ADDRESS_MAP_START( protection_map, AS_PROGRAM, 8 )
 
270
static ADDRESS_MAP_START( protection_map, AS_PROGRAM, 8, snowbros_state )
271
271
        AM_RANGE(0x0000, 0x1fff) AM_ROM
272
272
ADDRESS_MAP_END
273
273
 
274
 
static ADDRESS_MAP_START( protection_iomap, AS_IO, 8 )
 
274
static ADDRESS_MAP_START( protection_iomap, AS_IO, 8, snowbros_state )
275
275
        AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(prot_io_r,prot_io_w)
276
276
ADDRESS_MAP_END
277
277
 
278
278
/* Winter Bobble - bootleg GFX chip */
279
279
 
280
 
static ADDRESS_MAP_START( wintbob_map, AS_PROGRAM, 16 )
 
280
static ADDRESS_MAP_START( wintbob_map, AS_PROGRAM, 16, snowbros_state )
281
281
        AM_RANGE(0x000000, 0x03ffff) AM_ROM
282
282
        AM_RANGE(0x100000, 0x103fff) AM_RAM
283
283
        AM_RANGE(0x200000, 0x200001) AM_WRITE(watchdog_reset16_w)
286
286
        AM_RANGE(0x500000, 0x500001) AM_READ_PORT("DSW1")
287
287
        AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW2")
288
288
        AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
289
 
        AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
290
 
        AM_RANGE(0x700000, 0x701fff) AM_RAM AM_BASE_SIZE_MEMBER(snowbros_state, m_bootleg_spriteram16, m_spriteram_size)
 
289
        AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
 
290
        AM_RANGE(0x700000, 0x701fff) AM_RAM AM_SHARE("spriteram16b")
291
291
        AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)      /* IRQ 4 acknowledge */
292
292
        AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)      /* IRQ 3 acknowledge */
293
293
        AM_RANGE(0xa00000, 0xa00001) AM_WRITE(snowbros_irq2_ack_w)      /* IRQ 2 acknowledge */
295
295
 
296
296
/* Honey Dolls */
297
297
 
298
 
static ADDRESS_MAP_START( honeydol_map, AS_PROGRAM, 16 )
 
298
static ADDRESS_MAP_START( honeydol_map, AS_PROGRAM, 16, snowbros_state )
299
299
        AM_RANGE(0x000000, 0x03ffff) AM_ROM
300
 
        AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_BASE_MEMBER(snowbros_state, m_hyperpac_ram)
 
300
        AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_SHARE("hyperpac_ram")
301
301
        AM_RANGE(0x200000, 0x200001) AM_WRITENOP        /* ? */
302
302
        AM_RANGE(0x300000, 0x300001) AM_WRITE(snowbros_68000_sound_w)   /* ? */
303
303
        AM_RANGE(0x400000, 0x400001) AM_WRITE(snowbros_irq4_ack_w)      /* IRQ 4 acknowledge */
307
307
        AM_RANGE(0x900000, 0x900001) AM_READ_PORT("DSW1")
308
308
        AM_RANGE(0x900002, 0x900003) AM_READ_PORT("DSW2")
309
309
        AM_RANGE(0x900004, 0x900005) AM_READ_PORT("SYSTEM")
310
 
        AM_RANGE(0xa00000, 0xa007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
311
 
        AM_RANGE(0xb00000, 0xb01fff) AM_RAM AM_BASE_SIZE_MEMBER(snowbros_state, m_bootleg_spriteram16, m_spriteram_size)
 
310
        AM_RANGE(0xa00000, 0xa007ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
 
311
        AM_RANGE(0xb00000, 0xb01fff) AM_RAM AM_SHARE("spriteram16b")
312
312
ADDRESS_MAP_END
313
313
 
314
 
static ADDRESS_MAP_START( honeydol_sound_map, AS_PROGRAM, 8 )
 
314
static ADDRESS_MAP_START( honeydol_sound_map, AS_PROGRAM, 8, snowbros_state )
315
315
        AM_RANGE(0x0000, 0x7fff) AM_ROM
316
316
        AM_RANGE(0x8000, 0x87ff) AM_RAM
317
 
        AM_RANGE(0xe010, 0xe010) AM_DEVREADWRITE_MODERN("oki", okim6295_device, read, write)
 
317
        AM_RANGE(0xe010, 0xe010) AM_DEVREADWRITE("oki", okim6295_device, read, write)
318
318
ADDRESS_MAP_END
319
319
 
320
 
static ADDRESS_MAP_START( honeydol_sound_io_map, AS_IO, 8 )
 
320
static ADDRESS_MAP_START( honeydol_sound_io_map, AS_IO, 8, snowbros_state )
321
321
        ADDRESS_MAP_GLOBAL_MASK(0xff)
322
 
        AM_RANGE(0x02, 0x03) AM_DEVREADWRITE("ymsnd", ym3812_r, ym3812_w)                                                               // not connected?
323
 
        AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_r, soundlatch_w)   /* goes back to the main CPU, checked during boot */
 
322
        AM_RANGE(0x02, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym3812_r, ym3812_w)                                                                // not connected?
 
323
        AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_byte_r, soundlatch_byte_w) /* goes back to the main CPU, checked during boot */
324
324
ADDRESS_MAP_END
325
325
 
326
326
/* Twin Adventure */
327
327
 
328
 
static WRITE16_HANDLER( twinadv_68000_sound_w )
 
328
WRITE16_MEMBER(snowbros_state::twinadv_68000_sound_w)
329
329
{
330
330
        if (ACCESSING_BITS_0_7)
331
331
        {
332
 
                soundlatch_w(space, offset, data & 0xff);
333
 
                cputag_set_input_line(space->machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
 
332
                soundlatch_byte_w(space, offset, data & 0xff);
 
333
                cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
334
334
        }
335
335
}
336
336
 
337
 
static ADDRESS_MAP_START( twinadv_map, AS_PROGRAM, 16 )
 
337
static ADDRESS_MAP_START( twinadv_map, AS_PROGRAM, 16, snowbros_state )
338
338
        AM_RANGE(0x000000, 0x03ffff) AM_ROM
339
339
        AM_RANGE(0x100000, 0x10ffff) AM_RAM
340
340
        AM_RANGE(0x200000, 0x200001) AM_WRITE(watchdog_reset16_w)
344
344
        AM_RANGE(0x500000, 0x500001) AM_READ_PORT("DSW1")
345
345
        AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW2")
346
346
        AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
347
 
        AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
348
 
        AM_RANGE(0x700000, 0x701fff) AM_RAM AM_BASE_SIZE_MEMBER(snowbros_state, m_bootleg_spriteram16, m_spriteram_size)
 
347
        AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
 
348
        AM_RANGE(0x700000, 0x701fff) AM_RAM AM_SHARE("spriteram16b")
349
349
        AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)      /* IRQ 4 acknowledge */
350
350
        AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)      /* IRQ 3 acknowledge */
351
351
        AM_RANGE(0xa00000, 0xa00001) AM_WRITE(snowbros_irq2_ack_w)      /* IRQ 2 acknowledge */
360
360
        downcast<okim6295_device *>(device)->set_bank_base(bank * 0x40000);
361
361
}
362
362
 
363
 
static ADDRESS_MAP_START( twinadv_sound_io_map, AS_IO, 8 )
 
363
static ADDRESS_MAP_START( twinadv_sound_io_map, AS_IO, 8, snowbros_state )
364
364
        ADDRESS_MAP_GLOBAL_MASK(0xff)
365
 
        AM_RANGE(0x02, 0x02) AM_READWRITE(soundlatch_r, soundlatch_w) // back to 68k?
366
 
        AM_RANGE(0x04, 0x04) AM_DEVWRITE("oki", twinadv_oki_bank_w) // oki bank?
367
 
        AM_RANGE(0x06, 0x06) AM_DEVREADWRITE_MODERN("oki", okim6295_device, read, write)
 
365
        AM_RANGE(0x02, 0x02) AM_READWRITE(soundlatch_byte_r, soundlatch_byte_w) // back to 68k?
 
366
        AM_RANGE(0x04, 0x04) AM_DEVWRITE_LEGACY("oki", twinadv_oki_bank_w) // oki bank?
 
367
        AM_RANGE(0x06, 0x06) AM_DEVREADWRITE("oki", okim6295_device, read, write)
368
368
ADDRESS_MAP_END
369
369
 
370
370
 
375
375
 
376
376
*/
377
377
 
378
 
static ADDRESS_MAP_START( hyperpac_map, AS_PROGRAM, 16 )
 
378
static ADDRESS_MAP_START( hyperpac_map, AS_PROGRAM, 16, snowbros_state )
379
379
        AM_RANGE(0x000000, 0x0fffff) AM_ROM
380
 
        AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_BASE_MEMBER(snowbros_state, m_hyperpac_ram)
 
380
        AM_RANGE(0x100000, 0x10ffff) AM_RAM AM_SHARE("hyperpac_ram")
381
381
        AM_RANGE(0x300000, 0x300001) AM_WRITE(semicom_soundcmd_w)
382
382
//  AM_RANGE(0x400000, 0x400001) ???
383
383
        AM_RANGE(0x500000, 0x500001) AM_READ_PORT("DSW1")
384
384
        AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW2")
385
385
        AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
386
386
 
387
 
        AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
388
 
        AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE("pandora", pandora_spriteram_LSB_r,pandora_spriteram_LSB_w)
 
387
        AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
 
388
        AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r,pandora_spriteram_LSB_w)
389
389
        AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)      /* IRQ 4 acknowledge */
390
390
        AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)      /* IRQ 3 acknowledge */
391
391
        AM_RANGE(0xa00000, 0xa00001) AM_WRITE(snowbros_irq2_ack_w)      /* IRQ 2 acknowledge */
392
392
ADDRESS_MAP_END
393
393
 
394
 
static ADDRESS_MAP_START( hyperpac_sound_map, AS_PROGRAM, 8 )
 
394
static ADDRESS_MAP_START( hyperpac_sound_map, AS_PROGRAM, 8, snowbros_state )
395
395
        AM_RANGE(0x0000, 0xcfff) AM_ROM
396
396
        AM_RANGE(0xd000, 0xd7ff) AM_RAM
397
 
        AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE("ymsnd", ym2151_r,ym2151_w)
398
 
        AM_RANGE(0xf002, 0xf002) AM_DEVREADWRITE_MODERN("oki", okim6295_device, read, write)
399
 
        AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_r)
 
397
        AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r,ym2151_w)
 
398
        AM_RANGE(0xf002, 0xf002) AM_DEVREADWRITE("oki", okim6295_device, read, write)
 
399
        AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_byte_r)
400
400
ADDRESS_MAP_END
401
401
 
402
402
/* Same volume used for all samples at the Moment, could be right, we have no
403
403
   way of knowing .. */
404
 
static READ16_HANDLER( sb3_sound_r )
 
404
READ16_MEMBER(snowbros_state::sb3_sound_r)
405
405
{
406
406
        return 0x0003;
407
407
}
418
418
        {
419
419
                case 0x23:
420
420
                case 0x26:
421
 
                snd = machine.region("oki")->base();
 
421
                snd = state->memregion("oki")->base();
422
422
                memcpy(snd+0x20000, snd+0x80000+0x00000, 0x20000);
423
423
                state->m_sb3_music_is_playing = 1;
424
424
                break;
425
425
 
426
426
                case 0x24:
427
 
                snd = machine.region("oki")->base();
 
427
                snd = state->memregion("oki")->base();
428
428
                memcpy(snd+0x20000, snd+0x80000+0x20000, 0x20000);
429
429
                state->m_sb3_music_is_playing = 1;
430
430
                break;
437
437
                case 0x2b:
438
438
                case 0x2c:
439
439
                case 0x2d:
440
 
                snd = machine.region("oki")->base();
 
440
                snd = state->memregion("oki")->base();
441
441
                memcpy(snd+0x20000, snd+0x80000+0x40000, 0x20000);
442
442
                state->m_sb3_music_is_playing = 1;
443
443
                break;
509
509
 
510
510
 
511
511
 
512
 
static ADDRESS_MAP_START( snowbros3_map, AS_PROGRAM, 16 )
 
512
static ADDRESS_MAP_START( snowbros3_map, AS_PROGRAM, 16, snowbros_state )
513
513
        AM_RANGE( 0x000000, 0x03ffff) AM_ROM
514
514
        AM_RANGE( 0x100000, 0x103fff) AM_RAM
515
515
        AM_RANGE( 0x200000, 0x200001) AM_WRITE(watchdog_reset16_w)
516
516
        AM_RANGE( 0x300000, 0x300001) AM_READ(sb3_sound_r) // ?
517
 
        AM_RANGE( 0x300000, 0x300001) AM_DEVWRITE("oki", sb3_sound_w)  // ?
 
517
        AM_RANGE( 0x300000, 0x300001) AM_DEVWRITE_LEGACY("oki", sb3_sound_w)  // ?
518
518
        AM_RANGE( 0x400000, 0x400001) AM_WRITE(snowbros_flipscreen_w)
519
519
        AM_RANGE( 0x500000, 0x500001) AM_READ_PORT("DSW1")
520
520
        AM_RANGE( 0x500002, 0x500003) AM_READ_PORT("DSW2")
521
521
        AM_RANGE( 0x500004, 0x500005) AM_READ_PORT("SYSTEM")
522
 
        AM_RANGE( 0x600000, 0x6003ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC (paletteram)
523
 
        AM_RANGE( 0x700000, 0x7021ff) AM_RAM AM_BASE_SIZE_MEMBER(snowbros_state, m_bootleg_spriteram16, m_spriteram_size)
 
522
        AM_RANGE( 0x600000, 0x6003ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
 
523
        AM_RANGE( 0x700000, 0x7021ff) AM_RAM AM_SHARE("spriteram16b")
524
524
        AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)      /* IRQ 4 acknowledge */
525
525
        AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)      /* IRQ 3 acknowledge */
526
526
        AM_RANGE(0xa00000, 0xa00001) AM_WRITE(snowbros_irq2_ack_w)      /* IRQ 2 acknowledge */
528
528
 
529
529
/* Final Tetris */
530
530
 
531
 
static ADDRESS_MAP_START( finalttr_map, AS_PROGRAM, 16 )
 
531
static ADDRESS_MAP_START( finalttr_map, AS_PROGRAM, 16, snowbros_state )
532
532
        AM_RANGE(0x000000, 0x0fffff) AM_ROM
533
 
        AM_RANGE(0x100000, 0x103fff) AM_RAM AM_BASE_MEMBER(snowbros_state, m_hyperpac_ram)
 
533
        AM_RANGE(0x100000, 0x103fff) AM_RAM AM_SHARE("hyperpac_ram")
534
534
        AM_RANGE(0x300000, 0x300001) AM_WRITE(semicom_soundcmd_w)
535
535
//  AM_RANGE(0x400000, 0x400001) ???
536
536
 
538
538
        AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW2")
539
539
        AM_RANGE(0x500004, 0x500005) AM_READ_PORT("SYSTEM")
540
540
 
541
 
        AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
542
 
        AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w)
 
541
        AM_RANGE(0x600000, 0x6001ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
 
542
        AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w)
543
543
        AM_RANGE(0x800000, 0x800001) AM_WRITE(snowbros_irq4_ack_w)      /* IRQ 4 acknowledge */
544
544
        AM_RANGE(0x900000, 0x900001) AM_WRITE(snowbros_irq3_ack_w)      /* IRQ 3 acknowledge */
545
545
        AM_RANGE(0xa00000, 0xa00001) AM_WRITE(snowbros_irq2_ack_w)      /* IRQ 2 acknowledge */
558
558
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
559
559
        PORT_DIPSETTING(    0x08, DEF_STR( On ) )
560
560
        PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )   PORT_DIPLOCATION("SW1:5,6")
561
 
        PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x00)
562
 
        PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x00)
563
 
        PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x00)
564
 
        PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x01)
 
561
        PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x00)
 
562
        PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x00)
 
563
        PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x00)
 
564
        PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x01)
565
565
        PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
566
 
        PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x01)
567
 
        PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x01)
 
566
        PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x01)
 
567
        PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x01)
568
568
        PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )   PORT_DIPLOCATION("SW1:7,8")
569
 
        PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x01)
570
 
        PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x01)
571
 
        PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x01)
572
 
        PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x01)
573
 
        PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x00)
574
 
        PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x00)
575
 
        PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x00)
576
 
        PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )    PORT_CONDITION("DSW1", 0x01, PORTCOND_EQUALS, 0x00)
 
569
        PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x01)
 
570
        PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x01)
 
571
        PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x01)
 
572
        PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x01)
 
573
        PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x00)
 
574
        PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x00)
 
575
        PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x00)
 
576
        PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )    PORT_CONDITION("DSW1", 0x01, EQUALS, 0x00)
577
577
        PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
578
578
        PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
579
579
        PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
667
667
        PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 )
668
668
        PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 )
669
669
        PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 )
670
 
        PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_VBLANK )  /* Must be low or game stops! */
 
670
        PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")    /* Must be low or game stops! */
671
671
 
672
672
        PORT_START("DSW2")
673
673
        PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
743
743
        PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 )
744
744
        PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 )
745
745
        PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 )
746
 
        PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_VBLANK )  /* Must be low or game stops! */
 
746
        PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")    /* Must be low or game stops! */
747
747
 
748
748
        PORT_START("DSW2")
749
749
        PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
1111
1111
        PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
1112
1112
INPUT_PORTS_END
1113
1113
 
 
1114
static INPUT_PORTS_START( twinkle )
 
1115
        PORT_START("DSW1")      /* 500000.w */
 
1116
        PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) )  PORT_DIPLOCATION("SW1:1")
 
1117
        PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
 
1118
        PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
 
1119
        PORT_DIPNAME( 0x000e, 0x000e, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:2,3,4")
 
1120
        PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
 
1121
        PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
 
1122
        PORT_DIPSETTING(      0x0004, DEF_STR( 3C_1C ) )
 
1123
        PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C ) )
 
1124
        PORT_DIPSETTING(      0x000e, DEF_STR( 1C_1C ) )
 
1125
        PORT_DIPSETTING(      0x000a, DEF_STR( 2C_3C ) )
 
1126
        PORT_DIPSETTING(      0x000c, DEF_STR( 1C_2C ) )
 
1127
        PORT_DIPSETTING(      0x0008, DEF_STR( 1C_3C ) )
 
1128
        PORT_DIPNAME( 0x0070, 0x0070, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:5,6,7") // this is what service mode lists, but I don't trust it.
 
1129
        PORT_DIPSETTING(      0x0020, "Level 1" )
 
1130
        PORT_DIPSETTING(      0x0010, "Level 2" )
 
1131
        PORT_DIPSETTING(      0x0000, "Level 3" )
 
1132
        PORT_DIPSETTING(      0x0070, "Level 4" )
 
1133
        PORT_DIPSETTING(      0x0060, "Level 5" )
 
1134
        PORT_DIPSETTING(      0x0050, "Level 6" )
 
1135
        PORT_DIPSETTING(      0x0040, "Level 7" )
 
1136
        PORT_DIPSETTING(      0x0030, "Level 8" )
 
1137
        PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
 
1138
        PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
 
1139
        PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
 
1140
        PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
 
1141
        PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
 
1142
        PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)  // jump
 
1143
        PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)  // fire
 
1144
        PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1)  // test mode only?
 
1145
        PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
 
1146
 
 
1147
        PORT_START("DSW2")      /* 500002.w */
 
1148
        PORT_DIPNAME( 0x0003, 0x0002, DEF_STR( Lives ) )        PORT_DIPLOCATION("SW2:1,2") // unlisted in service mode
 
1149
        PORT_DIPSETTING(      0x0000, "1" )
 
1150
        PORT_DIPSETTING(      0x0003, "2" )
 
1151
        PORT_DIPSETTING(      0x0002, "3" )
 
1152
        PORT_DIPSETTING(      0x0001, "4" )
 
1153
        PORT_DIPUNKNOWN_DIPLOC( 0x0004, 0x0000, "SW2:3" )
 
1154
        PORT_DIPUNKNOWN_DIPLOC( 0x0008, 0x0000, "SW2:4" )
 
1155
        PORT_DIPNAME( 0x0010, 0x0010, "Pellet Animations" )             PORT_DIPLOCATION("SW2:5") // unlisted in service mode
 
1156
        PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
 
1157
        PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
 
1158
        PORT_DIPUNKNOWN_DIPLOC( 0x0020, 0x0000, "SW2:6" )
 
1159
        PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0000, "SW2:7" )
 
1160
        PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Free_Play ) )    PORT_DIPLOCATION("SW2:8")
 
1161
        PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
 
1162
        PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
 
1163
        PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
 
1164
        PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
 
1165
        PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
 
1166
        PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
 
1167
        PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)  // jump
 
1168
        PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)  // fire
 
1169
        PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2)  // test mode only?
 
1170
        PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
 
1171
 
 
1172
        PORT_START("SYSTEM")    /* 500004.w */
 
1173
        PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_START1 )
 
1174
        PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_START2 )
 
1175
        PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_COIN1 )
 
1176
        PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_COIN2 )
 
1177
        PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
 
1178
        PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
 
1179
        PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
 
1180
        PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
 
1181
INPUT_PORTS_END
 
1182
 
1114
1183
// don't trust the test mode! <-- Verified via actual game play: Demo Sounds, Coinage & Free Play
1115
1184
static INPUT_PORTS_START( pzlbreak )
1116
1185
        PORT_START("DSW1")      /* 500000.w */
1440
1509
 
1441
1510
static const ym2151_interface ym2151_config =
1442
1511
{
1443
 
        irqhandler
 
1512
        DEVCB_LINE(irqhandler)
1444
1513
};
1445
1514
 
1446
1515
 
1447
1516
static MACHINE_RESET (semiprot)
1448
1517
{
1449
1518
        snowbros_state *state = machine.driver_data<snowbros_state>();
1450
 
        UINT16 *PROTDATA = (UINT16*)machine.region("user1")->base();
 
1519
        UINT16 *PROTDATA = (UINT16*)state->memregion("user1")->base();
1451
1520
        int i;
1452
1521
 
1453
1522
        for (i = 0;i < 0x200/2;i++)
1457
1526
static MACHINE_RESET (finalttr)
1458
1527
{
1459
1528
        snowbros_state *state = machine.driver_data<snowbros_state>();
1460
 
        UINT16 *PROTDATA = (UINT16*)machine.region("user1")->base();
 
1529
        UINT16 *PROTDATA = (UINT16*)state->memregion("user1")->base();
1461
1530
        int i;
1462
1531
 
1463
1532
        for (i = 0;i < 0x200/2;i++)
2260
2329
        ROM_LOAD( "9.1h",     0xc0000, 0x40000, CRC(2ebd316d) SHA1(2f1249ebd2a0bb0cc15259f7187201576a365fa6) )
2261
2330
ROM_END
2262
2331
 
2263
 
static READ16_HANDLER ( moremorp_0a_read )
 
2332
READ16_MEMBER(snowbros_state::moremorp_0a_read)
2264
2333
{
2265
2334
        return 0x000a;
2266
2335
}
2268
2337
static DRIVER_INIT( moremorp )
2269
2338
{
2270
2339
        //snowbros_state *state = machine.driver_data<snowbros_state>();
2271
 
//  UINT16 *PROTDATA = (UINT16*)machine.region("user1")->base();
 
2340
//  UINT16 *PROTDATA = (UINT16*)state->memregion("user1")->base();
2272
2341
//  int i;
2273
2342
 
2274
2343
//  for (i = 0;i < 0x200/2;i++)
2275
2344
//      state->m_hyperpac_ram[0xf000/2 + i] = PROTDATA[i];
2276
2345
 
2277
2346
        /* explicit check in the code */
2278
 
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x200000, 0x200001, FUNC(moremorp_0a_read) );
 
2347
        snowbros_state *state = machine.driver_data<snowbros_state>();
 
2348
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::moremorp_0a_read),state));
2279
2349
}
2280
2350
 
2281
2351
 
2282
2352
static DRIVER_INIT( cookbib2 )
2283
2353
{
2284
2354
        //snowbros_state *state = machine.driver_data<snowbros_state>();
2285
 
//  UINT16 *HCROM = (UINT16*)machine.region("maincpu")->base();
2286
 
//  UINT16 *PROTDATA = (UINT16*)machine.region("user1")->base();
 
2355
//  UINT16 *HCROM = (UINT16*)state->memregion("maincpu")->base();
 
2356
//  UINT16 *PROTDATA = (UINT16*)state->memregion("user1")->base();
2287
2357
//  int i;
2288
2358
//  state->m_hyperpac_ram[0xf000/2] = 0x46fc;
2289
2359
//  state->m_hyperpac_ram[0xf002/2] = 0x2700;
2641
2711
}
2642
2712
#endif
2643
2713
 
2644
 
static READ16_HANDLER ( _4in1_02_read )
 
2714
READ16_MEMBER(snowbros_state::_4in1_02_read)
2645
2715
{
2646
2716
        return 0x0202;
2647
2717
}
2649
2719
static DRIVER_INIT(4in1boot)
2650
2720
{
2651
2721
        UINT8 *buffer;
2652
 
        UINT8 *src = machine.region("maincpu")->base();
2653
 
        int len = machine.region("maincpu")->bytes();
 
2722
        UINT8 *src = machine.root_device().memregion("maincpu")->base();
 
2723
        int len = machine.root_device().memregion("maincpu")->bytes();
2654
2724
 
2655
2725
        /* strange order */
2656
2726
        buffer = auto_alloc_array(machine, UINT8, len);
2664
2734
                auto_free(machine, buffer);
2665
2735
        }
2666
2736
 
2667
 
        src = machine.region("soundcpu")->base();
2668
 
        len = machine.region("soundcpu")->bytes();
 
2737
        src = machine.root_device().memregion("soundcpu")->base();
 
2738
        len = machine.root_device().memregion("soundcpu")->bytes();
2669
2739
 
2670
2740
        /* strange order */
2671
2741
        buffer = auto_alloc_array(machine, UINT8, len);
2676
2746
                memcpy(src,buffer,len);
2677
2747
                auto_free(machine, buffer);
2678
2748
        }
2679
 
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x200000, 0x200001, FUNC(_4in1_02_read) );
 
2749
        snowbros_state *state = machine.driver_data<snowbros_state>();
 
2750
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::_4in1_02_read),state));
2680
2751
}
2681
2752
 
2682
2753
static DRIVER_INIT(snowbro3)
2683
2754
{
2684
2755
        UINT8 *buffer;
2685
 
        UINT8 *src = machine.region("maincpu")->base();
2686
 
        int len = machine.region("maincpu")->bytes();
 
2756
        UINT8 *src = machine.root_device().memregion("maincpu")->base();
 
2757
        int len = machine.root_device().memregion("maincpu")->bytes();
2687
2758
 
2688
2759
        /* strange order */
2689
2760
        buffer = auto_alloc_array(machine, UINT8, len);
2696
2767
        }
2697
2768
}
2698
2769
 
2699
 
static READ16_HANDLER( _3in1_read )
 
2770
READ16_MEMBER(snowbros_state::_3in1_read)
2700
2771
{
2701
2772
        return 0x0a0a;
2702
2773
}
2703
2774
 
2704
2775
static DRIVER_INIT( 3in1semi )
2705
2776
{
2706
 
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x200000, 0x200001, FUNC(_3in1_read) );
 
2777
        snowbros_state *state = machine.driver_data<snowbros_state>();
 
2778
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::_3in1_read),state));
2707
2779
}
2708
2780
 
2709
 
static READ16_HANDLER( cookbib3_read )
 
2781
READ16_MEMBER(snowbros_state::cookbib3_read)
2710
2782
{
2711
2783
        return 0x2a2a;
2712
2784
}
2713
2785
 
2714
2786
static DRIVER_INIT( cookbib3 )
2715
2787
{
2716
 
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x200000, 0x200001, FUNC(cookbib3_read) );
 
2788
        snowbros_state *state = machine.driver_data<snowbros_state>();
 
2789
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::cookbib3_read),state));
2717
2790
}
2718
2791
 
2719
2792
static DRIVER_INIT( pzlbreak )
2740
2813
GAME( 1996, toppyrap, 0,        semiprot, toppyrap, 0,        ROT0, "SemiCom", "Toppy & Rappy", 0 )
2741
2814
GAME( 1997, cookbib3, 0,        semiprot, cookbib3, cookbib3, ROT0, "SemiCom", "Cookie & Bibi 3", 0 )
2742
2815
GAME( 1997, 3in1semi, 0,        semiprot, moremore, 3in1semi, ROT0, "SemiCom", "XESS - The New Revolution (SemiCom 3-in-1)", 0 )
2743
 
GAME( 1997, twinkle,  0,        semiprot, moremore, 0,        ROT0, "SemiCom", "Twinkle", 0 )
 
2816
GAME( 1997, twinkle,  0,        semiprot, twinkle,  0,        ROT0, "SemiCom", "Twinkle", 0 )
2744
2817
GAME( 1997, pzlbreak, 0,        semiprot, pzlbreak, pzlbreak, ROT0, "SemiCom", "Puzzle Break", 0 )
2745
2818
GAME( 1999, moremore, 0,        semiprot, moremore, moremorp, ROT0, "SemiCom / Exit", "More More", 0 )
2746
2819
GAME( 1999, moremorp, 0,        semiprot, moremore, moremorp, ROT0, "SemiCom / Exit", "More More Plus", 0 )