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

« back to all changes in this revision

Viewing changes to src/mame/drivers/nmg5.c

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Emmanuel Kasper, Félix Arreola Rodríguez, Jordi Mallach
  • Date: 2011-05-11 21:06:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110511210650-jizvh8a6x117y9hr
Tags: 0.142-1
[ Emmanuel Kasper ]
* New upstream release
* Set NOWERROR=1 to allow compiling with gcc-4.6
* Remove fix_powerpc_build.patch, as upstream has taken it in this release
* Add gnome-video-arcade front end as a suggested package

[ Félix Arreola Rodríguez ]
* Add kfreebsd-build.patch to quilt series, to fix build on kfreebsd

[ Jordi Mallach ]
* Remove unneeded and bogus addition of --with-quilt to the dh invocation.
* Add Cesare Falco (long time Ubuntu maintainer) to Uploaders, and wrap
  them into multiple lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
233
233
                : driver_device(machine, config) { }
234
234
 
235
235
        /* memory pointers */
236
 
        UINT16 *    fg_videoram;
237
 
        UINT16 *    bg_videoram;
238
 
        UINT16 *    scroll_ram;
239
 
        UINT16 *    bitmap;
240
 
        UINT16 *    spriteram;
241
 
//  UINT16 *  paletteram;    // currently this uses generic palette handling
242
 
        size_t      spriteram_size;
 
236
        UINT16 *    m_fg_videoram;
 
237
        UINT16 *    m_bg_videoram;
 
238
        UINT16 *    m_scroll_ram;
 
239
        UINT16 *    m_bitmap;
 
240
        UINT16 *    m_spriteram;
 
241
//  UINT16 *  m_paletteram;    // currently this uses generic palette handling
 
242
        size_t      m_spriteram_size;
243
243
 
244
244
        /* video-related */
245
 
        tilemap_t  *bg_tilemap, *fg_tilemap;
 
245
        tilemap_t  *m_bg_tilemap;
 
246
        tilemap_t  *m_fg_tilemap;
246
247
 
247
248
        /* misc */
248
 
        UINT8 prot_val, input_data, priority_reg, gfx_bank;
 
249
        UINT8 m_prot_val;
 
250
        UINT8 m_input_data;
 
251
        UINT8 m_priority_reg;
 
252
        UINT8 m_gfx_bank;
249
253
 
250
254
        /* devices */
251
 
        device_t *maincpu;
252
 
        device_t *soundcpu;
 
255
        device_t *m_maincpu;
 
256
        device_t *m_soundcpu;
253
257
};
254
258
 
255
259
 
256
260
 
257
261
static WRITE16_HANDLER( fg_videoram_w )
258
262
{
259
 
        nmg5_state *state = space->machine->driver_data<nmg5_state>();
260
 
        COMBINE_DATA(&state->fg_videoram[offset]);
261
 
        tilemap_mark_tile_dirty(state->fg_tilemap, offset);
 
263
        nmg5_state *state = space->machine().driver_data<nmg5_state>();
 
264
        COMBINE_DATA(&state->m_fg_videoram[offset]);
 
265
        tilemap_mark_tile_dirty(state->m_fg_tilemap, offset);
262
266
}
263
267
 
264
268
static WRITE16_HANDLER( bg_videoram_w )
265
269
{
266
 
        nmg5_state *state = space->machine->driver_data<nmg5_state>();
267
 
        COMBINE_DATA(&state->bg_videoram[offset]);
268
 
        tilemap_mark_tile_dirty(state->bg_tilemap, offset);
 
270
        nmg5_state *state = space->machine().driver_data<nmg5_state>();
 
271
        COMBINE_DATA(&state->m_bg_videoram[offset]);
 
272
        tilemap_mark_tile_dirty(state->m_bg_tilemap, offset);
269
273
}
270
274
 
271
275
static WRITE16_HANDLER( nmg5_soundlatch_w )
272
276
{
273
 
        nmg5_state *state = space->machine->driver_data<nmg5_state>();
 
277
        nmg5_state *state = space->machine().driver_data<nmg5_state>();
274
278
 
275
279
        if (ACCESSING_BITS_0_7)
276
280
        {
277
281
                soundlatch_w(space, 0, data & 0xff);
278
 
                cpu_set_input_line(state->soundcpu, INPUT_LINE_NMI, PULSE_LINE);
 
282
                device_set_input_line(state->m_soundcpu, INPUT_LINE_NMI, PULSE_LINE);
279
283
        }
280
284
}
281
285
 
282
286
static READ16_HANDLER( prot_r )
283
287
{
284
 
        nmg5_state *state = space->machine->driver_data<nmg5_state>();
285
 
        return state->prot_val | state->input_data;
 
288
        nmg5_state *state = space->machine().driver_data<nmg5_state>();
 
289
        return state->m_prot_val | state->m_input_data;
286
290
}
287
291
 
288
292
static WRITE16_HANDLER( prot_w )
289
293
{
290
 
        nmg5_state *state = space->machine->driver_data<nmg5_state>();
291
 
        state->input_data = data & 0x0f;
 
294
        nmg5_state *state = space->machine().driver_data<nmg5_state>();
 
295
        state->m_input_data = data & 0x0f;
292
296
}
293
297
 
294
298
static WRITE16_HANDLER( gfx_bank_w )
295
299
{
296
 
        nmg5_state *state = space->machine->driver_data<nmg5_state>();
 
300
        nmg5_state *state = space->machine().driver_data<nmg5_state>();
297
301
 
298
 
        if (state->gfx_bank != (data & 3))
 
302
        if (state->m_gfx_bank != (data & 3))
299
303
        {
300
 
                state->gfx_bank = data & 3;
301
 
                tilemap_mark_all_tiles_dirty_all(space->machine);
 
304
                state->m_gfx_bank = data & 3;
 
305
                tilemap_mark_all_tiles_dirty_all(space->machine());
302
306
        }
303
307
}
304
308
 
305
309
static WRITE16_HANDLER( priority_reg_w )
306
310
{
307
 
        nmg5_state *state = space->machine->driver_data<nmg5_state>();
308
 
 
309
 
        state->priority_reg = data & 7;
310
 
 
311
 
        if (state->priority_reg == 4 || state->priority_reg == 5 || state->priority_reg == 6)
312
 
                popmessage("unknown priority_reg value = %d\n", state->priority_reg);
 
311
        nmg5_state *state = space->machine().driver_data<nmg5_state>();
 
312
 
 
313
        state->m_priority_reg = data & 7;
 
314
 
 
315
        if (state->m_priority_reg == 4 || state->m_priority_reg == 5 || state->m_priority_reg == 6)
 
316
                popmessage("unknown priority_reg value = %d\n", state->m_priority_reg);
313
317
}
314
318
 
315
319
static WRITE8_DEVICE_HANDLER( oki_banking_w )
323
327
 
324
328
********************************************************************/
325
329
 
326
 
static ADDRESS_MAP_START( nmg5_map, ADDRESS_SPACE_PROGRAM, 16 )
 
330
static ADDRESS_MAP_START( nmg5_map, AS_PROGRAM, 16 )
327
331
        AM_RANGE(0x000000, 0x0fffff) AM_ROM
328
332
        AM_RANGE(0x120000, 0x12ffff) AM_RAM
329
333
        AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
330
 
        AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE_MEMBER(nmg5_state, spriteram, spriteram_size)
 
334
        AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE_MEMBER(nmg5_state, m_spriteram, m_spriteram_size)
331
335
        AM_RANGE(0x180000, 0x180001) AM_WRITE(nmg5_soundlatch_w)
332
336
        AM_RANGE(0x180002, 0x180003) AM_WRITENOP
333
337
        AM_RANGE(0x180004, 0x180005) AM_READWRITE(prot_r, prot_w)
336
340
        AM_RANGE(0x18000a, 0x18000b) AM_READ_PORT("SYSTEM")
337
341
        AM_RANGE(0x18000c, 0x18000d) AM_READ_PORT("INPUTS")
338
342
        AM_RANGE(0x18000e, 0x18000f) AM_WRITE(priority_reg_w)
339
 
        AM_RANGE(0x300002, 0x300009) AM_WRITEONLY AM_BASE_MEMBER(nmg5_state, scroll_ram)
 
343
        AM_RANGE(0x300002, 0x300009) AM_WRITEONLY AM_BASE_MEMBER(nmg5_state, m_scroll_ram)
340
344
        AM_RANGE(0x30000a, 0x30000f) AM_WRITENOP
341
 
        AM_RANGE(0x320000, 0x321fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE_MEMBER(nmg5_state, bg_videoram)
342
 
        AM_RANGE(0x322000, 0x323fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE_MEMBER(nmg5_state, fg_videoram)
343
 
        AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_MEMBER(nmg5_state, bitmap)
 
345
        AM_RANGE(0x320000, 0x321fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE_MEMBER(nmg5_state, m_bg_videoram)
 
346
        AM_RANGE(0x322000, 0x323fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE_MEMBER(nmg5_state, m_fg_videoram)
 
347
        AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_MEMBER(nmg5_state, m_bitmap)
344
348
ADDRESS_MAP_END
345
349
 
346
 
static ADDRESS_MAP_START( pclubys_map, ADDRESS_SPACE_PROGRAM, 16 )
 
350
static ADDRESS_MAP_START( pclubys_map, AS_PROGRAM, 16 )
347
351
        AM_RANGE(0x000000, 0x0fffff) AM_ROM
348
352
        AM_RANGE(0x200000, 0x20ffff) AM_RAM
349
353
        AM_RANGE(0x440000, 0x4407ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
350
 
        AM_RANGE(0x460000, 0x4607ff) AM_RAM AM_BASE_SIZE_MEMBER(nmg5_state, spriteram, spriteram_size)
 
354
        AM_RANGE(0x460000, 0x4607ff) AM_RAM AM_BASE_SIZE_MEMBER(nmg5_state, m_spriteram, m_spriteram_size)
351
355
        AM_RANGE(0x480000, 0x480001) AM_WRITE(nmg5_soundlatch_w)
352
356
        AM_RANGE(0x480002, 0x480003) AM_WRITENOP
353
357
        AM_RANGE(0x480004, 0x480005) AM_READWRITE(prot_r, prot_w)
356
360
        AM_RANGE(0x48000a, 0x48000b) AM_READ_PORT("SYSTEM")
357
361
        AM_RANGE(0x48000c, 0x48000d) AM_READ_PORT("INPUTS")
358
362
        AM_RANGE(0x48000e, 0x48000f) AM_WRITE(priority_reg_w)
359
 
        AM_RANGE(0x500002, 0x500009) AM_WRITEONLY AM_BASE_MEMBER(nmg5_state, scroll_ram)
360
 
        AM_RANGE(0x520000, 0x521fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE_MEMBER(nmg5_state, bg_videoram)
361
 
        AM_RANGE(0x522000, 0x523fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE_MEMBER(nmg5_state, fg_videoram)
362
 
        AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_MEMBER(nmg5_state, bitmap)
 
363
        AM_RANGE(0x500002, 0x500009) AM_WRITEONLY AM_BASE_MEMBER(nmg5_state, m_scroll_ram)
 
364
        AM_RANGE(0x520000, 0x521fff) AM_RAM_WRITE(bg_videoram_w) AM_BASE_MEMBER(nmg5_state, m_bg_videoram)
 
365
        AM_RANGE(0x522000, 0x523fff) AM_RAM_WRITE(fg_videoram_w) AM_BASE_MEMBER(nmg5_state, m_fg_videoram)
 
366
        AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_MEMBER(nmg5_state, m_bitmap)
363
367
ADDRESS_MAP_END
364
368
 
365
369
/*******************************************************************
368
372
 
369
373
********************************************************************/
370
374
 
371
 
static ADDRESS_MAP_START( nmg5_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
 
375
static ADDRESS_MAP_START( nmg5_sound_map, AS_PROGRAM, 8 )
372
376
        AM_RANGE(0x0000, 0xdfff) AM_ROM
373
377
        AM_RANGE(0xe000, 0xe7ff) AM_RAM
374
378
ADDRESS_MAP_END
375
379
 
376
 
static ADDRESS_MAP_START( pclubys_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
 
380
static ADDRESS_MAP_START( pclubys_sound_map, AS_PROGRAM, 8 )
377
381
        AM_RANGE(0x0000, 0xf7ff) AM_ROM
378
382
        AM_RANGE(0xf800, 0xffff) AM_RAM
379
383
ADDRESS_MAP_END
380
384
 
381
 
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
 
385
static ADDRESS_MAP_START( sound_io_map, AS_IO, 8 )
382
386
        ADDRESS_MAP_GLOBAL_MASK(0xff)
383
387
        AM_RANGE(0x00, 0x00) AM_DEVWRITE("oki", oki_banking_w)
384
388
        AM_RANGE(0x10, 0x11) AM_DEVREADWRITE("ymsnd", ym3812_r, ym3812_w)
823
827
INPUT_PORTS_END
824
828
 
825
829
 
826
 
INLINE void get_tile_info( running_machine *machine, tile_data *tileinfo, int tile_index, UINT16 *vram, int color )
 
830
INLINE void get_tile_info( running_machine &machine, tile_data *tileinfo, int tile_index, UINT16 *vram, int color )
827
831
{
828
 
        nmg5_state *state = machine->driver_data<nmg5_state>();
829
 
        SET_TILE_INFO(0, vram[tile_index] | (state->gfx_bank << 16), color, 0);
 
832
        nmg5_state *state = machine.driver_data<nmg5_state>();
 
833
        SET_TILE_INFO(0, vram[tile_index] | (state->m_gfx_bank << 16), color, 0);
830
834
}
831
835
 
832
 
static TILE_GET_INFO( fg_get_tile_info ) { nmg5_state *state = machine->driver_data<nmg5_state>();      get_tile_info(machine, tileinfo, tile_index, state->fg_videoram, 0); }
833
 
static TILE_GET_INFO( bg_get_tile_info ) { nmg5_state *state = machine->driver_data<nmg5_state>();      get_tile_info(machine, tileinfo, tile_index, state->bg_videoram, 1); }
 
836
static TILE_GET_INFO( fg_get_tile_info ) { nmg5_state *state = machine.driver_data<nmg5_state>();       get_tile_info(machine, tileinfo, tile_index, state->m_fg_videoram, 0); }
 
837
static TILE_GET_INFO( bg_get_tile_info ) { nmg5_state *state = machine.driver_data<nmg5_state>();       get_tile_info(machine, tileinfo, tile_index, state->m_bg_videoram, 1); }
834
838
 
835
839
static VIDEO_START( nmg5 )
836
840
{
837
 
        nmg5_state *state = machine->driver_data<nmg5_state>();
 
841
        nmg5_state *state = machine.driver_data<nmg5_state>();
838
842
 
839
 
        state->bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_rows, 8, 8, 64, 64);
840
 
        state->fg_tilemap = tilemap_create(machine, fg_get_tile_info, tilemap_scan_rows, 8, 8, 64, 64);
841
 
        tilemap_set_transparent_pen(state->fg_tilemap, 0);
 
843
        state->m_bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_rows, 8, 8, 64, 64);
 
844
        state->m_fg_tilemap = tilemap_create(machine, fg_get_tile_info, tilemap_scan_rows, 8, 8, 64, 64);
 
845
        tilemap_set_transparent_pen(state->m_fg_tilemap, 0);
842
846
}
843
847
 
844
 
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
 
848
static void draw_sprites( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect )
845
849
{
846
 
        nmg5_state *state = machine->driver_data<nmg5_state>();
847
 
        UINT16 *spriteram = state->spriteram;
 
850
        nmg5_state *state = machine.driver_data<nmg5_state>();
 
851
        UINT16 *spriteram = state->m_spriteram;
848
852
        int offs;
849
853
 
850
 
        for (offs = 0; offs < state->spriteram_size / 2; offs += 4)
 
854
        for (offs = 0; offs < state->m_spriteram_size / 2; offs += 4)
851
855
        {
852
856
                int sx, sy, code, color, flipx, flipy, height, y;
853
857
 
861
865
 
862
866
                for (y = 0; y < height; y++)
863
867
                {
864
 
                        drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
 
868
                        drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
865
869
                                        code + (flipy ? height-1 - y : y),
866
870
                                        color,
867
871
                                        flipx,flipy,
868
872
                                        sx & 0x1ff,248 - ((sy + 0x10 * (height - y)) & 0x1ff),0);
869
873
 
870
874
                        /* wrap around */
871
 
                        drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
 
875
                        drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
872
876
                                        code + (flipy ? height-1 - y : y),
873
877
                                        color,
874
878
                                        flipx,flipy,
877
881
        }
878
882
}
879
883
 
880
 
static void draw_bitmap( running_machine *machine, bitmap_t *bitmap )
 
884
static void draw_bitmap( running_machine &machine, bitmap_t *bitmap )
881
885
{
882
 
        nmg5_state *state = machine->driver_data<nmg5_state>();
 
886
        nmg5_state *state = machine.driver_data<nmg5_state>();
883
887
        int yyy = 256;
884
888
        int xxx = 512 / 4;
885
889
        UINT16 x, y, count;
892
896
        {
893
897
                for (x = 0; x < xxx; x++)
894
898
                {
895
 
                        pix = (state->bitmap[count] & 0xf000) >> 12;
 
899
                        pix = (state->m_bitmap[count] & 0xf000) >> 12;
896
900
                        if (pix) *BITMAP_ADDR16(bitmap, y + yoff, x * 4 + 0 + xoff) = pix + 0x300;
897
 
                        pix = (state->bitmap[count] & 0x0f00) >> 8;
 
901
                        pix = (state->m_bitmap[count] & 0x0f00) >> 8;
898
902
                        if (pix) *BITMAP_ADDR16(bitmap, y + yoff, x * 4 + 1 + xoff) = pix + 0x300;
899
 
                        pix = (state->bitmap[count] & 0x00f0) >> 4;
 
903
                        pix = (state->m_bitmap[count] & 0x00f0) >> 4;
900
904
                        if (pix) *BITMAP_ADDR16(bitmap, y + yoff, x * 4 + 2 + xoff) = pix + 0x300;
901
 
                        pix = (state->bitmap[count] & 0x000f) >> 0;
 
905
                        pix = (state->m_bitmap[count] & 0x000f) >> 0;
902
906
                        if (pix) *BITMAP_ADDR16(bitmap, y + yoff, x * 4 + 3 + xoff) = pix + 0x300;
903
907
 
904
908
                        count++;
907
911
}
908
912
 
909
913
 
910
 
static VIDEO_UPDATE( nmg5 )
 
914
static SCREEN_UPDATE( nmg5 )
911
915
{
912
 
        nmg5_state *state = screen->machine->driver_data<nmg5_state>();
913
 
 
914
 
        tilemap_set_scrolly(state->bg_tilemap, 0, state->scroll_ram[3] + 9);
915
 
        tilemap_set_scrollx(state->bg_tilemap, 0, state->scroll_ram[2] + 3);
916
 
        tilemap_set_scrolly(state->fg_tilemap, 0, state->scroll_ram[1] + 9);
917
 
        tilemap_set_scrollx(state->fg_tilemap, 0, state->scroll_ram[0] - 1);
918
 
 
919
 
        tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
920
 
 
921
 
        if (state->priority_reg == 0)
922
 
        {
923
 
                draw_sprites(screen->machine, bitmap, cliprect);
924
 
                tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
925
 
                draw_bitmap(screen->machine, bitmap);
926
 
        }
927
 
        else if (state->priority_reg == 1)
928
 
        {
929
 
                draw_bitmap(screen->machine, bitmap);
930
 
                draw_sprites(screen->machine, bitmap, cliprect);
931
 
                tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
932
 
        }
933
 
        else if (state->priority_reg == 2)
934
 
        {
935
 
                draw_sprites(screen->machine, bitmap, cliprect);
936
 
                draw_bitmap(screen->machine, bitmap);
937
 
                tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
938
 
        }
939
 
        else if (state->priority_reg == 3)
940
 
        {
941
 
                tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
942
 
                draw_sprites(screen->machine, bitmap, cliprect);
943
 
                draw_bitmap(screen->machine, bitmap);
944
 
        }
945
 
        else if (state->priority_reg == 7)
946
 
        {
947
 
                tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
948
 
                draw_bitmap(screen->machine, bitmap);
949
 
                draw_sprites(screen->machine, bitmap, cliprect);
 
916
        nmg5_state *state = screen->machine().driver_data<nmg5_state>();
 
917
 
 
918
        tilemap_set_scrolly(state->m_bg_tilemap, 0, state->m_scroll_ram[3] + 9);
 
919
        tilemap_set_scrollx(state->m_bg_tilemap, 0, state->m_scroll_ram[2] + 3);
 
920
        tilemap_set_scrolly(state->m_fg_tilemap, 0, state->m_scroll_ram[1] + 9);
 
921
        tilemap_set_scrollx(state->m_fg_tilemap, 0, state->m_scroll_ram[0] - 1);
 
922
 
 
923
        tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0);
 
924
 
 
925
        if (state->m_priority_reg == 0)
 
926
        {
 
927
                draw_sprites(screen->machine(), bitmap, cliprect);
 
928
                tilemap_draw(bitmap, cliprect, state->m_fg_tilemap, 0, 0);
 
929
                draw_bitmap(screen->machine(), bitmap);
 
930
        }
 
931
        else if (state->m_priority_reg == 1)
 
932
        {
 
933
                draw_bitmap(screen->machine(), bitmap);
 
934
                draw_sprites(screen->machine(), bitmap, cliprect);
 
935
                tilemap_draw(bitmap, cliprect, state->m_fg_tilemap, 0, 0);
 
936
        }
 
937
        else if (state->m_priority_reg == 2)
 
938
        {
 
939
                draw_sprites(screen->machine(), bitmap, cliprect);
 
940
                draw_bitmap(screen->machine(), bitmap);
 
941
                tilemap_draw(bitmap, cliprect, state->m_fg_tilemap, 0, 0);
 
942
        }
 
943
        else if (state->m_priority_reg == 3)
 
944
        {
 
945
                tilemap_draw(bitmap, cliprect, state->m_fg_tilemap, 0, 0);
 
946
                draw_sprites(screen->machine(), bitmap, cliprect);
 
947
                draw_bitmap(screen->machine(), bitmap);
 
948
        }
 
949
        else if (state->m_priority_reg == 7)
 
950
        {
 
951
                tilemap_draw(bitmap, cliprect, state->m_fg_tilemap, 0, 0);
 
952
                draw_bitmap(screen->machine(), bitmap);
 
953
                draw_sprites(screen->machine(), bitmap, cliprect);
950
954
        }
951
955
        return 0;
952
956
}
998
1002
 
999
1003
static void soundirq( device_t *device, int state )
1000
1004
{
1001
 
        nmg5_state *driver_state = device->machine->driver_data<nmg5_state>();
1002
 
        cpu_set_input_line(driver_state->soundcpu, 0, state);
 
1005
        nmg5_state *driver_state = device->machine().driver_data<nmg5_state>();
 
1006
        device_set_input_line(driver_state->m_soundcpu, 0, state);
1003
1007
}
1004
1008
 
1005
1009
static const ym3812_interface ym3812_intf =
1009
1013
 
1010
1014
static MACHINE_START( nmg5 )
1011
1015
{
1012
 
        nmg5_state *state = machine->driver_data<nmg5_state>();
1013
 
 
1014
 
        state->maincpu = machine->device("maincpu");
1015
 
        state->soundcpu = machine->device("soundcpu");
1016
 
 
1017
 
        state_save_register_global(machine, state->gfx_bank);
1018
 
        state_save_register_global(machine, state->priority_reg);
1019
 
        state_save_register_global(machine, state->input_data);
 
1016
        nmg5_state *state = machine.driver_data<nmg5_state>();
 
1017
 
 
1018
        state->m_maincpu = machine.device("maincpu");
 
1019
        state->m_soundcpu = machine.device("soundcpu");
 
1020
 
 
1021
        state->save_item(NAME(state->m_gfx_bank));
 
1022
        state->save_item(NAME(state->m_priority_reg));
 
1023
        state->save_item(NAME(state->m_input_data));
1020
1024
}
1021
1025
 
1022
1026
static MACHINE_RESET( nmg5 )
1023
1027
{
1024
 
        nmg5_state *state = machine->driver_data<nmg5_state>();
 
1028
        nmg5_state *state = machine.driver_data<nmg5_state>();
1025
1029
 
1026
1030
        /* some games don't set the priority register so it should be hard-coded to a normal layout */
1027
 
        state->priority_reg = 7;
 
1031
        state->m_priority_reg = 7;
1028
1032
 
1029
 
        state->gfx_bank = 0;
1030
 
        state->input_data = 0;
 
1033
        state->m_gfx_bank = 0;
 
1034
        state->m_input_data = 0;
1031
1035
}
1032
1036
 
1033
1037
static MACHINE_CONFIG_START( nmg5, nmg5_state )
1051
1055
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1052
1056
        MCFG_SCREEN_SIZE(320, 256)
1053
1057
        MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
 
1058
        MCFG_SCREEN_UPDATE(nmg5)
1054
1059
 
1055
1060
        MCFG_GFXDECODE(nmg5)
1056
1061
        MCFG_PALETTE_LENGTH(0x400)
1057
1062
 
1058
1063
        MCFG_VIDEO_START(nmg5)
1059
 
        MCFG_VIDEO_UPDATE(nmg5)
1060
1064
 
1061
1065
        /* sound hardware */
1062
1066
        MCFG_SPEAKER_STANDARD_MONO("mono")
1523
1527
 
1524
1528
static DRIVER_INIT( prot_val_00 )
1525
1529
{
1526
 
        nmg5_state *state = machine->driver_data<nmg5_state>();
1527
 
        state->prot_val = 0x00;
 
1530
        nmg5_state *state = machine.driver_data<nmg5_state>();
 
1531
        state->m_prot_val = 0x00;
1528
1532
}
1529
1533
 
1530
1534
static DRIVER_INIT( prot_val_10 )
1531
1535
{
1532
 
        nmg5_state *state = machine->driver_data<nmg5_state>();
1533
 
        state->prot_val = 0x10;
 
1536
        nmg5_state *state = machine.driver_data<nmg5_state>();
 
1537
        state->m_prot_val = 0x10;
1534
1538
}
1535
1539
 
1536
1540
static DRIVER_INIT( prot_val_20 )
1537
1541
{
1538
 
        nmg5_state *state = machine->driver_data<nmg5_state>();
1539
 
        state->prot_val = 0x20;
 
1542
        nmg5_state *state = machine.driver_data<nmg5_state>();
 
1543
        state->m_prot_val = 0x20;
1540
1544
}
1541
1545
 
1542
1546
static DRIVER_INIT( prot_val_40 )
1543
1547
{
1544
 
        nmg5_state *state = machine->driver_data<nmg5_state>();
1545
 
        state->prot_val = 0x40;
 
1548
        nmg5_state *state = machine.driver_data<nmg5_state>();
 
1549
        state->m_prot_val = 0x40;
1546
1550
}
1547
1551
 
1548
1552
GAME( 1998, nmg5,     0,       nmg5,     nmg5,     prot_val_10, ROT0, "Yun Sung", "Multi 5 / New Multi Game 5", GAME_SUPPORTS_SAVE )