diff options
| author | 2009-12-09 14:10:54 +0000 | |
|---|---|---|
| committer | 2009-12-09 14:10:54 +0000 | |
| commit | 3781da05a5e495c6551f827cb5aa362bedf37b18 (patch) | |
| tree | 48800904ccbf0e6951c7d880d231b94faf3f3409 | |
| parent | eb9e1e53e555c6d0ae1f2f960b9fccb1a4cb5253 (diff) | |
Added driver data struct and save states to jack.c
| -rw-r--r-- | .gitattributes | 1 | ||||
| -rw-r--r-- | src/mame/drivers/jack.c | 207 | ||||
| -rw-r--r-- | src/mame/includes/jack.h | 46 | ||||
| -rw-r--r-- | src/mame/video/jack.c | 62 |
4 files changed, 219 insertions, 97 deletions
diff --git a/.gitattributes b/.gitattributes index 4d0d55ee326..74407162c17 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2509,6 +2509,7 @@ src/mame/includes/irobot.h svneol=native#text/plain src/mame/includes/ironhors.h svneol=native#text/plain src/mame/includes/itech32.h svneol=native#text/plain src/mame/includes/itech8.h svneol=native#text/plain +src/mame/includes/jack.h svneol=native#text/plain src/mame/includes/jackal.h svneol=native#text/plain src/mame/includes/jaguar.h svneol=native#text/plain src/mame/includes/jailbrek.h svneol=native#text/plain diff --git a/src/mame/drivers/jack.c b/src/mame/drivers/jack.c index 80c55d3ce2f..34b8d9288fc 100644 --- a/src/mame/drivers/jack.c +++ b/src/mame/drivers/jack.c @@ -45,53 +45,48 @@ The 2 ay-8910 read ports are responsible for reading the sound commands. #include "deprecat.h" #include "cpu/z80/z80.h" #include "sound/ay8910.h" +#include "includes/jack.h" -extern WRITE8_HANDLER( jack_videoram_w ); -extern WRITE8_HANDLER( jack_colorram_w ); -extern WRITE8_HANDLER( jack_paletteram_w ); -extern READ8_HANDLER( jack_flipscreen_r ); -extern WRITE8_HANDLER( jack_flipscreen_w ); - -extern VIDEO_START( jack ); -extern VIDEO_UPDATE( jack ); - -extern PALETTE_INIT( joinem ); -extern VIDEO_START( joinem ); -extern VIDEO_UPDATE( joinem ); - -static int timer_rate; +/************************************* + * + * Memory handlers + * + *************************************/ static READ8_DEVICE_HANDLER( timer_r ) { + jack_state *state = (jack_state *)device->machine->driver_data; + /* wrong! there should be no need for timer_rate, the same function */ /* should work for both games */ - return cputag_get_total_cycles(device->machine, "audiocpu") / timer_rate; + return cpu_get_total_cycles(state->audiocpu) / state->timer_rate; } static WRITE8_HANDLER( jack_sh_command_w ) { + jack_state *state = (jack_state *)space->machine->driver_data; soundlatch_w(space, 0, data); - cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); + cpu_set_input_line(state->audiocpu, 0, HOLD_LINE); } /* these handlers are guessed, because otherwise you can't enter test mode */ -static int joinem_snd_bit = 0; - static WRITE8_HANDLER( joinem_misc_w ) { + jack_state *state = (jack_state *)space->machine->driver_data; flip_screen_set(space->machine, data & 0x80); - joinem_snd_bit = data & 1; + state->joinem_snd_bit = data & 1; } static CUSTOM_INPUT( sound_check_r ) { + jack_state *state = (jack_state *)field->port->machine->driver_data; UINT8 ret = 0; - if((input_port_read(field->port->machine, "IN2") & 0x80) && !joinem_snd_bit) + if ((input_port_read(field->port->machine, "IN2") & 0x80) && !state->joinem_snd_bit) ret = 1; return ret; @@ -101,22 +96,20 @@ static CUSTOM_INPUT( sound_check_r ) Super Triv questions read handler */ -static int question_address = 0; -static int question_rom = 0; -static int remap_address[16]; - static READ8_HANDLER( striv_question_r ) { + jack_state *state = (jack_state *)space->machine->driver_data; + // Set-up the remap table for every 16 bytes - if((offset & 0xc00) == 0x800) + if ((offset & 0xc00) == 0x800) { - remap_address[offset & 0x0f] = (offset & 0xf0) >> 4; + state->remap_address[offset & 0x0f] = (offset & 0xf0) >> 4; } // Select which rom to read and the high 5 bits of address - else if((offset & 0xc00) == 0xc00) + else if ((offset & 0xc00) == 0xc00) { - question_rom = offset & 7; - question_address = (offset & 0xf8) << 7; + state->question_rom = offset & 7; + state->question_address = (offset & 0xf8) << 7; } // Read the actual byte from question roms else @@ -124,13 +117,13 @@ static READ8_HANDLER( striv_question_r ) UINT8 *ROM = memory_region(space->machine, "user1"); int real_address; - real_address = question_address | (offset & 0x3f0) | remap_address[offset & 0x0f]; + real_address = state->question_address | (offset & 0x3f0) | state->remap_address[offset & 0x0f]; // Check if it wants to read from the upper 8 roms or not - if(offset & 0x400) - real_address |= 0x8000 * (question_rom + 8); + if (offset & 0x400) + real_address |= 0x8000 * (state->question_rom + 8); else - real_address |= 0x8000 * question_rom; + real_address |= 0x8000 * state->question_rom; return ROM[real_address]; } @@ -138,10 +131,16 @@ static READ8_HANDLER( striv_question_r ) return 0; // the value read from the configuration reads is discarded } +/************************************* + * + * Address maps + * + *************************************/ + static ADDRESS_MAP_START( jack_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x5fff) AM_RAM - AM_RANGE(0xb000, 0xb07f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) + AM_RANGE(0xb000, 0xb07f) AM_RAM AM_BASE_SIZE_MEMBER(jack_state, spriteram, spriteram_size) AM_RANGE(0xb400, 0xb400) AM_WRITE(jack_sh_command_w) AM_RANGE(0xb500, 0xb500) AM_READ_PORT("DSW1") AM_RANGE(0xb501, 0xb501) AM_READ_PORT("DSW2") @@ -151,15 +150,15 @@ static ADDRESS_MAP_START( jack_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xb505, 0xb505) AM_READ_PORT("IN3") AM_RANGE(0xb506, 0xb507) AM_READWRITE(jack_flipscreen_r, jack_flipscreen_w) AM_RANGE(0xb600, 0xb61f) AM_WRITE(jack_paletteram_w) AM_BASE_GENERIC(paletteram) - AM_RANGE(0xb800, 0xbbff) AM_RAM_WRITE(jack_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0xbc00, 0xbfff) AM_RAM_WRITE(jack_colorram_w) AM_BASE_GENERIC(colorram) + AM_RANGE(0xb800, 0xbbff) AM_RAM_WRITE(jack_videoram_w) AM_BASE_MEMBER(jack_state, videoram) + AM_RANGE(0xbc00, 0xbfff) AM_RAM_WRITE(jack_colorram_w) AM_BASE_MEMBER(jack_state, colorram) AM_RANGE(0xc000, 0xffff) AM_ROM ADDRESS_MAP_END static ADDRESS_MAP_START( joinem_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x8fff) AM_RAM - AM_RANGE(0xb000, 0xb0ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) + AM_RANGE(0xb000, 0xb0ff) AM_RAM AM_BASE_SIZE_MEMBER(jack_state, spriteram, spriteram_size) AM_RANGE(0xb400, 0xb400) AM_WRITE(jack_sh_command_w) AM_RANGE(0xb500, 0xb500) AM_READ_PORT("DSW1") AM_RANGE(0xb501, 0xb501) AM_READ_PORT("DSW2") @@ -168,8 +167,8 @@ static ADDRESS_MAP_START( joinem_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xb504, 0xb504) AM_READ_PORT("IN2") AM_RANGE(0xb506, 0xb507) AM_READWRITE(jack_flipscreen_r, jack_flipscreen_w) AM_RANGE(0xb700, 0xb700) AM_WRITE(joinem_misc_w) - AM_RANGE(0xb800, 0xbbff) AM_RAM_WRITE(jack_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0xbc00, 0xbfff) AM_RAM_WRITE(jack_colorram_w) AM_BASE_GENERIC(colorram) + AM_RANGE(0xb800, 0xbbff) AM_RAM_WRITE(jack_videoram_w) AM_BASE_MEMBER(jack_state, videoram) + AM_RANGE(0xbc00, 0xbfff) AM_RAM_WRITE(jack_colorram_w) AM_BASE_MEMBER(jack_state, colorram) ADDRESS_MAP_END @@ -186,6 +185,12 @@ static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_END +/************************************* + * + * Input ports + * + *************************************/ + static INPUT_PORTS_START( jack ) PORT_START("DSW1") PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) ) @@ -798,6 +803,12 @@ static INPUT_PORTS_START( striv ) INPUT_PORTS_END +/************************************* + * + * Graphics definitions + * + *************************************/ + static const gfx_layout charlayout = { 8,8, /* 8*8 characters */ @@ -837,8 +848,42 @@ static const ay8910_interface ay8910_config = }; +/************************************* + * + * Machine driver + * + *************************************/ + +static MACHINE_START( jack ) +{ + jack_state *state = (jack_state *)machine->driver_data; + + state->audiocpu = devtag_get_device(machine, "audiocpu"); + + state_save_register_global(machine, state->joinem_snd_bit); + state_save_register_global(machine, state->question_address); + state_save_register_global(machine, state->question_rom); + state_save_register_global_array(machine, state->remap_address); +} + +static MACHINE_RESET( jack ) +{ + jack_state *state = (jack_state *)machine->driver_data; + int i; + + state->joinem_snd_bit = 0; + state->question_address = 0; + state->question_rom = 0; + + for (i = 0; i < 16; i++) + state->remap_address[i] = 0; +} + static MACHINE_DRIVER_START( jack ) + /* driver data */ + MDRV_DRIVER_DATA(jack_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", Z80, 18000000/6) /* 3 MHz */ MDRV_CPU_PROGRAM_MAP(jack_map) @@ -848,6 +893,9 @@ static MACHINE_DRIVER_START( jack ) MDRV_CPU_PROGRAM_MAP(sound_map) MDRV_CPU_IO_MAP(sound_io_map) + MDRV_MACHINE_START(jack) + MDRV_MACHINE_RESET(jack) + /* video hardware */ MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_REFRESH_RATE(60) @@ -880,11 +928,11 @@ MACHINE_DRIVER_END static INTERRUPT_GEN( joinem_interrupts ) { - if(cpu_getiloops(device) > 0) + if (cpu_getiloops(device) > 0) cpu_set_input_line(device, 0, HOLD_LINE); else { - if(!(input_port_read(device->machine, "IN2") & 0x80)) + if (!(input_port_read(device->machine, "IN2") & 0x80)) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); } } @@ -928,11 +976,11 @@ static MACHINE_DRIVER_START( loverboy ) MDRV_VIDEO_UPDATE(joinem) MACHINE_DRIVER_END -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ +/************************************* + * + * ROM definition(s) + * + *************************************/ ROM_START( jack ) ROM_REGION( 0x10000, "maincpu", 0 ) @@ -1317,7 +1365,13 @@ ROM_START( striv ) ROM_END -static void treahunt_decode(running_machine *machine) +/************************************* + * + * Driver initialization + * + *************************************/ + +static void treahunt_decode( running_machine *machine ) { int A; const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); @@ -1364,22 +1418,27 @@ static void treahunt_decode(running_machine *machine) static DRIVER_INIT( jack ) { - timer_rate = 128; + jack_state *state = (jack_state *)machine->driver_data; + state->timer_rate = 128; } static DRIVER_INIT( treahunt ) { - timer_rate = 128; + jack_state *state = (jack_state *)machine->driver_data; + state->timer_rate = 128; treahunt_decode(machine); } static DRIVER_INIT( zzyzzyxx ) { - timer_rate = 16; + jack_state *state = (jack_state *)machine->driver_data; + state->timer_rate = 16; } static DRIVER_INIT( loverboy ) { + jack_state *state = (jack_state *)machine->driver_data; + /* this doesn't make sense.. the startup code, and irq0 have jumps to 0.. I replace the startup jump with another jump to what appears to be the start of the game code. @@ -1389,32 +1448,33 @@ static DRIVER_INIT( loverboy ) ROM[0x13] = 0x01; ROM[0x12] = 0x9d; - timer_rate = 16; + state->timer_rate = 16; } static DRIVER_INIT( striv ) { + jack_state *state = (jack_state *)machine->driver_data; UINT8 *ROM = memory_region(machine, "maincpu"); UINT8 data; int A; /* decrypt program rom */ /* thanks to David Widel to have helped with the decryption */ - for( A = 0; A < 0x4000; A++ ) + for (A = 0; A < 0x4000; A++) { data = ROM[A]; - if(A & 0x1000) + if (A & 0x1000) { - if(A & 4) + if (A & 4) ROM[A] = BITSWAP8(data,7,2,5,1,3,6,4,0) ^ 1; else ROM[A] = BITSWAP8(data,0,2,5,1,3,6,4,7) ^ 0x81; } else { - if(A & 4) + if (A & 4) ROM[A] = BITSWAP8(data,7,2,5,1,3,6,4,0) ^ 1; else ROM[A] = BITSWAP8(data,0,2,5,1,3,6,4,7); @@ -1427,21 +1487,26 @@ static DRIVER_INIT( striv ) // Nop out unused sprites writes memory_nop_write(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xb000, 0xb0ff, 0, 0); - timer_rate = 128; + state->timer_rate = 128; } -GAME( 1982, jack, 0, jack, jack, jack, ROT90, "Cinematronics", "Jack the Giantkiller (set 1)", 0 ) -GAME( 1982, jack2, jack, jack, jack2, jack, ROT90, "Cinematronics", "Jack the Giantkiller (set 2)", 0 ) -GAME( 1982, jack3, jack, jack, jack3, jack, ROT90, "Cinematronics", "Jack the Giantkiller (set 3)", 0 ) -GAME( 1982, treahunt, jack, jack, treahunt, treahunt, ROT90, "Hara Industries", "Treasure Hunt (bootleg?)", 0 ) -GAME( 1982, zzyzzyxx, 0, jack, zzyzzyxx, zzyzzyxx, ROT90, "Cinematronics + Advanced Microcomputer Systems", "Zzyzzyxx (set 1)", 0 ) -GAME( 1982, zzyzzyxx2,zzyzzyxx, jack, zzyzzyxx, zzyzzyxx, ROT90, "Cinematronics + Advanced Microcomputer Systems", "Zzyzzyxx (set 2)", 0 ) -GAME( 1982, brix, zzyzzyxx, jack, zzyzzyxx, zzyzzyxx, ROT90, "Cinematronics + Advanced Microcomputer Systems", "Brix", 0 ) -GAME( 1984, freeze, 0, jack, freeze, jack, ROT90, "Cinematronics", "Freeze", 0 ) -GAME( 1984, sucasino, 0, jack, sucasino, jack, ROT90, "Data Amusement", "Super Casino", 0 ) -GAME( 1981, tripool, 0, tripool, tripool, jack, ROT90, "Noma (Casino Tech license)", "Tri-Pool (Casino Tech)", 0 ) -GAME( 1981, tripoola, tripool, tripool, tripool, jack, ROT90, "Noma (Costal Games license)", "Tri-Pool (Costal Games)", 0 ) -GAME( 1986, joinem, 0, joinem, joinem, zzyzzyxx, ROT90, "Global Corporation", "Joinem", 0 ) -GAME( 1983, loverboy, 0, loverboy,loverboy, loverboy, ROT90, "G.T Enterprise Inc", "Lover Boy", 0 ) -GAME( 1985, striv, 0, jack, striv, striv, ROT270,"Hara Industries", "Super Triv", GAME_IMPERFECT_SOUND ) - +/************************************* + * + * Game driver(s) + * + *************************************/ + +GAME( 1982, jack, 0, jack, jack, jack, ROT90, "Cinematronics", "Jack the Giantkiller (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1982, jack2, jack, jack, jack2, jack, ROT90, "Cinematronics", "Jack the Giantkiller (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1982, jack3, jack, jack, jack3, jack, ROT90, "Cinematronics", "Jack the Giantkiller (set 3)", GAME_SUPPORTS_SAVE ) +GAME( 1982, treahunt, jack, jack, treahunt, treahunt, ROT90, "Hara Industries", "Treasure Hunt (bootleg?)", GAME_SUPPORTS_SAVE ) +GAME( 1982, zzyzzyxx, 0, jack, zzyzzyxx, zzyzzyxx, ROT90, "Cinematronics + Advanced Microcomputer Systems", "Zzyzzyxx (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1982, zzyzzyxx2,zzyzzyxx, jack, zzyzzyxx, zzyzzyxx, ROT90, "Cinematronics + Advanced Microcomputer Systems", "Zzyzzyxx (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1982, brix, zzyzzyxx, jack, zzyzzyxx, zzyzzyxx, ROT90, "Cinematronics + Advanced Microcomputer Systems", "Brix", GAME_SUPPORTS_SAVE ) +GAME( 1984, freeze, 0, jack, freeze, jack, ROT90, "Cinematronics", "Freeze", GAME_SUPPORTS_SAVE ) +GAME( 1984, sucasino, 0, jack, sucasino, jack, ROT90, "Data Amusement", "Super Casino", GAME_SUPPORTS_SAVE ) +GAME( 1981, tripool, 0, tripool, tripool, jack, ROT90, "Noma (Casino Tech license)", "Tri-Pool (Casino Tech)", GAME_SUPPORTS_SAVE ) +GAME( 1981, tripoola, tripool, tripool, tripool, jack, ROT90, "Noma (Costal Games license)", "Tri-Pool (Costal Games)", GAME_SUPPORTS_SAVE ) +GAME( 1986, joinem, 0, joinem, joinem, zzyzzyxx, ROT90, "Global Corporation", "Joinem", GAME_SUPPORTS_SAVE ) +GAME( 1983, loverboy, 0, loverboy,loverboy, loverboy, ROT90, "G.T Enterprise Inc", "Lover Boy", GAME_SUPPORTS_SAVE ) +GAME( 1985, striv, 0, jack, striv, striv, ROT270, "Hara Industries", "Super Triv", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/jack.h b/src/mame/includes/jack.h new file mode 100644 index 00000000000..b94d3a36aa0 --- /dev/null +++ b/src/mame/includes/jack.h @@ -0,0 +1,46 @@ +/************************************************************************* + + Jack the Giant Killer + +*************************************************************************/ + +typedef struct _jack_state jack_state; +struct _jack_state +{ + /* memory pointers */ + UINT8 * videoram; + UINT8 * colorram; + UINT8 * spriteram; +// UINT8 * paletteram; // currently this uses generic palette handling + size_t spriteram_size; + + /* video-related */ + tilemap *bg_tilemap; + + /* misc */ + int timer_rate; + int joinem_snd_bit; + int question_address; + int question_rom; + int remap_address[16]; + + + /* devices */ + const device_config *audiocpu; +}; + + +/*----------- defined in video/jack.c -----------*/ + +WRITE8_HANDLER( jack_videoram_w ); +WRITE8_HANDLER( jack_colorram_w ); +WRITE8_HANDLER( jack_paletteram_w ); +READ8_HANDLER( jack_flipscreen_r ); +WRITE8_HANDLER( jack_flipscreen_w ); + +VIDEO_START( jack ); +VIDEO_UPDATE( jack ); + +PALETTE_INIT( joinem ); +VIDEO_START( joinem ); +VIDEO_UPDATE( joinem ); diff --git a/src/mame/video/jack.c b/src/mame/video/jack.c index da22f263139..b700a229f11 100644 --- a/src/mame/video/jack.c +++ b/src/mame/video/jack.c @@ -7,25 +7,27 @@ ***************************************************************************/ #include "driver.h" +#include "includes/jack.h" -static tilemap *bg_tilemap; WRITE8_HANDLER( jack_videoram_w ) { - space->machine->generic.videoram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + jack_state *state = (jack_state *)space->machine->driver_data; + state->videoram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } WRITE8_HANDLER( jack_colorram_w ) { - space->machine->generic.colorram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + jack_state *state = (jack_state *)space->machine->driver_data; + state->colorram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } WRITE8_HANDLER( jack_paletteram_w ) { /* RGB output is inverted */ - paletteram_BBGGGRRR_w(space,offset,~data); + paletteram_BBGGGRRR_w(space, offset, ~data); } READ8_HANDLER( jack_flipscreen_r ) @@ -41,10 +43,11 @@ WRITE8_HANDLER( jack_flipscreen_w ) static TILE_GET_INFO( get_bg_tile_info ) { - int code = machine->generic.videoram.u8[tile_index] + ((machine->generic.colorram.u8[tile_index] & 0x18) << 5); - int color = machine->generic.colorram.u8[tile_index] & 0x07; + jack_state *state = (jack_state *)machine->driver_data; + int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0x18) << 5); + int color = state->colorram[tile_index] & 0x07; - // striv: machine->generic.colorram.u8[tile_index] & 0x80 ??? + // striv: state->colorram[tile_index] & 0x80 ??? SET_TILE_INFO(0, code, color, 0); } @@ -57,17 +60,19 @@ static UINT32 tilemap_scan_cols_flipy( UINT32 col, UINT32 row, UINT32 num_cols, VIDEO_START( jack ) { - bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols_flipy, 8, 8, 32, 32); + jack_state *state = (jack_state *)machine->driver_data; + state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols_flipy, 8, 8, 32, 32); } -static void jack_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) +static void jack_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { - UINT8 *spriteram = machine->generic.spriteram.u8; + jack_state *state = (jack_state *)machine->driver_data; + UINT8 *spriteram = state->spriteram; int offs; - for (offs = machine->generic.spriteram_size - 4;offs >= 0;offs -= 4) + for (offs = state->spriteram_size - 4; offs >= 0; offs -= 4) { - int sx,sy,num, color,flipx,flipy; + int sx, sy, num, color, flipx, flipy; sx = spriteram[offs + 1]; sy = spriteram[offs]; @@ -94,7 +99,8 @@ static void jack_draw_sprites(running_machine *machine, bitmap_t *bitmap, const VIDEO_UPDATE( jack ) { - tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); + jack_state *state = (jack_state *)screen->machine->driver_data; + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); jack_draw_sprites(screen->machine, bitmap, cliprect); return 0; } @@ -108,9 +114,9 @@ PALETTE_INIT( joinem ) { int i; - for (i = 0;i < machine->config->total_colors;i++) + for (i = 0; i < machine->config->total_colors; i++) { - int bit0,bit1,bit2,r,g,b; + int bit0, bit1, bit2, r, g, b; bit0 = (color_prom[i] >> 0) & 0x01; bit1 = (color_prom[i] >> 1) & 0x01; bit2 = (color_prom[i] >> 2) & 0x01; @@ -124,31 +130,34 @@ PALETTE_INIT( joinem ) bit2 = (color_prom[i] >> 7) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - palette_set_color(machine,i,MAKE_RGB(r,g,b)); + palette_set_color(machine, i, MAKE_RGB(r,g,b)); } } static TILE_GET_INFO( joinem_get_bg_tile_info ) { - int code = machine->generic.videoram.u8[tile_index] + ((machine->generic.colorram.u8[tile_index] & 0x03) << 8); - int color = (machine->generic.colorram.u8[tile_index] & 0x38) >> 3; + jack_state *state = (jack_state *)machine->driver_data; + int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0x03) << 8); + int color = (state->colorram[tile_index] & 0x38) >> 3; SET_TILE_INFO(0, code, color, 0); } VIDEO_START( joinem ) { - bg_tilemap = tilemap_create(machine, joinem_get_bg_tile_info, tilemap_scan_cols_flipy, 8, 8, 32, 32); + jack_state *state = (jack_state *)machine->driver_data; + state->bg_tilemap = tilemap_create(machine, joinem_get_bg_tile_info, tilemap_scan_cols_flipy, 8, 8, 32, 32); } -static void joinem_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) +static void joinem_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { - UINT8 *spriteram = machine->generic.spriteram.u8; + jack_state *state = (jack_state *)machine->driver_data; + UINT8 *spriteram = state->spriteram; int offs; - for (offs = machine->generic.spriteram_size - 4;offs >= 0;offs -= 4) + for (offs = state->spriteram_size - 4; offs >= 0; offs -= 4) { - int sx,sy,num, color,flipx,flipy; + int sx, sy, num, color, flipx, flipy; sx = spriteram[offs + 1]; sy = spriteram[offs]; @@ -175,7 +184,8 @@ static void joinem_draw_sprites(running_machine *machine, bitmap_t *bitmap, cons VIDEO_UPDATE( joinem ) { - tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); + jack_state *state = (jack_state *)screen->machine->driver_data; + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); joinem_draw_sprites(screen->machine, bitmap, cliprect); return 0; } |
