diff --git a/.gitattributes b/.gitattributes index e68f1a9dd99..42b064eca00 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2405,6 +2405,7 @@ src/mame/includes/dcheese.h svneol=native#text/plain src/mame/includes/dday.h svneol=native#text/plain src/mame/includes/ddragon.h svneol=native#text/plain src/mame/includes/ddragon3.h svneol=native#text/plain +src/mame/includes/ddrible.h svneol=native#text/plain src/mame/includes/dec0.h svneol=native#text/plain src/mame/includes/dec8.h svneol=native#text/plain src/mame/includes/deco16ic.h svneol=native#text/plain @@ -2453,6 +2454,7 @@ src/mame/includes/funkybee.h svneol=native#text/plain src/mame/includes/funybubl.h svneol=native#text/plain src/mame/includes/fuukifg2.h svneol=native#text/plain src/mame/includes/fuukifg3.h svneol=native#text/plain +src/mame/includes/gaelco.h svneol=native#text/plain src/mame/includes/gaelco2.h svneol=native#text/plain src/mame/includes/gaelco3d.h svneol=native#text/plain src/mame/includes/gaelcrpt.h svneol=native#text/plain @@ -2460,9 +2462,11 @@ src/mame/includes/gaiden.h svneol=native#text/plain src/mame/includes/galaga.h svneol=native#text/plain src/mame/includes/galaxian.h svneol=native#text/plain src/mame/includes/galaxold.h svneol=native#text/plain +src/mame/includes/galivan.h svneol=native#text/plain src/mame/includes/gameplan.h svneol=native#text/plain src/mame/includes/gaplus.h svneol=native#text/plain src/mame/includes/gauntlet.h svneol=native#text/plain +src/mame/includes/gberet.h svneol=native#text/plain src/mame/includes/gcpinbal.h svneol=native#text/plain src/mame/includes/genesis.h svneol=native#text/plain src/mame/includes/gomoku.h svneol=native#text/plain @@ -2486,6 +2490,7 @@ src/mame/includes/itech32.h svneol=native#text/plain src/mame/includes/itech8.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 src/mame/includes/jedi.h svneol=native#text/plain src/mame/includes/jpmimpct.h svneol=native#text/plain src/mame/includes/kaneko16.h svneol=native#text/plain diff --git a/src/mame/audio/trackfld.c b/src/mame/audio/trackfld.c index acf7f9754ec..070810b353d 100644 --- a/src/mame/audio/trackfld.c +++ b/src/mame/audio/trackfld.c @@ -7,8 +7,6 @@ #define TIMER_RATE (4096/4) -static int SN76496_latch; - /* The timer port on TnF and HyperSports sound hardware is derived from a 14.318 MHz clock crystal which is passed through a couple of 74ls393 ripple counters. @@ -22,91 +20,94 @@ static int SN76496_latch; READ8_HANDLER( trackfld_sh_timer_r ) { - UINT32 clock = cpu_get_total_cycles(space->cpu) / TIMER_RATE; + UINT32 clock = cpu_get_total_cycles(space->cpu) / TIMER_RATE; - return clock & 0xF; + return clock & 0xF; } READ8_DEVICE_HANDLER( trackfld_speech_r ) { - return vlm5030_bsy(device) ? 0x10 : 0; + return vlm5030_bsy(device) ? 0x10 : 0; } -static int last_addr = 0; - WRITE8_DEVICE_HANDLER( trackfld_sound_w ) { - int changes = offset^last_addr; - /* A7 = data enable for VLM5030 (don't care ) */ - /* A8 = STA pin (1->0 data data , 0->1 start speech */ - /* A9 = RST pin 1=reset */ + trackfld_state *state = (trackfld_state *)device->machine->driver_data; + int changes = offset ^ state->last_addr; - /* A8 VLM5030 ST pin */ - if( changes & 0x100 ) - vlm5030_st( device, offset&0x100 ); - /* A9 VLM5030 RST pin */ - if( changes & 0x200 ) - vlm5030_rst( device, offset&0x200 ); - last_addr = offset; + /* A7 = data enable for VLM5030 (don't care ) */ + /* A8 = STA pin (1->0 data data , 0->1 start speech */ + /* A9 = RST pin 1=reset */ + + /* A8 VLM5030 ST pin */ + if (changes & 0x100) + vlm5030_st(device, offset & 0x100); + + /* A9 VLM5030 RST pin */ + if (changes & 0x200) + vlm5030_rst(device, offset & 0x200); + + state->last_addr = offset; } READ8_HANDLER( hyperspt_sh_timer_r ) { - UINT32 clock = cpu_get_total_cycles(space->cpu) / TIMER_RATE; + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + UINT32 clock = cpu_get_total_cycles(space->cpu) / TIMER_RATE; - if (devtag_get_device(space->machine, "vlm")) - { - return (clock & 0x3) | (vlm5030_bsy(devtag_get_device(space->machine, "vlm"))? 0x04 : 0); - } + if (state->vlm != NULL) + return (clock & 0x3) | (vlm5030_bsy(state->vlm) ? 0x04 : 0); else - { return (clock & 0x3); - } } WRITE8_DEVICE_HANDLER( hyperspt_sound_w ) { - int changes = offset^last_addr; - /* A3 = data enable for VLM5030 (don't care ) */ - /* A4 = STA pin (1->0 data data , 0->1 start speech */ - /* A5 = RST pin 1=reset */ - /* A6 = VLM5030 output disable (don't care ) */ - /* A7 = kONAMI DAC output disable (don't care ) */ - /* A8 = SN76489 output disable (don't care ) */ + trackfld_state *state = (trackfld_state *)device->machine->driver_data; + int changes = offset ^ state->last_addr; - /* A4 VLM5030 ST pin */ - if( changes & 0x10 ) - vlm5030_st( device, offset&0x10 ); - /* A5 VLM5030 RST pin */ - if( changes & 0x20 ) - vlm5030_rst( device, offset&0x20 ); + /* A3 = data enable for VLM5030 (don't care ) */ + /* A4 = STA pin (1->0 data data , 0->1 start speech */ + /* A5 = RST pin 1=reset */ + /* A6 = VLM5030 output disable (don't care ) */ + /* A7 = kONAMI DAC output disable (don't care ) */ + /* A8 = SN76489 output disable (don't care ) */ - last_addr = offset; + /* A4 VLM5030 ST pin */ + if (changes & 0x10) + vlm5030_st(device, offset & 0x10); + + /* A5 VLM5030 RST pin */ + if( changes & 0x20 ) + vlm5030_rst(device, offset & 0x20); + + state->last_addr = offset; } WRITE8_HANDLER( konami_sh_irqtrigger_w ) { - static int last; + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + if (state->last_irq == 0 && data) + { + /* setting bit 0 low then high triggers IRQ on the sound CPU */ + cpu_set_input_line_and_vector(state->audiocpu, 0, HOLD_LINE, 0xff); + } - if (last == 0 && data) - { - /* setting bit 0 low then high triggers IRQ on the sound CPU */ - cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff); - } - - last = data; + state->last_irq = data; } WRITE8_HANDLER( konami_SN76496_latch_w ) { - SN76496_latch = data; + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + state->SN76496_latch = data; } WRITE8_DEVICE_HANDLER( konami_SN76496_w ) { - sn76496_w(device, offset, SN76496_latch); + trackfld_state *state = (trackfld_state *)device->machine->driver_data; + sn76496_w(device, offset, state->SN76496_latch); } diff --git a/src/mame/drivers/ddrible.c b/src/mame/drivers/ddrible.c index 60970c29295..c53161844b6 100644 --- a/src/mame/drivers/ddrible.c +++ b/src/mame/drivers/ddrible.c @@ -1,11 +1,11 @@ /*************************************************************************** -Double Dribble(GX690) (c) Konami 1986 + Double Dribble (GX690) (c) Konami 1986 -Driver by Manuel Abadia + Driver by Manuel Abadia -2008-08 -Dip locations and suggested settings verified with US manual. + 2008-08 + Dip locations and suggested settings verified with US manual. ***************************************************************************/ @@ -14,40 +14,21 @@ Dip locations and suggested settings verified with US manual. #include "sound/2203intf.h" #include "sound/vlm5030.h" #include "sound/flt_rc.h" -#include "konamipt.h" - -int ddrible_int_enable_0; -int ddrible_int_enable_1; - -static UINT8 *ddrible_sharedram; -static UINT8 *ddrible_snd_sharedram; - -extern UINT8 *ddrible_spriteram_1; -extern UINT8 *ddrible_spriteram_2; -extern UINT8 *ddrible_fg_videoram; -extern UINT8 *ddrible_bg_videoram; - -/* video hardware memory handlers */ -WRITE8_HANDLER( ddrible_fg_videoram_w ); -WRITE8_HANDLER( ddrible_bg_videoram_w ); - -/* video hardware functions */ -PALETTE_INIT( ddrible ); -VIDEO_START( ddrible ); -VIDEO_UPDATE( ddrible ); -WRITE8_HANDLER( K005885_0_w ); -WRITE8_HANDLER( K005885_1_w ); +#include "includes/konamipt.h" +#include "includes/ddrible.h" static INTERRUPT_GEN( ddrible_interrupt_0 ) { - if (ddrible_int_enable_0) + ddrible_state *state = (ddrible_state *)device->machine->driver_data; + if (state->int_enable_0) cpu_set_input_line(device, M6809_FIRQ_LINE, HOLD_LINE); } static INTERRUPT_GEN( ddrible_interrupt_1 ) { - if (ddrible_int_enable_1) + ddrible_state *state = (ddrible_state *)device->machine->driver_data; + if (state->int_enable_1) cpu_set_input_line(device, M6809_FIRQ_LINE, HOLD_LINE); } @@ -57,29 +38,33 @@ static WRITE8_HANDLER( ddrible_bankswitch_w ) int bankaddress; UINT8 *RAM = memory_region(space->machine, "maincpu"); - bankaddress = 0x10000 + (data & 0x0f)*0x2000; - memory_set_bankptr(space->machine, 1,&RAM[bankaddress]); + bankaddress = 0x10000 + (data & 0x0f) * 0x2000; + memory_set_bankptr(space->machine, 1, &RAM[bankaddress]); } static READ8_HANDLER( ddrible_sharedram_r ) { - return ddrible_sharedram[offset]; + ddrible_state *state = (ddrible_state *)space->machine->driver_data; + return state->sharedram[offset]; } static WRITE8_HANDLER( ddrible_sharedram_w ) { - ddrible_sharedram[offset] = data; + ddrible_state *state = (ddrible_state *)space->machine->driver_data; + state->sharedram[offset] = data; } static READ8_HANDLER( ddrible_snd_sharedram_r ) { - return ddrible_snd_sharedram[offset]; + ddrible_state *state = (ddrible_state *)space->machine->driver_data; + return state->snd_sharedram[offset]; } static WRITE8_HANDLER( ddrible_snd_sharedram_w ) { - ddrible_snd_sharedram[offset] = data; + ddrible_state *state = (ddrible_state *)space->machine->driver_data; + state->snd_sharedram[offset] = data; } static WRITE8_HANDLER( ddrible_coin_counter_w ) @@ -104,36 +89,43 @@ static READ8_DEVICE_HANDLER( ddrible_vlm5030_busy_r ) static WRITE8_DEVICE_HANDLER( ddrible_vlm5030_ctrl_w ) { + ddrible_state *state = (ddrible_state *)device->machine->driver_data; UINT8 *SPEECH_ROM = memory_region(device->machine, "vlm"); /* b7 : vlm data bus OE */ + /* b6 : VLM5030-RST */ + vlm5030_rst(device, data & 0x40 ? 1 : 0); + /* b5 : VLM5030-ST */ + vlm5030_st(device, data & 0x20 ? 1 : 0); + /* b4 : VLM5300-VCU */ + vlm5030_vcu(device, data & 0x10 ? 1 : 0); + /* b3 : ROM bank select */ - vlm5030_rst( device, data & 0x40 ? 1 : 0 ); - vlm5030_st( device, data & 0x20 ? 1 : 0 ); - vlm5030_vcu( device, data & 0x10 ? 1 : 0 ); vlm5030_set_rom(device, &SPEECH_ROM[data & 0x08 ? 0x10000 : 0]); /* b2 : SSG-C rc filter enable */ + filter_rc_set_RC(state->filter3, FLT_RC_LOWPASS, 1000, 2200, 1000, data & 0x04 ? CAP_N(150) : 0); /* YM2203-SSG-C */ + /* b1 : SSG-B rc filter enable */ + filter_rc_set_RC(state->filter2, FLT_RC_LOWPASS, 1000, 2200, 1000, data & 0x02 ? CAP_N(150) : 0); /* YM2203-SSG-B */ + /* b0 : SSG-A rc filter enable */ - filter_rc_set_RC(devtag_get_device(device->machine, "filter3"),FLT_RC_LOWPASS, 1000,2200,1000,data & 0x04 ? CAP_N(150) : 0); /* YM2203-SSG-C */ - filter_rc_set_RC(devtag_get_device(device->machine, "filter2"),FLT_RC_LOWPASS, 1000,2200,1000,data & 0x02 ? CAP_N(150) : 0); /* YM2203-SSG-B */ - filter_rc_set_RC(devtag_get_device(device->machine, "filter1"),FLT_RC_LOWPASS, 1000,2200,1000,data & 0x01 ? CAP_N(150) : 0); /* YM2203-SSG-A */ + filter_rc_set_RC(state->filter1, FLT_RC_LOWPASS, 1000, 2200, 1000, data & 0x01 ? CAP_N(150) : 0); /* YM2203-SSG-A */ } static ADDRESS_MAP_START( cpu0_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0004) AM_WRITE(K005885_0_w) /* video registers (005885 #1) */ AM_RANGE(0x0800, 0x0804) AM_WRITE(K005885_1_w) /* video registers (005885 #2) */ - AM_RANGE(0x1800, 0x187f) AM_RAM AM_BASE_GENERIC(paletteram) /* palette */ - AM_RANGE(0x2000, 0x2fff) AM_RAM_WRITE(ddrible_fg_videoram_w) AM_BASE(&ddrible_fg_videoram) /* Video RAM 1 */ - AM_RANGE(0x3000, 0x3fff) AM_RAM AM_BASE(&ddrible_spriteram_1) /* Object RAM 1 */ - AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE(&ddrible_sharedram) /* shared RAM with CPU #1 */ - AM_RANGE(0x6000, 0x6fff) AM_RAM_WRITE(ddrible_bg_videoram_w) AM_BASE(&ddrible_bg_videoram) /* Video RAM 2 */ - AM_RANGE(0x7000, 0x7fff) AM_RAM AM_BASE(&ddrible_spriteram_2) /* Object RAM 2 */ + AM_RANGE(0x1800, 0x187f) AM_RAM AM_BASE_MEMBER(ddrible_state, paletteram) /* palette */ + AM_RANGE(0x2000, 0x2fff) AM_RAM_WRITE(ddrible_fg_videoram_w) AM_BASE_MEMBER(ddrible_state, fg_videoram) /* Video RAM 1 */ + AM_RANGE(0x3000, 0x3fff) AM_RAM AM_BASE_MEMBER(ddrible_state, spriteram_1) /* Object RAM 1 */ + AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE_MEMBER(ddrible_state, sharedram) /* shared RAM with CPU #1 */ + AM_RANGE(0x6000, 0x6fff) AM_RAM_WRITE(ddrible_bg_videoram_w) AM_BASE_MEMBER(ddrible_state, bg_videoram) /* Video RAM 2 */ + AM_RANGE(0x7000, 0x7fff) AM_RAM AM_BASE_MEMBER(ddrible_state, spriteram_2) /* Object RAM 2 */ AM_RANGE(0x8000, 0x8000) AM_WRITE(ddrible_bankswitch_w) /* bankswitch control */ AM_RANGE(0x8000, 0x9fff) AM_ROMBANK(1) /* banked ROM */ AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM) /* ROM */ @@ -155,7 +147,7 @@ static ADDRESS_MAP_START( cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) ADDRESS_MAP_END static ADDRESS_MAP_START( cpu2_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&ddrible_snd_sharedram) /* shared RAM with CPU #1 */ + AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE_MEMBER(ddrible_state, snd_sharedram) /* shared RAM with CPU #1 */ AM_RANGE(0x1000, 0x1001) AM_DEVREADWRITE("ymsnd", ym2203_r, ym2203_w) /* YM2203 */ AM_RANGE(0x3000, 0x3000) AM_DEVWRITE("vlm", vlm5030_data_w) /* Speech data */ AM_RANGE(0x8000, 0xffff) AM_ROM /* ROM */ @@ -259,8 +251,45 @@ static const vlm5030_interface vlm5030_config = 0x10000 /* memory size 64Kbyte * 2 bank */ }; + + +static MACHINE_START( ddrible ) +{ + ddrible_state *state = (ddrible_state *)machine->driver_data; + + state->filter1 = devtag_get_device(machine, "filter1"); + state->filter2 = devtag_get_device(machine, "filter2"); + state->filter3 = devtag_get_device(machine, "filter3"); + + state_save_register_global(machine, state->int_enable_0); + state_save_register_global(machine, state->int_enable_1); + state_save_register_global_array(machine, state->vregs[0]); + state_save_register_global_array(machine, state->vregs[1]); + state_save_register_global_array(machine, state->charbank); +} + +static MACHINE_RESET( ddrible ) +{ + ddrible_state *state = (ddrible_state *)machine->driver_data; + int i; + + for (i = 0; i < 5; i++) + { + state->vregs[0][i] = 0; + state->vregs[1][i] = 0; + } + + state->int_enable_0 = 0; + state->int_enable_1 = 0; + state->charbank[0] = 0; + state->charbank[1] = 0; +} + static MACHINE_DRIVER_START( ddribble ) + /* driver data */ + MDRV_DRIVER_DATA(ddrible_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M6809, XTAL_18_432MHz/12) /* verified on pcb */ MDRV_CPU_PROGRAM_MAP(cpu0_map) @@ -275,6 +304,9 @@ static MACHINE_DRIVER_START( ddribble ) MDRV_QUANTUM_TIME(HZ(6000)) /* we need heavy synch */ + MDRV_MACHINE_START(ddrible) + MDRV_MACHINE_RESET(ddrible) + /* video hardware */ MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_REFRESH_RATE(60) @@ -347,4 +379,4 @@ ROM_START( ddribble ) ROM_END -GAME( 1986, ddribble, 0, ddribble, ddribble, 0, ROT0, "Konami", "Double Dribble", 0) +GAME( 1986, ddribble, 0, ddribble, ddribble, 0, ROT0, "Konami", "Double Dribble", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/gaelco.c b/src/mame/drivers/gaelco.c index 590a0b45b00..7d6092409d6 100644 --- a/src/mame/drivers/gaelco.c +++ b/src/mame/drivers/gaelco.c @@ -11,49 +11,192 @@ #include "cpu/m68000/m68000.h" #include "sound/okim6295.h" #include "sound/3812intf.h" -#include "gaelcrpt.h" - -extern UINT16 *gaelco_vregs; -extern UINT16 *gaelco_videoram; -extern UINT16 *gaelco_spriteram; -extern tilemap *gaelco_tilemap[2]; -static UINT16 *gaelco_screen; - -/* from video/gaelco.c */ -WRITE16_HANDLER( gaelco_vram_w ); +#include "includes/gaelcrpt.h" +#include "includes/gaelco.h" -#define TILELAYOUT8(NUM) static const gfx_layout tilelayout8_##NUM = \ -{ \ - 8,8, /* 8x8 tiles */ \ - NUM/8, /* number of tiles */ \ - 4, /* bitplanes */ \ - { 0*NUM*8, 1*NUM*8, 2*NUM*8, 3*NUM*8 }, /* plane offsets */ \ - { 0,1,2,3,4,5,6,7 }, \ - { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 }, \ - 8*8 \ +/************************************* + * + * Memory handlers + * + *************************************/ + +static WRITE16_HANDLER( bigkarnk_sound_command_w ) +{ + gaelco_state *state = (gaelco_state *)space->machine->driver_data; + + if (ACCESSING_BITS_0_7) + { + soundlatch_w(space, 0, data & 0xff); + cpu_set_input_line(state->audiocpu, M6809_FIRQ_LINE, HOLD_LINE); + } } -#define TILELAYOUT16(NUM) static const gfx_layout tilelayout16_##NUM = \ -{ \ - 16,16, /* 16x16 tiles */ \ - NUM/32, /* number of tiles */ \ - 4, /* bitplanes */ \ - { 0*NUM*8, 1*NUM*8, 2*NUM*8, 3*NUM*8 }, /* plane offsets */ \ - { 0,1,2,3,4,5,6,7, 16*8+0,16*8+1,16*8+2,16*8+3,16*8+4,16*8+5,16*8+6,16*8+7 }, \ - { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8, 8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, \ - 32*8 \ +static WRITE16_HANDLER( bigkarnk_coin_w ) +{ + if (ACCESSING_BITS_0_7) + { + switch ((offset >> 3)) + { + case 0x00: /* Coin Lockouts */ + case 0x01: + coin_lockout_w(space->machine, (offset >> 3) & 0x01, ~data & 0x01); + break; + case 0x02: /* Coin Counters */ + case 0x03: + coin_counter_w(space->machine, (offset >> 3) & 0x01, data & 0x01); + break; + } + } } -#define GFXDECODEINFO(NUM,ENTRIES) \ -static GFXDECODE_START( NUM )\ - GFXDECODE_ENTRY( "gfx1", 0x000000, tilelayout8_##NUM,0, ENTRIES ) \ - GFXDECODE_ENTRY( "gfx1", 0x000000, tilelayout16_##NUM,0, ENTRIES ) \ -GFXDECODE_END +static WRITE16_HANDLER( OKIM6295_bankswitch_w ) +{ + UINT8 *RAM = memory_region(space->machine, "oki"); + if (ACCESSING_BITS_0_7) + { + memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f) * 0x10000], 0x10000); + } +} + +/*********** Squash Encryption Related Code ******************/ + +static WRITE16_HANDLER( gaelco_vram_encrypted_w ) +{ + gaelco_state *state = (gaelco_state *)space->machine->driver_data; + + // mame_printf_debug("gaelco_vram_encrypted_w!!\n"); + data = gaelco_decrypt(space, offset, data, 0x0f, 0x4228); + COMBINE_DATA(&state->videoram[offset]); + + tilemap_mark_tile_dirty(state->tilemap[offset >> 11], ((offset << 1) & 0x0fff) >> 2); +} + + +static WRITE16_HANDLER(gaelco_encrypted_w) +{ + gaelco_state *state = (gaelco_state *)space->machine->driver_data; + + // mame_printf_debug("gaelco_encrypted_w!!\n"); + data = gaelco_decrypt(space, offset, data, 0x0f, 0x4228); + COMBINE_DATA(&state->screen[offset]); +} + +/*********** Thunder Hoop Encryption Related Code ******************/ + +static WRITE16_HANDLER( thoop_vram_encrypted_w ) +{ + gaelco_state *state = (gaelco_state *)space->machine->driver_data; + + // mame_printf_debug("gaelco_vram_encrypted_w!!\n"); + data = gaelco_decrypt(space, offset, data, 0x0e, 0x4228); + COMBINE_DATA(&state->videoram[offset]); + + tilemap_mark_tile_dirty(state->tilemap[offset >> 11], ((offset << 1) & 0x0fff) >> 2); +} + +static WRITE16_HANDLER(thoop_encrypted_w) +{ + gaelco_state *state = (gaelco_state *)space->machine->driver_data; + + // mame_printf_debug("gaelco_encrypted_w!!\n"); + data = gaelco_decrypt(space, offset, data, 0x0e, 0x4228); + COMBINE_DATA(&state->screen[offset]); +} + +/************************************* + * + * Address maps + * + *************************************/ + +static ADDRESS_MAP_START( bigkarnk_map, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x07ffff) AM_ROM /* ROM */ + AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(gaelco_vram_w) AM_BASE_MEMBER(gaelco_state, videoram) /* Video RAM */ + AM_RANGE(0x102000, 0x103fff) AM_RAM /* Screen RAM */ + AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_BASE_MEMBER(gaelco_state, vregs) /* Video Registers */ +// AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w) /* INT 6 ACK/Watchdog timer */ + AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) /* Palette */ + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(gaelco_state, spriteram) /* Sprite RAM */ + AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW1") + AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW2") + AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") + AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") + AM_RANGE(0x700008, 0x700009) AM_READ_PORT("SERVICE") + AM_RANGE(0x70000e, 0x70000f) AM_WRITE(bigkarnk_sound_command_w) /* Triggers a FIRQ on the sound CPU */ + AM_RANGE(0x70000a, 0x70003b) AM_WRITE(bigkarnk_coin_w) /* Coin Counters + Coin Lockout */ + AM_RANGE(0xff8000, 0xffffff) AM_RAM /* Work RAM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bigkarnk_snd_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x07ff) AM_RAM /* RAM */ + AM_RANGE(0x0800, 0x0801) AM_DEVREADWRITE("oki", okim6295_r, okim6295_w) /* OKI6295 */ +// AM_RANGE(0x0900, 0x0900) AM_WRITENOP /* enable sound output? */ + AM_RANGE(0x0a00, 0x0a01) AM_DEVREADWRITE("ymsnd", ym3812_r, ym3812_w) /* YM3812 */ + AM_RANGE(0x0b00, 0x0b00) AM_READ(soundlatch_r) /* Sound latch */ + AM_RANGE(0x0c00, 0xffff) AM_ROM /* ROM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( maniacsq_map, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ + AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(gaelco_vram_w) AM_BASE_MEMBER(gaelco_state, videoram) /* Video RAM */ + AM_RANGE(0x102000, 0x103fff) AM_RAM /* Screen RAM */ + AM_RANGE(0x108000, 0x108007) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(gaelco_state, vregs) /* Video Registers */ +// AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w) /* INT 6 ACK/Watchdog timer */ + AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) /* Palette */ + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(gaelco_state, spriteram) /* Sprite RAM */ + AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2") + AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1") + AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") + AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") + AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */ + AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_r, okim6295_w, 0x00ff) /* OKI6295 status register */ + AM_RANGE(0xff0000, 0xffffff) AM_RAM /* Work RAM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( squash_map, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ + AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(gaelco_vram_encrypted_w) AM_BASE_MEMBER(gaelco_state, videoram) /* Video RAM */ + AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(gaelco_encrypted_w) AM_BASE_MEMBER(gaelco_state, screen) /* Screen RAM */ + AM_RANGE(0x108000, 0x108007) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(gaelco_state, vregs) /* Video Registers */ +// AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w) /* INT 6 ACK/Watchdog timer */ + AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) /* Palette */ + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(gaelco_state, spriteram) /* Sprite RAM */ + AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2") + AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1") + AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") + AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") + AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */ + AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_r, okim6295_w, 0x00ff) /* OKI6295 status register */ + AM_RANGE(0xff0000, 0xffffff) AM_RAM /* Work RAM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( thoop_map, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ + AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(thoop_vram_encrypted_w) AM_BASE_MEMBER(gaelco_state, videoram) /* Video RAM */ + AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(thoop_encrypted_w) AM_BASE_MEMBER(gaelco_state, screen) /* Screen RAM */ + AM_RANGE(0x108000, 0x108007) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(gaelco_state, vregs) /* Video Registers */ +// AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w) /* INT 6 ACK/Watchdog timer */ + AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) /* Palette */ + AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE_MEMBER(gaelco_state, spriteram) /* Sprite RAM */ + AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2") + AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1") + AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") + AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") + AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */ + AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_r, okim6295_w, 0x00ff) /* OKI6295 status register */ + AM_RANGE(0xff0000, 0xffffff) AM_RAM /* Work RAM */ +ADDRESS_MAP_END + + +/************************************* + * + * Input ports + * + *************************************/ /* Common Inputs used by all the games */ - static INPUT_PORTS_START( gaelco ) PORT_START("DSW1") PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:8,7,6,5") @@ -102,70 +245,6 @@ static INPUT_PORTS_START( gaelco ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) INPUT_PORTS_END - -/*============================================================================ - BIG KARNAK - ============================================================================*/ - -VIDEO_START( bigkarnk ); -VIDEO_UPDATE( bigkarnk ); - - -static WRITE16_HANDLER( bigkarnk_sound_command_w ) -{ - if (ACCESSING_BITS_0_7) - { - soundlatch_w(space, 0, data & 0xff); - cputag_set_input_line(space->machine, "audiocpu", M6809_FIRQ_LINE, HOLD_LINE); - } -} - -static WRITE16_HANDLER( bigkarnk_coin_w ) -{ - if (ACCESSING_BITS_0_7) - { - switch ((offset >> 3)) - { - case 0x00: /* Coin Lockouts */ - case 0x01: - coin_lockout_w( space->machine, (offset >> 3) & 0x01, ~data & 0x01); - break; - case 0x02: /* Coin Counters */ - case 0x03: - coin_counter_w( space->machine, (offset >> 3) & 0x01, data & 0x01); - break; - } - } -} - - -static ADDRESS_MAP_START( bigkarnk_map, ADDRESS_SPACE_PROGRAM, 16 ) - AM_RANGE(0x000000, 0x07ffff) AM_ROM /* ROM */ - AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(gaelco_vram_w) AM_BASE(&gaelco_videoram) /* Video RAM */ - AM_RANGE(0x102000, 0x103fff) AM_RAM /* Screen RAM */ - AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_BASE(&gaelco_vregs) /* Video Registers */ -// AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w) /* INT 6 ACK/Watchdog timer */ - AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) /* Palette */ - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&gaelco_spriteram) /* Sprite RAM */ - AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW1") - AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW2") - AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") - AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") - AM_RANGE(0x700008, 0x700009) AM_READ_PORT("SERVICE") - AM_RANGE(0x70000e, 0x70000f) AM_WRITE(bigkarnk_sound_command_w) /* Triggers a FIRQ on the sound CPU */ - AM_RANGE(0x70000a, 0x70003b) AM_WRITE(bigkarnk_coin_w) /* Coin Counters + Coin Lockout */ - AM_RANGE(0xff8000, 0xffffff) AM_RAM /* Work RAM */ -ADDRESS_MAP_END - -static ADDRESS_MAP_START( bigkarnk_snd_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x07ff) AM_RAM /* RAM */ - AM_RANGE(0x0800, 0x0801) AM_DEVREADWRITE("oki", okim6295_r, okim6295_w) /* OKI6295 */ -// AM_RANGE(0x0900, 0x0900) AM_WRITENOP /* enable sound output? */ - AM_RANGE(0x0a00, 0x0a01) AM_DEVREADWRITE("ymsnd", ym3812_r, ym3812_w) /* YM3812 */ - AM_RANGE(0x0b00, 0x0b00) AM_READ(soundlatch_r) /* Sound latch */ - AM_RANGE(0x0c00, 0xffff) AM_ROM /* ROM */ -ADDRESS_MAP_END - static INPUT_PORTS_START( bigkarnk ) PORT_INCLUDE( gaelco ) @@ -200,110 +279,6 @@ static INPUT_PORTS_START( bigkarnk ) PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END - -TILELAYOUT8(0x100000); -TILELAYOUT16(0x100000); - -GFXDECODEINFO(0x100000,64) - - -static MACHINE_DRIVER_START( bigkarnk ) - - /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", M68000, 10000000) /* MC68000P10, 10 MHz */ - MDRV_CPU_PROGRAM_MAP(bigkarnk_map) - MDRV_CPU_VBLANK_INT("screen", irq6_line_hold) - - MDRV_CPU_ADD("audiocpu", M6809, 8867000/4) /* 68B09, 2.21675 MHz? */ - MDRV_CPU_PROGRAM_MAP(bigkarnk_snd_map) - - MDRV_QUANTUM_TIME(HZ(600)) - - /* video hardware */ - MDRV_SCREEN_ADD("screen", RASTER) - MDRV_SCREEN_REFRESH_RATE(60) - MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_SIZE(32*16, 32*16) - MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) - - MDRV_GFXDECODE(0x100000) - MDRV_PALETTE_LENGTH(1024) - - MDRV_VIDEO_START(bigkarnk) - MDRV_VIDEO_UPDATE(bigkarnk) - - /* sound hardware */ - MDRV_SPEAKER_STANDARD_MONO("mono") - - MDRV_SOUND_ADD("ymsnd", YM3812, 3580000) - MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - MDRV_SOUND_ADD("oki", OKIM6295, 1056000) - MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified - MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) -MACHINE_DRIVER_END - - -ROM_START( bigkarnk ) - ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 code */ - ROM_LOAD16_BYTE( "d16", 0x000000, 0x040000, CRC(44fb9c73) SHA1(c33852b37afea15482f4a43cb045434660e7a056) ) - ROM_LOAD16_BYTE( "d19", 0x000001, 0x040000, CRC(ff79dfdd) SHA1(2bfa440299317967ba2018d3a148291ae0c144ae) ) - - ROM_REGION( 0x01e000, "audiocpu", 0 ) /* 6809 code */ - ROM_LOAD( "d5", 0x000000, 0x010000, CRC(3b73b9c5) SHA1(1b1c5545609a695dab87d611bd53e0c3dd91e6b7) ) - - ROM_REGION( 0x400000, "gfx1", 0 ) - ROM_LOAD( "h5", 0x000000, 0x080000, CRC(20e239ff) SHA1(685059340f0f3a8e3c98702bd760dae685a58ddb) ) - ROM_RELOAD( 0x080000, 0x080000 ) - ROM_LOAD( "h10",0x100000, 0x080000, CRC(ab442855) SHA1(bcd69d4908ff8dc1b2215d2c2d2e54b950e0c015) ) - ROM_RELOAD( 0x180000, 0x080000 ) - ROM_LOAD( "h8", 0x200000, 0x080000, CRC(83dce5a3) SHA1(b4f9473e93c96f4b86c446e89d13fd3ef2b03996) ) - ROM_RELOAD( 0x280000, 0x080000 ) - ROM_LOAD( "h6", 0x300000, 0x080000, CRC(24e84b24) SHA1(c0ad6ce1e4b8aa7b9c9a3db8bb0165e90f4b48ed) ) - ROM_RELOAD( 0x380000, 0x080000 ) - - ROM_REGION( 0x040000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ - ROM_LOAD( "d1", 0x000000, 0x040000, CRC(26444ad1) SHA1(804101b9bbb6e1b6d43a1e9d91737f9c3b27802a) ) -ROM_END - - -/*============================================================================ - BIOMECHANICAL TOY & MANIAC SQUARE - ============================================================================*/ - -VIDEO_START( maniacsq ); -VIDEO_UPDATE( maniacsq ); - - -static WRITE16_HANDLER( OKIM6295_bankswitch_w ) -{ - UINT8 *RAM = memory_region(space->machine, "oki"); - - if (ACCESSING_BITS_0_7) - { - memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f)*0x10000], 0x10000); - } -} - -static ADDRESS_MAP_START( maniacsq_map, ADDRESS_SPACE_PROGRAM, 16 ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ - AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(gaelco_vram_w) AM_BASE(&gaelco_videoram) /* Video RAM */ - AM_RANGE(0x102000, 0x103fff) AM_RAM /* Screen RAM */ - AM_RANGE(0x108000, 0x108007) AM_WRITE(SMH_RAM) AM_BASE(&gaelco_vregs) /* Video Registers */ -// AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w) /* INT 6 ACK/Watchdog timer */ - AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) /* Palette */ - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&gaelco_spriteram) /* Sprite RAM */ - AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2") - AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1") - AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") - AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") - AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */ - AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_r, okim6295_w, 0x00ff) /* OKI6295 status register */ - AM_RANGE(0xff0000, 0xffffff) AM_RAM /* Work RAM */ -ADDRESS_MAP_END - - static INPUT_PORTS_START( maniacsq ) PORT_INCLUDE( gaelco ) @@ -358,95 +333,6 @@ static INPUT_PORTS_START( biomtoy ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) INPUT_PORTS_END - -static MACHINE_DRIVER_START( maniacsq ) - - /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", M68000,24000000/2) /* 12 MHz */ - MDRV_CPU_PROGRAM_MAP(maniacsq_map) - MDRV_CPU_VBLANK_INT("screen", irq6_line_hold) - - /* video hardware */ - MDRV_SCREEN_ADD("screen", RASTER) - MDRV_SCREEN_REFRESH_RATE(60) - MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_SIZE(32*16, 32*16) - MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) - - MDRV_GFXDECODE(0x100000) - MDRV_PALETTE_LENGTH(1024) - - MDRV_VIDEO_START(maniacsq) - MDRV_VIDEO_UPDATE(maniacsq) - - /* sound hardware */ - MDRV_SPEAKER_STANDARD_MONO("mono") - - MDRV_SOUND_ADD("oki", OKIM6295, 1056000) - MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified - MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) -MACHINE_DRIVER_END - - -ROM_START( maniacsp ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ - ROM_LOAD16_BYTE( "d18", 0x000000, 0x020000, CRC(740ecab2) SHA1(8d8583364cc6aeea58ea2b9cb9a2aab2a43a44df) ) - ROM_LOAD16_BYTE( "d16", 0x000001, 0x020000, CRC(c6c42729) SHA1(1aac9f93d47a4eb57e06e206e9f50e349b1817da) ) - - ROM_REGION( 0x400000, "gfx1", 0 ) - ROM_LOAD( "f3", 0x000000, 0x040000, CRC(e7f6582b) SHA1(9e352edf2f71d0edecb54a11ab3fd0e3ec867d42) ) - ROM_RELOAD( 0x080000, 0x040000 ) - /* 0x040000-0x07ffff and 0x0c0000-0x0fffff empty */ - ROM_LOAD( "f2", 0x100000, 0x040000, CRC(ca43a5ae) SHA1(8d2ed537be1dee60096a58b68b735fb50cab3285) ) - ROM_RELOAD( 0x180000, 0x040000 ) - /* 0x140000-0x17ffff and 0x1c0000-0x1fffff empty */ - ROM_LOAD( "f1", 0x200000, 0x040000, CRC(fca112e8) SHA1(2a1412f8f1c856b18b6cc7794191d327a415266f) ) - ROM_RELOAD( 0x280000, 0x040000 ) - /* 0x240000-0x27ffff and 0x2c0000-0x2fffff empty */ - ROM_LOAD( "f0", 0x300000, 0x040000, CRC(6e829ee8) SHA1(b602da8d987c1bafa41baf5d5e5d753e29ff5403) ) - ROM_RELOAD( 0x380000, 0x040000 ) - /* 0x340000-0x37ffff and 0x3c0000-0x3fffff empty */ - - ROM_REGION( 0x140000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ - ROM_LOAD( "c1", 0x000000, 0x080000, CRC(2557f2d6) SHA1(3a99388f2d845281f73a427d6dc797dce87b2f82) ) - /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */ - ROM_RELOAD( 0x040000, 0x080000 ) - ROM_RELOAD( 0x0c0000, 0x080000 ) -ROM_END - - -ROM_START( biomtoy ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ - ROM_LOAD16_BYTE( "d18", 0x000000, 0x080000, CRC(4569ce64) SHA1(96557aca55779c23f7c2c11fddc618823c04ead0) ) - ROM_LOAD16_BYTE( "d16", 0x000001, 0x080000, CRC(739449bd) SHA1(711a8ea5081f15dea6067577516c9296239c4145) ) - - ROM_REGION( 0x400000, "gfx1", 0 ) - /* weird gfx ordering */ - ROM_LOAD( "h6", 0x040000, 0x040000, CRC(9416a729) SHA1(425149b3041554579791fc23c09fda6be054e89d) ) - ROM_CONTINUE( 0x0c0000, 0x040000 ) - ROM_LOAD( "j6", 0x000000, 0x040000, CRC(e923728b) SHA1(113eac1de73c74ef7c9d3e2e72599a1ff775176d) ) - ROM_CONTINUE( 0x080000, 0x040000 ) - ROM_LOAD( "h7", 0x140000, 0x040000, CRC(9c984d7b) SHA1(98d43a9c3fa93c9ea55f41475ecab6ca25713087) ) - ROM_CONTINUE( 0x1c0000, 0x040000 ) - ROM_LOAD( "j7", 0x100000, 0x040000, CRC(0e18fac2) SHA1(acb0a3699395a6c68cacdeadda42a785aa4020f5) ) - ROM_CONTINUE( 0x180000, 0x040000 ) - ROM_LOAD( "h9", 0x240000, 0x040000, CRC(8c1f6718) SHA1(9377e838ebb1e16d24072b9b4ed278408d7a808f) ) - ROM_CONTINUE( 0x2c0000, 0x040000 ) - ROM_LOAD( "j9", 0x200000, 0x040000, CRC(1c93f050) SHA1(fabeffa05dae7a83a199a57022bd318d6ad02c4d) ) - ROM_CONTINUE( 0x280000, 0x040000 ) - ROM_LOAD( "h10", 0x340000, 0x040000, CRC(aca1702b) SHA1(6b36b230722270dbfc2f69bd7eb07b9e718db089) ) - ROM_CONTINUE( 0x3c0000, 0x040000 ) - ROM_LOAD( "j10", 0x300000, 0x040000, CRC(8e3e96cc) SHA1(761009f3f32b18139e98f20a22c433b6a49d9168) ) - ROM_CONTINUE( 0x380000, 0x040000 ) - - ROM_REGION( 0x140000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ - ROM_LOAD( "c1", 0x000000, 0x080000, CRC(0f02de7e) SHA1(a8779370cc36290616794ff11eb3eebfdea5b1a9) ) - /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */ - ROM_RELOAD( 0x040000, 0x080000 ) - ROM_LOAD( "c3", 0x0c0000, 0x080000, CRC(914e4bbc) SHA1(ca82b7481621a119f05992ed093b963da70d748a) ) -ROM_END - static INPUT_PORTS_START( squash ) PORT_INCLUDE( gaelco ) @@ -525,74 +411,146 @@ static INPUT_PORTS_START( squash ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END -/*********** Squash Encryption Related Code ******************/ +static INPUT_PORTS_START( thoop ) + PORT_INCLUDE( squash ) -static WRITE16_HANDLER( gaelco_vram_encrypted_w ) -{ -// mame_printf_debug("gaelco_vram_encrypted_w!!\n"); + PORT_MODIFY("DSW1") + PORT_DIPNAME( 0x40, 0x40, "2 Credits to Start, 1 to Continue" ) PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - data = gaelco_decrypt(space, offset, data, 0x0f, 0x4228); - COMBINE_DATA(&gaelco_videoram[offset]); + PORT_MODIFY("DSW2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:8,7") + PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) + PORT_DIPNAME( 0x04, 0x04, "Player Controls" ) PORT_DIPLOCATION("SW2:6") + PORT_DIPSETTING( 0x04, "2 Joysticks" ) + PORT_DIPSETTING( 0x00, "1 Joystick" ) + PORT_DIPNAME( 0x18, 0x08, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:5,4") + PORT_DIPSETTING( 0x00, "4" ) + PORT_DIPSETTING( 0x08, "3" ) + PORT_DIPSETTING( 0x10, "2" ) + PORT_DIPSETTING( 0x18, "1" ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:3") + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2") + PORT_DIPSETTING( 0x40, DEF_STR( Upright ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) + PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:1" ) +INPUT_PORTS_END - tilemap_mark_tile_dirty(gaelco_tilemap[offset >> 11],((offset << 1) & 0x0fff) >> 2); + +/************************************* + * + * Graphics definitions + * + *************************************/ + +#define TILELAYOUT8(NUM) static const gfx_layout tilelayout8_##NUM = \ +{ \ + 8,8, /* 8x8 tiles */ \ + NUM/8, /* number of tiles */ \ + 4, /* bitplanes */ \ + { 0*NUM*8, 1*NUM*8, 2*NUM*8, 3*NUM*8 }, /* plane offsets */ \ + { 0,1,2,3,4,5,6,7 }, \ + { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 }, \ + 8*8 \ } - -static WRITE16_HANDLER(gaelco_encrypted_w) -{ -// mame_printf_debug("gaelco_encrypted_w!!\n"); - - data = gaelco_decrypt(space, offset, data, 0x0f, 0x4228); - COMBINE_DATA(&gaelco_screen[offset]); +#define TILELAYOUT16(NUM) static const gfx_layout tilelayout16_##NUM = \ +{ \ + 16,16, /* 16x16 tiles */ \ + NUM/32, /* number of tiles */ \ + 4, /* bitplanes */ \ + { 0*NUM*8, 1*NUM*8, 2*NUM*8, 3*NUM*8 }, /* plane offsets */ \ + { 0,1,2,3,4,5,6,7, 16*8+0,16*8+1,16*8+2,16*8+3,16*8+4,16*8+5,16*8+6,16*8+7 }, \ + { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8, 8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, \ + 32*8 \ } -/*********** Thunder Hoop Encryption Related Code ******************/ +#define GFXDECODEINFO(NUM,ENTRIES) \ +static GFXDECODE_START( NUM )\ + GFXDECODE_ENTRY( "gfx1", 0x000000, tilelayout8_##NUM,0, ENTRIES ) \ + GFXDECODE_ENTRY( "gfx1", 0x000000, tilelayout16_##NUM,0, ENTRIES ) \ +GFXDECODE_END -static WRITE16_HANDLER( thoop_vram_encrypted_w ) + +TILELAYOUT8(0x100000); +TILELAYOUT16(0x100000); + +GFXDECODEINFO(0x100000,64) + + +/************************************* + * + * Machine driver + * + *************************************/ + +static MACHINE_START( gaelco ) { -// mame_printf_debug("gaelco_vram_encrypted_w!!\n"); + gaelco_state *state = (gaelco_state *)machine->driver_data; - data = gaelco_decrypt(space, offset, data, 0x0e, 0x4228); - COMBINE_DATA(&gaelco_videoram[offset]); - - tilemap_mark_tile_dirty(gaelco_tilemap[offset >> 11],((offset << 1) & 0x0fff) >> 2); + state->audiocpu = devtag_get_device(machine, "audiocpu"); } -static WRITE16_HANDLER(thoop_encrypted_w) -{ -// mame_printf_debug("gaelco_encrypted_w!!\n"); +static MACHINE_DRIVER_START( bigkarnk ) - data = gaelco_decrypt(space, offset, data, 0x0e, 0x4228); - COMBINE_DATA(&gaelco_screen[offset]); -} - - -static ADDRESS_MAP_START( squash_map, ADDRESS_SPACE_PROGRAM, 16 ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ - AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(gaelco_vram_encrypted_w) AM_BASE(&gaelco_videoram) /* Video RAM */ - AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(gaelco_encrypted_w) AM_BASE(&gaelco_screen) /* Screen RAM */ - AM_RANGE(0x108000, 0x108007) AM_WRITE(SMH_RAM) AM_BASE(&gaelco_vregs) /* Video Registers */ -// AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w) /* INT 6 ACK/Watchdog timer */ - AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) /* Palette */ - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&gaelco_spriteram) /* Sprite RAM */ - AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2") - AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1") - AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") - AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") - AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */ - AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_r, okim6295_w, 0x00ff) /* OKI6295 status register */ - AM_RANGE(0xff0000, 0xffffff) AM_RAM /* Work RAM */ -ADDRESS_MAP_END - -static MACHINE_DRIVER_START( squash ) + /* driver data */ + MDRV_DRIVER_DATA(gaelco_state) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", M68000, 12000000) /* MC68000P12, 12 MHz */ - MDRV_CPU_PROGRAM_MAP(squash_map) + MDRV_CPU_ADD("maincpu", M68000, 10000000) /* MC68000P10, 10 MHz */ + MDRV_CPU_PROGRAM_MAP(bigkarnk_map) MDRV_CPU_VBLANK_INT("screen", irq6_line_hold) + MDRV_CPU_ADD("audiocpu", M6809, 8867000/4) /* 68B09, 2.21675 MHz? */ + MDRV_CPU_PROGRAM_MAP(bigkarnk_snd_map) + MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(gaelco) + + /* video hardware */ + MDRV_SCREEN_ADD("screen", RASTER) + MDRV_SCREEN_REFRESH_RATE(60) + MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_SIZE(32*16, 32*16) + MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) + + MDRV_GFXDECODE(0x100000) + MDRV_PALETTE_LENGTH(1024) + + MDRV_VIDEO_START(bigkarnk) + MDRV_VIDEO_UPDATE(bigkarnk) + + /* sound hardware */ + MDRV_SPEAKER_STANDARD_MONO("mono") + + MDRV_SOUND_ADD("ymsnd", YM3812, 3580000) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MDRV_SOUND_ADD("oki", OKIM6295, 1056000) + MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) +MACHINE_DRIVER_END + +static MACHINE_DRIVER_START( maniacsq ) + + /* driver data */ + MDRV_DRIVER_DATA(gaelco_state) + + /* basic machine hardware */ + MDRV_CPU_ADD("maincpu", M68000,24000000/2) /* 12 MHz */ + MDRV_CPU_PROGRAM_MAP(maniacsq_map) + MDRV_CPU_VBLANK_INT("screen", irq6_line_hold) + + MDRV_MACHINE_START(gaelco) + /* video hardware */ MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_REFRESH_RATE(60) @@ -615,6 +573,165 @@ static MACHINE_DRIVER_START( squash ) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_DRIVER_END +static MACHINE_DRIVER_START( squash ) + + /* driver data */ + MDRV_DRIVER_DATA(gaelco_state) + + /* basic machine hardware */ + MDRV_CPU_ADD("maincpu", M68000, 12000000) /* MC68000P12, 12 MHz */ + MDRV_CPU_PROGRAM_MAP(squash_map) + MDRV_CPU_VBLANK_INT("screen", irq6_line_hold) + + MDRV_QUANTUM_TIME(HZ(600)) + + MDRV_MACHINE_START(gaelco) + + /* video hardware */ + MDRV_SCREEN_ADD("screen", RASTER) + MDRV_SCREEN_REFRESH_RATE(60) + MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_SIZE(32*16, 32*16) + MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) + + MDRV_GFXDECODE(0x100000) + MDRV_PALETTE_LENGTH(1024) + + MDRV_VIDEO_START(maniacsq) + MDRV_VIDEO_UPDATE(maniacsq) + + /* sound hardware */ + MDRV_SPEAKER_STANDARD_MONO("mono") + + MDRV_SOUND_ADD("oki", OKIM6295, 1056000) + MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) +MACHINE_DRIVER_END + +static MACHINE_DRIVER_START( thoop ) + + /* driver data */ + MDRV_DRIVER_DATA(gaelco_state) + + /* basic machine hardware */ + MDRV_CPU_ADD("maincpu", M68000, 12000000) /* MC68000P12, 12 MHz */ + MDRV_CPU_PROGRAM_MAP(thoop_map) + MDRV_CPU_VBLANK_INT("screen", irq6_line_hold) + + MDRV_QUANTUM_TIME(HZ(600)) + + MDRV_MACHINE_START(gaelco) + + /* video hardware */ + MDRV_SCREEN_ADD("screen", RASTER) + MDRV_SCREEN_REFRESH_RATE(60) + MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_SIZE(32*16, 32*16) + MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) + + MDRV_GFXDECODE(0x100000) + MDRV_PALETTE_LENGTH(1024) + + MDRV_VIDEO_START(maniacsq) + MDRV_VIDEO_UPDATE(maniacsq) + + /* sound hardware */ + MDRV_SPEAKER_STANDARD_MONO("mono") + + MDRV_SOUND_ADD("oki", OKIM6295, 1056000) + MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) +MACHINE_DRIVER_END + + +/************************************* + * + * ROM definition(s) + * + *************************************/ + +ROM_START( bigkarnk ) + ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 code */ + ROM_LOAD16_BYTE( "d16", 0x000000, 0x040000, CRC(44fb9c73) SHA1(c33852b37afea15482f4a43cb045434660e7a056) ) + ROM_LOAD16_BYTE( "d19", 0x000001, 0x040000, CRC(ff79dfdd) SHA1(2bfa440299317967ba2018d3a148291ae0c144ae) ) + + ROM_REGION( 0x01e000, "audiocpu", 0 ) /* 6809 code */ + ROM_LOAD( "d5", 0x000000, 0x010000, CRC(3b73b9c5) SHA1(1b1c5545609a695dab87d611bd53e0c3dd91e6b7) ) + + ROM_REGION( 0x400000, "gfx1", 0 ) + ROM_LOAD( "h5", 0x000000, 0x080000, CRC(20e239ff) SHA1(685059340f0f3a8e3c98702bd760dae685a58ddb) ) + ROM_RELOAD( 0x080000, 0x080000 ) + ROM_LOAD( "h10",0x100000, 0x080000, CRC(ab442855) SHA1(bcd69d4908ff8dc1b2215d2c2d2e54b950e0c015) ) + ROM_RELOAD( 0x180000, 0x080000 ) + ROM_LOAD( "h8", 0x200000, 0x080000, CRC(83dce5a3) SHA1(b4f9473e93c96f4b86c446e89d13fd3ef2b03996) ) + ROM_RELOAD( 0x280000, 0x080000 ) + ROM_LOAD( "h6", 0x300000, 0x080000, CRC(24e84b24) SHA1(c0ad6ce1e4b8aa7b9c9a3db8bb0165e90f4b48ed) ) + ROM_RELOAD( 0x380000, 0x080000 ) + + ROM_REGION( 0x040000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ + ROM_LOAD( "d1", 0x000000, 0x040000, CRC(26444ad1) SHA1(804101b9bbb6e1b6d43a1e9d91737f9c3b27802a) ) +ROM_END + +ROM_START( maniacsp ) + ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ + ROM_LOAD16_BYTE( "d18", 0x000000, 0x020000, CRC(740ecab2) SHA1(8d8583364cc6aeea58ea2b9cb9a2aab2a43a44df) ) + ROM_LOAD16_BYTE( "d16", 0x000001, 0x020000, CRC(c6c42729) SHA1(1aac9f93d47a4eb57e06e206e9f50e349b1817da) ) + + ROM_REGION( 0x400000, "gfx1", 0 ) + ROM_LOAD( "f3", 0x000000, 0x040000, CRC(e7f6582b) SHA1(9e352edf2f71d0edecb54a11ab3fd0e3ec867d42) ) + ROM_RELOAD( 0x080000, 0x040000 ) + /* 0x040000-0x07ffff and 0x0c0000-0x0fffff empty */ + ROM_LOAD( "f2", 0x100000, 0x040000, CRC(ca43a5ae) SHA1(8d2ed537be1dee60096a58b68b735fb50cab3285) ) + ROM_RELOAD( 0x180000, 0x040000 ) + /* 0x140000-0x17ffff and 0x1c0000-0x1fffff empty */ + ROM_LOAD( "f1", 0x200000, 0x040000, CRC(fca112e8) SHA1(2a1412f8f1c856b18b6cc7794191d327a415266f) ) + ROM_RELOAD( 0x280000, 0x040000 ) + /* 0x240000-0x27ffff and 0x2c0000-0x2fffff empty */ + ROM_LOAD( "f0", 0x300000, 0x040000, CRC(6e829ee8) SHA1(b602da8d987c1bafa41baf5d5e5d753e29ff5403) ) + ROM_RELOAD( 0x380000, 0x040000 ) + /* 0x340000-0x37ffff and 0x3c0000-0x3fffff empty */ + + ROM_REGION( 0x140000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ + ROM_LOAD( "c1", 0x000000, 0x080000, CRC(2557f2d6) SHA1(3a99388f2d845281f73a427d6dc797dce87b2f82) ) + /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */ + ROM_RELOAD( 0x040000, 0x080000 ) + ROM_RELOAD( 0x0c0000, 0x080000 ) +ROM_END + + +ROM_START( biomtoy ) + ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ + ROM_LOAD16_BYTE( "d18", 0x000000, 0x080000, CRC(4569ce64) SHA1(96557aca55779c23f7c2c11fddc618823c04ead0) ) + ROM_LOAD16_BYTE( "d16", 0x000001, 0x080000, CRC(739449bd) SHA1(711a8ea5081f15dea6067577516c9296239c4145) ) + + ROM_REGION( 0x400000, "gfx1", 0 ) + /* weird gfx ordering */ + ROM_LOAD( "h6", 0x040000, 0x040000, CRC(9416a729) SHA1(425149b3041554579791fc23c09fda6be054e89d) ) + ROM_CONTINUE( 0x0c0000, 0x040000 ) + ROM_LOAD( "j6", 0x000000, 0x040000, CRC(e923728b) SHA1(113eac1de73c74ef7c9d3e2e72599a1ff775176d) ) + ROM_CONTINUE( 0x080000, 0x040000 ) + ROM_LOAD( "h7", 0x140000, 0x040000, CRC(9c984d7b) SHA1(98d43a9c3fa93c9ea55f41475ecab6ca25713087) ) + ROM_CONTINUE( 0x1c0000, 0x040000 ) + ROM_LOAD( "j7", 0x100000, 0x040000, CRC(0e18fac2) SHA1(acb0a3699395a6c68cacdeadda42a785aa4020f5) ) + ROM_CONTINUE( 0x180000, 0x040000 ) + ROM_LOAD( "h9", 0x240000, 0x040000, CRC(8c1f6718) SHA1(9377e838ebb1e16d24072b9b4ed278408d7a808f) ) + ROM_CONTINUE( 0x2c0000, 0x040000 ) + ROM_LOAD( "j9", 0x200000, 0x040000, CRC(1c93f050) SHA1(fabeffa05dae7a83a199a57022bd318d6ad02c4d) ) + ROM_CONTINUE( 0x280000, 0x040000 ) + ROM_LOAD( "h10", 0x340000, 0x040000, CRC(aca1702b) SHA1(6b36b230722270dbfc2f69bd7eb07b9e718db089) ) + ROM_CONTINUE( 0x3c0000, 0x040000 ) + ROM_LOAD( "j10", 0x300000, 0x040000, CRC(8e3e96cc) SHA1(761009f3f32b18139e98f20a22c433b6a49d9168) ) + ROM_CONTINUE( 0x380000, 0x040000 ) + + ROM_REGION( 0x140000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ + ROM_LOAD( "c1", 0x000000, 0x080000, CRC(0f02de7e) SHA1(a8779370cc36290616794ff11eb3eebfdea5b1a9) ) + /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */ + ROM_RELOAD( 0x040000, 0x080000 ) + ROM_LOAD( "c3", 0x0c0000, 0x080000, CRC(914e4bbc) SHA1(ca82b7481621a119f05992ed093b963da70d748a) ) +ROM_END + /* Squash (version 1.0) @@ -687,86 +804,6 @@ ROM_START( squash ) ROM_RELOAD( 0x0c0000, 0x080000 ) ROM_END -static INPUT_PORTS_START( thoop ) - PORT_INCLUDE( squash ) - - PORT_MODIFY("DSW1") - PORT_DIPNAME( 0x40, 0x40, "2 Credits to Start, 1 to Continue" ) PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_MODIFY("DSW2") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:8,7") - PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Normal ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) - PORT_DIPNAME( 0x04, 0x04, "Player Controls" ) PORT_DIPLOCATION("SW2:6") - PORT_DIPSETTING( 0x04, "2 Joysticks" ) - PORT_DIPSETTING( 0x00, "1 Joystick" ) - PORT_DIPNAME( 0x18, 0x08, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:5,4") - PORT_DIPSETTING( 0x00, "4" ) - PORT_DIPSETTING( 0x08, "3" ) - PORT_DIPSETTING( 0x10, "2" ) - PORT_DIPSETTING( 0x18, "1" ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:3") - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2") - PORT_DIPSETTING( 0x40, DEF_STR( Upright ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) - PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:1" ) -INPUT_PORTS_END - - - -static ADDRESS_MAP_START( thoop_map, ADDRESS_SPACE_PROGRAM, 16 ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ - AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(thoop_vram_encrypted_w) AM_BASE(&gaelco_videoram) /* Video RAM */ - AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(thoop_encrypted_w) AM_BASE(&gaelco_screen) /* Screen RAM */ - AM_RANGE(0x108000, 0x108007) AM_WRITE(SMH_RAM) AM_BASE(&gaelco_vregs) /* Video Registers */ -// AM_RANGE(0x10800c, 0x10800d) AM_WRITE(watchdog_reset_w) /* INT 6 ACK/Watchdog timer */ - AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) /* Palette */ - AM_RANGE(0x440000, 0x440fff) AM_RAM AM_BASE(&gaelco_spriteram) /* Sprite RAM */ - AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW2") - AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1") - AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1") - AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2") - AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */ - AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_r, okim6295_w, 0x00ff) /* OKI6295 status register */ - AM_RANGE(0xff0000, 0xffffff) AM_RAM /* Work RAM */ -ADDRESS_MAP_END - -static MACHINE_DRIVER_START( thoop ) - - /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", M68000, 12000000) /* MC68000P12, 12 MHz */ - MDRV_CPU_PROGRAM_MAP(thoop_map) - MDRV_CPU_VBLANK_INT("screen", irq6_line_hold) - - MDRV_QUANTUM_TIME(HZ(600)) - - /* video hardware */ - MDRV_SCREEN_ADD("screen", RASTER) - MDRV_SCREEN_REFRESH_RATE(60) - MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_SIZE(32*16, 32*16) - MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) - - MDRV_GFXDECODE(0x100000) - MDRV_PALETTE_LENGTH(1024) - - MDRV_VIDEO_START(maniacsq) - MDRV_VIDEO_UPDATE(maniacsq) - - /* sound hardware */ - MDRV_SPEAKER_STANDARD_MONO("mono") - - MDRV_SOUND_ADD("oki", OKIM6295, 1056000) - MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified - MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) -MACHINE_DRIVER_END /* encrypted video ram */ ROM_START( thoop ) @@ -798,8 +835,16 @@ ROM_START( thoop ) ROM_RELOAD( 0x040000, 0x100000 ) ROM_END -GAME( 1991, bigkarnk, 0, bigkarnk, bigkarnk, 0, ROT0, "Gaelco", "Big Karnak", 0 ) -GAME( 1995, biomtoy, 0, maniacsq, biomtoy, 0, ROT0, "Gaelco", "Biomechanical Toy (unprotected)", 0 ) -GAME( 1996, maniacsp, maniacsq, maniacsq, maniacsq, 0, ROT0, "Gaelco", "Maniac Square (prototype)", 0 ) -GAME( 1992, squash, 0, squash, squash, 0, ROT0, "Gaelco", "Squash (Ver. 1.0)", 0 ) -GAME( 1992, thoop, 0, thoop, thoop, 0, ROT0, "Gaelco", "Thunder Hoop (Ver. 1)", 0 ) + + +/************************************* + * + * Game driver(s) + * + *************************************/ + +GAME( 1991, bigkarnk, 0, bigkarnk, bigkarnk, 0, ROT0, "Gaelco", "Big Karnak", GAME_SUPPORTS_SAVE ) +GAME( 1995, biomtoy, 0, maniacsq, biomtoy, 0, ROT0, "Gaelco", "Biomechanical Toy (unprotected)", GAME_SUPPORTS_SAVE ) +GAME( 1996, maniacsp, maniacsq, maniacsq, maniacsq, 0, ROT0, "Gaelco", "Maniac Square (prototype)", GAME_SUPPORTS_SAVE ) +GAME( 1992, squash, 0, squash, squash, 0, ROT0, "Gaelco", "Squash (Ver. 1.0)", GAME_SUPPORTS_SAVE ) +GAME( 1992, thoop, 0, thoop, thoop, 0, ROT0, "Gaelco", "Thunder Hoop (Ver. 1)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/galivan.c b/src/mame/drivers/galivan.c index 32e4d775382..5a7ba9510f2 100644 --- a/src/mame/drivers/galivan.c +++ b/src/mame/drivers/galivan.c @@ -31,50 +31,24 @@ Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/12/17 - #include "cpu/z80/z80.h" #include "sound/dac.h" #include "sound/3526intf.h" +#include "includes/galivan.h" -WRITE8_HANDLER( galivan_scrollx_w ); -WRITE8_HANDLER( galivan_scrolly_w ); -WRITE8_HANDLER( galivan_videoram_w ); -WRITE8_HANDLER( galivan_colorram_w ); -WRITE8_HANDLER( galivan_gfxbank_w ); -PALETTE_INIT( galivan ); -VIDEO_START( galivan ); -VIDEO_UPDATE( galivan ); - -WRITE8_HANDLER( ninjemak_scrollx_w ); -WRITE8_HANDLER( ninjemak_scrolly_w ); -WRITE8_HANDLER( ninjemak_gfxbank_w ); -VIDEO_START( ninjemak ); -VIDEO_UPDATE( ninjemak ); - - - -static MACHINE_RESET( galivan ) -{ - UINT8 *RAM = memory_region(machine, "maincpu"); - - memory_set_bankptr(machine, 1,&RAM[0x10000]); - device_reset(cputag_get_cpu(machine, "maincpu")); -// layers = 0x60; -} static WRITE8_HANDLER( galivan_sound_command_w ) { - soundlatch_w(space,offset,(data << 1) | 1); + soundlatch_w(space, offset, (data << 1) | 1); } static READ8_HANDLER( galivan_sound_command_r ) { - int data; - - data = soundlatch_r(space,offset); - soundlatch_clear_w(space,0,0); + int data = soundlatch_r(space, offset); + soundlatch_clear_w(space, 0, 0); return data; } static READ8_HANDLER( IO_port_c0_r ) { - return (0x58); /* To Avoid Reset on Ufo Robot dangar */ + return (0x58); /* To Avoid Reset on Ufo Robot dangar */ } @@ -106,11 +80,11 @@ static ADDRESS_MAP_START( galivan_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0xbfff) AM_ROM // The next three entires need to be looked at. It's ugly. - AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK(1)) - AM_RANGE(0xd800, 0xdbff) AM_WRITE(galivan_videoram_w) AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) - AM_RANGE(0xdc00, 0xdfff) AM_WRITE(galivan_colorram_w) AM_BASE_GENERIC(colorram) + AM_RANGE(0xc000, 0xdfff) AM_ROMBANK(1) + AM_RANGE(0xd800, 0xdbff) AM_WRITE(galivan_videoram_w) AM_BASE_SIZE_MEMBER(galivan_state, videoram, videoram_size) + AM_RANGE(0xdc00, 0xdfff) AM_WRITE(galivan_colorram_w) AM_BASE_MEMBER(galivan_state, colorram) - AM_RANGE(0xe000, 0xe0ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) + AM_RANGE(0xe000, 0xe0ff) AM_RAM AM_BASE_SIZE_MEMBER(galivan_state, spriteram, spriteram_size) AM_RANGE(0xe100, 0xffff) AM_RAM ADDRESS_MAP_END @@ -118,12 +92,12 @@ static ADDRESS_MAP_START( ninjemak_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0xbfff) AM_ROM // The next three entires need to be looked at. It's ugly. - AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_BANK(1)) + AM_RANGE(0xc000, 0xdfff) AM_ROMBANK(1) AM_RANGE(0xd800, 0xd81f) AM_WRITE(ninjemak_videoreg_w) - AM_RANGE(0xd800, 0xdbff) AM_WRITE(galivan_videoram_w) AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) - AM_RANGE(0xdc00, 0xdfff) AM_WRITE(galivan_colorram_w) AM_BASE_GENERIC(colorram) + AM_RANGE(0xd800, 0xdbff) AM_WRITE(galivan_videoram_w) AM_BASE_SIZE_MEMBER(galivan_state, videoram, videoram_size) + AM_RANGE(0xdc00, 0xdfff) AM_WRITE(galivan_colorram_w) AM_BASE_MEMBER(galivan_state, colorram) - AM_RANGE(0xe000, 0xe1ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) + AM_RANGE(0xe000, 0xe1ff) AM_RAM AM_BASE_SIZE_MEMBER(galivan_state, spriteram, spriteram_size) AM_RANGE(0xe200, 0xffff) AM_RAM ADDRESS_MAP_END @@ -434,8 +408,70 @@ GFXDECODE_END +static MACHINE_START( galivan ) +{ + galivan_state *state = (galivan_state *)machine->driver_data; + + /* configure ROM banking */ + UINT8 *rombase = memory_region(machine, "maincpu"); + memory_configure_bank(machine, 1, 0, 2, &rombase[0x10000], 0x2000); + memory_set_bank(machine, 1, 0); + + /* register for saving */ + state_save_register_global_array(machine, state->scrollx); + state_save_register_global_array(machine, state->scrolly); + state_save_register_global(machine, state->flipscreen); + state_save_register_global(machine, state->write_layers); + state_save_register_global(machine, state->layers); +} + +static MACHINE_START( ninjemak ) +{ + galivan_state *state = (galivan_state *)machine->driver_data; + + /* configure ROM banking */ + UINT8 *rombase = memory_region(machine, "maincpu"); + memory_configure_bank(machine, 1, 0, 4, &rombase[0x10000], 0x2000); + memory_set_bank(machine, 1, 0); + + /* register for saving */ + state_save_register_global_array(machine, state->scrollx); + state_save_register_global_array(machine, state->scrolly); + state_save_register_global(machine, state->flipscreen); + state_save_register_global(machine, state->ninjemak_dispdisable); +} + +static MACHINE_RESET( galivan ) +{ + galivan_state *state = (galivan_state *)machine->driver_data; + + device_reset(cputag_get_cpu(machine, "maincpu")); + +// state->layers = 0x60; + state->layers = 0; + state->write_layers = 0; + state->scrollx[0] = state->scrollx[1] = 0; + state->scrolly[0] = state->scrolly[1] = 0; + state->flipscreen = 0; +} + +static MACHINE_RESET( ninjemak ) +{ + galivan_state *state = (galivan_state *)machine->driver_data; + + device_reset(cputag_get_cpu(machine, "maincpu")); + + state->scrollx[0] = state->scrollx[1] = 0; + state->scrolly[0] = state->scrolly[1] = 0; + state->flipscreen = 0; + state->ninjemak_dispdisable = 0; +} + static MACHINE_DRIVER_START( galivan ) + /* driver data */ + MDRV_DRIVER_DATA(galivan_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", Z80,12000000/2) /* 6 MHz? */ MDRV_CPU_PROGRAM_MAP(galivan_map) @@ -447,6 +483,7 @@ static MACHINE_DRIVER_START( galivan ) MDRV_CPU_IO_MAP(sound_io_map) MDRV_CPU_PERIODIC_INT(irq0_line_hold, 7250) /* timed interrupt, ?? Hz */ + MDRV_MACHINE_START(galivan) MDRV_MACHINE_RESET(galivan) /* video hardware */ @@ -479,6 +516,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( ninjemak ) + /* driver data */ + MDRV_DRIVER_DATA(galivan_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", Z80,12000000/2) /* 6 MHz? */ MDRV_CPU_PROGRAM_MAP(ninjemak_map) @@ -490,7 +530,8 @@ static MACHINE_DRIVER_START( ninjemak ) MDRV_CPU_IO_MAP(sound_io_map) MDRV_CPU_PERIODIC_INT(irq0_line_hold, 7250) /* timed interrupt, ?? Hz */ - MDRV_MACHINE_RESET(galivan) + MDRV_MACHINE_START(ninjemak) + MDRV_MACHINE_RESET(ninjemak) /* video hardware */ MDRV_SCREEN_ADD("screen", RASTER) @@ -953,18 +994,12 @@ ROM_END static WRITE8_HANDLER( youmab_extra_bank_w ) { - if (data==0xff) - { - memory_set_bankptr(space->machine, 2, memory_region(space->machine, "user2")+0x4000 ); - } - else if (data==0x00) - { - memory_set_bankptr(space->machine, 2, memory_region(space->machine, "user2") ); - } + if (data == 0xff) + memory_set_bank(space->machine, 2, 1); + else if (data == 0x00) + memory_set_bank(space->machine, 2, 0); else - { - printf("data %03x\n",data); - } + printf("data %03x\n", data); } static READ8_HANDLER( youmab_8a_r ) @@ -986,9 +1021,11 @@ static DRIVER_INIT( youmab ) { memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x82, 0x82, 0, 0, youmab_extra_bank_w); // banks rom at 0x8000? writes 0xff and 0x00 before executing code there memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0, (read8_space_func)SMH_BANK(3)); - memory_set_bankptr(machine, 3, memory_region(machine, "maincpu") ); + memory_set_bankptr(machine, 3, memory_region(machine, "maincpu")); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(2)); - memory_set_bankptr(machine, 2, memory_region(machine, "user2") ); + memory_configure_bank(machine, 2, 0, 2, memory_region(machine, "user2"), 0x4000); + memory_set_bank(machine, 2, 0); memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x81, 0x81, 0, 0, youmab_81_w); // ?? often, alternating values memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x84, 0x84, 0, 0, youmab_84_w); // ?? often, sequence.. @@ -1008,5 +1045,3 @@ GAME( 1986, ninjemak, 0, ninjemak, ninjemak, 0, ROT270, "Nichibutsu", "Ni GAME( 1986, youma, ninjemak, ninjemak, ninjemak, 0, ROT270, "Nichibutsu", "Youma Ninpou Chou (Japan)", GAME_SUPPORTS_SAVE ) GAME( 1986, youmab, ninjemak, ninjemak, ninjemak, youmab, ROT270, "bootleg", "Youma Ninpou Chou (Game Electronics bootleg, set 1)", GAME_NOT_WORKING|GAME_SUPPORTS_SAVE ) // scrolling doesn't work GAME( 1986, youmab2, ninjemak, ninjemak, ninjemak, youmab, ROT270, "bootleg", "Youma Ninpou Chou (Game Electronics bootleg, set 2)", GAME_NOT_WORKING|GAME_SUPPORTS_SAVE ) // scrolling doesn't work - - diff --git a/src/mame/drivers/gberet.c b/src/mame/drivers/gberet.c index 27652e696bd..94ca3e02a78 100644 --- a/src/mame/drivers/gberet.c +++ b/src/mame/drivers/gberet.c @@ -69,44 +69,38 @@ #include "cpu/z80/z80.h" #include "deprecat.h" #include "sound/sn76496.h" -#include "konamipt.h" - -extern UINT8 *gberet_scrollram; - -extern WRITE8_HANDLER( gberet_videoram_w ); -extern WRITE8_HANDLER( gberet_colorram_w ); -extern WRITE8_HANDLER( gberet_scroll_w ); -extern WRITE8_HANDLER( gberetb_scroll_w ); -extern WRITE8_HANDLER( gberet_sprite_bank_w ); - -extern PALETTE_INIT( gberet ); -extern VIDEO_START( gberet ); -extern VIDEO_UPDATE( gberet ); -extern VIDEO_UPDATE( gberetb ); +#include "includes/konamipt.h" +#include "includes/gberet.h" -static UINT8 nmi_enable, irq_enable; - - -/* Interrupt Generators */ +/************************************* + * + * Interrupt generators + * + *************************************/ static INTERRUPT_GEN( gberet_interrupt ) { + gberet_state *state = (gberet_state *)device->machine->driver_data; if (cpu_getiloops(device) == 0) { - if (irq_enable) + if (state->irq_enable) cpu_set_input_line(device, 0, HOLD_LINE); } if (cpu_getiloops(device) % 2) { - if (nmi_enable) + if (state->nmi_enable) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); } } -/* Read/Write Handlers */ +/************************************* + * + * Memory handlers + * + *************************************/ static WRITE8_HANDLER( gberet_coin_counter_w ) { @@ -117,8 +111,9 @@ static WRITE8_HANDLER( gberet_coin_counter_w ) static WRITE8_HANDLER( gberet_flipscreen_w ) { - nmi_enable = data & 0x01; - irq_enable = data & 0x04; + gberet_state *state = (gberet_state *)space->machine->driver_data; + state->nmi_enable = data & 0x01; + state->irq_enable = data & 0x04; flip_screen_set(space->machine, data & 0x08); } @@ -138,22 +133,27 @@ static WRITE8_HANDLER( mrgoemon_coin_counter_w ) static WRITE8_HANDLER( mrgoemon_flipscreen_w ) { - nmi_enable = data & 0x01; - irq_enable = data & 0x02; + gberet_state *state = (gberet_state *)space->machine->driver_data; + state->nmi_enable = data & 0x01; + state->irq_enable = data & 0x02; flip_screen_set(space->machine, data & 0x08); } -/* Memory Maps */ +/************************************* + * + * Address maps + * + *************************************/ static ADDRESS_MAP_START( gberet_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(gberet_colorram_w) AM_BASE_GENERIC(colorram) - AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(gberet_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0xd000, 0xd0ff) AM_RAM AM_BASE_GENERIC(spriteram2) - AM_RANGE(0xd100, 0xd1ff) AM_RAM AM_BASE_GENERIC(spriteram) + AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(gberet_colorram_w) AM_BASE_MEMBER(gberet_state, colorram) + AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(gberet_videoram_w) AM_BASE_MEMBER(gberet_state, videoram) + AM_RANGE(0xd000, 0xd0ff) AM_RAM AM_BASE_MEMBER(gberet_state, spriteram2) + AM_RANGE(0xd100, 0xd1ff) AM_RAM AM_BASE_MEMBER(gberet_state, spriteram) AM_RANGE(0xd200, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xe03f) AM_RAM_WRITE(gberet_scroll_w) AM_BASE(&gberet_scrollram) + AM_RANGE(0xe000, 0xe03f) AM_RAM_WRITE(gberet_scroll_w) AM_BASE_MEMBER(gberet_state, scrollram) AM_RANGE(0xe040, 0xe042) AM_WRITENOP // ??? AM_RANGE(0xe043, 0xe043) AM_WRITE(gberet_sprite_bank_w) AM_RANGE(0xe044, 0xe044) AM_WRITE(gberet_flipscreen_w) @@ -169,14 +169,14 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( gberetb_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(gberet_colorram_w) AM_BASE_GENERIC(colorram) - AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(gberet_videoram_w) AM_BASE_GENERIC(videoram) + AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(gberet_colorram_w) AM_BASE_MEMBER(gberet_state, colorram) + AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(gberet_videoram_w) AM_BASE_MEMBER(gberet_state, videoram) AM_RANGE(0xd000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe03f) AM_RAM AM_RANGE(0xe040, 0xe043) AM_WRITENOP // ??? AM_RANGE(0xe044, 0xe044) AM_WRITE(gberet_flipscreen_w) AM_RANGE(0xe800, 0xe8ff) AM_RAM - AM_RANGE(0xe900, 0xe9ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) + AM_RANGE(0xe900, 0xe9ff) AM_RAM AM_BASE_SIZE_MEMBER(gberet_state, spriteram, spriteram_size) AM_RANGE(0xf000, 0xf000) AM_WRITENOP // coin counter not supported AM_RANGE(0xf200, 0xf200) AM_READ_PORT("DSW2") AM_RANGE(0xf400, 0xf400) AM_DEVWRITE("snsnd", sn76496_w) @@ -190,12 +190,12 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mrgoemon_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(gberet_colorram_w) AM_BASE_GENERIC(colorram) - AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(gberet_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0xd000, 0xd0ff) AM_RAM AM_BASE_GENERIC(spriteram2) - AM_RANGE(0xd100, 0xd1ff) AM_RAM AM_BASE_GENERIC(spriteram) + AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(gberet_colorram_w) AM_BASE_MEMBER(gberet_state, colorram) + AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(gberet_videoram_w) AM_BASE_MEMBER(gberet_state, videoram) + AM_RANGE(0xd000, 0xd0ff) AM_RAM AM_BASE_MEMBER(gberet_state, spriteram2) + AM_RANGE(0xd100, 0xd1ff) AM_RAM AM_BASE_MEMBER(gberet_state, spriteram) AM_RANGE(0xd200, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xe03f) AM_RAM_WRITE(gberet_scroll_w) AM_BASE(&gberet_scrollram) + AM_RANGE(0xe000, 0xe03f) AM_RAM_WRITE(gberet_scroll_w) AM_BASE_MEMBER(gberet_state, scrollram) AM_RANGE(0xe040, 0xe042) AM_WRITENOP // ??? AM_RANGE(0xe043, 0xe043) AM_WRITE(gberet_sprite_bank_w) AM_RANGE(0xe044, 0xe044) AM_WRITE(mrgoemon_flipscreen_w) @@ -209,7 +209,11 @@ static ADDRESS_MAP_START( mrgoemon_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xf800, 0xffff) AM_ROMBANK(1) ADDRESS_MAP_END -/* Input Ports */ +/************************************* + * + * Input ports + * + *************************************/ static INPUT_PORTS_START( gberet ) PORT_START("P1") @@ -290,7 +294,11 @@ static INPUT_PORTS_START( mrgoemon ) PORT_SERVICE_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW3:3" ) INPUT_PORTS_END -/* Graphics Layouts */ +/************************************* + * + * Graphics definitions + * + *************************************/ static const gfx_layout charlayout = { @@ -340,8 +348,6 @@ static const gfx_layout gberetb_spritelayout = 32*8 /* every sprite takes 32 consecutive bytes */ }; -/* Graphics Decode Information */ - static GFXDECODE_START( gberet ) GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 ) GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16*16, 16 ) @@ -352,16 +358,45 @@ static GFXDECODE_START( gberetb ) GFXDECODE_ENTRY( "gfx2", 0, gberetb_spritelayout, 16*16, 16 ) GFXDECODE_END -/* Machine Drivers */ + +/************************************* + * + * Machine driver + * + *************************************/ + +static MACHINE_START( gberet ) +{ + gberet_state *state = (gberet_state *)machine->driver_data; + + state_save_register_global(machine, state->irq_enable); + state_save_register_global(machine, state->nmi_enable); + state_save_register_global(machine, state->spritebank); +} + +static MACHINE_RESET( gberet ) +{ + gberet_state *state = (gberet_state *)machine->driver_data; + + state->irq_enable = 0; + state->nmi_enable = 0; + state->spritebank = 0; +} static MACHINE_DRIVER_START( gberet ) - // basic machine hardware + + /* driver data */ + MDRV_DRIVER_DATA(gberet_state) + + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", Z80, 18432000/6) // X1S (generated by a custom IC) MDRV_CPU_PROGRAM_MAP(gberet_map) MDRV_CPU_VBLANK_INT_HACK(gberet_interrupt, 32) // 1 IRQ + 16 NMI (generated by a custom IC) - // video hardware + MDRV_MACHINE_START(gberet) + MDRV_MACHINE_RESET(gberet) + /* video hardware */ MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_REFRESH_RATE(30) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) @@ -376,7 +411,7 @@ static MACHINE_DRIVER_START( gberet ) MDRV_VIDEO_START(gberet) MDRV_VIDEO_UPDATE(gberet) - // sound hardware + /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") MDRV_SOUND_ADD("snsnd", SN76496, 18432000/12) @@ -386,16 +421,16 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( gberetb ) MDRV_IMPORT_FROM(gberet) - // basic machine hardware + /* basic machine hardware */ MDRV_CPU_MODIFY("maincpu") MDRV_CPU_PROGRAM_MAP(gberetb_map) MDRV_CPU_VBLANK_INT_HACK(gberet_interrupt, 16) // 1 IRQ + 8 NMI + /* video hardware */ MDRV_SCREEN_MODIFY("screen") MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - // video hardware MDRV_GFXDECODE(gberetb) MDRV_VIDEO_UPDATE(gberetb) @@ -404,17 +439,22 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( mrgoemon ) MDRV_IMPORT_FROM(gberet) - // basic machine hardware + /* basic machine hardware */ MDRV_CPU_MODIFY("maincpu") MDRV_CPU_PROGRAM_MAP(mrgoemon_map) MDRV_CPU_VBLANK_INT_HACK(gberet_interrupt, 16) // 1 IRQ + 8 NMI + /* video hardware */ MDRV_SCREEN_MODIFY("screen") MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MACHINE_DRIVER_END -/* ROMs */ +/************************************* + * + * ROM definition(s) + * + *************************************/ ROM_START( gberet ) ROM_REGION( 0x10000, "maincpu", 0 ) // 64k for code @@ -497,9 +537,13 @@ ROM_START( mrgoemon ) ROM_LOAD( "621a07.6f", 0x0120, 0x0100, CRC(3980acdc) SHA1(f4e0bd74bccd77b84096c38bc70cf488a42d9562) ) // sprites ROM_END -/* Game Drivers */ +/************************************* + * + * Game driver(s) + * + *************************************/ -GAME( 1985, gberet, 0, gberet, gberet, 0, ROT0, "Konami", "Green Beret", 0 ) -GAME( 1985, rushatck, gberet, gberet, gberet, 0, ROT0, "Konami", "Rush'n Attack (US)", 0 ) -GAME( 1985, gberetb, gberet, gberetb, gberetb, 0, ROT0, "bootleg", "Green Beret (bootleg)", 0 ) -GAME( 1986, mrgoemon, 0, mrgoemon, mrgoemon, 0, ROT0, "Konami", "Mr. Goemon (Japan)", 0 ) +GAME( 1985, gberet, 0, gberet, gberet, 0, ROT0, "Konami", "Green Beret", GAME_SUPPORTS_SAVE ) +GAME( 1985, rushatck, gberet, gberet, gberet, 0, ROT0, "Konami", "Rush'n Attack (US)", GAME_SUPPORTS_SAVE ) +GAME( 1985, gberetb, gberet, gberetb, gberetb, 0, ROT0, "bootleg", "Green Beret (bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1986, mrgoemon, 0, mrgoemon, mrgoemon, 0, ROT0, "Konami", "Mr. Goemon (Japan)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/hyperspt.c b/src/mame/drivers/hyperspt.c index eb212a6b0d5..3cd1304bd25 100644 --- a/src/mame/drivers/hyperspt.c +++ b/src/mame/drivers/hyperspt.c @@ -7,54 +7,26 @@ Based on drivers from Juno First emulator by Chris Hardy (chrish@kcbbs.gen.nz) ***************************************************************************/ #include "driver.h" -#include "trackfld.h" #include "cpu/z80/z80.h" +#include "cpu/m6800/m6800.h" #include "cpu/m6809/m6809.h" #include "sound/dac.h" #include "sound/sn76496.h" #include "sound/vlm5030.h" #include "machine/konami1.h" -#include "konamipt.h" -#include "cpu/m6800/m6800.h" +#include "includes/konamipt.h" #include "includes/trackfld.h" -extern UINT8 *hyperspt_scroll; - -extern WRITE8_HANDLER( hyperspt_videoram_w ); -extern WRITE8_HANDLER( hyperspt_colorram_w ); -extern WRITE8_HANDLER( hyperspt_flipscreen_w ); - -extern PALETTE_INIT( hyperspt ); -extern VIDEO_START( hyperspt ); -extern VIDEO_UPDATE( hyperspt ); -extern VIDEO_START( roadf ); - static WRITE8_HANDLER( hyperspt_coin_counter_w ) { - coin_counter_w(space->machine, offset,data); + coin_counter_w(space->machine, offset, data); } -/* - Track'n'Field has 1k of battery backed RAM which can be erased by setting a dipswitch -*/ -static UINT8 *nvram; -static size_t nvram_size; - -static NVRAM_HANDLER( hyperspt ) -{ - if (read_or_write) - mame_fwrite(file,nvram,nvram_size); - else if (file) - mame_fread(file,nvram,nvram_size); -} - - - static ADDRESS_MAP_START( hyperspt_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x1000, 0x10bf) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) - AM_RANGE(0x10c0, 0x10ff) AM_RAM AM_BASE(&hyperspt_scroll) /* Scroll amount */ + AM_RANGE(0x1000, 0x10bf) AM_RAM AM_BASE_SIZE_MEMBER(trackfld_state, spriteram, spriteram_size) + AM_RANGE(0x10c0, 0x10ff) AM_RAM AM_BASE_MEMBER(trackfld_state, scroll) /* Scroll amount */ AM_RANGE(0x1400, 0x1400) AM_WRITE(watchdog_reset_w) AM_RANGE(0x1480, 0x1480) AM_WRITE(hyperspt_flipscreen_w) AM_RANGE(0x1481, 0x1481) AM_WRITE(konami_sh_irqtrigger_w) /* cause interrupt on audio CPU */ @@ -66,16 +38,16 @@ static ADDRESS_MAP_START( hyperspt_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1681, 0x1681) AM_READ_PORT("P1_P2") AM_RANGE(0x1682, 0x1682) AM_READ_PORT("P3_P4") AM_RANGE(0x1683, 0x1683) AM_READ_PORT("DSW1") - AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(hyperspt_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(hyperspt_colorram_w) AM_BASE_GENERIC(colorram) + AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(hyperspt_videoram_w) AM_BASE_MEMBER(trackfld_state, videoram) + AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(hyperspt_colorram_w) AM_BASE_MEMBER(trackfld_state, colorram) AM_RANGE(0x3000, 0x37ff) AM_RAM - AM_RANGE(0x3800, 0x3fff) AM_RAM AM_BASE(&nvram) AM_SIZE(&nvram_size) + AM_RANGE(0x3800, 0x3fff) AM_RAM AM_BASE_SIZE_GENERIC(nvram) AM_RANGE(0x4000, 0xffff) AM_ROM ADDRESS_MAP_END static ADDRESS_MAP_START( roadf_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x1000, 0x10bf) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) - AM_RANGE(0x10c0, 0x10ff) AM_RAM AM_BASE(&hyperspt_scroll) /* Scroll amount */ + AM_RANGE(0x1000, 0x10bf) AM_RAM AM_BASE_SIZE_MEMBER(trackfld_state, spriteram, spriteram_size) + AM_RANGE(0x10c0, 0x10ff) AM_RAM AM_BASE_MEMBER(trackfld_state, scroll) /* Scroll amount */ AM_RANGE(0x1400, 0x1400) AM_WRITE(watchdog_reset_w) AM_RANGE(0x1480, 0x1480) AM_WRITE(hyperspt_flipscreen_w) AM_RANGE(0x1481, 0x1481) AM_WRITE(konami_sh_irqtrigger_w) /* cause interrupt on audio CPU */ @@ -87,10 +59,10 @@ static ADDRESS_MAP_START( roadf_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1681, 0x1681) AM_READ_PORT("P1") AM_RANGE(0x1682, 0x1682) AM_READ_PORT("P2") AM_RANGE(0x1683, 0x1683) AM_READ_PORT("DSW1") - AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(hyperspt_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(hyperspt_colorram_w) AM_BASE_GENERIC(colorram) + AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(hyperspt_videoram_w) AM_BASE_MEMBER(trackfld_state, videoram) + AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(hyperspt_colorram_w) AM_BASE_MEMBER(trackfld_state, colorram) AM_RANGE(0x3000, 0x37ff) AM_RAM - AM_RANGE(0x3800, 0x3fff) AM_RAM AM_BASE(&nvram) AM_SIZE(&nvram_size) + AM_RANGE(0x3800, 0x3fff) AM_RAM AM_BASE_SIZE_GENERIC(nvram) AM_RANGE(0x4000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -294,8 +266,55 @@ GFXDECODE_END +static MACHINE_START( hyperspt ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + state->audiocpu = devtag_get_device(machine, "audiocpu"); + state->vlm = devtag_get_device(machine, "vlm"); + + /* sound */ + state_save_register_global(machine, state->SN76496_latch); + state_save_register_global(machine, state->last_addr); + state_save_register_global(machine, state->last_irq); +} + +static MACHINE_START( hypersptb ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + MACHINE_START_CALL(hyperspt); + + state_save_register_global(machine, state->hyprolyb_adpcm_ready); // only bootlegs + state_save_register_global(machine, state->hyprolyb_adpcm_busy); + state_save_register_global(machine, state->hyprolyb_vck_ready); +} + +static MACHINE_RESET( hyperspt ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + state->SN76496_latch = 0; + state->last_addr = 0; + state->last_irq = 0; +} + +static MACHINE_RESET( hypersptb ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + MACHINE_RESET_CALL(hyperspt); + + state->hyprolyb_adpcm_ready = 0; + state->hyprolyb_adpcm_busy = 0; + state->hyprolyb_vck_ready = 0; +} + static MACHINE_DRIVER_START( hyperspt ) + /* driver data */ + MDRV_DRIVER_DATA(trackfld_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M6809, XTAL_18_432MHz/12) /* verified on pcb */ MDRV_CPU_PROGRAM_MAP(hyperspt_map) @@ -304,7 +323,9 @@ static MACHINE_DRIVER_START( hyperspt ) MDRV_CPU_ADD("audiocpu", Z80,XTAL_14_31818MHz/4) /* verified on pcb */ MDRV_CPU_PROGRAM_MAP(sound_map) - MDRV_NVRAM_HANDLER(hyperspt) + MDRV_MACHINE_START(hyperspt) + MDRV_MACHINE_RESET(hyperspt) + MDRV_NVRAM_HANDLER(generic_0fill) /* video hardware */ MDRV_SCREEN_ADD("screen", RASTER) @@ -345,15 +366,18 @@ static MACHINE_DRIVER_START( hypersptb ) MDRV_CPU_ADD("adpcm", M6802, XTAL_14_31818MHz/8) /* unknown clock */ MDRV_CPU_PROGRAM_MAP(hyprolyb_adpcm_map) + MDRV_MACHINE_START(hypersptb) + MDRV_MACHINE_RESET(hypersptb) + MDRV_SOUND_ADD("msm", MSM5205, 384000) MDRV_SOUND_CONFIG(hyprolyb_msm5205_config) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MACHINE_DRIVER_END static MACHINE_DRIVER_START( roadf ) MDRV_IMPORT_FROM(hyperspt) + MDRV_CPU_MODIFY("maincpu") MDRV_CPU_PROGRAM_MAP(roadf_map) MDRV_GFXDECODE(roadf) @@ -555,8 +579,8 @@ static DRIVER_INIT( hyperspt ) } -GAME( 1984, hyperspt, 0, hyperspt, hyperspt, hyperspt, ROT0, "Konami (Centuri license)", "Hyper Sports", 0 ) -GAME( 1984, hypersptb,hyperspt, hypersptb,hyperspt, hyperspt, ROT0, "bootleg", "Hyper Sports (bootleg)", GAME_IMPERFECT_SOUND ) // has ADPCM vis MSM5205 instead of VLM -GAME( 1984, hpolym84, hyperspt, hyperspt, hyperspt, hyperspt, ROT0, "Konami", "Hyper Olympic '84", 0 ) -GAME( 1984, roadf, 0, roadf, roadf, hyperspt, ROT90, "Konami", "Road Fighter (set 1)", 0 ) -GAME( 1984, roadf2, roadf, roadf, roadf, hyperspt, ROT90, "Konami", "Road Fighter (set 2)", 0 ) +GAME( 1984, hyperspt, 0, hyperspt, hyperspt, hyperspt, ROT0, "Konami (Centuri license)", "Hyper Sports", GAME_SUPPORTS_SAVE ) +GAME( 1984, hypersptb, hyperspt, hypersptb, hyperspt, hyperspt, ROT0, "bootleg", "Hyper Sports (bootleg)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // has ADPCM vis MSM5205 instead of VLM +GAME( 1984, hpolym84, hyperspt, hyperspt, hyperspt, hyperspt, ROT0, "Konami", "Hyper Olympic '84", GAME_SUPPORTS_SAVE ) +GAME( 1984, roadf, 0, roadf, roadf, hyperspt, ROT90, "Konami", "Road Fighter (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1984, roadf2, roadf, roadf, roadf, hyperspt, ROT90, "Konami", "Road Fighter (set 2)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/jailbrek.c b/src/mame/drivers/jailbrek.c index 54d649d0a9c..47cf1f0bfdf 100644 --- a/src/mame/drivers/jailbrek.c +++ b/src/mame/drivers/jailbrek.c @@ -75,83 +75,73 @@ Notes: VSync - 60.6059Hz -***************************************************************************/ - -/* +**************************************************************************** TODO: - coin counters -*/ - - -#define MASTER_CLOCK XTAL_18_432MHz -#define VOICE_CLOCK XTAL_3_579545MHz +***************************************************************************/ #include "driver.h" #include "machine/konami1.h" #include "cpu/m6809/m6809.h" #include "sound/sn76496.h" #include "sound/vlm5030.h" -#include "konamipt.h" - -extern UINT8 *jailbrek_scroll_x; -extern UINT8 *jailbrek_scroll_dir; - -extern WRITE8_HANDLER( jailbrek_videoram_w ); -extern WRITE8_HANDLER( jailbrek_colorram_w ); - -extern PALETTE_INIT( jailbrek ); -extern VIDEO_START( jailbrek ); -extern VIDEO_UPDATE( jailbrek ); - - -static UINT8 irq_enable,nmi_enable; +#include "includes/konamipt.h" +#include "includes/jailbrek.h" static WRITE8_HANDLER( ctrl_w ) { - nmi_enable = data & 0x01; - irq_enable = data & 0x02; + jailbrek_state *state = (jailbrek_state *)space->machine->driver_data; + + state->nmi_enable = data & 0x01; + state->irq_enable = data & 0x02; flip_screen_set(space->machine, data & 0x08); } static INTERRUPT_GEN( jb_interrupt ) { - if (irq_enable) + jailbrek_state *state = (jailbrek_state *)device->machine->driver_data; + + if (state->irq_enable) cpu_set_input_line(device, 0, HOLD_LINE); } static INTERRUPT_GEN( jb_interrupt_nmi ) { - if (nmi_enable) + jailbrek_state *state = (jailbrek_state *)device->machine->driver_data; + + if (state->nmi_enable) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); } -static READ8_DEVICE_HANDLER( jailbrek_speech_r ) { - return ( vlm5030_bsy(device) ? 1 : 0 ); +static READ8_DEVICE_HANDLER( jailbrek_speech_r ) +{ + return (vlm5030_bsy(device) ? 1 : 0); } -static WRITE8_DEVICE_HANDLER( jailbrek_speech_w ) { +static WRITE8_DEVICE_HANDLER( jailbrek_speech_w ) +{ /* bit 0 could be latch direction like in yiear */ - vlm5030_st( device, ( data >> 1 ) & 1 ); - vlm5030_rst( device, ( data >> 2 ) & 1 ); + vlm5030_st(device, (data >> 1) & 1); + vlm5030_rst(device, (data >> 2) & 1); } static ADDRESS_MAP_START( jailbrek_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(jailbrek_colorram_w) AM_BASE_GENERIC(colorram) - AM_RANGE(0x0800, 0x0fff) AM_RAM_WRITE(jailbrek_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0x1000, 0x10bf) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) + AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(jailbrek_colorram_w) AM_BASE_MEMBER(jailbrek_state, colorram) + AM_RANGE(0x0800, 0x0fff) AM_RAM_WRITE(jailbrek_videoram_w) AM_BASE_MEMBER(jailbrek_state, videoram) + AM_RANGE(0x1000, 0x10bf) AM_RAM AM_BASE_SIZE_MEMBER(jailbrek_state, spriteram, spriteram_size) AM_RANGE(0x10c0, 0x14ff) AM_RAM /* ??? */ AM_RANGE(0x1500, 0x1fff) AM_RAM /* work ram */ - AM_RANGE(0x2000, 0x203f) AM_RAM AM_BASE(&jailbrek_scroll_x) - AM_RANGE(0x2040, 0x2040) AM_WRITENOP /* ??? */ - AM_RANGE(0x2041, 0x2041) AM_WRITENOP /* ??? */ - AM_RANGE(0x2042, 0x2042) AM_RAM AM_BASE(&jailbrek_scroll_dir) /* bit 2 = scroll direction */ - AM_RANGE(0x2043, 0x2043) AM_WRITENOP /* ??? */ - AM_RANGE(0x2044, 0x2044) AM_WRITE(ctrl_w) /* irq, nmi enable, screen flip */ + AM_RANGE(0x2000, 0x203f) AM_RAM AM_BASE_MEMBER(jailbrek_state, scroll_x) + AM_RANGE(0x2040, 0x2040) AM_WRITENOP /* ??? */ + AM_RANGE(0x2041, 0x2041) AM_WRITENOP /* ??? */ + AM_RANGE(0x2042, 0x2042) AM_RAM AM_BASE_MEMBER(jailbrek_state, scroll_dir) /* bit 2 = scroll direction */ + AM_RANGE(0x2043, 0x2043) AM_WRITENOP /* ??? */ + AM_RANGE(0x2044, 0x2044) AM_WRITE(ctrl_w) /* irq, nmi enable, screen flip */ AM_RANGE(0x3000, 0x307f) AM_RAM /* related to sprites? */ AM_RANGE(0x3100, 0x3100) AM_READ_PORT("DSW2") AM_DEVWRITE("snsnd", sn76496_w) AM_RANGE(0x3200, 0x3200) AM_READ_PORT("DSW3") AM_WRITENOP /* mirror of the previous? */ @@ -249,12 +239,23 @@ GFXDECODE_END static MACHINE_START( jailbrek ) { - state_save_register_global(machine, irq_enable); - state_save_register_global(machine, nmi_enable); + jailbrek_state *state = (jailbrek_state *)machine->driver_data; + state_save_register_global(machine, state->irq_enable); + state_save_register_global(machine, state->nmi_enable); +} + +static MACHINE_RESET( jailbrek ) +{ + jailbrek_state *state = (jailbrek_state *)machine->driver_data; + state->irq_enable = 0; + state->nmi_enable = 0; } static MACHINE_DRIVER_START( jailbrek ) + /* driver data */ + MDRV_DRIVER_DATA(jailbrek_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M6809, MASTER_CLOCK/12) MDRV_CPU_PROGRAM_MAP(jailbrek_map) @@ -262,6 +263,7 @@ static MACHINE_DRIVER_START( jailbrek ) MDRV_CPU_PERIODIC_INT(jb_interrupt_nmi, 500) /* ? */ MDRV_MACHINE_START(jailbrek) + MDRV_MACHINE_RESET(jailbrek) /* video hardware */ MDRV_GFXDECODE(jailbrek) @@ -293,53 +295,53 @@ MACHINE_DRIVER_END ***************************************************************************/ ROM_START( jailbrek ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "507p03.11d", 0x8000, 0x4000, CRC(a0b88dfd) SHA1(f999e382b9d3b812fca41f4d0da3ea692fef6b19) ) ROM_LOAD( "507p02.9d", 0xc000, 0x4000, CRC(444b7d8e) SHA1(c708b67c2d249448dae9a3d10c24d13ba6849597) ) - ROM_REGION( 0x08000, "gfx1", 0 ) + ROM_REGION( 0x08000, "gfx1", 0 ) ROM_LOAD( "507l08.4f", 0x0000, 0x4000, CRC(e3b7a226) SHA1(c19a02a2def65648bf198fccec98ebbd2fc7c0fb) ) /* characters */ - ROM_LOAD( "507j09.5f", 0x4000, 0x4000, CRC(504f0912) SHA1(b51a45dd5506bccdf0061dd6edd7f49ac86ed0f8) ) + ROM_LOAD( "507j09.5f", 0x4000, 0x4000, CRC(504f0912) SHA1(b51a45dd5506bccdf0061dd6edd7f49ac86ed0f8) ) - ROM_REGION( 0x10000, "gfx2", 0 ) - ROM_LOAD( "507j04.3e", 0x0000, 0x4000, CRC(0d269524) SHA1(a10ddb405e884bfec521a3c7a29d22f63e535b59) ) /* sprites */ - ROM_LOAD( "507j05.4e", 0x4000, 0x4000, CRC(27d4f6f4) SHA1(c42c064dbd7c5cf0b1d99651367e0bee1728a5b0) ) - ROM_LOAD( "507j06.5e", 0x8000, 0x4000, CRC(717485cb) SHA1(22609489186dcb3d7cd49b7ddfdc6f04d0739354) ) - ROM_LOAD( "507j07.3f", 0xc000, 0x4000, CRC(e933086f) SHA1(c0fd1e8d23c0f7e14c0b75f629448034420cf8ef) ) + ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_LOAD( "507j04.3e", 0x0000, 0x4000, CRC(0d269524) SHA1(a10ddb405e884bfec521a3c7a29d22f63e535b59) ) /* sprites */ + ROM_LOAD( "507j05.4e", 0x4000, 0x4000, CRC(27d4f6f4) SHA1(c42c064dbd7c5cf0b1d99651367e0bee1728a5b0) ) + ROM_LOAD( "507j06.5e", 0x8000, 0x4000, CRC(717485cb) SHA1(22609489186dcb3d7cd49b7ddfdc6f04d0739354) ) + ROM_LOAD( "507j07.3f", 0xc000, 0x4000, CRC(e933086f) SHA1(c0fd1e8d23c0f7e14c0b75f629448034420cf8ef) ) ROM_REGION( 0x0240, "proms", 0 ) - ROM_LOAD( "507j10.1f", 0x0000, 0x0020, CRC(f1909605) SHA1(91eaa865375b3bc052897732b64b1ff7df3f78f6) ) /* red & green */ - ROM_LOAD( "507j11.2f", 0x0020, 0x0020, CRC(f70bb122) SHA1(bf77990260e8346faa3d3481718cbe46a4a27150) ) /* blue */ - ROM_LOAD( "507j13.7f", 0x0040, 0x0100, CRC(d4fe5c97) SHA1(972e9dab6c53722545dd3a43e3ada7921e88708b) ) /* char lookup */ - ROM_LOAD( "507j12.6f", 0x0140, 0x0100, CRC(0266c7db) SHA1(a8f21e86e6d974c9bfd92a147689d0e7316d66e2) ) /* sprites lookup */ + ROM_LOAD( "507j10.1f", 0x0000, 0x0020, CRC(f1909605) SHA1(91eaa865375b3bc052897732b64b1ff7df3f78f6) ) /* red & green */ + ROM_LOAD( "507j11.2f", 0x0020, 0x0020, CRC(f70bb122) SHA1(bf77990260e8346faa3d3481718cbe46a4a27150) ) /* blue */ + ROM_LOAD( "507j13.7f", 0x0040, 0x0100, CRC(d4fe5c97) SHA1(972e9dab6c53722545dd3a43e3ada7921e88708b) ) /* char lookup */ + ROM_LOAD( "507j12.6f", 0x0140, 0x0100, CRC(0266c7db) SHA1(a8f21e86e6d974c9bfd92a147689d0e7316d66e2) ) /* sprites lookup */ - ROM_REGION( 0x4000, "vlm", 0 ) /* speech rom */ - ROM_LOAD( "507l01.8c", 0x0000, 0x4000, CRC(0c8a3605) SHA1(d886b66d3861c3a90a1825ccf5bf0011831ca366) ) + ROM_REGION( 0x4000, "vlm", 0 ) /* speech rom */ + ROM_LOAD( "507l01.8c", 0x0000, 0x4000, CRC(0c8a3605) SHA1(d886b66d3861c3a90a1825ccf5bf0011831ca366) ) ROM_END ROM_START( manhatan ) - ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "507n03.11d", 0x8000, 0x4000, CRC(e5039f7e) SHA1(0f12484ed40444d978e0405c27bdd027ae2e2a0b) ) - ROM_LOAD( "507n02.9d", 0xc000, 0x4000, CRC(143cc62c) SHA1(9520dbb1b6f1fa439e03d4caa9bed96ef8f805f2) ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "507n03.11d", 0x8000, 0x4000, CRC(e5039f7e) SHA1(0f12484ed40444d978e0405c27bdd027ae2e2a0b) ) + ROM_LOAD( "507n02.9d", 0xc000, 0x4000, CRC(143cc62c) SHA1(9520dbb1b6f1fa439e03d4caa9bed96ef8f805f2) ) - ROM_REGION( 0x08000, "gfx1", 0 ) - ROM_LOAD( "507j08.4f", 0x0000, 0x4000, CRC(175e1b49) SHA1(4cfe982cdf7729bd05c6da803480571876320bf6) ) /* characters */ - ROM_LOAD( "507j09.5f", 0x4000, 0x4000, CRC(504f0912) SHA1(b51a45dd5506bccdf0061dd6edd7f49ac86ed0f8) ) + ROM_REGION( 0x08000, "gfx1", 0 ) + ROM_LOAD( "507j08.4f", 0x0000, 0x4000, CRC(175e1b49) SHA1(4cfe982cdf7729bd05c6da803480571876320bf6) ) /* characters */ + ROM_LOAD( "507j09.5f", 0x4000, 0x4000, CRC(504f0912) SHA1(b51a45dd5506bccdf0061dd6edd7f49ac86ed0f8) ) - ROM_REGION( 0x10000, "gfx2", 0 ) - ROM_LOAD( "507j04.3e", 0x0000, 0x4000, CRC(0d269524) SHA1(a10ddb405e884bfec521a3c7a29d22f63e535b59) ) /* sprites */ - ROM_LOAD( "507j05.4e", 0x4000, 0x4000, CRC(27d4f6f4) SHA1(c42c064dbd7c5cf0b1d99651367e0bee1728a5b0) ) - ROM_LOAD( "507j06.5e", 0x8000, 0x4000, CRC(717485cb) SHA1(22609489186dcb3d7cd49b7ddfdc6f04d0739354) ) - ROM_LOAD( "507j07.3f", 0xc000, 0x4000, CRC(e933086f) SHA1(c0fd1e8d23c0f7e14c0b75f629448034420cf8ef) ) + ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_LOAD( "507j04.3e", 0x0000, 0x4000, CRC(0d269524) SHA1(a10ddb405e884bfec521a3c7a29d22f63e535b59) ) /* sprites */ + ROM_LOAD( "507j05.4e", 0x4000, 0x4000, CRC(27d4f6f4) SHA1(c42c064dbd7c5cf0b1d99651367e0bee1728a5b0) ) + ROM_LOAD( "507j06.5e", 0x8000, 0x4000, CRC(717485cb) SHA1(22609489186dcb3d7cd49b7ddfdc6f04d0739354) ) + ROM_LOAD( "507j07.3f", 0xc000, 0x4000, CRC(e933086f) SHA1(c0fd1e8d23c0f7e14c0b75f629448034420cf8ef) ) ROM_REGION( 0x0240, "proms", 0 ) - ROM_LOAD( "507j10.1f", 0x0000, 0x0020, CRC(f1909605) SHA1(91eaa865375b3bc052897732b64b1ff7df3f78f6) ) /* red & green */ - ROM_LOAD( "507j11.2f", 0x0020, 0x0020, CRC(f70bb122) SHA1(bf77990260e8346faa3d3481718cbe46a4a27150) ) /* blue */ - ROM_LOAD( "507j13.7f", 0x0040, 0x0100, CRC(d4fe5c97) SHA1(972e9dab6c53722545dd3a43e3ada7921e88708b) ) /* char lookup */ - ROM_LOAD( "507j12.6f", 0x0140, 0x0100, CRC(0266c7db) SHA1(a8f21e86e6d974c9bfd92a147689d0e7316d66e2) ) /* sprites lookup */ + ROM_LOAD( "507j10.1f", 0x0000, 0x0020, CRC(f1909605) SHA1(91eaa865375b3bc052897732b64b1ff7df3f78f6) ) /* red & green */ + ROM_LOAD( "507j11.2f", 0x0020, 0x0020, CRC(f70bb122) SHA1(bf77990260e8346faa3d3481718cbe46a4a27150) ) /* blue */ + ROM_LOAD( "507j13.7f", 0x0040, 0x0100, CRC(d4fe5c97) SHA1(972e9dab6c53722545dd3a43e3ada7921e88708b) ) /* char lookup */ + ROM_LOAD( "507j12.6f", 0x0140, 0x0100, CRC(0266c7db) SHA1(a8f21e86e6d974c9bfd92a147689d0e7316d66e2) ) /* sprites lookup */ - ROM_REGION( 0x4000, "vlm", 0 ) /* speech rom */ - ROM_LOAD( "507p01.8c", 0x0000, 0x4000, CRC(973fa351) SHA1(ac360d05ed4d03334e00c80e70d5ae939d93af5f) ) + ROM_REGION( 0x4000, "vlm", 0 ) /* speech rom */ + ROM_LOAD( "507p01.8c", 0x0000, 0x4000, CRC(973fa351) SHA1(ac360d05ed4d03334e00c80e70d5ae939d93af5f) ) ROM_END /* @@ -379,15 +381,15 @@ ROM_END */ ROM_START( jailbrekb ) - ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "1.k6", 0x8000, 0x8000, CRC(df0e8fc7) SHA1(62e59dbb3941ed8af365e96906315318d9aee060) ) - ROM_REGION( 0x08000, "gfx1", 0 ) /* characters */ + ROM_REGION( 0x08000, "gfx1", 0 ) /* characters */ ROM_LOAD( "3.h6", 0x0000, 0x8000, CRC(bf67a8ff) SHA1(9aca8de7e2c2cc0ff9fe3f316a9300574df4ff06) ) - ROM_REGION( 0x10000, "gfx2", 0 ) /* sprites */ - ROM_LOAD( "5.f6", 0x0000, 0x8000, CRC(081d2eea) SHA1(dae66b2607d1a56e72e9cb456bdb3c0c21337d6c) ) - ROM_LOAD( "4.g6", 0x8000, 0x8000, CRC(e34b93b8) SHA1(fb6ed12ab017ac1e5006165f435cf0ed95a49c17) ) + ROM_REGION( 0x10000, "gfx2", 0 ) /* sprites */ + ROM_LOAD( "5.f6", 0x0000, 0x8000, CRC(081d2eea) SHA1(dae66b2607d1a56e72e9cb456bdb3c0c21337d6c) ) + ROM_LOAD( "4.g6", 0x8000, 0x8000, CRC(e34b93b8) SHA1(fb6ed12ab017ac1e5006165f435cf0ed95a49c17) ) ROM_REGION( 0x0240, "proms", 0 ) ROM_LOAD( "prom.j2", 0x0000, 0x0020, CRC(f1909605) SHA1(91eaa865375b3bc052897732b64b1ff7df3f78f6) ) /* red & green */ @@ -398,7 +400,7 @@ ROM_START( jailbrekb ) ROM_REGION( 0x2000, "vlm", 0 ) /* speech rom */ ROM_LOAD( "2.i6", 0x0000, 0x2000, CRC(d91d15e3) SHA1(475fe50aafbf8f2fb79880ef0e2c25158eda5270) ) - ROM_REGION( 0x0004, "plds", 0 ) + ROM_REGION( 0x0004, "plds", 0 ) ROM_LOAD( "k4.bin", 0x0000, 0x0001, NO_DUMP ) /* PAL16L8 */ ROM_LOAD( "a7.bin", 0x0000, 0x0001, NO_DUMP ) /* PAL16R4 */ ROM_LOAD( "g9.bin", 0x0000, 0x0001, NO_DUMP ) /* PAL16R6 */ @@ -408,7 +410,7 @@ ROM_END static DRIVER_INIT( jailbrek ) { UINT8 *SPEECH_ROM = memory_region(machine, "vlm"); - int nIndex; + int ind; /* Check if the rom used for the speech is not a 2764, but a 27128. If a @@ -421,9 +423,9 @@ static DRIVER_INIT( jailbrek ) if (memory_region_length(machine, "vlm") == 0x4000) { - for (nIndex = 0; nIndex < 0x2000; ++nIndex) + for (ind = 0; ind < 0x2000; ++ind) { - SPEECH_ROM[nIndex] = SPEECH_ROM[nIndex + 0x2000]; + SPEECH_ROM[ind] = SPEECH_ROM[ind + 0x2000]; } } diff --git a/src/mame/drivers/sbasketb.c b/src/mame/drivers/sbasketb.c index 506296e1b62..fcbbe5d3b91 100644 --- a/src/mame/drivers/sbasketb.c +++ b/src/mame/drivers/sbasketb.c @@ -39,52 +39,41 @@ CPU/Video Board Parts: ***************************************************************************/ #include "driver.h" -#include "trackfld.h" #include "cpu/z80/z80.h" #include "cpu/m6809/m6809.h" #include "sound/dac.h" #include "sound/sn76496.h" #include "sound/vlm5030.h" #include "machine/konami1.h" -#include "konamipt.h" - -extern UINT8 *sbasketb_scroll; -extern UINT8 *sbasketb_palettebank; -extern UINT8 *sbasketb_spriteram_select; - -WRITE8_HANDLER( sbasketb_videoram_w ); -WRITE8_HANDLER( sbasketb_colorram_w ); -WRITE8_HANDLER( sbasketb_flipscreen_w ); - -PALETTE_INIT( sbasketb ); -VIDEO_START( sbasketb ); -VIDEO_UPDATE( sbasketb ); +#include "includes/konamipt.h" +#include "includes/trackfld.h" static WRITE8_HANDLER( sbasketb_sh_irqtrigger_w ) { - cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff); + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + cpu_set_input_line_and_vector(state->audiocpu, 0, HOLD_LINE, 0xff); } static WRITE8_HANDLER( sbasketb_coin_counter_w ) { - coin_counter_w(space->machine, offset,data); + coin_counter_w(space->machine, offset, data); } static ADDRESS_MAP_START( sbasketb_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2000, 0x2fff) AM_RAM - AM_RANGE(0x3000, 0x33ff) AM_RAM_WRITE(sbasketb_colorram_w) AM_BASE_GENERIC(colorram) - AM_RANGE(0x3400, 0x37ff) AM_RAM_WRITE(sbasketb_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0x3800, 0x39ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) + AM_RANGE(0x3000, 0x33ff) AM_RAM_WRITE(sbasketb_colorram_w) AM_BASE_MEMBER(trackfld_state, colorram) + AM_RANGE(0x3400, 0x37ff) AM_RAM_WRITE(sbasketb_videoram_w) AM_BASE_MEMBER(trackfld_state, videoram) + AM_RANGE(0x3800, 0x39ff) AM_RAM AM_BASE_SIZE_MEMBER(trackfld_state, spriteram, spriteram_size) AM_RANGE(0x3a00, 0x3bff) AM_RAM /* Probably unused, but initialized */ AM_RANGE(0x3c00, 0x3c00) AM_WRITE(watchdog_reset_w) AM_RANGE(0x3c10, 0x3c10) AM_READNOP /* ???? */ - AM_RANGE(0x3c20, 0x3c20) AM_WRITEONLY AM_BASE(&sbasketb_palettebank) + AM_RANGE(0x3c20, 0x3c20) AM_WRITEONLY AM_BASE_MEMBER(trackfld_state, palettebank) AM_RANGE(0x3c80, 0x3c80) AM_WRITE(sbasketb_flipscreen_w) AM_RANGE(0x3c81, 0x3c81) AM_WRITE(interrupt_enable_w) AM_RANGE(0x3c83, 0x3c84) AM_WRITE(sbasketb_coin_counter_w) - AM_RANGE(0x3c85, 0x3c85) AM_WRITE(SMH_RAM) AM_BASE(&sbasketb_spriteram_select) + AM_RANGE(0x3c85, 0x3c85) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(trackfld_state, spriteram_select) AM_RANGE(0x3d00, 0x3d00) AM_WRITE(soundlatch_w) AM_RANGE(0x3d80, 0x3d80) AM_WRITE(sbasketb_sh_irqtrigger_w) AM_RANGE(0x3e00, 0x3e00) AM_READ_PORT("SYSTEM") @@ -93,8 +82,8 @@ static ADDRESS_MAP_START( sbasketb_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3e03, 0x3e03) AM_READNOP AM_RANGE(0x3e80, 0x3e80) AM_READ_PORT("DSW2") AM_RANGE(0x3f00, 0x3f00) AM_READ_PORT("DSW1") - AM_RANGE(0x3f80, 0x3f80) AM_WRITEONLY AM_BASE(&sbasketb_scroll) - AM_RANGE(0x6000, 0xffff) AM_READ(SMH_ROM) + AM_RANGE(0x3f80, 0x3f80) AM_WRITEONLY AM_BASE_MEMBER(trackfld_state, scroll) + AM_RANGE(0x6000, 0xffff) AM_ROM ADDRESS_MAP_END static ADDRESS_MAP_START( sbasketb_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -183,8 +172,33 @@ static GFXDECODE_START( sbasketb ) GFXDECODE_END +static MACHINE_START( sbasketb ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + state->audiocpu = devtag_get_device(machine, "audiocpu"); + state->vlm = devtag_get_device(machine, "vlm"); + + /* sound */ + state_save_register_global(machine, state->SN76496_latch); + state_save_register_global(machine, state->last_addr); + state_save_register_global(machine, state->last_irq); +} + +static MACHINE_RESET( sbasketb ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + state->SN76496_latch = 0; + state->last_addr = 0; + state->last_irq = 0; +} + static MACHINE_DRIVER_START( sbasketb ) + /* driver data */ + MDRV_DRIVER_DATA(trackfld_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M6809, 1400000) /* 1.400 MHz ??? */ MDRV_CPU_PROGRAM_MAP(sbasketb_map) @@ -193,6 +207,9 @@ static MACHINE_DRIVER_START( sbasketb ) MDRV_CPU_ADD("audiocpu", Z80, XTAL_14_31818MHz / 4) /* 3.5795 MHz */ MDRV_CPU_PROGRAM_MAP(sbasketb_sound_map) + MDRV_MACHINE_START(sbasketb) + MDRV_MACHINE_RESET(sbasketb) + /* video hardware */ MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_REFRESH_RATE(60) @@ -400,7 +417,7 @@ static DRIVER_INIT( sbasketb ) konami1_decode(machine, "maincpu"); } -GAME( 1984, sbasketb, 0, sbasketb, sbasketb, sbasketb, ROT90, "Konami", "Super Basketball (version I, encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1984, sbasketb, 0, sbasketb, sbasketb, sbasketb, ROT90, "Konami", "Super Basketball (version I, encrypted)", GAME_SUPPORTS_SAVE ) GAME( 1984, sbasketh, sbasketb, sbasketb, sbasketb, 0, ROT90, "Konami", "Super Basketball (version H, unprotected)", GAME_SUPPORTS_SAVE ) -GAME( 1984, sbasketg, sbasketb, sbasketb, sbasketb, sbasketb, ROT90, "Konami", "Super Basketball (version G, encrypted)", GAME_SUPPORTS_SAVE ) -GAME( 1984, sbaskete, sbasketb, sbasketb, sbasketb, sbasketb, ROT90, "Konami", "Super Basketball (version E, encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1984, sbasketg, sbasketb, sbasketb, sbasketb, sbasketb, ROT90, "Konami", "Super Basketball (version G, encrypted)", GAME_SUPPORTS_SAVE ) +GAME( 1984, sbaskete, sbasketb, sbasketb, sbasketb, sbasketb, ROT90, "Konami", "Super Basketball (version E, encrypted)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/trackfld.c b/src/mame/drivers/trackfld.c index be62a294e76..3df7ec9637b 100644 --- a/src/mame/drivers/trackfld.c +++ b/src/mame/drivers/trackfld.c @@ -18,7 +18,6 @@ MAIN BOARD: ***************************************************************************/ #include "driver.h" -#include "trackfld.h" #include "cpu/z80/z80.h" #include "cpu/m6800/m6800.h" #include "machine/konami1.h" @@ -27,20 +26,17 @@ MAIN BOARD: #include "sound/vlm5030.h" #include "sound/dac.h" #include "sound/msm5205.h" - -#define MASTER_CLOCK XTAL_18_432MHz -#define SOUND_CLOCK XTAL_14_31818MHz -#define VLM_CLOCK XTAL_3_579545MHz +#include "includes/trackfld.h" -static UINT8 hyprolyb_adpcm_ready; -static UINT8 hyprolyb_adpcm_busy; -static UINT8 hyprolyb_vck_ready; +#define MASTER_CLOCK XTAL_18_432MHz +#define SOUND_CLOCK XTAL_14_31818MHz +#define VLM_CLOCK XTAL_3_579545MHz static WRITE8_HANDLER( coin_w ) { - coin_counter_w(space->machine, offset,data & 1); + coin_counter_w(space->machine, offset, data & 1); } static WRITE8_HANDLER( questions_bank_w ) @@ -65,41 +61,46 @@ static WRITE8_HANDLER( questions_bank_w ) WRITE8_HANDLER( hyprolyb_adpcm_w ) { + trackfld_state *state = (trackfld_state *)space->machine->driver_data; soundlatch2_w(space, offset, data); - hyprolyb_adpcm_ready = 0x80; + state->hyprolyb_adpcm_ready = 0x80; } static READ8_HANDLER( hyprolyb_adpcm_busy_r ) { - return hyprolyb_adpcm_busy ? 0x10 : 0x00; + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + return state->hyprolyb_adpcm_busy ? 0x10 : 0x00; } static WRITE8_DEVICE_HANDLER( hyprolyb_msm_data_w ) { + trackfld_state *state = (trackfld_state *)device->machine->driver_data; msm5205_data_w(device, data); - hyprolyb_adpcm_busy = ~data & 0x80; + state->hyprolyb_adpcm_busy = ~data & 0x80; } static READ8_DEVICE_HANDLER( hyprolyb_msm_vck_r ) { - UINT8 old = hyprolyb_vck_ready; - hyprolyb_vck_ready = 0x00; + trackfld_state *state = (trackfld_state *)device->machine->driver_data; + UINT8 old = state->hyprolyb_vck_ready; + state->hyprolyb_vck_ready = 0x00; return old; } static READ8_HANDLER( hyprolyb_adpcm_ready_r ) { - return hyprolyb_adpcm_ready; + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + return state->hyprolyb_adpcm_ready; } static READ8_HANDLER( hyprolyb_adpcm_data_r ) { - hyprolyb_adpcm_ready = 0x00; + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + state->hyprolyb_adpcm_ready = 0x00; return soundlatch2_r(space, offset); } - static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x007f) AM_WRITE(watchdog_reset_w) /* AFE */ AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x0078) AM_WRITE(trackfld_flipscreen_w) /* FLIP */ @@ -116,15 +117,15 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1282, 0x1282) AM_MIRROR(0x007c) AM_READ_PORT("IN1") AM_RANGE(0x1283, 0x1283) AM_MIRROR(0x007c) AM_READ_PORT("DSW1") /* not used according to schems: AM_RANGE(0x1300, 0x1300) AM_MIRROR(0x007f) AM_READ_PORT("DSW3") */ - AM_RANGE(0x1800, 0x183f) AM_RAM AM_BASE_GENERIC(spriteram2) - AM_RANGE(0x1840, 0x185f) AM_RAM AM_BASE(&trackfld_scroll) + AM_RANGE(0x1800, 0x183f) AM_RAM AM_BASE_MEMBER(trackfld_state, spriteram2) + AM_RANGE(0x1840, 0x185f) AM_RAM AM_BASE_MEMBER(trackfld_state, scroll) AM_RANGE(0x1860, 0x1bff) AM_RAM - AM_RANGE(0x1c00, 0x1c3f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) - AM_RANGE(0x1c40, 0x1c5f) AM_RAM AM_BASE(&trackfld_scroll2) + AM_RANGE(0x1c00, 0x1c3f) AM_RAM AM_BASE_SIZE_MEMBER(trackfld_state, spriteram, spriteram_size) + AM_RANGE(0x1c40, 0x1c5f) AM_RAM AM_BASE_MEMBER(trackfld_state, scroll2) AM_RANGE(0x1c60, 0x1fff) AM_RAM AM_RANGE(0x2800, 0x2fff) AM_RAM AM_BASE_SIZE_GENERIC(nvram) - AM_RANGE(0x3000, 0x37ff) AM_RAM_WRITE(trackfld_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0x3800, 0x3fff) AM_RAM_WRITE(trackfld_colorram_w) AM_BASE_GENERIC(colorram) + AM_RANGE(0x3000, 0x37ff) AM_RAM_WRITE(trackfld_videoram_w) AM_BASE_MEMBER(trackfld_state, videoram) + AM_RANGE(0x3800, 0x3fff) AM_RAM_WRITE(trackfld_colorram_w) AM_BASE_MEMBER(trackfld_state, colorram) AM_RANGE(0x6000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -142,16 +143,16 @@ static ADDRESS_MAP_START( reaktor_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x9281, 0x9281) AM_READ_PORT("IN0") AM_RANGE(0x9282, 0x9282) AM_READ_PORT("IN1") AM_RANGE(0x9283, 0x9283) AM_READ_PORT("DSW1") - AM_RANGE(0x9800, 0x983f) AM_RAM AM_BASE_GENERIC(spriteram2) - AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE(&trackfld_scroll) + AM_RANGE(0x9800, 0x983f) AM_RAM AM_BASE_MEMBER(trackfld_state, spriteram2) + AM_RANGE(0x9840, 0x985f) AM_RAM AM_BASE_MEMBER(trackfld_state, scroll) AM_RANGE(0x9860, 0x9bff) AM_RAM - AM_RANGE(0x9c00, 0x9c3f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) - AM_RANGE(0x9c40, 0x9c5f) AM_RAM AM_BASE(&trackfld_scroll2) + AM_RANGE(0x9c00, 0x9c3f) AM_RAM AM_BASE_SIZE_MEMBER(trackfld_state, spriteram, spriteram_size) + AM_RANGE(0x9c40, 0x9c5f) AM_RAM AM_BASE_MEMBER(trackfld_state, scroll2) AM_RANGE(0x9c60, 0x9fff) AM_RAM AM_RANGE(0xa800, 0xabff) AM_RAM AM_RANGE(0xac00, 0xafff) AM_RAM AM_BASE_SIZE_GENERIC(nvram) - AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(trackfld_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0xb800, 0xbfff) AM_RAM_WRITE(trackfld_colorram_w) AM_BASE_GENERIC(colorram) + AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(trackfld_videoram_w) AM_BASE_MEMBER(trackfld_state, videoram) + AM_RANGE(0xb800, 0xbfff) AM_RAM_WRITE(trackfld_colorram_w) AM_BASE_MEMBER(trackfld_state, colorram) ADDRESS_MAP_END /* Reaktor reads / writes some I/O ports, no idea what they're connected to, if anything */ @@ -175,16 +176,16 @@ static ADDRESS_MAP_START( mastkin_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1281, 0x1281) AM_READ_PORT("IN0") // AM_RANGE(0x1282, 0x1282) AM_READ_PORT("IN1") /* unused */ AM_RANGE(0x1283, 0x1283) AM_READ_PORT("DSW1") - AM_RANGE(0x1800, 0x183f) AM_RAM AM_BASE_GENERIC(spriteram2) - AM_RANGE(0x1840, 0x185f) AM_RAM AM_BASE(&trackfld_scroll) + AM_RANGE(0x1800, 0x183f) AM_RAM AM_BASE_MEMBER(trackfld_state, spriteram2) + AM_RANGE(0x1840, 0x185f) AM_RAM AM_BASE_MEMBER(trackfld_state, scroll) AM_RANGE(0x1860, 0x1bff) AM_RAM - AM_RANGE(0x1c00, 0x1c3f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) - AM_RANGE(0x1c40, 0x1c5f) AM_RAM AM_BASE(&trackfld_scroll2) + AM_RANGE(0x1c00, 0x1c3f) AM_RAM AM_BASE_SIZE_MEMBER(trackfld_state, spriteram, spriteram_size) + AM_RANGE(0x1c40, 0x1c5f) AM_RAM AM_BASE_MEMBER(trackfld_state, scroll2) AM_RANGE(0x1c60, 0x1fff) AM_RAM AM_RANGE(0x2800, 0x2bff) AM_RAM AM_RANGE(0x2c00, 0x2fff) AM_RAM AM_BASE_SIZE_GENERIC(nvram) - AM_RANGE(0x3000, 0x37ff) AM_RAM_WRITE(trackfld_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0x3800, 0x3fff) AM_RAM_WRITE(trackfld_colorram_w) AM_BASE_GENERIC(colorram) + AM_RANGE(0x3000, 0x37ff) AM_RAM_WRITE(trackfld_videoram_w) AM_BASE_MEMBER(trackfld_state, videoram) + AM_RANGE(0x3800, 0x3fff) AM_RAM_WRITE(trackfld_colorram_w) AM_BASE_MEMBER(trackfld_state, colorram) AM_RANGE(0x6000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -201,18 +202,18 @@ static ADDRESS_MAP_START( wizzquiz_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1281, 0x1281) AM_READ_PORT("IN0") AM_RANGE(0x1282, 0x1282) AM_READ_PORT("IN1") AM_RANGE(0x1283, 0x1283) AM_READ_PORT("DSW1") - AM_RANGE(0x1800, 0x183f) AM_RAM AM_BASE_GENERIC(spriteram2) - AM_RANGE(0x1840, 0x185f) AM_RAM AM_BASE(&trackfld_scroll) + AM_RANGE(0x1800, 0x183f) AM_RAM AM_BASE_MEMBER(trackfld_state, spriteram2) + AM_RANGE(0x1840, 0x185f) AM_RAM AM_BASE_MEMBER(trackfld_state, scroll) AM_RANGE(0x1860, 0x1bff) AM_RAM - AM_RANGE(0x1c00, 0x1c3f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) - AM_RANGE(0x1c40, 0x1c5f) AM_RAM AM_BASE(&trackfld_scroll2) + AM_RANGE(0x1c00, 0x1c3f) AM_RAM AM_BASE_SIZE_MEMBER(trackfld_state, spriteram, spriteram_size) + AM_RANGE(0x1c40, 0x1c5f) AM_RAM AM_BASE_MEMBER(trackfld_state, scroll2) AM_RANGE(0x1c60, 0x1fff) AM_RAM AM_RANGE(0x2800, 0x2bff) AM_RAM AM_RANGE(0x2c00, 0x2fff) AM_RAM AM_BASE_SIZE_GENERIC(nvram) - AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM) AM_WRITE(trackfld_videoram_w) AM_BASE_GENERIC(videoram) - AM_RANGE(0x3800, 0x3fff) AM_READ(SMH_RAM) AM_WRITE(trackfld_colorram_w) AM_BASE_GENERIC(colorram) + AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM) AM_WRITE(trackfld_videoram_w) AM_BASE_MEMBER(trackfld_state, videoram) + AM_RANGE(0x3800, 0x3fff) AM_READ(SMH_RAM) AM_WRITE(trackfld_colorram_w) AM_BASE_MEMBER(trackfld_state, colorram) AM_RANGE(0xc000, 0xc000) AM_WRITE(questions_bank_w) - AM_RANGE(0x6000, 0xdfff) AM_READ(SMH_BANK(1)) + AM_RANGE(0x6000, 0xdfff) AM_ROMBANK(1) AM_RANGE(0xe000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -596,55 +597,55 @@ static INPUT_PORTS_START( reaktor ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x01, "Pricing" ) - PORT_DIPSETTING( 0x01, "10p / 25c per play" ) - PORT_DIPSETTING( 0x00, "20p / 50c per play" ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Coinage Type" ) - PORT_DIPSETTING( 0x10, "English (10p / 20p)" ) - PORT_DIPSETTING( 0x00, "American (25c / 50c)" ) - PORT_DIPNAME( 0x60, 0x20, DEF_STR( Lives ) ) - PORT_DIPSETTING( 0x60, "2" ) - PORT_DIPSETTING( 0x40, "3" ) - PORT_DIPSETTING( 0x20, "4" ) - PORT_DIPSETTING( 0x00, "5" ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Bonus_Life ) ) - PORT_DIPSETTING( 0x80, "20000" ) - PORT_DIPSETTING( 0x00, "30000" ) + PORT_DIPNAME( 0x01, 0x01, "Pricing" ) + PORT_DIPSETTING( 0x01, "10p / 25c per play" ) + PORT_DIPSETTING( 0x00, "20p / 50c per play" ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, "Coinage Type" ) + PORT_DIPSETTING( 0x10, "English (10p / 20p)" ) + PORT_DIPSETTING( 0x00, "American (25c / 50c)" ) + PORT_DIPNAME( 0x60, 0x20, DEF_STR( Lives ) ) + PORT_DIPSETTING( 0x60, "2" ) + PORT_DIPSETTING( 0x40, "3" ) + PORT_DIPSETTING( 0x20, "4" ) + PORT_DIPSETTING( 0x00, "5" ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Bonus_Life ) ) + PORT_DIPSETTING( 0x80, "20000" ) + PORT_DIPSETTING( 0x00, "30000" ) PORT_START("DSW2") - PORT_DIPNAME( 0x01, 0x01, "Game Orientation" ) - PORT_DIPSETTING( 0x01, "For Vertical Monitor" ) - PORT_DIPSETTING( 0x00, "For Horizontal Monitor" ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, "Wipe Highscores" ) // it doesn't have NVRAM does it? - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x01, 0x01, "Game Orientation" ) + PORT_DIPSETTING( 0x01, "For Vertical Monitor" ) + PORT_DIPSETTING( 0x00, "For Horizontal Monitor" ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, "Wipe Highscores" ) // it doesn't have NVRAM does it? + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END static const gfx_layout charlayout = @@ -677,9 +678,10 @@ static GFXDECODE_START( trackfld ) GFXDECODE_END -static void adpcm_vck_callback(const device_config *device) +static void adpcm_vck_callback( const device_config *device ) { - hyprolyb_vck_ready = 0x80; + trackfld_state *state = (trackfld_state *)device->machine->driver_data; + state->hyprolyb_vck_ready = 0x80; } const msm5205_interface hyprolyb_msm5205_config = @@ -690,8 +692,65 @@ const msm5205_interface hyprolyb_msm5205_config = +static MACHINE_START( trackfld ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + state->audiocpu = devtag_get_device(machine, "audiocpu"); + state->vlm = devtag_get_device(machine, "vlm"); + + /* video */ + state_save_register_global(machine, state->bg_bank); + state_save_register_global(machine, state->sprite_bank1); + state_save_register_global(machine, state->sprite_bank2); + state_save_register_global(machine, state->old_gfx_bank); + + /* sound */ + state_save_register_global(machine, state->SN76496_latch); + state_save_register_global(machine, state->last_addr); + state_save_register_global(machine, state->last_irq); +} + +static MACHINE_START( hyprolyb ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + MACHINE_START_CALL(trackfld); + + state_save_register_global(machine, state->hyprolyb_adpcm_ready); // only bootlegs + state_save_register_global(machine, state->hyprolyb_adpcm_busy); + state_save_register_global(machine, state->hyprolyb_vck_ready); +} + +static MACHINE_RESET( trackfld ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + state->bg_bank = 0; + state->sprite_bank1 = 0; + state->sprite_bank2 = 0; + state->old_gfx_bank = 0; + state->SN76496_latch = 0; + state->last_addr = 0; + state->last_irq = 0; +} + +static MACHINE_RESET( hyprolyb ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + MACHINE_RESET_CALL(trackfld); + + state->hyprolyb_adpcm_ready = 0; + state->hyprolyb_adpcm_busy = 0; + state->hyprolyb_vck_ready = 0; +} + static MACHINE_DRIVER_START( trackfld ) + /* driver data */ + MDRV_DRIVER_DATA(trackfld_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M6809, MASTER_CLOCK/6/2) /* a guess for now */ MDRV_CPU_PROGRAM_MAP(main_map) @@ -700,6 +759,8 @@ static MACHINE_DRIVER_START( trackfld ) MDRV_CPU_ADD("audiocpu", Z80, SOUND_CLOCK/4) MDRV_CPU_PROGRAM_MAP(sound_map) + MDRV_MACHINE_START(trackfld) + MDRV_MACHINE_RESET(trackfld) MDRV_NVRAM_HANDLER(generic_0fill) /* video hardware */ @@ -741,6 +802,9 @@ static MACHINE_DRIVER_START( hyprolyb ) MDRV_CPU_ADD("adpcm", M6802, SOUND_CLOCK/8) /* unknown clock */ MDRV_CPU_PROGRAM_MAP(hyprolyb_adpcm_map) + MDRV_MACHINE_START(hyprolyb) + MDRV_MACHINE_RESET(hyprolyb) + /* sound hardware */ MDRV_DEVICE_REMOVE("vlm") @@ -1120,7 +1184,7 @@ static DRIVER_INIT( atlantol ) decrypt = konami1_decode(machine, "maincpu"); /* not encrypted opcodes */ - for (A = 0;A < 0x6000;A++) + for (A = 0; A < 0x6000; A++) decrypt[A] = rom[A]; memory_set_decrypted_region(space, 0x0000, 0xffff, decrypt); @@ -1166,25 +1230,25 @@ static DRIVER_INIT( wizzquiz ) int i; /* decrypt program rom */ - for( i = 0; i < 0x2000; i++ ) + for (i = 0; i < 0x2000; i++) ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7); ROM = memory_region(machine, "user1"); /* decrypt questions roms */ - for( i = 0; i < 0x40000; i++ ) + for (i = 0; i < 0x40000; i++) ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7); memory_configure_bank(machine, 1, 0, 8, ROM, 0x8000); } -GAME( 1983, trackfld, 0, trackfld, trackfld, trackfld, ROT0, "Konami", "Track & Field", 0 ) -GAME( 1983, trackfldc,trackfld, trackfld, trackfld, trackfld, ROT0, "Konami (Centuri license)", "Track & Field (Centuri)", 0 ) -GAME( 1983, hyprolym, trackfld, trackfld, trackfld, trackfld, ROT0, "Konami", "Hyper Olympic", 0 ) -GAME( 1983, hyprolymb,trackfld, hyprolyb, trackfld, trackfld, ROT0, "bootleg", "Hyper Olympic (bootleg)", GAME_IMPERFECT_SOUND ) -GAME( 1996, atlantol, trackfld, hyprolyb, atlantol, atlantol, ROT0, "bootleg", "Atlant Olimpic", 0 ) -GAME( 1988, mastkin, 0, mastkin, mastkin, mastkin, ROT0, "Du Tech", "The Masters of Kin", GAME_WRONG_COLORS ) -GAME( 1985, wizzquiz, 0, wizzquiz, wizzquiz, wizzquiz, ROT0, "Konami", "Wizz Quiz (Konami version)", 0 ) -GAME( 1985, wizzquiza,wizzquiz, wizzquiz, wizzquiz, wizzquiz, ROT0, "Zilec - Zenitone", "Wizz Quiz (version 4)", 0 ) -GAME( 1987, reaktor, 0, reaktor, reaktor, 0, ROT90, "Zilec", "Reaktor (Track & Field conversion)", 0 ) +GAME( 1983, trackfld, 0, trackfld, trackfld, trackfld, ROT0, "Konami", "Track & Field", GAME_SUPPORTS_SAVE ) +GAME( 1983, trackfldc, trackfld, trackfld, trackfld, trackfld, ROT0, "Konami (Centuri license)", "Track & Field (Centuri)", GAME_SUPPORTS_SAVE ) +GAME( 1983, hyprolym, trackfld, trackfld, trackfld, trackfld, ROT0, "Konami", "Hyper Olympic", GAME_SUPPORTS_SAVE ) +GAME( 1983, hyprolymb, trackfld, hyprolyb, trackfld, trackfld, ROT0, "bootleg", "Hyper Olympic (bootleg)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1996, atlantol, trackfld, hyprolyb, atlantol, atlantol, ROT0, "bootleg", "Atlant Olimpic", GAME_SUPPORTS_SAVE ) +GAME( 1988, mastkin, 0, mastkin, mastkin, mastkin, ROT0, "Du Tech", "The Masters of Kin", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) +GAME( 1985, wizzquiz, 0, wizzquiz, wizzquiz, wizzquiz, ROT0, "Konami", "Wizz Quiz (Konami version)", GAME_SUPPORTS_SAVE ) +GAME( 1985, wizzquiza, wizzquiz, wizzquiz, wizzquiz, wizzquiz, ROT0, "Zilec - Zenitone", "Wizz Quiz (version 4)", GAME_SUPPORTS_SAVE ) +GAME( 1987, reaktor, 0, reaktor, reaktor, 0, ROT90, "Zilec", "Reaktor (Track & Field conversion)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/yiear.c b/src/mame/drivers/yiear.c index 350dca48faa..a412b8c38e9 100644 --- a/src/mame/drivers/yiear.c +++ b/src/mame/drivers/yiear.c @@ -48,39 +48,35 @@ The 6809 NMI is used for sound timing. ***************************************************************************/ #include "driver.h" -#include "trackfld.h" #include "cpu/m6809/m6809.h" #include "sound/sn76496.h" #include "sound/vlm5030.h" -#include "konamipt.h" - -extern int yiear_nmi_enable; - -extern WRITE8_HANDLER( yiear_videoram_w ); -extern WRITE8_HANDLER( yiear_control_w ); - -extern PALETTE_INIT( yiear ); -extern VIDEO_START( yiear ); -extern VIDEO_UPDATE( yiear ); +#include "includes/konamipt.h" +#include "includes/trackfld.h" static READ8_DEVICE_HANDLER( yiear_speech_r ) { - if (vlm5030_bsy(device)) return 1; - else return 0; + if (vlm5030_bsy(device)) + return 1; + else + return 0; } static WRITE8_DEVICE_HANDLER( yiear_VLM5030_control_w ) { /* bit 0 is latch direction */ - vlm5030_st( device, ( data >> 1 ) & 1 ); - vlm5030_rst( device, ( data >> 2 ) & 1 ); + vlm5030_st(device, (data >> 1) & 1); + vlm5030_rst(device, (data >> 2) & 1); } static INTERRUPT_GEN( yiear_nmi_interrupt ) { + trackfld_state *state = (trackfld_state *)device->machine->driver_data; + /* can't use nmi_line_pulse() because interrupt_enable_w() effects it */ - if (yiear_nmi_enable) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); + if (state->yiear_nmi_enable) + cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); } @@ -98,9 +94,9 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x4e02, 0x4e02) AM_READ_PORT("P2") AM_RANGE(0x4e03, 0x4e03) AM_READ_PORT("DSW3") AM_RANGE(0x4f00, 0x4f00) AM_WRITE(watchdog_reset_w) - AM_RANGE(0x5000, 0x502f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) - AM_RANGE(0x5400, 0x542f) AM_RAM AM_BASE_GENERIC(spriteram2) - AM_RANGE(0x5800, 0x5fff) AM_WRITE(yiear_videoram_w) AM_BASE_GENERIC(videoram) + AM_RANGE(0x5000, 0x502f) AM_RAM AM_BASE_SIZE_MEMBER(trackfld_state, spriteram, spriteram_size) + AM_RANGE(0x5400, 0x542f) AM_RAM AM_BASE_MEMBER(trackfld_state, spriteram2) + AM_RANGE(0x5800, 0x5fff) AM_WRITE(yiear_videoram_w) AM_BASE_MEMBER(trackfld_state, videoram) AM_RANGE(0x5000, 0x5fff) AM_RAM AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -193,14 +189,45 @@ GFXDECODE_END +static MACHINE_START( yiear ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + state->audiocpu = NULL; + state->vlm = devtag_get_device(machine, "vlm"); + + state_save_register_global(machine, state->yiear_nmi_enable); + + /* sound */ + state_save_register_global(machine, state->SN76496_latch); + state_save_register_global(machine, state->last_addr); + state_save_register_global(machine, state->last_irq); +} + +static MACHINE_RESET( yiear ) +{ + trackfld_state *state = (trackfld_state *)machine->driver_data; + + state->yiear_nmi_enable = 0; + state->SN76496_latch = 0; + state->last_addr = 0; + state->last_irq = 0; +} + static MACHINE_DRIVER_START( yiear ) + /* driver data */ + MDRV_DRIVER_DATA(trackfld_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M6809,XTAL_18_432MHz/16) /* verified on pcb */ MDRV_CPU_PROGRAM_MAP(main_map) MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) MDRV_CPU_PERIODIC_INT(yiear_nmi_interrupt,500) /* music tempo (correct frequency unknown) */ + MDRV_MACHINE_START(yiear) + MDRV_MACHINE_RESET(yiear) + /* video hardware */ MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_REFRESH_RATE(60.58) /* verified on pcb */ @@ -279,5 +306,5 @@ ROM_END -GAME( 1985, yiear, 0, yiear, yiear, 0, ROT0, "Konami", "Yie Ar Kung-Fu (set 1)", 0 ) -GAME( 1985, yiear2, yiear, yiear, yiear, 0, ROT0, "Konami", "Yie Ar Kung-Fu (set 2)", 0 ) +GAME( 1985, yiear, 0, yiear, yiear, 0, ROT0, "Konami", "Yie Ar Kung-Fu (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1985, yiear2, yiear, yiear, yiear, 0, ROT0, "Konami", "Yie Ar Kung-Fu (set 2)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/ddrible.h b/src/mame/includes/ddrible.h new file mode 100644 index 00000000000..f4ea217997a --- /dev/null +++ b/src/mame/includes/ddrible.h @@ -0,0 +1,42 @@ +/*************************************************************************** + + Double Dribble + +***************************************************************************/ + +typedef struct _ddrible_state ddrible_state; +struct _ddrible_state +{ + /* memory pointers */ + UINT8 * sharedram; + UINT8 * snd_sharedram; + UINT8 * spriteram_1; + UINT8 * spriteram_2; + UINT8 * bg_videoram; + UINT8 * fg_videoram; + UINT8 * paletteram; + + /* video-related */ + tilemap *fg_tilemap,*bg_tilemap; + int vregs[2][5]; + int charbank[2]; + + /* misc */ + int int_enable_0, int_enable_1; + + /* devices */ + const device_config *filter1; + const device_config *filter2; + const device_config *filter3; +}; + +/*----------- defined in video/ddrible.c -----------*/ + +WRITE8_HANDLER( ddrible_fg_videoram_w ); +WRITE8_HANDLER( ddrible_bg_videoram_w ); +WRITE8_HANDLER( K005885_0_w ); +WRITE8_HANDLER( K005885_1_w ); + +PALETTE_INIT( ddrible ); +VIDEO_START( ddrible ); +VIDEO_UPDATE( ddrible ); diff --git a/src/mame/includes/gaelco.h b/src/mame/includes/gaelco.h new file mode 100644 index 00000000000..3d9ffc59487 --- /dev/null +++ b/src/mame/includes/gaelco.h @@ -0,0 +1,34 @@ +/*************************************************************************** + + Gaelco game hardware from 1991-1996 + +***************************************************************************/ + +typedef struct _gaelco_state gaelco_state; +struct _gaelco_state +{ + /* memory pointers */ + UINT16 * videoram; + UINT16 * spriteram; + UINT16 * vregs; + UINT16 * screen; +// UINT16 * paletteram; // currently this uses generic palette handling + + /* video-related */ + tilemap *tilemap[2]; + + /* devices */ + const device_config *audiocpu; +}; + + + +/*----------- defined in video/gaelco.c -----------*/ + +WRITE16_HANDLER( gaelco_vram_w ); + +VIDEO_START( bigkarnk ); +VIDEO_START( maniacsq ); + +VIDEO_UPDATE( bigkarnk ); +VIDEO_UPDATE( maniacsq ); diff --git a/src/mame/includes/galivan.h b/src/mame/includes/galivan.h new file mode 100644 index 00000000000..02ec2a45cd1 --- /dev/null +++ b/src/mame/includes/galivan.h @@ -0,0 +1,43 @@ +/*************************************************************************** + + Galivan - Cosmo Police + +***************************************************************************/ + +typedef struct _galivan_state galivan_state; +struct _galivan_state +{ + /* memory pointers */ + UINT8 * videoram; + UINT8 * colorram; + UINT8 * spriteram; + size_t videoram_size; + size_t spriteram_size; + + /* video-related */ + tilemap *bg_tilemap, *tx_tilemap; + UINT8 scrollx[2], scrolly[2]; + UINT8 flipscreen; + UINT8 write_layers, layers; + UINT8 ninjemak_dispdisable; +}; + + + +/*----------- defined in video/galivan.c -----------*/ + +WRITE8_HANDLER( galivan_scrollx_w ); +WRITE8_HANDLER( galivan_scrolly_w ); +WRITE8_HANDLER( galivan_videoram_w ); +WRITE8_HANDLER( galivan_colorram_w ); +WRITE8_HANDLER( galivan_gfxbank_w ); +WRITE8_HANDLER( ninjemak_scrollx_w ); +WRITE8_HANDLER( ninjemak_scrolly_w ); +WRITE8_HANDLER( ninjemak_gfxbank_w ); + +PALETTE_INIT( galivan ); + +VIDEO_START( galivan ); +VIDEO_START( ninjemak ); +VIDEO_UPDATE( galivan ); +VIDEO_UPDATE( ninjemak ); diff --git a/src/mame/includes/gberet.h b/src/mame/includes/gberet.h new file mode 100644 index 00000000000..76a486a5a16 --- /dev/null +++ b/src/mame/includes/gberet.h @@ -0,0 +1,38 @@ +/*************************************************************************** + + Green Beret + +***************************************************************************/ + +typedef struct _gberet_state gberet_state; +struct _gberet_state +{ + /* memory pointers */ + UINT8 * videoram; + UINT8 * colorram; + UINT8 * spriteram; + UINT8 * spriteram2; + UINT8 * scrollram; + size_t spriteram_size; + + /* video-related */ + tilemap *bg_tilemap; + UINT8 spritebank; + + /* misc */ + UINT8 nmi_enable, irq_enable; +}; + + +/*----------- defined in video/gberet.c -----------*/ + +WRITE8_HANDLER( gberet_videoram_w ); +WRITE8_HANDLER( gberet_colorram_w ); +WRITE8_HANDLER( gberet_scroll_w ); +WRITE8_HANDLER( gberetb_scroll_w ); +WRITE8_HANDLER( gberet_sprite_bank_w ); + +PALETTE_INIT( gberet ); +VIDEO_START( gberet ); +VIDEO_UPDATE( gberet ); +VIDEO_UPDATE( gberetb ); diff --git a/src/mame/includes/jailbrek.h b/src/mame/includes/jailbrek.h new file mode 100644 index 00000000000..e7c9119bfce --- /dev/null +++ b/src/mame/includes/jailbrek.h @@ -0,0 +1,36 @@ +/*************************************************************************** + + Jailbreak + +***************************************************************************/ + +#define MASTER_CLOCK XTAL_18_432MHz +#define VOICE_CLOCK XTAL_3_579545MHz + +typedef struct _jailbrek_state jailbrek_state; +struct _jailbrek_state +{ + /* memory pointers */ + UINT8 * videoram; + UINT8 * colorram; + UINT8 * spriteram; + UINT8 * scroll_x; + UINT8 * scroll_dir; + size_t spriteram_size; + + /* video-related */ + tilemap *bg_tilemap; + + /* misc */ + UINT8 irq_enable, nmi_enable; +}; + + +/*----------- defined in video/jailbrek.c -----------*/ + +WRITE8_HANDLER( jailbrek_videoram_w ); +WRITE8_HANDLER( jailbrek_colorram_w ); + +PALETTE_INIT( jailbrek ); +VIDEO_START( jailbrek ); +VIDEO_UPDATE( jailbrek ); diff --git a/src/mame/includes/trackfld.h b/src/mame/includes/trackfld.h index 1e9acae9276..6280fc4d1ff 100644 --- a/src/mame/includes/trackfld.h +++ b/src/mame/includes/trackfld.h @@ -1,11 +1,51 @@ /*************************************************************************** - Track'n'Field + Track'n'Field - Hyper Sports - Yie Ar Kung-Fu - Super Basketball + (these drivers share sound hardware handling) ***************************************************************************/ #include "sound/msm5205.h" + +typedef struct _trackfld_state trackfld_state; +struct _trackfld_state +{ + /* memory pointers */ + UINT8 * videoram; // trackfld, hyperspt, yiear, sbasketb + UINT8 * colorram; // trackfld, hyperspt, sbasketb + UINT8 * scroll; // trackfld, hyperspt + UINT8 * scroll2; // trackfld + UINT8 * spriteram; + UINT8 * spriteram2; +// UINT8 * nvram; // currently this uses generic nvram handling (trackfld & hyperspt) + size_t spriteram_size; + UINT8 * palettebank; // sbasketb + UINT8 * spriteram_select; // sbasketb + + /* video-related */ + tilemap *bg_tilemap; + int bg_bank, sprite_bank1, sprite_bank2; // trackfld + int old_gfx_bank; // needed by atlantol + + + /* sound-related */ + int SN76496_latch; + int last_addr; + int last_irq; + + /* game specific */ + UINT8 hyprolyb_adpcm_ready; // only bootlegs + UINT8 hyprolyb_adpcm_busy; + UINT8 hyprolyb_vck_ready; + int yiear_nmi_enable; // yiear + + /* devices */ + const device_config *audiocpu; + const device_config *vlm; +}; + + /*----------- defined in audio/trackfld.c -----------*/ WRITE8_HANDLER( konami_sh_irqtrigger_w ); @@ -17,15 +57,16 @@ WRITE8_DEVICE_HANDLER( hyperspt_sound_w ); WRITE8_HANDLER( konami_SN76496_latch_w ); WRITE8_DEVICE_HANDLER( konami_SN76496_w ); + /*----------- defined in drivers/trackfld.c -----------*/ +/*-------------- (needed by hypersptb) ----------------*/ + extern const msm5205_interface hyprolyb_msm5205_config; extern WRITE8_HANDLER( hyprolyb_adpcm_w ); ADDRESS_MAP_EXTERN( hyprolyb_adpcm_map, 8 ); -/*----------- defined in video/trackfld.c -----------*/ -extern UINT8 *trackfld_scroll; -extern UINT8 *trackfld_scroll2; +/*----------- defined in video/trackfld.c -----------*/ WRITE8_HANDLER( trackfld_videoram_w ); WRITE8_HANDLER( trackfld_colorram_w ); @@ -35,3 +76,36 @@ WRITE8_HANDLER( atlantol_gfxbank_w ); PALETTE_INIT( trackfld ); VIDEO_START( trackfld ); VIDEO_UPDATE( trackfld ); + + +/*----------- defined in video/hyperspt.c -----------*/ + +WRITE8_HANDLER( hyperspt_videoram_w ); +WRITE8_HANDLER( hyperspt_colorram_w ); +WRITE8_HANDLER( hyperspt_flipscreen_w ); + +PALETTE_INIT( hyperspt ); +VIDEO_START( hyperspt ); +VIDEO_UPDATE( hyperspt ); +VIDEO_START( roadf ); + + +/*----------- defined in video/sbasketb.c -----------*/ + +WRITE8_HANDLER( sbasketb_videoram_w ); +WRITE8_HANDLER( sbasketb_colorram_w ); +WRITE8_HANDLER( sbasketb_flipscreen_w ); + +PALETTE_INIT( sbasketb ); +VIDEO_START( sbasketb ); +VIDEO_UPDATE( sbasketb ); + + +/*----------- defined in video/yiear.c -----------*/ + +WRITE8_HANDLER( yiear_videoram_w ); +WRITE8_HANDLER( yiear_control_w ); + +PALETTE_INIT( yiear ); +VIDEO_START( yiear ); +VIDEO_UPDATE( yiear ); diff --git a/src/mame/video/ddrible.c b/src/mame/video/ddrible.c index d177bd2b9d7..6ca44d20e10 100644 --- a/src/mame/video/ddrible.c +++ b/src/mame/video/ddrible.c @@ -7,19 +7,7 @@ ***************************************************************************/ #include "driver.h" - -extern int ddrible_int_enable_0; -extern int ddrible_int_enable_1; - -UINT8 *ddrible_fg_videoram; -UINT8 *ddrible_bg_videoram; -UINT8 *ddrible_spriteram_1; -UINT8 *ddrible_spriteram_2; - -static int ddribble_vregs[2][5]; -static int charbank[2]; - -static tilemap *fg_tilemap,*bg_tilemap; +#include "includes/ddrible.h" PALETTE_INIT( ddrible ) @@ -41,16 +29,16 @@ PALETTE_INIT( ddrible ) } -static void set_pens(running_machine *machine) +static void set_pens( running_machine *machine ) { + ddrible_state *state = (ddrible_state *)machine->driver_data; int i; for (i = 0x00; i < 0x80; i += 2) { - UINT16 data = machine->generic.paletteram.u8[i | 1] | (machine->generic.paletteram.u8[i] << 8); + UINT16 data = state->paletteram[i | 1] | (state->paletteram[i] << 8); rgb_t color = MAKE_RGB(pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); - colortable_palette_set_color(machine->colortable, i >> 1, color); } } @@ -58,36 +46,40 @@ static void set_pens(running_machine *machine) WRITE8_HANDLER( K005885_0_w ) { - switch (offset){ + ddrible_state *state = (ddrible_state *)space->machine->driver_data; + switch (offset) + { case 0x03: /* char bank selection for set 1 */ - if ((data & 0x03) != charbank[0]) + if ((data & 0x03) != state->charbank[0]) { - charbank[0] = data & 0x03; - tilemap_mark_all_tiles_dirty( fg_tilemap ); + state->charbank[0] = data & 0x03; + tilemap_mark_all_tiles_dirty(state->fg_tilemap); } break; case 0x04: /* IRQ control, flipscreen */ - ddrible_int_enable_0 = data & 0x02; + state->int_enable_0 = data & 0x02; break; } - ddribble_vregs[0][offset] = data; + state->vregs[0][offset] = data; } WRITE8_HANDLER( K005885_1_w ) { - switch (offset){ + ddrible_state *state = (ddrible_state *)space->machine->driver_data; + switch (offset) + { case 0x03: /* char bank selection for set 2 */ - if ((data & 0x03) != charbank[1]) + if ((data & 0x03) != state->charbank[1]) { - charbank[1] = data & 0x03; - tilemap_mark_all_tiles_dirty( bg_tilemap ); + state->charbank[1] = data & 0x03; + tilemap_mark_all_tiles_dirty(state->bg_tilemap); } break; case 0x04: /* IRQ control, flipscreen */ - ddrible_int_enable_1 = data & 0x02; + state->int_enable_1 = data & 0x02; break; } - ddribble_vregs[1][offset] = data; + state->vregs[1][offset] = data; } /*************************************************************************** @@ -104,9 +96,9 @@ static TILEMAP_MAPPER( tilemap_scan ) static TILE_GET_INFO( get_fg_tile_info ) { - UINT8 attr = ddrible_fg_videoram[tile_index]; - int num = ddrible_fg_videoram[tile_index + 0x400] + - ((attr & 0xc0) << 2) + ((attr & 0x20) << 5) + ((charbank[0] & 2) << 10); + ddrible_state *state = (ddrible_state *)machine->driver_data; + UINT8 attr = state->fg_videoram[tile_index]; + int num = state->fg_videoram[tile_index + 0x400] + ((attr & 0xc0) << 2) + ((attr & 0x20) << 5) + ((state->charbank[0] & 2) << 10); SET_TILE_INFO( 0, num, @@ -116,9 +108,9 @@ static TILE_GET_INFO( get_fg_tile_info ) static TILE_GET_INFO( get_bg_tile_info ) { - UINT8 attr = ddrible_bg_videoram[tile_index]; - int num = ddrible_bg_videoram[tile_index + 0x400] + - ((attr & 0xc0) << 2) + ((attr & 0x20) << 5) + (charbank[1] << 11); + ddrible_state *state = (ddrible_state *)machine->driver_data; + UINT8 attr = state->bg_videoram[tile_index]; + int num = state->bg_videoram[tile_index + 0x400] + ((attr & 0xc0) << 2) + ((attr & 0x20) << 5) + (state->charbank[1] << 11); SET_TILE_INFO( 1, num, @@ -134,10 +126,12 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( ddrible ) { - fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan,8,8,64,32); - bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan, 8,8,64,32); + ddrible_state *state = (ddrible_state *)machine->driver_data; - tilemap_set_transparent_pen(fg_tilemap,0); + state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan, 8, 8, 64, 32); + state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan, 8, 8, 64, 32); + + tilemap_set_transparent_pen(state->fg_tilemap, 0); } /*************************************************************************** @@ -148,14 +142,16 @@ VIDEO_START( ddrible ) WRITE8_HANDLER( ddrible_fg_videoram_w ) { - ddrible_fg_videoram[offset] = data; - tilemap_mark_tile_dirty(fg_tilemap,offset & 0xbff); + ddrible_state *state = (ddrible_state *)space->machine->driver_data; + state->fg_videoram[offset] = data; + tilemap_mark_tile_dirty(state->fg_tilemap, offset & 0xbff); } WRITE8_HANDLER( ddrible_bg_videoram_w ) { - ddrible_bg_videoram[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap,offset & 0xbff); + ddrible_state *state = (ddrible_state *)space->machine->driver_data; + state->bg_videoram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset & 0xbff); } /*************************************************************************** @@ -180,12 +176,12 @@ byte #4: attributes ***************************************************************************/ -static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* source, int lenght, int gfxset, int flipscreen ) +static void draw_sprites( running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* source, int lenght, int gfxset, int flipscreen ) { gfx_element *gfx = machine->gfx[gfxset]; const UINT8 *finish = source + lenght; - while( source < finish ) + while (source < finish) { int number = source[0] | ((source[1] & 0x07) << 8); /* sprite number */ int attr = source[4]; /* attributes */ @@ -194,21 +190,24 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const recta int flipx = attr & 0x20; /* flip x */ int flipy = attr & 0x40; /* flip y */ int color = (source[1] & 0xf0) >> 4; /* color */ - int width,height; + int width, height; - if (flipscreen){ - flipx = !flipx; - flipy = !flipy; - sx = 240 - sx; - sy = 240 - sy; + if (flipscreen) + { + flipx = !flipx; + flipy = !flipy; + sx = 240 - sx; + sy = 240 - sy; - if ((attr & 0x1c) == 0x10){ /* ???. needed for some sprites in flipped mode */ - sx -= 0x10; - sy -= 0x10; - } + if ((attr & 0x1c) == 0x10) + { /* ???. needed for some sprites in flipped mode */ + sx -= 0x10; + sy -= 0x10; + } } - switch (attr & 0x1c){ + switch (attr & 0x1c) + { case 0x10: /* 32x32 */ width = height = 2; number &= (~3); break; case 0x08: /* 16x32 */ @@ -223,12 +222,14 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const recta { static const int x_offset[2] = { 0x00, 0x01 }; static const int y_offset[2] = { 0x00, 0x02 }; - int x,y, ex, ey; + int x, y, ex, ey; - for( y=0; y < height; y++ ){ - for( x=0; x < width; x++ ){ - ex = flipx ? (width-1-x) : x; - ey = flipy ? (height-1-y) : y; + for (y = 0; y < height; y++) + { + for (x = 0; x < width; x++) + { + ex = flipx ? (width - 1 - x) : x; + ey = flipy ? (height - 1 - y) : y; drawgfx_transpen(bitmap,cliprect, gfx, @@ -251,20 +252,21 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const recta VIDEO_UPDATE( ddrible ) { + ddrible_state *state = (ddrible_state *)screen->machine->driver_data; set_pens(screen->machine); - tilemap_set_flip(fg_tilemap, (ddribble_vregs[0][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); - tilemap_set_flip(bg_tilemap, (ddribble_vregs[1][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); + tilemap_set_flip(state->fg_tilemap, (state->vregs[0][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); + tilemap_set_flip(state->bg_tilemap, (state->vregs[1][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); /* set scroll registers */ - tilemap_set_scrollx(fg_tilemap,0,ddribble_vregs[0][1] | ((ddribble_vregs[0][2] & 0x01) << 8)); - tilemap_set_scrollx(bg_tilemap,0,ddribble_vregs[1][1] | ((ddribble_vregs[1][2] & 0x01) << 8)); - tilemap_set_scrolly(fg_tilemap,0,ddribble_vregs[0][0]); - tilemap_set_scrolly(bg_tilemap,0,ddribble_vregs[1][0]); + tilemap_set_scrollx(state->fg_tilemap, 0, state->vregs[0][1] | ((state->vregs[0][2] & 0x01) << 8)); + tilemap_set_scrollx(state->bg_tilemap, 0, state->vregs[1][1] | ((state->vregs[1][2] & 0x01) << 8)); + tilemap_set_scrolly(state->fg_tilemap, 0, state->vregs[0][0]); + tilemap_set_scrolly(state->bg_tilemap, 0, state->vregs[1][0]); - tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); - draw_sprites(screen->machine,bitmap,cliprect,ddrible_spriteram_1,0x07d,2,ddribble_vregs[0][4] & 0x08); - draw_sprites(screen->machine,bitmap,cliprect,ddrible_spriteram_2,0x140,3,ddribble_vregs[1][4] & 0x08); - tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); + draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_1, 0x07d, 2, state->vregs[0][4] & 0x08); + draw_sprites(screen->machine, bitmap, cliprect, state->spriteram_2, 0x140, 3, state->vregs[1][4] & 0x08); + tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0); return 0; } diff --git a/src/mame/video/gaelco.c b/src/mame/video/gaelco.c index a9099b585bd..30e677078d7 100644 --- a/src/mame/video/gaelco.c +++ b/src/mame/video/gaelco.c @@ -7,14 +7,7 @@ ***************************************************************************/ #include "driver.h" - -UINT16 *gaelco_vregs; -UINT16 *gaelco_videoram; -UINT16 *gaelco_spriteram; - -tilemap *gaelco_tilemap[2]; -#define pant gaelco_tilemap - +#include "gaelco.h" /*************************************************************************** @@ -40,8 +33,9 @@ tilemap *gaelco_tilemap[2]; static TILE_GET_INFO( get_tile_info_gaelco_screen0 ) { - int data = gaelco_videoram[tile_index << 1]; - int data2 = gaelco_videoram[(tile_index << 1) + 1]; + gaelco_state *state = (gaelco_state *)machine->driver_data; + int data = state->videoram[tile_index << 1]; + int data2 = state->videoram[(tile_index << 1) + 1]; int code = ((data & 0xfffc) >> 2); tileinfo->category = (data2 >> 6) & 0x03; @@ -52,8 +46,9 @@ static TILE_GET_INFO( get_tile_info_gaelco_screen0 ) static TILE_GET_INFO( get_tile_info_gaelco_screen1 ) { - int data = gaelco_videoram[(0x1000/2) + (tile_index << 1)]; - int data2 = gaelco_videoram[(0x1000/2) + (tile_index << 1) + 1]; + gaelco_state *state = (gaelco_state *)machine->driver_data; + int data = state->videoram[(0x1000 / 2) + (tile_index << 1)]; + int data2 = state->videoram[(0x1000 / 2) + (tile_index << 1) + 1]; int code = ((data & 0xfffc) >> 2); tileinfo->category = (data2 >> 6) & 0x03; @@ -69,8 +64,9 @@ static TILE_GET_INFO( get_tile_info_gaelco_screen1 ) WRITE16_HANDLER( gaelco_vram_w ) { - COMBINE_DATA(&gaelco_videoram[offset]); - tilemap_mark_tile_dirty(pant[offset >> 11],((offset << 1) & 0x0fff) >> 2); + gaelco_state *state = (gaelco_state *)space->machine->driver_data; + COMBINE_DATA(&state->videoram[offset]); + tilemap_mark_tile_dirty(state->tilemap[offset >> 11], ((offset << 1) & 0x0fff) >> 2); } /*************************************************************************** @@ -81,20 +77,22 @@ WRITE16_HANDLER( gaelco_vram_w ) VIDEO_START( bigkarnk ) { - pant[0] = tilemap_create(machine, get_tile_info_gaelco_screen0,tilemap_scan_rows,16,16,32,32); - pant[1] = tilemap_create(machine, get_tile_info_gaelco_screen1,tilemap_scan_rows,16,16,32,32); + gaelco_state *state = (gaelco_state *)machine->driver_data; + state->tilemap[0] = tilemap_create(machine, get_tile_info_gaelco_screen0, tilemap_scan_rows, 16, 16, 32, 32); + state->tilemap[1] = tilemap_create(machine, get_tile_info_gaelco_screen1, tilemap_scan_rows, 16, 16, 32, 32); - tilemap_set_transmask(pant[0],0,0xff01,0x00ff); /* pens 1-7 opaque, pens 0, 8-15 transparent */ - tilemap_set_transmask(pant[1],0,0xff01,0x00ff); /* pens 1-7 opaque, pens 0, 8-15 transparent */ + tilemap_set_transmask(state->tilemap[0], 0, 0xff01, 0x00ff); /* pens 1-7 opaque, pens 0, 8-15 transparent */ + tilemap_set_transmask(state->tilemap[1], 0, 0xff01, 0x00ff); /* pens 1-7 opaque, pens 0, 8-15 transparent */ } VIDEO_START( maniacsq ) { - pant[0] = tilemap_create(machine, get_tile_info_gaelco_screen0,tilemap_scan_rows,16,16,32,32); - pant[1] = tilemap_create(machine, get_tile_info_gaelco_screen1,tilemap_scan_rows,16,16,32,32); + gaelco_state *state = (gaelco_state *)machine->driver_data; + state->tilemap[0] = tilemap_create(machine, get_tile_info_gaelco_screen0, tilemap_scan_rows, 16, 16, 32, 32); + state->tilemap[1] = tilemap_create(machine, get_tile_info_gaelco_screen1, tilemap_scan_rows, 16, 16, 32, 32); - tilemap_set_transparent_pen(pant[0],0); - tilemap_set_transparent_pen(pant[1],0); + tilemap_set_transparent_pen(state->tilemap[0], 0); + tilemap_set_transparent_pen(state->tilemap[1], 0); } @@ -123,54 +121,56 @@ VIDEO_START( maniacsq ) 3 | xxxxxxxx xxxxxx-- | sprite code */ -static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) +static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { + gaelco_state *state = (gaelco_state *)machine->driver_data; int i, x, y, ex, ey; const gfx_element *gfx = machine->gfx[0]; static const int x_offset[2] = {0x0,0x2}; static const int y_offset[2] = {0x0,0x1}; - for (i = 0x800 - 4 - 1; i >= 3; i -= 4){ - int sx = gaelco_spriteram[i+2] & 0x01ff; - int sy = (240 - (gaelco_spriteram[i] & 0x00ff)) & 0x00ff; - int number = gaelco_spriteram[i+3]; - int color = (gaelco_spriteram[i+2] & 0x7e00) >> 9; - int attr = (gaelco_spriteram[i] & 0xfe00) >> 9; - int priority = (gaelco_spriteram[i] & 0x3000) >> 12; + for (i = 0x800 - 4 - 1; i >= 3; i -= 4) + { + int sx = state->spriteram[i + 2] & 0x01ff; + int sy = (240 - (state->spriteram[i] & 0x00ff)) & 0x00ff; + int number = state->spriteram[i + 3]; + int color = (state->spriteram[i + 2] & 0x7e00) >> 9; + int attr = (state->spriteram[i] & 0xfe00) >> 9; + int priority = (state->spriteram[i] & 0x3000) >> 12; int xflip = attr & 0x20; int yflip = attr & 0x40; int spr_size, pri_mask; /* palettes 0x38-0x3f are used for high priority sprites in Big Karnak */ - if (color >= 0x38){ + if (color >= 0x38) priority = 4; - } - switch( priority ) + switch (priority) { case 0: pri_mask = 0xff00; break; - case 1: pri_mask = 0xff00|0xf0f0; break; - case 2: pri_mask = 0xff00|0xf0f0|0xcccc; break; - case 3: pri_mask = 0xff00|0xf0f0|0xcccc|0xaaaa; break; + case 1: pri_mask = 0xff00 | 0xf0f0; break; + case 2: pri_mask = 0xff00 | 0xf0f0 | 0xcccc; break; + case 3: pri_mask = 0xff00 | 0xf0f0 | 0xcccc | 0xaaaa; break; default: case 4: pri_mask = 0; break; } - if (attr & 0x04){ + if (attr & 0x04) spr_size = 1; - } - else{ + else + { spr_size = 2; number &= (~3); } - for (y = 0; y < spr_size; y++){ - for (x = 0; x < spr_size; x++){ - - ex = xflip ? (spr_size-1-x) : x; - ey = yflip ? (spr_size-1-y) : y; + for (y = 0; y < spr_size; y++) + { + for (x = 0; x < spr_size; x++) + { + ex = xflip ? (spr_size - 1 - x) : x; + ey = yflip ? (spr_size - 1 - y) : y; pdrawgfx_transpen(bitmap,cliprect,gfx,number + x_offset[ex] + y_offset[ey], color,xflip,yflip, @@ -189,66 +189,70 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta VIDEO_UPDATE( maniacsq ) { + gaelco_state *state = (gaelco_state *)screen->machine->driver_data; + /* set scroll registers */ - tilemap_set_scrolly(pant[0], 0, gaelco_vregs[0]); - tilemap_set_scrollx(pant[0], 0, gaelco_vregs[1]+4); - tilemap_set_scrolly(pant[1], 0, gaelco_vregs[2]); - tilemap_set_scrollx(pant[1], 0, gaelco_vregs[3]); + tilemap_set_scrolly(state->tilemap[0], 0, state->vregs[0]); + tilemap_set_scrollx(state->tilemap[0], 0, state->vregs[1] + 4); + tilemap_set_scrolly(state->tilemap[1], 0, state->vregs[2]); + tilemap_set_scrollx(state->tilemap[1], 0, state->vregs[3]); - bitmap_fill(screen->machine->priority_bitmap,cliprect,0); - bitmap_fill( bitmap, cliprect , 0); + bitmap_fill(screen->machine->priority_bitmap, cliprect, 0); + bitmap_fill(bitmap, cliprect, 0); - tilemap_draw(bitmap,cliprect,pant[1],3,0); - tilemap_draw(bitmap,cliprect,pant[0],3,0); + tilemap_draw(bitmap, cliprect, state->tilemap[1], 3, 0); + tilemap_draw(bitmap, cliprect, state->tilemap[0], 3, 0); - tilemap_draw(bitmap,cliprect,pant[1],2,1); - tilemap_draw(bitmap,cliprect,pant[0],2,1); + tilemap_draw(bitmap, cliprect, state->tilemap[1], 2, 1); + tilemap_draw(bitmap, cliprect, state->tilemap[0], 2, 1); - tilemap_draw(bitmap,cliprect,pant[1],1,2); - tilemap_draw(bitmap,cliprect,pant[0],1,2); + tilemap_draw(bitmap, cliprect, state->tilemap[1], 1, 2); + tilemap_draw(bitmap, cliprect, state->tilemap[0], 1, 2); - tilemap_draw(bitmap,cliprect,pant[1],0,4); - tilemap_draw(bitmap,cliprect,pant[0],0,4); + tilemap_draw(bitmap, cliprect, state->tilemap[1], 0, 4); + tilemap_draw(bitmap, cliprect, state->tilemap[0], 0, 4); - draw_sprites(screen->machine,bitmap,cliprect); + draw_sprites(screen->machine, bitmap, cliprect); return 0; } VIDEO_UPDATE( bigkarnk ) { + gaelco_state *state = (gaelco_state *)screen->machine->driver_data; + /* set scroll registers */ - tilemap_set_scrolly(pant[0], 0, gaelco_vregs[0]); - tilemap_set_scrollx(pant[0], 0, gaelco_vregs[1]+4); - tilemap_set_scrolly(pant[1], 0, gaelco_vregs[2]); - tilemap_set_scrollx(pant[1], 0, gaelco_vregs[3]); + tilemap_set_scrolly(state->tilemap[0], 0, state->vregs[0]); + tilemap_set_scrollx(state->tilemap[0], 0, state->vregs[1] + 4); + tilemap_set_scrolly(state->tilemap[1], 0, state->vregs[2]); + tilemap_set_scrollx(state->tilemap[1], 0, state->vregs[3]); - bitmap_fill(screen->machine->priority_bitmap,cliprect,0); - bitmap_fill( bitmap, cliprect , 0); + bitmap_fill(screen->machine->priority_bitmap, cliprect, 0); + bitmap_fill(bitmap, cliprect, 0); - tilemap_draw(bitmap,cliprect,pant[1],TILEMAP_DRAW_LAYER1 | 3,0); - tilemap_draw(bitmap,cliprect,pant[0],TILEMAP_DRAW_LAYER1 | 3,0); + tilemap_draw(bitmap, cliprect, state->tilemap[1], TILEMAP_DRAW_LAYER1 | 3, 0); + tilemap_draw(bitmap, cliprect, state->tilemap[0], TILEMAP_DRAW_LAYER1 | 3, 0); - tilemap_draw(bitmap,cliprect,pant[1],TILEMAP_DRAW_LAYER0 | 3,1); - tilemap_draw(bitmap,cliprect,pant[0],TILEMAP_DRAW_LAYER0 | 3,1); + tilemap_draw(bitmap, cliprect, state->tilemap[1], TILEMAP_DRAW_LAYER0 | 3, 1); + tilemap_draw(bitmap, cliprect, state->tilemap[0], TILEMAP_DRAW_LAYER0 | 3, 1); - tilemap_draw(bitmap,cliprect,pant[1],TILEMAP_DRAW_LAYER1 | 2,1); - tilemap_draw(bitmap,cliprect,pant[0],TILEMAP_DRAW_LAYER1 | 2,1); + tilemap_draw(bitmap, cliprect, state->tilemap[1], TILEMAP_DRAW_LAYER1 | 2, 1); + tilemap_draw(bitmap, cliprect, state->tilemap[0], TILEMAP_DRAW_LAYER1 | 2, 1); - tilemap_draw(bitmap,cliprect,pant[1],TILEMAP_DRAW_LAYER0 | 2,2); - tilemap_draw(bitmap,cliprect,pant[0],TILEMAP_DRAW_LAYER0 | 2,2); + tilemap_draw(bitmap, cliprect, state->tilemap[1], TILEMAP_DRAW_LAYER0 | 2, 2); + tilemap_draw(bitmap, cliprect, state->tilemap[0], TILEMAP_DRAW_LAYER0 | 2, 2); - tilemap_draw(bitmap,cliprect,pant[1],TILEMAP_DRAW_LAYER1 | 1,2); - tilemap_draw(bitmap,cliprect,pant[0],TILEMAP_DRAW_LAYER1 | 1,2); + tilemap_draw(bitmap, cliprect, state->tilemap[1], TILEMAP_DRAW_LAYER1 | 1, 2); + tilemap_draw(bitmap, cliprect, state->tilemap[0], TILEMAP_DRAW_LAYER1 | 1, 2); - tilemap_draw(bitmap,cliprect,pant[1],TILEMAP_DRAW_LAYER0 | 1,4); - tilemap_draw(bitmap,cliprect,pant[0],TILEMAP_DRAW_LAYER0 | 1,4); + tilemap_draw(bitmap, cliprect, state->tilemap[1], TILEMAP_DRAW_LAYER0 | 1, 4); + tilemap_draw(bitmap, cliprect, state->tilemap[0], TILEMAP_DRAW_LAYER0 | 1, 4); - tilemap_draw(bitmap,cliprect,pant[1],TILEMAP_DRAW_LAYER1 | 0,4); - tilemap_draw(bitmap,cliprect,pant[0],TILEMAP_DRAW_LAYER1 | 0,4); + tilemap_draw(bitmap, cliprect, state->tilemap[1], TILEMAP_DRAW_LAYER1 | 0, 4); + tilemap_draw(bitmap, cliprect, state->tilemap[0], TILEMAP_DRAW_LAYER1 | 0, 4); - tilemap_draw(bitmap,cliprect,pant[1],TILEMAP_DRAW_LAYER0 | 0,8); - tilemap_draw(bitmap,cliprect,pant[0],TILEMAP_DRAW_LAYER0 | 0,8); + tilemap_draw(bitmap, cliprect, state->tilemap[1], TILEMAP_DRAW_LAYER0 | 0, 8); + tilemap_draw(bitmap, cliprect, state->tilemap[0], TILEMAP_DRAW_LAYER0 | 0, 8); - draw_sprites(screen->machine,bitmap,cliprect); + draw_sprites(screen->machine, bitmap, cliprect); return 0; } diff --git a/src/mame/video/galivan.c b/src/mame/video/galivan.c index 72ebbe66fb4..f5d7df1f6ee 100644 --- a/src/mame/video/galivan.c +++ b/src/mame/video/galivan.c @@ -30,8 +30,7 @@ background: 0x4000 bytes of ROM: 76543210 tile code low bits ***************************************************************************/ #include "driver.h" - -static UINT8 scrollx[2], scrolly[2]; +#include "includes/galivan.h" /* Layers has only bits 5-6 active. 6 selects background off/on @@ -39,11 +38,6 @@ static UINT8 scrollx[2], scrolly[2]; not for scores or push start nor game) */ -static UINT8 flipscreen; -static UINT8 write_layers, layers; -static UINT8 ninjemak_dispdisable; - -static tilemap *bg_tilemap, *tx_tilemap; /* Notes: write_layers and layers are used in galivan/dangar but not ninjemak @@ -139,8 +133,9 @@ static TILE_GET_INFO( get_bg_tile_info ) static TILE_GET_INFO( get_tx_tile_info ) { - int attr = machine->generic.colorram.u8[tile_index]; - int code = machine->generic.videoram.u8[tile_index] | ((attr & 0x01) << 8); + galivan_state *state = (galivan_state *)machine->driver_data; + int attr = state->colorram[tile_index]; + int code = state->videoram[tile_index] | ((attr & 0x01) << 8); SET_TILE_INFO( 0, code, @@ -163,8 +158,9 @@ static TILE_GET_INFO( ninjemak_get_bg_tile_info ) static TILE_GET_INFO( ninjemak_get_tx_tile_info ) { - int attr = machine->generic.colorram.u8[tile_index]; - int code = machine->generic.videoram.u8[tile_index] | ((attr & 0x03) << 8); + galivan_state *state = (galivan_state *)machine->driver_data; + int attr = state->colorram[tile_index]; + int code = state->videoram[tile_index] | ((attr & 0x03) << 8); SET_TILE_INFO( 0, code, @@ -182,39 +178,22 @@ static TILE_GET_INFO( ninjemak_get_tx_tile_info ) VIDEO_START( galivan ) { - /* configure ROM banking */ - UINT8 *rombase = memory_region(machine, "maincpu"); - memory_configure_bank(machine, 1, 0, 2, &rombase[0x10000], 0x2000); + galivan_state *state = (galivan_state *)machine->driver_data; - bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows, 16,16,128,128); - tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_cols,8,8,32,32); + state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16, 16, 128, 128); + state->tx_tilemap = tilemap_create(machine, get_tx_tile_info, tilemap_scan_cols, 8, 8, 32, 32); - tilemap_set_transparent_pen(tx_tilemap,15); - - /* register for saving */ - state_save_register_global_array(machine, scrollx); - state_save_register_global_array(machine, scrolly); - state_save_register_global(machine, flipscreen); - state_save_register_global(machine, write_layers); - state_save_register_global(machine, layers); + tilemap_set_transparent_pen(state->tx_tilemap, 15); } VIDEO_START( ninjemak ) { - /* configure ROM banking */ - UINT8 *rombase = memory_region(machine, "maincpu"); - memory_configure_bank(machine, 1, 0, 4, &rombase[0x10000], 0x2000); + galivan_state *state = (galivan_state *)machine->driver_data; - bg_tilemap = tilemap_create(machine, ninjemak_get_bg_tile_info,tilemap_scan_cols, 16,16,512,32); - tx_tilemap = tilemap_create(machine, ninjemak_get_tx_tile_info,tilemap_scan_cols,8,8,32,32); + state->bg_tilemap = tilemap_create(machine, ninjemak_get_bg_tile_info, tilemap_scan_cols, 16, 16, 512, 32); + state->tx_tilemap = tilemap_create(machine, ninjemak_get_tx_tile_info, tilemap_scan_cols, 8, 8, 32, 32); - tilemap_set_transparent_pen(tx_tilemap,15); - - /* register for saving */ - state_save_register_global_array(machine, scrollx); - state_save_register_global_array(machine, scrolly); - state_save_register_global(machine, flipscreen); - state_save_register_global(machine, ninjemak_dispdisable); + tilemap_set_transparent_pen(state->tx_tilemap, 15); } @@ -227,66 +206,71 @@ VIDEO_START( ninjemak ) WRITE8_HANDLER( galivan_videoram_w ) { - space->machine->generic.videoram.u8[offset] = data; - tilemap_mark_tile_dirty(tx_tilemap,offset); + galivan_state *state = (galivan_state *)space->machine->driver_data; + state->videoram[offset] = data; + tilemap_mark_tile_dirty(state->tx_tilemap, offset); } WRITE8_HANDLER( galivan_colorram_w ) { - space->machine->generic.colorram.u8[offset] = data; - tilemap_mark_tile_dirty(tx_tilemap,offset); + galivan_state *state = (galivan_state *)space->machine->driver_data; + state->colorram[offset] = data; + tilemap_mark_tile_dirty(state->tx_tilemap, offset); } /* Written through port 40 */ WRITE8_HANDLER( galivan_gfxbank_w ) { + galivan_state *state = (galivan_state *)space->machine->driver_data; + /* bits 0 and 1 coin counters */ coin_counter_w(space->machine, 0,data & 1); coin_counter_w(space->machine, 1,data & 2); /* bit 2 flip screen */ - flipscreen = data & 0x04; - tilemap_set_flip (bg_tilemap, flipscreen ? TILEMAP_FLIPX|TILEMAP_FLIPY : 0); - tilemap_set_flip (tx_tilemap, flipscreen ? TILEMAP_FLIPX|TILEMAP_FLIPY : 0); + state->flipscreen = data & 0x04; + tilemap_set_flip (state->bg_tilemap, state->flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); + tilemap_set_flip (state->tx_tilemap, state->flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); /* bit 7 selects one of two ROM banks for c000-dfff */ memory_set_bank(space->machine, 1, (data & 0x80) >> 7); -/* logerror("Address: %04X - port 40 = %02x\n",cpu_get_pc(space->cpu),data); */ + /* logerror("Address: %04X - port 40 = %02x\n", cpu_get_pc(space->cpu), data); */ } WRITE8_HANDLER( ninjemak_gfxbank_w ) { + galivan_state *state = (galivan_state *)space->machine->driver_data; + /* bits 0 and 1 coin counters */ coin_counter_w(space->machine, 0,data & 1); coin_counter_w(space->machine, 1,data & 2); /* bit 2 flip screen */ - flipscreen = data & 0x04; - tilemap_set_flip (bg_tilemap, flipscreen ? TILEMAP_FLIPX|TILEMAP_FLIPY : 0); - tilemap_set_flip (tx_tilemap, flipscreen ? TILEMAP_FLIPX|TILEMAP_FLIPY : 0); + state->flipscreen = data & 0x04; + tilemap_set_flip (state->bg_tilemap, state->flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); + tilemap_set_flip (state->tx_tilemap, state->flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); /* bit 3 text bank flag ??? */ if (data & 0x08) { /* This is a temporary condition specification. */ - int offs; -logerror("%04x: write %02x to port 80\n",cpu_get_pc(space->cpu),data); + logerror("%04x: write %02x to port 80\n", cpu_get_pc(space->cpu), data); - for (offs = 0; offs < space->machine->generic.videoram_size; offs++) + for (offs = 0; offs < state->videoram_size; offs++) { galivan_videoram_w(space, offs, 0x20); } - for (offs = 0; offs < space->machine->generic.videoram_size; offs++) + for (offs = 0; offs < state->videoram_size; offs++) { galivan_colorram_w(space, offs, 0x03); } } /* bit 4 background disable flag */ - ninjemak_dispdisable = data & 0x10; + state->ninjemak_dispdisable = data & 0x10; /* bit 5 sprite flag ??? */ @@ -312,32 +296,38 @@ logerror("%04x: write %02x to port 80\n",cpu_get_pc(space->cpu),data); /* Written through port 41-42 */ WRITE8_HANDLER( galivan_scrollx_w ) { - if (offset == 1) { + galivan_state *state = (galivan_state *)space->machine->driver_data; + if (offset == 1) + { if (data & 0x80) - write_layers = 1; - else if (write_layers) { - layers = data & 0x60; - write_layers = 0; + state->write_layers = 1; + else if (state->write_layers) + { + state->layers = data & 0x60; + state->write_layers = 0; } } - scrollx[offset] = data; + state->scrollx[offset] = data; } /* Written through port 43-44 */ WRITE8_HANDLER( galivan_scrolly_w ) { - scrolly[offset] = data; + galivan_state *state = (galivan_state *)space->machine->driver_data; + state->scrolly[offset] = data; } WRITE8_HANDLER( ninjemak_scrollx_w ) { - scrollx[offset] = data; + galivan_state *state = (galivan_state *)space->machine->driver_data; + state->scrollx[offset] = data; } WRITE8_HANDLER( ninjemak_scrolly_w ) { - scrolly[offset] = data; + galivan_state *state = (galivan_state *)space->machine->driver_data; + state->scrolly[offset] = data; } @@ -348,25 +338,26 @@ WRITE8_HANDLER( ninjemak_scrolly_w ) ***************************************************************************/ -static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) +static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { + galivan_state *state = (galivan_state *)machine->driver_data; const UINT8 *spritepalettebank = memory_region(machine, "user1"); - UINT8 *spriteram = machine->generic.spriteram.u8; + UINT8 *spriteram = state->spriteram; int offs; /* draw the sprites */ - for (offs = 0;offs < machine->generic.spriteram_size;offs += 4) + for (offs = 0; offs < state->spriteram_size; offs += 4) { int code; - int attr = spriteram[offs+2]; + int attr = spriteram[offs + 2]; int color = (attr & 0x3c) >> 2; int flipx = attr & 0x40; int flipy = attr & 0x80; - int sx,sy; + int sx, sy; - sx = (spriteram[offs+3] - 0x80) + 256 * (attr & 0x01); + sx = (spriteram[offs + 3] - 0x80) + 256 * (attr & 0x01); sy = 240 - spriteram[offs]; - if (flipscreen) + if (state->flipscreen) { sx = 240 - sx; sy = 240 - sy; @@ -374,8 +365,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta flipy = !flipy; } -// code = spriteram[offs+1] + ((attr & 0x02) << 7); - code = spriteram[offs+1] + ((attr & 0x06) << 7); // for ninjemak, not sure ? +// code = spriteram[offs + 1] + ((attr & 0x02) << 7); + code = spriteram[offs + 1] + ((attr & 0x06) << 7); // for ninjemak, not sure ? drawgfx_transpen(bitmap,cliprect,machine->gfx[2], code, @@ -388,22 +379,26 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta VIDEO_UPDATE( galivan ) { - tilemap_set_scrollx(bg_tilemap,0,scrollx[0] + 256 * (scrollx[1] & 0x07)); - tilemap_set_scrolly(bg_tilemap,0,scrolly[0] + 256 * (scrolly[1] & 0x07)); + galivan_state *state = (galivan_state *)screen->machine->driver_data; + tilemap_set_scrollx(state->bg_tilemap, 0, state->scrollx[0] + 256 * (state->scrollx[1] & 0x07)); + tilemap_set_scrolly(state->bg_tilemap, 0, state->scrolly[0] + 256 * (state->scrolly[1] & 0x07)); - if (layers & 0x40) - bitmap_fill(bitmap,cliprect,0); + if (state->layers & 0x40) + bitmap_fill(bitmap, cliprect, 0); else - tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); - if (layers & 0x20) { - tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); - tilemap_draw(bitmap,cliprect,tx_tilemap,1,0); - draw_sprites(screen->machine,bitmap,cliprect); - } else { - draw_sprites(screen->machine,bitmap,cliprect); - tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); - tilemap_draw(bitmap,cliprect,tx_tilemap,1,0); + if (state->layers & 0x20) + { + tilemap_draw(bitmap, cliprect, state->tx_tilemap, 0, 0); + tilemap_draw(bitmap, cliprect, state->tx_tilemap, 1, 0); + draw_sprites(screen->machine, bitmap, cliprect); + } + else + { + draw_sprites(screen->machine, bitmap, cliprect); + tilemap_draw(bitmap, cliprect, state->tx_tilemap, 0, 0); + tilemap_draw(bitmap, cliprect, state->tx_tilemap, 1, 0); } return 0; @@ -411,17 +406,18 @@ VIDEO_UPDATE( galivan ) VIDEO_UPDATE( ninjemak ) { + galivan_state *state = (galivan_state *)screen->machine->driver_data; + /* (scrollx[1] & 0x40) does something */ - tilemap_set_scrollx(bg_tilemap,0,scrollx[0] + 256 * (scrollx[1] & 0x1f)); - tilemap_set_scrolly(bg_tilemap,0,scrolly[0] + 256 * (scrolly[1] & 0xff)); + tilemap_set_scrollx(state->bg_tilemap, 0, state->scrollx[0] + 256 * (state->scrollx[1] & 0x1f)); + tilemap_set_scrolly(state->bg_tilemap, 0, state->scrolly[0] + 256 * (state->scrolly[1] & 0xff)); - if (ninjemak_dispdisable) - bitmap_fill(bitmap,cliprect,0); + if (state->ninjemak_dispdisable) + bitmap_fill(bitmap, cliprect, 0); else - tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); - draw_sprites(screen->machine,bitmap,cliprect); - - tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); + draw_sprites(screen->machine, bitmap, cliprect); + tilemap_draw(bitmap, cliprect, state->tx_tilemap, 0, 0); return 0; } diff --git a/src/mame/video/gberet.c b/src/mame/video/gberet.c index 0974c85989f..bb0e4e24a02 100644 --- a/src/mame/video/gberet.c +++ b/src/mame/video/gberet.c @@ -1,11 +1,5 @@ #include "driver.h" - - -UINT8 *gberet_scrollram; - -static int gberet_spritebank; - -static tilemap *bg_tilemap; +#include "includes/gberet.h" /*************************************************************************** @@ -85,35 +79,40 @@ PALETTE_INIT( gberet ) WRITE8_HANDLER( gberet_videoram_w ) { - space->machine->generic.videoram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + gberet_state *state = (gberet_state *)space->machine->driver_data; + state->videoram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } WRITE8_HANDLER( gberet_colorram_w ) { - space->machine->generic.colorram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + gberet_state *state = (gberet_state *)space->machine->driver_data; + state->colorram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } WRITE8_HANDLER( gberet_scroll_w ) { + gberet_state *state = (gberet_state *)space->machine->driver_data; int scroll; - gberet_scrollram[offset] = data; + state->scrollram[offset] = data; - scroll = gberet_scrollram[offset & 0x1f] | (gberet_scrollram[offset | 0x20] << 8); - tilemap_set_scrollx(bg_tilemap, offset & 0x1f, scroll); + scroll = state->scrollram[offset & 0x1f] | (state->scrollram[offset | 0x20] << 8); + tilemap_set_scrollx(state->bg_tilemap, offset & 0x1f, scroll); } WRITE8_HANDLER( gberet_sprite_bank_w ) { - gberet_spritebank = data; + gberet_state *state = (gberet_state *)space->machine->driver_data; + state->spritebank = data; } static TILE_GET_INFO( get_bg_tile_info ) { - int attr = machine->generic.colorram.u8[tile_index]; - int code = machine->generic.videoram.u8[tile_index] + ((attr & 0x40) << 2); + gberet_state *state = (gberet_state *)machine->driver_data; + int attr = state->colorram[tile_index]; + int code = state->videoram[tile_index] + ((attr & 0x40) << 2); int color = attr & 0x0f; int flags = TILE_FLIPYX((attr & 0x30) >> 4); @@ -125,28 +124,30 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( gberet ) { - bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32); + gberet_state *state = (gberet_state *)machine->driver_data; - colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 0x10); - tilemap_set_scroll_rows(bg_tilemap, 32); + state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32); + colortable_configure_tilemap_groups(machine->colortable, state->bg_tilemap, machine->gfx[0], 0x10); + tilemap_set_scroll_rows(state->bg_tilemap, 32); } -static void gberet_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) +static void gberet_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { + gberet_state *state = (gberet_state *)machine->driver_data; int offs; UINT8 *sr; - if (gberet_spritebank & 0x08) - sr = machine->generic.spriteram2.u8; + if (state->spritebank & 0x08) + sr = state->spriteram2; else - sr = machine->generic.spriteram.u8; + sr = state->spriteram; for (offs = 0; offs < 0xc0; offs += 4) { if (sr[offs + 3]) { int attr = sr[offs + 1]; - int code = sr[offs+0] + ((attr & 0x40) << 2); + int code = sr[offs + 0] + ((attr & 0x40) << 2); int color = attr & 0x0f; int sx = sr[offs + 2] - 2 * (attr & 0x80); int sy = sr[offs + 3]; @@ -169,9 +170,11 @@ static void gberet_draw_sprites(running_machine *machine, bitmap_t *bitmap, cons VIDEO_UPDATE( gberet ) { - tilemap_draw(bitmap, cliprect, bg_tilemap, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); + gberet_state *state = (gberet_state *)screen->machine->driver_data; + + tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); gberet_draw_sprites(screen->machine, bitmap, cliprect); - tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); return 0; } @@ -179,21 +182,23 @@ VIDEO_UPDATE( gberet ) WRITE8_HANDLER( gberetb_scroll_w ) { - int scroll; + gberet_state *state = (gberet_state *)space->machine->driver_data; + int scroll = data; - scroll = data; - if (offset) scroll |= 0x100; + if (offset) + scroll |= 0x100; for (offset = 6; offset < 29; offset++) - tilemap_set_scrollx(bg_tilemap, offset, scroll + 64-8); + tilemap_set_scrollx(state->bg_tilemap, offset, scroll + 64 - 8); } -static void gberetb_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) +static void gberetb_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { - UINT8 *spriteram = machine->generic.spriteram.u8; + gberet_state *state = (gberet_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) { if (spriteram[offs + 1]) { @@ -221,8 +226,9 @@ static void gberetb_draw_sprites(running_machine *machine, bitmap_t *bitmap, con VIDEO_UPDATE( gberetb ) { - tilemap_draw(bitmap, cliprect, bg_tilemap, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); + gberet_state *state = (gberet_state *)screen->machine->driver_data; + tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); gberetb_draw_sprites(screen->machine, bitmap, cliprect); - tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); return 0; } diff --git a/src/mame/video/hyperspt.c b/src/mame/video/hyperspt.c index 6682cfd72bc..03b1ad50e04 100644 --- a/src/mame/video/hyperspt.c +++ b/src/mame/video/hyperspt.c @@ -8,10 +8,7 @@ #include "driver.h" #include "video/resnet.h" - -UINT8 *hyperspt_scroll; - -static tilemap *bg_tilemap; +#include "includes/trackfld.h" /*************************************************************************** @@ -31,10 +28,11 @@ static tilemap *bg_tilemap; bit 0 -- 1 kohm resistor -- RED ***************************************************************************/ + PALETTE_INIT( hyperspt ) { static const int resistances_rg[3] = { 1000, 470, 220 }; - static const int resistances_b [2] = { 470, 220 }; + static const int resistances_b[2] = { 470, 220 }; double rweights[3], gweights[3], bweights[2]; int i; @@ -93,14 +91,16 @@ PALETTE_INIT( hyperspt ) WRITE8_HANDLER( hyperspt_videoram_w ) { - space->machine->generic.videoram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + state->videoram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } WRITE8_HANDLER( hyperspt_colorram_w ) { - space->machine->generic.colorram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + state->colorram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } WRITE8_HANDLER( hyperspt_flipscreen_w ) @@ -114,26 +114,29 @@ WRITE8_HANDLER( hyperspt_flipscreen_w ) static TILE_GET_INFO( get_bg_tile_info ) { - int code = machine->generic.videoram.u8[tile_index] + ((machine->generic.colorram.u8[tile_index] & 0x80) << 1) + ((machine->generic.colorram.u8[tile_index] & 0x40) << 3); - int color = machine->generic.colorram.u8[tile_index] & 0x0f; - int flags = ((machine->generic.colorram.u8[tile_index] & 0x10) ? TILE_FLIPX : 0) | ((machine->generic.colorram.u8[tile_index] & 0x20) ? TILE_FLIPY : 0); + trackfld_state *state = (trackfld_state *)machine->driver_data; + int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0x80) << 1) + ((state->colorram[tile_index] & 0x40) << 3); + int color = state->colorram[tile_index] & 0x0f; + int flags = ((state->colorram[tile_index] & 0x10) ? TILE_FLIPX : 0) | ((state->colorram[tile_index] & 0x20) ? TILE_FLIPY : 0); SET_TILE_INFO(1, code, color, flags); } VIDEO_START( hyperspt ) { - bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32); + trackfld_state *state = (trackfld_state *)machine->driver_data; - tilemap_set_scroll_rows(bg_tilemap, 32); + state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32); + tilemap_set_scroll_rows(state->bg_tilemap, 32); } -static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) +static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { - UINT8 *spriteram = machine->generic.spriteram.u8; + trackfld_state *state = (trackfld_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 = spriteram[offs + 3]; int sy = 240 - spriteram[offs + 1]; @@ -173,34 +176,36 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta VIDEO_UPDATE( hyperspt ) { + trackfld_state *state = (trackfld_state *)screen->machine->driver_data; int row; for (row = 0; row < 32; row++) { - int scrollx = hyperspt_scroll[row * 2] + (hyperspt_scroll[(row * 2) + 1] & 0x01) * 256; + int scrollx = state->scroll[row * 2] + (state->scroll[(row * 2) + 1] & 0x01) * 256; if (flip_screen_get(screen->machine)) scrollx = -scrollx; - tilemap_set_scrollx(bg_tilemap, row, scrollx); + tilemap_set_scrollx(state->bg_tilemap, row, scrollx); } - tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); draw_sprites(screen->machine, bitmap, cliprect); return 0; } /* Road Fighter */ - static TILE_GET_INFO( roadf_get_bg_tile_info ) { - int code = machine->generic.videoram.u8[tile_index] + ((machine->generic.colorram.u8[tile_index] & 0x80) << 1) + ((machine->generic.colorram.u8[tile_index] & 0x60) << 4); - int color = machine->generic.colorram.u8[tile_index] & 0x0f; - int flags = (machine->generic.colorram.u8[tile_index] & 0x10) ? TILE_FLIPX : 0; + trackfld_state *state = (trackfld_state *)machine->driver_data; + int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0x80) << 1) + ((state->colorram[tile_index] & 0x60) << 4); + int color = state->colorram[tile_index] & 0x0f; + int flags = (state->colorram[tile_index] & 0x10) ? TILE_FLIPX : 0; SET_TILE_INFO(1, code, color, flags); } VIDEO_START( roadf ) { - bg_tilemap = tilemap_create(machine, roadf_get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32); + trackfld_state *state = (trackfld_state *)machine->driver_data; - tilemap_set_scroll_rows(bg_tilemap, 32); + state->bg_tilemap = tilemap_create(machine, roadf_get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32); + tilemap_set_scroll_rows(state->bg_tilemap, 32); } diff --git a/src/mame/video/jailbrek.c b/src/mame/video/jailbrek.c index 0a14d97c875..93b5e592917 100644 --- a/src/mame/video/jailbrek.c +++ b/src/mame/video/jailbrek.c @@ -1,9 +1,5 @@ #include "driver.h" - -UINT8 *jailbrek_scroll_x; -UINT8 *jailbrek_scroll_dir; - -static tilemap *bg_tilemap; +#include "includes/jailbrek.h" PALETTE_INIT( jailbrek ) { @@ -40,20 +36,23 @@ PALETTE_INIT( jailbrek ) WRITE8_HANDLER( jailbrek_videoram_w ) { - space->machine->generic.videoram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + jailbrek_state *state = (jailbrek_state *)space->machine->driver_data; + state->videoram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } WRITE8_HANDLER( jailbrek_colorram_w ) { - space->machine->generic.colorram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + jailbrek_state *state = (jailbrek_state *)space->machine->driver_data; + state->colorram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } static TILE_GET_INFO( get_bg_tile_info ) { - int attr = machine->generic.colorram.u8[tile_index]; - int code = machine->generic.videoram.u8[tile_index] + ((attr & 0xc0) << 2); + jailbrek_state *state = (jailbrek_state *)machine->driver_data; + int attr = state->colorram[tile_index]; + int code = state->videoram[tile_index] + ((attr & 0xc0) << 2); int color = attr & 0x0f; SET_TILE_INFO(0, code, color, 0); @@ -61,17 +60,18 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( jailbrek ) { - bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, - 8, 8, 64, 32); - tilemap_set_scrolldx(bg_tilemap, 0, 396 - 256); + jailbrek_state *state = (jailbrek_state *)machine->driver_data; + state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32); + tilemap_set_scrolldx(state->bg_tilemap, 0, 396 - 256); } -static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) +static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { - UINT8 *spriteram = machine->generic.spriteram.u8; + jailbrek_state *state = (jailbrek_state *)machine->driver_data; + UINT8 *spriteram = state->spriteram; int i; - for (i = 0; i < machine->generic.spriteram_size; i += 4) + for (i = 0; i < state->spriteram_size; i += 4) { int attr = spriteram[i + 1]; // attributes = ?tyxcccc int code = spriteram[i] + ((attr & 0x40) << 2); @@ -97,30 +97,31 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta VIDEO_UPDATE( jailbrek ) { + jailbrek_state *state = (jailbrek_state *)screen->machine->driver_data; int i; // added support for vertical scrolling (credits). 23/1/2002 -BR // bit 2 appears to be horizontal/vertical scroll control - if (jailbrek_scroll_dir[0] & 0x04) + if (state->scroll_dir[0] & 0x04) { - tilemap_set_scroll_cols(bg_tilemap, 32); - tilemap_set_scroll_rows(bg_tilemap, 1); - tilemap_set_scrollx(bg_tilemap, 0, 0); + tilemap_set_scroll_cols(state->bg_tilemap, 32); + tilemap_set_scroll_rows(state->bg_tilemap, 1); + tilemap_set_scrollx(state->bg_tilemap, 0, 0); for (i = 0; i < 32; i++) - tilemap_set_scrolly(bg_tilemap, i, ((jailbrek_scroll_x[i + 32] << 8) + jailbrek_scroll_x[i])); + tilemap_set_scrolly(state->bg_tilemap, i, ((state->scroll_x[i + 32] << 8) + state->scroll_x[i])); } else { - tilemap_set_scroll_rows(bg_tilemap, 32); - tilemap_set_scroll_cols(bg_tilemap, 1); - tilemap_set_scrolly(bg_tilemap, 0, 0); + tilemap_set_scroll_rows(state->bg_tilemap, 32); + tilemap_set_scroll_cols(state->bg_tilemap, 1); + tilemap_set_scrolly(state->bg_tilemap, 0, 0); for (i = 0; i < 32; i++) - tilemap_set_scrollx(bg_tilemap, i, ((jailbrek_scroll_x[i + 32] << 8) + jailbrek_scroll_x[i])); + tilemap_set_scrollx(state->bg_tilemap, i, ((state->scroll_x[i + 32] << 8) + state->scroll_x[i])); } - tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); draw_sprites(screen->machine, bitmap, cliprect); return 0; } diff --git a/src/mame/video/sbasketb.c b/src/mame/video/sbasketb.c index b6e7273bd14..b3cd18a5b1d 100644 --- a/src/mame/video/sbasketb.c +++ b/src/mame/video/sbasketb.c @@ -8,12 +8,7 @@ #include "driver.h" #include "video/resnet.h" - -UINT8 *sbasketb_scroll; -UINT8 *sbasketb_palettebank; -UINT8 *sbasketb_spriteram_select; - -static tilemap *bg_tilemap; +#include "includes/trackfld.h" /*************************************************************************** @@ -30,6 +25,7 @@ static tilemap *bg_tilemap; bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE ***************************************************************************/ + PALETTE_INIT( sbasketb ) { static const int resistances[4] = { 2000, 1000, 470, 220 }; @@ -100,14 +96,16 @@ PALETTE_INIT( sbasketb ) WRITE8_HANDLER( sbasketb_videoram_w ) { - space->machine->generic.videoram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + state->videoram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } WRITE8_HANDLER( sbasketb_colorram_w ) { - space->machine->generic.colorram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + state->colorram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } WRITE8_HANDLER( sbasketb_flipscreen_w ) @@ -121,24 +119,27 @@ WRITE8_HANDLER( sbasketb_flipscreen_w ) static TILE_GET_INFO( get_bg_tile_info ) { - int code = machine->generic.videoram.u8[tile_index] + ((machine->generic.colorram.u8[tile_index] & 0x20) << 3); - int color = machine->generic.colorram.u8[tile_index] & 0x0f; - int flags = ((machine->generic.colorram.u8[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((machine->generic.colorram.u8[tile_index] & 0x80) ? TILE_FLIPY : 0); + trackfld_state *state = (trackfld_state *)machine->driver_data; + int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0x20) << 3); + int color = state->colorram[tile_index] & 0x0f; + int flags = ((state->colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((state->colorram[tile_index] & 0x80) ? TILE_FLIPY : 0); SET_TILE_INFO(0, code, color, flags); } VIDEO_START( sbasketb ) { - bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); + trackfld_state *state = (trackfld_state *)machine->driver_data; - tilemap_set_scroll_cols(bg_tilemap, 32); + state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); + tilemap_set_scroll_cols(state->bg_tilemap, 32); } -static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) +static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { - UINT8 *spriteram = machine->generic.spriteram.u8; - int offs = (*sbasketb_spriteram_select & 0x01) * 0x100; + trackfld_state *state = (trackfld_state *)machine->driver_data; + UINT8 *spriteram = state->spriteram; + int offs = (*state->spriteram_select & 0x01) * 0x100; int i; for (i = 0; i < 64; i++, offs += 4) @@ -149,7 +150,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta if (sx || sy) { int code = spriteram[offs + 0] | ((spriteram[offs + 1] & 0x20) << 3); - int color = (spriteram[offs + 1] & 0x0f) + 16 * *sbasketb_palettebank; + int color = (spriteram[offs + 1] & 0x0f) + 16 * *state->palettebank; int flipx = spriteram[offs + 1] & 0x40; int flipy = spriteram[offs + 1] & 0x80; @@ -172,12 +173,13 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta VIDEO_UPDATE( sbasketb ) { + trackfld_state *state = (trackfld_state *)screen->machine->driver_data; int col; for (col = 6; col < 32; col++) - tilemap_set_scrolly(bg_tilemap, col, *sbasketb_scroll); + tilemap_set_scrolly(state->bg_tilemap, col, *state->scroll); - tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); draw_sprites(screen->machine, bitmap, cliprect); return 0; } diff --git a/src/mame/video/trackfld.c b/src/mame/video/trackfld.c index e437c928ce5..574b2caa42e 100644 --- a/src/mame/video/trackfld.c +++ b/src/mame/video/trackfld.c @@ -10,12 +10,6 @@ #include "video/resnet.h" #include "includes/trackfld.h" -UINT8 *trackfld_scroll; -UINT8 *trackfld_scroll2; - -static tilemap *bg_tilemap; -static int bg_bank = 0, sprite_bank1 = 0, sprite_bank2 = 0; - /*************************************************************************** Convert the color PROMs into a more useable format. @@ -34,6 +28,7 @@ static int bg_bank = 0, sprite_bank1 = 0, sprite_bank2 = 0; bit 0 -- 1 kohm resistor -- RED ***************************************************************************/ + PALETTE_INIT( trackfld ) { static const int resistances_rg[3] = { 1000, 470, 220 }; @@ -96,14 +91,16 @@ PALETTE_INIT( trackfld ) WRITE8_HANDLER( trackfld_videoram_w ) { - space->machine->generic.videoram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + state->videoram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } WRITE8_HANDLER( trackfld_colorram_w ) { - space->machine->generic.colorram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + state->colorram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset); } WRITE8_HANDLER( trackfld_flipscreen_w ) @@ -117,65 +114,61 @@ WRITE8_HANDLER( trackfld_flipscreen_w ) WRITE8_HANDLER( atlantol_gfxbank_w ) { - static int old = 0; - - if( data & 1 ) + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + if (data & 1) { /* male / female sprites switch */ - if( (old == 1 && (data & 1) == 1) || - (old == 0 && (data & 1) == 1) ) - sprite_bank2 = 0x200; + if ((state->old_gfx_bank == 1 && (data & 1) == 1) || (state->old_gfx_bank == 0 && (data & 1) == 1)) + state->sprite_bank2 = 0x200; else - sprite_bank2 = 0; + state->sprite_bank2 = 0; - sprite_bank1 = 0; - - old = data & 1; + state->sprite_bank1 = 0; + state->old_gfx_bank = data & 1; } else { /* male / female sprites switch */ - if( (old == 0 && (data & 1) == 0) || - (old == 1 && (data & 1) == 0) ) - sprite_bank2 = 0; + if ((state->old_gfx_bank == 0 && (data & 1) == 0) || (state->old_gfx_bank == 1 && (data & 1) == 0)) + state->sprite_bank2 = 0; else - sprite_bank2 = 0x200; + state->sprite_bank2 = 0x200; - sprite_bank1 = 0; - - old = data & 1; + state->sprite_bank1 = 0; + state->old_gfx_bank = data & 1; } - if( (data & 3) == 3 ) + if ((data & 3) == 3) { - if( sprite_bank2 ) - sprite_bank1 = 0x500; + if (state->sprite_bank2) + state->sprite_bank1 = 0x500; else - sprite_bank1 = 0x300; + state->sprite_bank1 = 0x300; } - else if( (data & 3) == 2 ) + else if ((data & 3) == 2) { - if( sprite_bank2 ) - sprite_bank1 = 0x300; + if (state->sprite_bank2) + state->sprite_bank1 = 0x300; else - sprite_bank1 = 0x100; + state->sprite_bank1 = 0x100; } - if( bg_bank != (data & 0x8) ) + if (state->bg_bank != (data & 0x8)) { - bg_bank = data & 0x8; - tilemap_mark_all_tiles_dirty(bg_tilemap); + state->bg_bank = data & 0x8; + tilemap_mark_all_tiles_dirty(state->bg_tilemap); } } static TILE_GET_INFO( get_bg_tile_info ) { - int attr = machine->generic.colorram.u8[tile_index]; - int code = machine->generic.videoram.u8[tile_index] + 4 * (attr & 0xc0); + trackfld_state *state = (trackfld_state *)machine->driver_data; + int attr = state->colorram[tile_index]; + int code = state->videoram[tile_index] + 4 * (attr & 0xc0); int color = attr & 0x0f; int flags = ((attr & 0x10) ? TILE_FLIPX : 0) | ((attr & 0x20) ? TILE_FLIPY : 0); - if( bg_bank ) + if (state->bg_bank) code |= 0x400; SET_TILE_INFO(1, code, color, flags); @@ -183,19 +176,19 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( trackfld ) { - bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, - 8, 8, 64, 32); - - tilemap_set_scroll_rows(bg_tilemap, 32); + trackfld_state *state = (trackfld_state *)machine->driver_data; + state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32); + tilemap_set_scroll_rows(state->bg_tilemap, 32); } -static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) +static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { - UINT8 *spriteram = machine->generic.spriteram.u8; - UINT8 *spriteram_2 = machine->generic.spriteram2.u8; + trackfld_state *state = (trackfld_state *)machine->driver_data; + UINT8 *spriteram = state->spriteram; + UINT8 *spriteram_2 = state->spriteram2; int offs; - for (offs = machine->generic.spriteram_size - 2; offs >= 0; offs -= 2) + for (offs = state->spriteram_size - 2; offs >= 0; offs -= 2) { int attr = spriteram_2[offs]; int code = spriteram[offs + 1]; @@ -217,7 +210,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta drawgfx_transmask(bitmap, cliprect, machine->gfx[0], - code + sprite_bank1 + sprite_bank2, color, + code + state->sprite_bank1 + state->sprite_bank2, color, flipx, flipy, sx, sy, colortable_get_transpen_mask(machine->colortable, machine->gfx[0], color, 0)); @@ -225,7 +218,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta /* redraw with wraparound */ drawgfx_transmask(bitmap,cliprect, machine->gfx[0], - code + sprite_bank1 + sprite_bank2, color, + code + state->sprite_bank1 + state->sprite_bank2, color, flipx, flipy, sx - 256, sy, colortable_get_transpen_mask(machine->colortable, machine->gfx[0], color, 0)); @@ -234,16 +227,17 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta VIDEO_UPDATE( trackfld ) { + trackfld_state *state = (trackfld_state *)screen->machine->driver_data; int row, scrollx; for (row = 0; row < 32; row++) { - scrollx = trackfld_scroll[row] + 256 * (trackfld_scroll2[row] & 0x01); + scrollx = state->scroll[row] + 256 * (state->scroll2[row] & 0x01); if (flip_screen_get(screen->machine)) scrollx = -scrollx; - tilemap_set_scrollx(bg_tilemap, row, scrollx); + tilemap_set_scrollx(state->bg_tilemap, row, scrollx); } - tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); draw_sprites(screen->machine, bitmap, cliprect); return 0; } diff --git a/src/mame/video/yiear.c b/src/mame/video/yiear.c index 02f7df9b391..970f530b92d 100644 --- a/src/mame/video/yiear.c +++ b/src/mame/video/yiear.c @@ -7,10 +7,8 @@ ***************************************************************************/ #include "driver.h" +#include "includes/trackfld.h" -int yiear_nmi_enable; - -static tilemap *bg_tilemap; /*************************************************************************** @@ -29,14 +27,14 @@ static tilemap *bg_tilemap; bit 0 -- 1 kohm resistor -- RED ***************************************************************************/ + PALETTE_INIT( yiear ) { 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; /* red component */ bit0 = (*color_prom >> 0) & 0x01; @@ -56,21 +54,22 @@ PALETTE_INIT( yiear ) bit2 = (*color_prom >> 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)); color_prom++; } } WRITE8_HANDLER( yiear_videoram_w ) { - space->machine->generic.videoram.u8[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset / 2); + trackfld_state *state = (trackfld_state *)space->machine->driver_data; + state->videoram[offset] = data; + tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2); } WRITE8_HANDLER( yiear_control_w ) { + trackfld_state *state = (trackfld_state *)space->machine->driver_data; /* bit 0 flips screen */ - if (flip_screen_get(space->machine) != (data & 0x01)) { flip_screen_set(space->machine, data & 0x01); @@ -78,24 +77,22 @@ WRITE8_HANDLER( yiear_control_w ) } /* bit 1 is NMI enable */ - - yiear_nmi_enable = data & 0x02; + state->yiear_nmi_enable = data & 0x02; /* bit 2 is IRQ enable */ - interrupt_enable_w(space, 0, data & 0x04); /* bits 3 and 4 are coin counters */ - coin_counter_w(space->machine, 0, data & 0x08); coin_counter_w(space->machine, 1, data & 0x10); } static TILE_GET_INFO( get_bg_tile_info ) { + trackfld_state *state = (trackfld_state *)machine->driver_data; int offs = tile_index * 2; - int attr = machine->generic.videoram.u8[offs]; - int code = machine->generic.videoram.u8[offs + 1] | ((attr & 0x10) << 4); + int attr = state->videoram[offs]; + int code = state->videoram[offs + 1] | ((attr & 0x10) << 4); // int color = (attr & 0xf0) >> 4; int flags = ((attr & 0x80) ? TILE_FLIPX : 0) | ((attr & 0x40) ? TILE_FLIPY : 0); @@ -104,17 +101,18 @@ static TILE_GET_INFO( get_bg_tile_info ) VIDEO_START( yiear ) { - bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, - 8, 8, 32, 32); + trackfld_state *state = (trackfld_state *)machine->driver_data; + state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); } -static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) +static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { - UINT8 *spriteram = machine->generic.spriteram.u8; - UINT8 *spriteram_2 = machine->generic.spriteram2.u8; + trackfld_state *state = (trackfld_state *)machine->driver_data; + UINT8 *spriteram = state->spriteram; + UINT8 *spriteram_2 = state->spriteram2; int offs; - for (offs = machine->generic.spriteram_size - 2;offs >= 0;offs -= 2) + for (offs = state->spriteram_size - 2; offs >= 0; offs -= 2) { int attr = spriteram[offs]; int code = spriteram_2[offs + 1] + 256 * (attr & 0x01); @@ -145,7 +143,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta VIDEO_UPDATE( yiear ) { - tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); + trackfld_state *state = (trackfld_state *)screen->machine->driver_data; + + tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0); draw_sprites(screen->machine, bitmap, cliprect); return 0; }