mirror of
https://github.com/holub/mame
synced 2025-05-12 00:58:53 +03:00
This patch revisits archive files I've already patched to remove
statics and globals and handles some drivers and variables I missed or couldn't yet apply in my earlier pass. [Atari Ace]
This commit is contained in:
parent
0668334f27
commit
b7aa7df561
@ -291,7 +291,7 @@ static WRITE16_HANDLER( roadriot_sloop_data_w )
|
||||
|
||||
static void guardians_sloop_tweak(atarig42_state *state, int offset)
|
||||
{
|
||||
static UINT32 last_accesses[8];
|
||||
UINT32 *last_accesses = state->last_accesses;
|
||||
|
||||
if (offset >= 0x7f7c0/2)
|
||||
{
|
||||
|
@ -74,8 +74,21 @@ Dumped by Chack'n
|
||||
#include "sound/ay8910.h"
|
||||
#include "machine/tait8741.h"
|
||||
|
||||
static UINT8 *cyclemb_vram,*cyclemb_cram;
|
||||
static UINT8 *cyclemb_obj1_ram,*cyclemb_obj2_ram,*cyclemb_obj3_ram;
|
||||
|
||||
class cyclemb_state : public driver_device
|
||||
{
|
||||
public:
|
||||
cyclemb_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *vram;
|
||||
UINT8 *cram;
|
||||
UINT8 *obj1_ram;
|
||||
UINT8 *obj2_ram;
|
||||
UINT8 *obj3_ram;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static PALETTE_INIT( cyclemb )
|
||||
{
|
||||
@ -110,6 +123,7 @@ static VIDEO_START( cyclemb )
|
||||
|
||||
static SCREEN_UPDATE( cyclemb )
|
||||
{
|
||||
cyclemb_state *state = screen->machine->driver_data<cyclemb_state>();
|
||||
int x,y,count;
|
||||
const gfx_element *gfx = screen->machine->gfx[0];
|
||||
UINT8 flip_screen = flip_screen_get(screen->machine);
|
||||
@ -120,12 +134,12 @@ static SCREEN_UPDATE( cyclemb )
|
||||
{
|
||||
for (x=0;x<64;x++)
|
||||
{
|
||||
int attr = cyclemb_cram[count];
|
||||
int tile = (cyclemb_vram[count]) | ((attr & 3)<<8);
|
||||
int attr = state->cram[count];
|
||||
int tile = (state->vram[count]) | ((attr & 3)<<8);
|
||||
int color = ((attr & 0xf8) >> 3) ^ 0x1f;
|
||||
int odd_line = y & 1 ? 0x40 : 0x00;
|
||||
// int sx_offs = flip_screen ? 512 : 0
|
||||
int scrollx = ((cyclemb_vram[(y/2)+odd_line]) + (cyclemb_cram[(y/2)+odd_line]<<8) + 48) & 0x1ff;
|
||||
int scrollx = ((state->vram[(y/2)+odd_line]) + (state->cram[(y/2)+odd_line]<<8) + 48) & 0x1ff;
|
||||
|
||||
if(flip_screen)
|
||||
{
|
||||
@ -170,24 +184,24 @@ static SCREEN_UPDATE( cyclemb )
|
||||
|
||||
for(i=0;i<0x40;i+=2)
|
||||
{
|
||||
y = 0xf1 - cyclemb_obj2_ram[i];
|
||||
x = cyclemb_obj2_ram[i+1] - 56;
|
||||
spr_offs = (cyclemb_obj1_ram[i+0]);
|
||||
col = (cyclemb_obj1_ram[i+1] & 0x3f);
|
||||
region = ((cyclemb_obj3_ram[i] & 0x10) >> 4) + 1;
|
||||
y = 0xf1 - state->obj2_ram[i];
|
||||
x = state->obj2_ram[i+1] - 56;
|
||||
spr_offs = (state->obj1_ram[i+0]);
|
||||
col = (state->obj1_ram[i+1] & 0x3f);
|
||||
region = ((state->obj3_ram[i] & 0x10) >> 4) + 1;
|
||||
if(region == 2)
|
||||
{
|
||||
spr_offs >>= 2;
|
||||
spr_offs += ((cyclemb_obj3_ram[i+0] & 3) << 5);
|
||||
spr_offs += ((state->obj3_ram[i+0] & 3) << 5);
|
||||
y-=16;
|
||||
}
|
||||
|
||||
if(cyclemb_obj3_ram[i+1] & 1)
|
||||
if(state->obj3_ram[i+1] & 1)
|
||||
x+=256;
|
||||
//if(cyclemb_obj3_ram[i+1] & 2)
|
||||
//if(state->obj3_ram[i+1] & 2)
|
||||
// x-=256;
|
||||
fx = (cyclemb_obj3_ram[i+0] & 4) >> 2;
|
||||
fy = (cyclemb_obj3_ram[i+0] & 8) >> 3;
|
||||
fx = (state->obj3_ram[i+0] & 4) >> 2;
|
||||
fy = (state->obj3_ram[i+0] & 8) >> 3;
|
||||
|
||||
if(flip_screen)
|
||||
{
|
||||
@ -238,11 +252,11 @@ static WRITE8_HANDLER( cyclemb_flip_w )
|
||||
static ADDRESS_MAP_START( cyclemb_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x8fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0x9000, 0x97ff) AM_RAM AM_BASE(&cyclemb_vram)
|
||||
AM_RANGE(0x9800, 0x9fff) AM_RAM AM_BASE(&cyclemb_cram)
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_BASE(&cyclemb_obj1_ram) //ORAM1 (only a000-a3ff tested)
|
||||
AM_RANGE(0xa800, 0xafff) AM_RAM AM_BASE(&cyclemb_obj2_ram) //ORAM2 (only a800-abff tested)
|
||||
AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_BASE(&cyclemb_obj3_ram) //ORAM3 (only b000-b3ff tested)
|
||||
AM_RANGE(0x9000, 0x97ff) AM_RAM AM_BASE_MEMBER(cyclemb_state, vram)
|
||||
AM_RANGE(0x9800, 0x9fff) AM_RAM AM_BASE_MEMBER(cyclemb_state, cram)
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_BASE_MEMBER(cyclemb_state, obj1_ram) //ORAM1 (only a000-a3ff tested)
|
||||
AM_RANGE(0xa800, 0xafff) AM_RAM AM_BASE_MEMBER(cyclemb_state, obj2_ram) //ORAM2 (only a800-abff tested)
|
||||
AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_BASE_MEMBER(cyclemb_state, obj3_ram) //ORAM3 (only b000-b3ff tested)
|
||||
AM_RANGE(0xb800, 0xbfff) AM_RAM //WRAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -512,7 +526,7 @@ static GFXDECODE_START( cyclemb )
|
||||
GFXDECODE_ENTRY( "sprite_data_2", 0, spritelayout_32x32, 0x00, 0x40 )
|
||||
GFXDECODE_END
|
||||
|
||||
static MACHINE_CONFIG_START( cyclemb, driver_device )
|
||||
static MACHINE_CONFIG_START( cyclemb, cyclemb_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu",Z80,18000000/4)
|
||||
MCFG_CPU_PROGRAM_MAP(cyclemb_map)
|
||||
|
@ -150,10 +150,6 @@ Fax 1982 6502 FXL, FLA
|
||||
#include "includes/exidy.h"
|
||||
|
||||
|
||||
static UINT8 last_dial;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Special Teeter Torture input
|
||||
@ -162,19 +158,20 @@ static UINT8 last_dial;
|
||||
|
||||
static CUSTOM_INPUT( teetert_input_r )
|
||||
{
|
||||
exidy_state *state = field->port->machine->driver_data<exidy_state>();
|
||||
UINT8 dial = input_port_read(field->port->machine, "DIAL");
|
||||
int result = 0;
|
||||
|
||||
result = (dial != last_dial) << 4;
|
||||
result = (dial != state->last_dial) << 4;
|
||||
if (result != 0)
|
||||
{
|
||||
if (((dial - last_dial) & 0xff) < 0x80)
|
||||
if (((dial - state->last_dial) & 0xff) < 0x80)
|
||||
{
|
||||
result |= 1;
|
||||
last_dial++;
|
||||
state->last_dial++;
|
||||
}
|
||||
else
|
||||
last_dial--;
|
||||
state->last_dial--;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -207,24 +204,24 @@ static WRITE8_HANDLER( fax_bank_select_w )
|
||||
|
||||
static ADDRESS_MAP_START( exidy_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x03ff) AM_RAM
|
||||
AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0400) AM_RAM AM_BASE(&exidy_videoram)
|
||||
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE(&exidy_sprite1_xpos)
|
||||
AM_RANGE(0x5040, 0x5040) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE(&exidy_sprite1_ypos)
|
||||
AM_RANGE(0x5080, 0x5080) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE(&exidy_sprite2_xpos)
|
||||
AM_RANGE(0x50c0, 0x50c0) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE(&exidy_sprite2_ypos)
|
||||
AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0400) AM_RAM AM_BASE_MEMBER(exidy_state, videoram)
|
||||
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite1_xpos)
|
||||
AM_RANGE(0x5040, 0x5040) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite1_ypos)
|
||||
AM_RANGE(0x5080, 0x5080) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite2_xpos)
|
||||
AM_RANGE(0x50c0, 0x50c0) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite2_ypos)
|
||||
AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE(&exidy_spriteno)
|
||||
AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, spriteno)
|
||||
AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE(&exidy_sprite_enable)
|
||||
AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite_enable)
|
||||
AM_RANGE(0x5103, 0x5103) AM_MIRROR(0x00fc) AM_READ(exidy_interrupt_r)
|
||||
AM_RANGE(0x5210, 0x5212) AM_WRITEONLY AM_BASE(&exidy_color_latch)
|
||||
AM_RANGE(0x5210, 0x5212) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, color_latch)
|
||||
AM_RANGE(0x5213, 0x5213) AM_READ_PORT("IN2")
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( sidetrac_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0800, 0x3fff) AM_ROM
|
||||
AM_RANGE(0x4800, 0x4fff) AM_ROM AM_BASE(&exidy_characterram)
|
||||
AM_RANGE(0x4800, 0x4fff) AM_ROM AM_BASE_MEMBER(exidy_state, characterram)
|
||||
AM_RANGE(0x5200, 0x5200) AM_WRITE(targ_audio_1_w)
|
||||
AM_RANGE(0x5201, 0x5201) AM_WRITE(spectar_audio_2_w)
|
||||
AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("maincpu", 0x3f00)
|
||||
@ -234,7 +231,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( targ_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0800, 0x3fff) AM_ROM
|
||||
AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE(&exidy_characterram)
|
||||
AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
|
||||
AM_RANGE(0x5200, 0x5200) AM_WRITE(targ_audio_1_w)
|
||||
AM_RANGE(0x5201, 0x5201) AM_WRITE(targ_audio_2_w)
|
||||
AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("maincpu", 0x3f00)
|
||||
@ -244,7 +241,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( spectar_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0800, 0x3fff) AM_ROM
|
||||
AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE(&exidy_characterram)
|
||||
AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
|
||||
AM_RANGE(0x5200, 0x5200) AM_WRITE(targ_audio_1_w)
|
||||
AM_RANGE(0x5201, 0x5201) AM_WRITE(spectar_audio_2_w)
|
||||
AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("maincpu", 0x3f00)
|
||||
@ -255,27 +252,27 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( rallys_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x03ff) AM_RAM
|
||||
AM_RANGE(0x0800, 0x3fff) AM_ROM
|
||||
AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0400) AM_RAM AM_BASE(&exidy_videoram)
|
||||
AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE(&exidy_characterram)
|
||||
AM_RANGE(0x5000, 0x5000) AM_WRITEONLY AM_BASE(&exidy_sprite1_xpos)
|
||||
AM_RANGE(0x5001, 0x5001) AM_WRITEONLY AM_BASE(&exidy_sprite1_ypos)
|
||||
AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0400) AM_RAM AM_BASE_MEMBER(exidy_state, videoram)
|
||||
AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
|
||||
AM_RANGE(0x5000, 0x5000) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite1_xpos)
|
||||
AM_RANGE(0x5001, 0x5001) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite1_ypos)
|
||||
AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE(&exidy_spriteno)
|
||||
AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, spriteno)
|
||||
AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE(&exidy_sprite_enable)
|
||||
AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite_enable)
|
||||
AM_RANGE(0x5103, 0x5103) AM_MIRROR(0x00fc) AM_READ(exidy_interrupt_r)
|
||||
AM_RANGE(0x5200, 0x5200) AM_WRITE(targ_audio_1_w)
|
||||
AM_RANGE(0x5201, 0x5201) AM_WRITE(spectar_audio_2_w)
|
||||
AM_RANGE(0x5210, 0x5212) AM_WRITEONLY AM_BASE(&exidy_color_latch)
|
||||
AM_RANGE(0x5210, 0x5212) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, color_latch)
|
||||
AM_RANGE(0x5213, 0x5213) AM_READ_PORT("IN2")
|
||||
AM_RANGE(0x5300, 0x5300) AM_WRITEONLY AM_BASE(&exidy_sprite2_xpos)
|
||||
AM_RANGE(0x5301, 0x5301) AM_WRITEONLY AM_BASE(&exidy_sprite2_ypos)
|
||||
AM_RANGE(0x5300, 0x5300) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite2_xpos)
|
||||
AM_RANGE(0x5301, 0x5301) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite2_ypos)
|
||||
AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("maincpu", 0x3f00)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( venture_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE(&exidy_characterram)
|
||||
AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
|
||||
AM_RANGE(0x5200, 0x520f) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w)
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||
AM_IMPORT_FROM(exidy_map)
|
||||
@ -285,7 +282,7 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( pepper2_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x4800, 0x4fff) AM_NOP
|
||||
AM_RANGE(0x5200, 0x520f) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w)
|
||||
AM_RANGE(0x6000, 0x6fff) AM_RAM AM_BASE(&exidy_characterram)
|
||||
AM_RANGE(0x6000, 0x6fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||
AM_IMPORT_FROM(exidy_map)
|
||||
ADDRESS_MAP_END
|
||||
@ -299,7 +296,7 @@ static ADDRESS_MAP_START( fax_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0x5200, 0x520f) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w)
|
||||
AM_RANGE(0x5213, 0x5217) AM_WRITENOP /* empty control lines on color/sound board */
|
||||
AM_RANGE(0x6000, 0x6fff) AM_RAM AM_BASE(&exidy_characterram)
|
||||
AM_RANGE(0x6000, 0x6fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||
AM_IMPORT_FROM(exidy_map)
|
||||
ADDRESS_MAP_END
|
||||
@ -798,7 +795,8 @@ GFXDECODE_END
|
||||
|
||||
static MACHINE_START( teetert )
|
||||
{
|
||||
state_save_register_global(machine, last_dial);
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
state_save_register_global(machine, state->last_dial);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
@ -807,7 +805,7 @@ static MACHINE_START( teetert )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_CONFIG_START( base, driver_device )
|
||||
static MACHINE_CONFIG_START( base, exidy_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6502, EXIDY_CPU_CLOCK)
|
||||
@ -1386,54 +1384,59 @@ ROM_END
|
||||
|
||||
static DRIVER_INIT( sidetrac )
|
||||
{
|
||||
exidy_video_config(0x00, 0x00, FALSE);
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
exidy_video_config(machine, 0x00, 0x00, FALSE);
|
||||
|
||||
/* hard-coded palette controlled via 8x3 DIP switches on the board */
|
||||
exidy_color_latch[2] = 0xf8;
|
||||
exidy_color_latch[1] = 0xdc;
|
||||
exidy_color_latch[0] = 0xb8;
|
||||
state->color_latch[2] = 0xf8;
|
||||
state->color_latch[1] = 0xdc;
|
||||
state->color_latch[0] = 0xb8;
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( targ )
|
||||
{
|
||||
exidy_video_config(0x00, 0x00, FALSE);
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
exidy_video_config(machine, 0x00, 0x00, FALSE);
|
||||
|
||||
/* hard-coded palette controlled via 8x3 DIP switches on the board */
|
||||
exidy_color_latch[2] = 0x5c;
|
||||
exidy_color_latch[1] = 0xee;
|
||||
exidy_color_latch[0] = 0x6b;
|
||||
state->color_latch[2] = 0x5c;
|
||||
state->color_latch[1] = 0xee;
|
||||
state->color_latch[0] = 0x6b;
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( spectar )
|
||||
{
|
||||
exidy_video_config(0x00, 0x00, FALSE);
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
exidy_video_config(machine, 0x00, 0x00, FALSE);
|
||||
|
||||
/* hard-coded palette controlled via 8x3 DIP switches on the board */
|
||||
exidy_color_latch[2] = 0x58;
|
||||
exidy_color_latch[1] = 0xee;
|
||||
exidy_color_latch[0] = 0x09;
|
||||
state->color_latch[2] = 0x58;
|
||||
state->color_latch[1] = 0xee;
|
||||
state->color_latch[0] = 0x09;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( rallys )
|
||||
{
|
||||
exidy_video_config(0x00, 0x00, FALSE);
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
exidy_video_config(machine, 0x00, 0x00, FALSE);
|
||||
|
||||
/* hard-coded palette controlled via 8x3 DIP switches on the board */
|
||||
exidy_color_latch[2] = 0x58;
|
||||
exidy_color_latch[1] = 0xee;
|
||||
exidy_color_latch[0] = 0x09;
|
||||
state->color_latch[2] = 0x58;
|
||||
state->color_latch[1] = 0xee;
|
||||
state->color_latch[0] = 0x09;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( phantoma )
|
||||
{
|
||||
exidy_video_config(0x00, 0x00, FALSE);
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
exidy_video_config(machine, 0x00, 0x00, FALSE);
|
||||
|
||||
/* hard-coded palette controlled via 8x3 DIP switches on the board */
|
||||
exidy_color_latch[2] = 0x58;
|
||||
exidy_color_latch[1] = 0xee;
|
||||
exidy_color_latch[0] = 0x09;
|
||||
state->color_latch[2] = 0x58;
|
||||
state->color_latch[1] = 0xee;
|
||||
state->color_latch[0] = 0x09;
|
||||
|
||||
/* the ROM is actually mapped high */
|
||||
memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf800, 0xffff, 0, 0, "bank1");
|
||||
@ -1443,25 +1446,25 @@ static DRIVER_INIT( phantoma )
|
||||
|
||||
static DRIVER_INIT( mtrap )
|
||||
{
|
||||
exidy_video_config(0x14, 0x00, FALSE);
|
||||
exidy_video_config(machine, 0x14, 0x00, FALSE);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( venture )
|
||||
{
|
||||
exidy_video_config(0x04, 0x04, FALSE);
|
||||
exidy_video_config(machine, 0x04, 0x04, FALSE);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( teetert )
|
||||
{
|
||||
exidy_video_config(0x0c, 0x0c, FALSE);
|
||||
exidy_video_config(machine, 0x0c, 0x0c, FALSE);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( pepper2 )
|
||||
{
|
||||
exidy_video_config(0x14, 0x04, TRUE);
|
||||
exidy_video_config(machine, 0x14, 0x04, TRUE);
|
||||
}
|
||||
|
||||
|
||||
@ -1469,7 +1472,7 @@ static DRIVER_INIT( fax )
|
||||
{
|
||||
address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
|
||||
exidy_video_config(0x04, 0x04, TRUE);
|
||||
exidy_video_config(machine, 0x04, 0x04, TRUE);
|
||||
|
||||
/* reset the ROM bank */
|
||||
fax_bank_select_w(space,0,0);
|
||||
|
@ -242,13 +242,6 @@ Who Dunnit 1988 6809
|
||||
#define MAIN_CPU_CLOCK (EXIDY440_MASTER_CLOCK / 8)
|
||||
|
||||
|
||||
/* local variables */
|
||||
static UINT8 exidy440_bank;
|
||||
|
||||
static const UINT8 *showdown_bank_data[2];
|
||||
static INT8 showdown_bank_select;
|
||||
static UINT8 showdown_bank_offset;
|
||||
|
||||
static READ8_HANDLER( showdown_bank0_r );
|
||||
|
||||
|
||||
@ -276,13 +269,15 @@ static INPUT_CHANGED( coin_inserted )
|
||||
|
||||
static CUSTOM_INPUT( firq_beam_r )
|
||||
{
|
||||
return exidy440_firq_beam;
|
||||
exidy440_state *state = field->port->machine->driver_data<exidy440_state>();
|
||||
return state->firq_beam;
|
||||
}
|
||||
|
||||
|
||||
static CUSTOM_INPUT( firq_vblank_r )
|
||||
{
|
||||
return exidy440_firq_vblank;
|
||||
exidy440_state *state = field->port->machine->driver_data<exidy440_state>();
|
||||
return state->firq_vblank;
|
||||
}
|
||||
|
||||
|
||||
@ -303,25 +298,27 @@ static CUSTOM_INPUT( hitnmiss_button1_r )
|
||||
|
||||
void exidy440_bank_select(running_machine *machine, UINT8 bank)
|
||||
{
|
||||
exidy440_state *state = machine->driver_data<exidy440_state>();
|
||||
/* for the showdown case, bank 0 is a PLD */
|
||||
if (showdown_bank_data[0] != NULL)
|
||||
if (state->showdown_bank_data[0] != NULL)
|
||||
{
|
||||
if (bank == 0 && exidy440_bank != 0)
|
||||
if (bank == 0 && state->bank != 0)
|
||||
memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, showdown_bank0_r);
|
||||
else if (bank != 0 && exidy440_bank == 0)
|
||||
else if (bank != 0 && state->bank == 0)
|
||||
memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, "bank1");
|
||||
}
|
||||
|
||||
/* select the bank and update the bank pointer */
|
||||
exidy440_bank = bank;
|
||||
memory_set_bankptr(machine, "bank1", &machine->region("maincpu")->base()[0x10000 + exidy440_bank * 0x4000]);
|
||||
state->bank = bank;
|
||||
memory_set_bankptr(machine, "bank1", &machine->region("maincpu")->base()[0x10000 + state->bank * 0x4000]);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( bankram_w )
|
||||
{
|
||||
exidy440_state *state = space->machine->driver_data<exidy440_state>();
|
||||
/* EEROM lives in the upper 8k of bank 15 */
|
||||
if (exidy440_bank == 15 && offset >= 0x2000)
|
||||
if (state->bank == 15 && offset >= 0x2000)
|
||||
{
|
||||
space->machine->region("maincpu")->base()[0x10000 + 15 * 0x4000 + offset] = data;
|
||||
logerror("W EEROM[%04X] = %02X\n", offset - 0x2000, data);
|
||||
@ -398,27 +395,28 @@ static WRITE8_HANDLER( exidy440_coin_counter_w )
|
||||
|
||||
static READ8_HANDLER( showdown_bank0_r )
|
||||
{
|
||||
exidy440_state *state = space->machine->driver_data<exidy440_state>();
|
||||
/* showdown relies on different values from different memory locations */
|
||||
/* yukon relies on multiple reads from the same location returning different values */
|
||||
UINT8 result = 0xff;
|
||||
|
||||
/* fetch the special data if a bank is selected */
|
||||
if (showdown_bank_select >= 0)
|
||||
if (state->showdown_bank_select >= 0)
|
||||
{
|
||||
result = showdown_bank_data[showdown_bank_select][showdown_bank_offset++];
|
||||
result = state->showdown_bank_data[state->showdown_bank_select][state->showdown_bank_offset++];
|
||||
|
||||
/* after 24 bytes, stop and revert back to the beginning */
|
||||
if (showdown_bank_offset == 0x18)
|
||||
showdown_bank_offset = 0;
|
||||
if (state->showdown_bank_offset == 0x18)
|
||||
state->showdown_bank_offset = 0;
|
||||
}
|
||||
|
||||
/* look for special offsets to adjust our behavior */
|
||||
if (offset == 0x0055)
|
||||
showdown_bank_select = -1;
|
||||
else if (showdown_bank_select == -1)
|
||||
state->showdown_bank_select = -1;
|
||||
else if (state->showdown_bank_select == -1)
|
||||
{
|
||||
showdown_bank_select = (offset == 0x00ed) ? 0 : (offset == 0x1243) ? 1 : 0;
|
||||
showdown_bank_offset = 0;
|
||||
state->showdown_bank_select = (offset == 0x00ed) ? 0 : (offset == 0x1243) ? 1 : 0;
|
||||
state->showdown_bank_offset = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -439,7 +437,8 @@ static READ8_HANDLER( topsecex_input_port_5_r )
|
||||
|
||||
static WRITE8_HANDLER( topsecex_yscroll_w )
|
||||
{
|
||||
*topsecex_yscroll = data;
|
||||
exidy440_state *state = space->machine->driver_data<exidy440_state>();
|
||||
*state->topsecex_yscroll = data;
|
||||
}
|
||||
|
||||
|
||||
@ -459,7 +458,8 @@ static MACHINE_START( exidy440 )
|
||||
|
||||
static MACHINE_RESET( exidy440 )
|
||||
{
|
||||
exidy440_bank = 0xff;
|
||||
exidy440_state *state = machine->driver_data<exidy440_state>();
|
||||
state->bank = 0xff;
|
||||
exidy440_bank_select(machine, 0);
|
||||
}
|
||||
|
||||
@ -472,13 +472,13 @@ static MACHINE_RESET( exidy440 )
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( exidy440_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE(&exidy440_imageram)
|
||||
AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE_MEMBER(exidy440_state, imageram)
|
||||
AM_RANGE(0x2000, 0x209f) AM_RAM_WRITE(exidy440_spriteram_w) AM_BASE_GENERIC(spriteram)
|
||||
AM_RANGE(0x20a0, 0x29ff) AM_RAM
|
||||
AM_RANGE(0x2a00, 0x2aff) AM_READWRITE(exidy440_videoram_r, exidy440_videoram_w)
|
||||
AM_RANGE(0x2b00, 0x2b00) AM_READ(exidy440_vertical_pos_r)
|
||||
AM_RANGE(0x2b01, 0x2b01) AM_READWRITE(exidy440_horizontal_pos_r, exidy440_interrupt_clear_w)
|
||||
AM_RANGE(0x2b02, 0x2b02) AM_RAM AM_BASE(&exidy440_scanline)
|
||||
AM_RANGE(0x2b02, 0x2b02) AM_RAM AM_BASE_MEMBER(exidy440_state, scanline)
|
||||
AM_RANGE(0x2b03, 0x2b03) AM_READ_PORT("IN0") AM_WRITE(exidy440_control_w)
|
||||
AM_RANGE(0x2c00, 0x2dff) AM_READWRITE(exidy440_paletteram_r, exidy440_paletteram_w)
|
||||
AM_RANGE(0x2e00, 0x2e1f) AM_RAM_WRITE(sound_command_w)
|
||||
@ -1001,7 +1001,7 @@ INPUT_PORTS_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_CONFIG_START( exidy440, driver_device )
|
||||
static MACHINE_CONFIG_START( exidy440, exidy440_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6809, MAIN_CPU_CLOCK)
|
||||
@ -1933,7 +1933,8 @@ ROM_END
|
||||
|
||||
static DRIVER_INIT( exidy440 )
|
||||
{
|
||||
showdown_bank_data[0] = showdown_bank_data[1] = NULL;
|
||||
exidy440_state *state = machine->driver_data<exidy440_state>();
|
||||
state->showdown_bank_data[0] = state->showdown_bank_data[1] = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -1947,6 +1948,7 @@ static DRIVER_INIT( claypign )
|
||||
|
||||
static DRIVER_INIT( topsecex )
|
||||
{
|
||||
exidy440_state *state = machine->driver_data<exidy440_state>();
|
||||
DRIVER_INIT_CALL(exidy440);
|
||||
|
||||
/* extra input ports and scrolling */
|
||||
@ -1954,12 +1956,13 @@ static DRIVER_INIT( topsecex )
|
||||
memory_install_read_port(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x2ec6, 0x2ec6, 0, 0, "AN0");
|
||||
memory_install_read_port(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x2ec7, 0x2ec7, 0, 0, "IN4");
|
||||
|
||||
topsecex_yscroll = memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x2ec1, 0x2ec1, 0, 0, topsecex_yscroll_w);
|
||||
state->topsecex_yscroll = memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x2ec1, 0x2ec1, 0, 0, topsecex_yscroll_w);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( showdown )
|
||||
{
|
||||
exidy440_state *state = machine->driver_data<exidy440_state>();
|
||||
static const UINT8 bankdata0[0x18] =
|
||||
{
|
||||
0x15,0x40,0xc1,0x8d,0x4c,0x84,0x0e,0xce,
|
||||
@ -1976,13 +1979,14 @@ static DRIVER_INIT( showdown )
|
||||
DRIVER_INIT_CALL(exidy440);
|
||||
|
||||
/* set up the fake PLD */
|
||||
showdown_bank_data[0] = bankdata0;
|
||||
showdown_bank_data[1] = bankdata1;
|
||||
state->showdown_bank_data[0] = bankdata0;
|
||||
state->showdown_bank_data[1] = bankdata1;
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( yukon )
|
||||
{
|
||||
exidy440_state *state = machine->driver_data<exidy440_state>();
|
||||
static const UINT8 bankdata0[0x18] =
|
||||
{
|
||||
0x31,0x40,0xc1,0x95,0x54,0x90,0x16,0xd6,
|
||||
@ -1999,8 +2003,8 @@ static DRIVER_INIT( yukon )
|
||||
DRIVER_INIT_CALL(exidy440);
|
||||
|
||||
/* set up the fake PLD */
|
||||
showdown_bank_data[0] = bankdata0;
|
||||
showdown_bank_data[1] = bankdata1;
|
||||
state->showdown_bank_data[0] = bankdata0;
|
||||
state->showdown_bank_data[1] = bankdata1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,6 +59,21 @@ Hopper, Ticket Counter, Prize System (Option)
|
||||
#include "machine/i2cmem.h"
|
||||
|
||||
|
||||
enum nand_mode_t
|
||||
{
|
||||
NAND_M_INIT, // initial state
|
||||
NAND_M_READ, // read page data
|
||||
};
|
||||
|
||||
struct nand_t
|
||||
{
|
||||
nand_mode_t mode;
|
||||
int page_addr;
|
||||
int byte_addr;
|
||||
int addr_load_ptr;
|
||||
};
|
||||
|
||||
|
||||
class ghosteo_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -69,6 +84,7 @@ public:
|
||||
UINT32 *steppingstone;
|
||||
int security_count;
|
||||
UINT32 bballoon_port[20];
|
||||
struct nand_t nand;
|
||||
};
|
||||
|
||||
|
||||
@ -98,22 +114,6 @@ NAND Flash Controller (4KB internal buffer)
|
||||
static const UINT8 security_data[] = { 0x01, 0xC4, 0xFF, 0x22 };
|
||||
|
||||
|
||||
enum nand_mode_t
|
||||
{
|
||||
NAND_M_INIT, // initial state
|
||||
NAND_M_READ, // read page data
|
||||
};
|
||||
|
||||
struct nand_t
|
||||
{
|
||||
nand_mode_t mode;
|
||||
int page_addr;
|
||||
int byte_addr;
|
||||
int addr_load_ptr;
|
||||
};
|
||||
|
||||
static struct nand_t nand;
|
||||
|
||||
static UINT32 s3c2410_gpio_port_r( device_t *device, int port)
|
||||
{
|
||||
ghosteo_state *state = device->machine->driver_data<ghosteo_state>();
|
||||
@ -167,6 +167,8 @@ static void s3c2410_gpio_port_w( device_t *device, int port, UINT32 data)
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( s3c2410_nand_command_w )
|
||||
{
|
||||
ghosteo_state *state = device->machine->driver_data<ghosteo_state>();
|
||||
struct nand_t &nand = state->nand;
|
||||
// device_t *nand = device->machine->device( "nand");
|
||||
logerror( "s3c2410_nand_command_w %02X\n", data);
|
||||
switch (data)
|
||||
@ -189,6 +191,8 @@ static WRITE8_DEVICE_HANDLER( s3c2410_nand_command_w )
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( s3c2410_nand_address_w )
|
||||
{
|
||||
ghosteo_state *state = device->machine->driver_data<ghosteo_state>();
|
||||
struct nand_t &nand = state->nand;
|
||||
// device_t *nand = device->machine->device( "nand");
|
||||
logerror( "s3c2410_nand_address_w %02X\n", data);
|
||||
switch (nand.mode)
|
||||
@ -221,6 +225,8 @@ static WRITE8_DEVICE_HANDLER( s3c2410_nand_address_w )
|
||||
|
||||
static READ8_DEVICE_HANDLER( s3c2410_nand_data_r )
|
||||
{
|
||||
ghosteo_state *state = device->machine->driver_data<ghosteo_state>();
|
||||
struct nand_t &nand = state->nand;
|
||||
// device_t *nand = device->machine->device( "nand");
|
||||
UINT8 data = 0;
|
||||
switch (nand.mode)
|
||||
|
@ -204,26 +204,52 @@ Video sync 6 F Video sync Post 6 F Post
|
||||
#define CLIP_H (VIS_MAXY - VIS_MINY + 1)
|
||||
#define CLIP_BYTEW (CLIP_W << 1)
|
||||
|
||||
static UINT16 *render_layer[MAX_LAYERS];
|
||||
static UINT8 sound_fifo[MAX_SOUNDS];
|
||||
static UINT8 *gfx_plane02, *gfx_plane13, *collision_list;
|
||||
static UINT8 *scrolly0, *scrollx0, *scrolly1, *scrollx1;
|
||||
static UINT32 *internal_palette, *alpha_table;
|
||||
|
||||
static UINT8 *cpu1_base, *gfx1_base, *blitter_ram, *io_ram;
|
||||
static size_t blitter_ramsize, io_ramsize;
|
||||
class halleys_state : public driver_device
|
||||
{
|
||||
public:
|
||||
halleys_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
static int game_id, blitter_busy, collision_count, stars_enabled, bgcolor, ffcount, ffhead, fftail;
|
||||
static int mVectorType, sndnmi_mask, firq_level;
|
||||
static emu_timer *blitter_reset_timer;
|
||||
UINT16 *render_layer[MAX_LAYERS];
|
||||
UINT8 sound_fifo[MAX_SOUNDS];
|
||||
UINT8 *gfx_plane02;
|
||||
UINT8 *gfx_plane13;
|
||||
UINT8 *collision_list;
|
||||
UINT8 *scrolly0;
|
||||
UINT8 *scrollx0;
|
||||
UINT8 *scrolly1;
|
||||
UINT8 *scrollx1;
|
||||
UINT32 *internal_palette;
|
||||
UINT32 *alpha_table;
|
||||
UINT8 *cpu1_base;
|
||||
UINT8 *gfx1_base;
|
||||
UINT8 *blitter_ram;
|
||||
UINT8 *io_ram;
|
||||
size_t blitter_ramsize;
|
||||
size_t io_ramsize;
|
||||
int game_id;
|
||||
int blitter_busy;
|
||||
int collision_count;
|
||||
int stars_enabled;
|
||||
int bgcolor;
|
||||
int ffcount;
|
||||
int ffhead;
|
||||
int fftail;
|
||||
int mVectorType;
|
||||
int sndnmi_mask;
|
||||
int firq_level;
|
||||
emu_timer *blitter_reset_timer;
|
||||
offs_t collision_detection;
|
||||
int latch_delay;
|
||||
};
|
||||
|
||||
static offs_t halleys_collision_detection;
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// MB1551x Blitter Functions
|
||||
|
||||
static void blit(int offset)
|
||||
static void blit(halleys_state *state, int offset)
|
||||
{
|
||||
/*
|
||||
The render layers can be converted to standard MAME bitmaps but
|
||||
@ -307,7 +333,7 @@ static void blit(int offset)
|
||||
UINT16 ax; UINT8 al, ah; // partial regs
|
||||
|
||||
|
||||
param = blitter_ram + offset;
|
||||
param = state->blitter_ram + offset;
|
||||
|
||||
|
||||
#if HALLEYS_DEBUG
|
||||
@ -329,11 +355,11 @@ if (0) {
|
||||
// update sprite status
|
||||
layer = (code>>3 & 2) | (code>>7 & 1);
|
||||
offset >>= 4;
|
||||
status = (stptr) ? cpu1_base[stptr] : ACTIVE;
|
||||
status = (stptr) ? state->cpu1_base[stptr] : ACTIVE;
|
||||
flags = mode;
|
||||
group = mode & GROUP;
|
||||
command = code & COMMAND;
|
||||
if (game_id == GAME_HALLEYS)
|
||||
if (state->game_id == GAME_HALLEYS)
|
||||
{
|
||||
if (!layer) flags |= PPCD_ON;
|
||||
if (offset >= HALLEYS_SPLIT) flags |= AD_HIGH; else
|
||||
@ -361,7 +387,7 @@ if (0) {
|
||||
src1 &= 0x3fff;
|
||||
src2 &= 0x3fff;
|
||||
bank = ((code & BANKBIT0) | (color & BANKBIT1)) << 8;
|
||||
pal_ptr = internal_palette;
|
||||
pal_ptr = state->internal_palette;
|
||||
|
||||
|
||||
// the crossroad of fate
|
||||
@ -408,8 +434,8 @@ if (0) {
|
||||
|
||||
|
||||
// calculate entry points and loop constants
|
||||
src1_ptr = gfx_plane02 + ((bank + src1)<<3) + eax;
|
||||
src2_ptr = gfx_plane13 + ((bank + src2)<<3) + eax;
|
||||
src1_ptr = state->gfx_plane02 + ((bank + src1)<<3) + eax;
|
||||
src2_ptr = state->gfx_plane13 + ((bank + src2)<<3) + eax;
|
||||
|
||||
if (!(flags & (S1_IDLE | S2_IDLE)))
|
||||
{
|
||||
@ -419,7 +445,7 @@ if (0) {
|
||||
}
|
||||
else src_dy = src_dx = 0;
|
||||
|
||||
dst_ptr = render_layer[layer] + dst_skip;
|
||||
dst_ptr = state->render_layer[layer] + dst_skip;
|
||||
|
||||
|
||||
// look up pen values and set rendering flags
|
||||
@ -529,11 +555,11 @@ if (0) {
|
||||
// update collision list if object collided with the other group
|
||||
if (status & ACTIVE && ax & SP_COLLD)
|
||||
{
|
||||
collision_list[collision_count & (MAX_SPRITES-1)] = offset;
|
||||
collision_count++;
|
||||
state->collision_list[state->collision_count & (MAX_SPRITES-1)] = offset;
|
||||
state->collision_count++;
|
||||
|
||||
#if HALLEYS_DEBUG
|
||||
popmessage("ID:%02x CC:%3d", offset, collision_count);
|
||||
popmessage("ID:%02x CC:%3d", offset, state->collision_count);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -678,10 +704,10 @@ COMMAND_MODE:
|
||||
if (flags & S1_IDLE) src_dx = 0; else src_dx = 1;
|
||||
if (flags & S1_REV ) src_dx = -src_dx;
|
||||
|
||||
src_base = gfx1_base + bank;
|
||||
src_base = state->gfx1_base + bank;
|
||||
|
||||
if (command == STARPASS1 || command == STARPASS2) layer = (layer & 1) + 4;
|
||||
dst_base = render_layer[layer];
|
||||
dst_base = state->render_layer[layer];
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -705,17 +731,17 @@ COMMAND_MODE:
|
||||
if (!command && y == 0xff && h == 1)
|
||||
{
|
||||
y = 0; h = SCREEN_HEIGHT;
|
||||
dst_base = render_layer[(layer&1)+4];
|
||||
dst_base = state->render_layer[(layer&1)+4];
|
||||
WARP_WIPE_COMMON
|
||||
|
||||
stars_enabled = ~layer & 1;
|
||||
state->stars_enabled = ~layer & 1;
|
||||
}
|
||||
|
||||
// wipe background and chain-wipe corresponding sprite layer when the command is zero
|
||||
else
|
||||
{
|
||||
WARP_WIPE_COMMON
|
||||
if (!command) { dst_base = render_layer[layer&1]; WARP_WIPE_COMMON }
|
||||
if (!command) { dst_base = state->render_layer[layer&1]; WARP_WIPE_COMMON }
|
||||
}
|
||||
|
||||
} else
|
||||
@ -767,7 +793,7 @@ COMMAND_MODE:
|
||||
}
|
||||
}
|
||||
|
||||
stars_enabled = layer & 1;
|
||||
state->stars_enabled = layer & 1;
|
||||
|
||||
#undef RORB
|
||||
#undef C2S
|
||||
@ -835,7 +861,7 @@ COMMAND_MODE:
|
||||
if (flags & IGNORE_0) { w=8; h=8; WARP_WIPE_COMMON }
|
||||
|
||||
src1_ptr = src_base + src1;
|
||||
dst_ptr = render_layer[2] + (y << SCREEN_WIDTH_L2);
|
||||
dst_ptr = state->render_layer[2] + (y << SCREEN_WIDTH_L2);
|
||||
|
||||
src1_ptr += 8;
|
||||
edx = -8;
|
||||
@ -949,11 +975,12 @@ COMMAND_MODE:
|
||||
// draws Ben Bero Beh's color backdrop(verification required)
|
||||
static WRITE8_HANDLER( bgtile_w )
|
||||
{
|
||||
halleys_state *state = space->machine->driver_data<halleys_state>();
|
||||
int yskip, xskip, ecx;
|
||||
UINT16 *edi;
|
||||
UINT16 ax;
|
||||
|
||||
cpu1_base[0x1f00+offset] = data;
|
||||
state->cpu1_base[0x1f00+offset] = data;
|
||||
offset -= 0x18;
|
||||
|
||||
if (offset >= 191) return;
|
||||
@ -964,7 +991,7 @@ static WRITE8_HANDLER( bgtile_w )
|
||||
yskip = yskip * 48 + 24;
|
||||
xskip = xskip * 5 + 2;
|
||||
|
||||
edi = render_layer[2] + (yskip<<SCREEN_WIDTH_L2) + xskip + (48<<SCREEN_WIDTH_L2);
|
||||
edi = state->render_layer[2] + (yskip<<SCREEN_WIDTH_L2) + xskip + (48<<SCREEN_WIDTH_L2);
|
||||
ecx = -(48<<SCREEN_WIDTH_L2);
|
||||
ax = (UINT16)data | BG_RGB;
|
||||
|
||||
@ -974,7 +1001,8 @@ static WRITE8_HANDLER( bgtile_w )
|
||||
|
||||
static READ8_HANDLER( blitter_status_r )
|
||||
{
|
||||
if (game_id==GAME_HALLEYS && cpu_get_pc(space->cpu)==0x8017) return(0x55); // HACK: trick SRAM test on startup
|
||||
halleys_state *state = space->machine->driver_data<halleys_state>();
|
||||
if (state->game_id==GAME_HALLEYS && cpu_get_pc(space->cpu)==0x8017) return(0x55); // HACK: trick SRAM test on startup
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -982,39 +1010,42 @@ static READ8_HANDLER( blitter_status_r )
|
||||
|
||||
static READ8_HANDLER( blitter_r )
|
||||
{
|
||||
halleys_state *state = space->machine->driver_data<halleys_state>();
|
||||
int i = offset & 0xf;
|
||||
|
||||
if (i==0 || i==4) return(1);
|
||||
|
||||
return(blitter_ram[offset]);
|
||||
return(state->blitter_ram[offset]);
|
||||
}
|
||||
|
||||
|
||||
static TIMER_CALLBACK( blitter_reset )
|
||||
{
|
||||
blitter_busy = 0;
|
||||
halleys_state *state = machine->driver_data<halleys_state>();
|
||||
state->blitter_busy = 0;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( blitter_w )
|
||||
{
|
||||
halleys_state *state = space->machine->driver_data<halleys_state>();
|
||||
int i = offset & 0xf;
|
||||
|
||||
blitter_ram[offset] = data;
|
||||
state->blitter_ram[offset] = data;
|
||||
|
||||
if (i==0) blit(offset);
|
||||
if (i==0) blit(state, offset);
|
||||
|
||||
if (game_id == GAME_BENBEROB)
|
||||
if (state->game_id == GAME_BENBEROB)
|
||||
{
|
||||
if (i==0 || (i==4 && !data))
|
||||
{
|
||||
blitter_busy = 0;
|
||||
if (firq_level) cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE); // make up delayed FIRQ's
|
||||
state->blitter_busy = 0;
|
||||
if (state->firq_level) cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE); // make up delayed FIRQ's
|
||||
}
|
||||
else
|
||||
{
|
||||
blitter_busy = 1;
|
||||
blitter_reset_timer->adjust(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(100)); // free blitter if no updates in 100 cycles
|
||||
state->blitter_busy = 1;
|
||||
state->blitter_reset_timer->adjust(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(100)); // free blitter if no updates in 100 cycles
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1022,6 +1053,7 @@ static WRITE8_HANDLER( blitter_w )
|
||||
|
||||
static READ8_HANDLER( collision_id_r )
|
||||
{
|
||||
halleys_state *state = space->machine->driver_data<halleys_state>();
|
||||
/*
|
||||
Collision detection abstract:
|
||||
|
||||
@ -1044,14 +1076,14 @@ static READ8_HANDLER( collision_id_r )
|
||||
UPDATE: re-implemented pixel collision to accompany the hack method.
|
||||
*/
|
||||
|
||||
if (game_id==GAME_HALLEYS && cpu_get_pc(space->cpu)==halleys_collision_detection) // HACK: collision detection bypass
|
||||
if (state->game_id==GAME_HALLEYS && cpu_get_pc(space->cpu)==state->collision_detection) // HACK: collision detection bypass
|
||||
{
|
||||
if (collision_count) { collision_count--; return(collision_list[collision_count]); }
|
||||
if (state->collision_count) { state->collision_count--; return(state->collision_list[state->collision_count]); }
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
return(io_ram[0x66]);
|
||||
return(state->io_ram[0x66]);
|
||||
}
|
||||
|
||||
|
||||
@ -1060,8 +1092,9 @@ static READ8_HANDLER( collision_id_r )
|
||||
|
||||
static PALETTE_INIT( halleys )
|
||||
{
|
||||
halleys_state *state = machine->driver_data<halleys_state>();
|
||||
UINT32 d, r, g, b, i, j, count;
|
||||
UINT32 *pal_ptr = internal_palette;
|
||||
UINT32 *pal_ptr = state->internal_palette;
|
||||
|
||||
for (count=0; count<1024; count++)
|
||||
{
|
||||
@ -1153,8 +1186,9 @@ static void halleys_decode_rgb(running_machine *machine, UINT32 *r, UINT32 *g, U
|
||||
|
||||
static WRITE8_HANDLER( halleys_paletteram_IIRRGGBB_w )
|
||||
{
|
||||
halleys_state *state = space->machine->driver_data<halleys_state>();
|
||||
UINT32 d, r, g, b, i, j;
|
||||
UINT32 *pal_ptr = internal_palette;
|
||||
UINT32 *pal_ptr = state->internal_palette;
|
||||
|
||||
space->machine->generic.paletteram.u8[offset] = data;
|
||||
d = (UINT32)data;
|
||||
@ -1182,6 +1216,7 @@ static WRITE8_HANDLER( halleys_paletteram_IIRRGGBB_w )
|
||||
|
||||
static VIDEO_START( halleys )
|
||||
{
|
||||
halleys_state *state = machine->driver_data<halleys_state>();
|
||||
#define HALLEYS_Y0 0x8e
|
||||
#define HALLEYS_X0 0x9a
|
||||
#define HALLEYS_Y1 0xa2
|
||||
@ -1190,10 +1225,10 @@ static VIDEO_START( halleys )
|
||||
int dst, src, c;
|
||||
|
||||
// create short cuts to scroll registers
|
||||
scrolly0 = io_ram + HALLEYS_Y0;
|
||||
scrollx0 = io_ram + HALLEYS_X0;
|
||||
scrolly1 = io_ram + HALLEYS_Y1;
|
||||
scrollx1 = io_ram + HALLEYS_X1;
|
||||
state->scrolly0 = state->io_ram + HALLEYS_Y0;
|
||||
state->scrollx0 = state->io_ram + HALLEYS_X0;
|
||||
state->scrolly1 = state->io_ram + HALLEYS_Y1;
|
||||
state->scrollx1 = state->io_ram + HALLEYS_X1;
|
||||
|
||||
// fill alpha table
|
||||
for (src=0; src<256; src++)
|
||||
@ -1204,7 +1239,7 @@ static VIDEO_START( halleys )
|
||||
c += (((src&0x0c)+(dst&0x0c))>>1) & 0x0c;
|
||||
c += (((src&0x03)+(dst&0x03))>>1) & 0x03;
|
||||
|
||||
alpha_table[(src<<8)+dst] = c | BG_RGB;
|
||||
state->alpha_table[(src<<8)+dst] = c | BG_RGB;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1388,14 +1423,15 @@ static void copy_fixed_2b(bitmap_t *bitmap, UINT16 *source)
|
||||
}
|
||||
|
||||
|
||||
static void filter_bitmap(bitmap_t *bitmap, int mask)
|
||||
static void filter_bitmap(running_machine *machine, bitmap_t *bitmap, int mask)
|
||||
{
|
||||
halleys_state *state = machine->driver_data<halleys_state>();
|
||||
int dst_pitch;
|
||||
|
||||
UINT32 *pal_ptr, *edi;
|
||||
int esi, eax, ebx, ecx, edx;
|
||||
|
||||
pal_ptr = internal_palette;
|
||||
pal_ptr = state->internal_palette;
|
||||
esi = mask | 0xffffff00;
|
||||
edi = (UINT32*)BITMAP_ADDR16(bitmap, VIS_MINY, VIS_MINX + CLIP_W);
|
||||
dst_pitch = bitmap->rowpixels >> 1;
|
||||
@ -1430,41 +1466,43 @@ static void filter_bitmap(bitmap_t *bitmap, int mask)
|
||||
|
||||
static SCREEN_UPDATE( halleys )
|
||||
{
|
||||
halleys_state *state = screen->machine->driver_data<halleys_state>();
|
||||
int i, j;
|
||||
|
||||
if (stars_enabled)
|
||||
if (state->stars_enabled)
|
||||
{
|
||||
copy_scroll_op(bitmap, render_layer[5], *scrollx0, *scrolly0);
|
||||
copy_scroll_xp(bitmap, render_layer[4], *scrollx1, *scrolly1);
|
||||
copy_scroll_op(bitmap, state->render_layer[5], *state->scrollx0, *state->scrolly0);
|
||||
copy_scroll_xp(bitmap, state->render_layer[4], *state->scrollx1, *state->scrolly1);
|
||||
}
|
||||
else
|
||||
bitmap_fill(bitmap, cliprect, bgcolor);
|
||||
bitmap_fill(bitmap, cliprect, state->bgcolor);
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
if (input_port_read(screen->machine, "DEBUG")) copy_scroll_xp(bitmap, render_layer[3], *scrollx0, *scrolly0); // not used???
|
||||
if (input_port_read(screen->machine, "DEBUG")) copy_scroll_xp(bitmap, state->render_layer[3], *state->scrollx0, *state->scrolly0); // not used???
|
||||
#endif
|
||||
|
||||
copy_scroll_xp(bitmap, render_layer[2], *scrollx1, *scrolly1);
|
||||
copy_fixed_2b (bitmap, render_layer[1]);
|
||||
copy_fixed_xp (bitmap, render_layer[0]);
|
||||
copy_scroll_xp(bitmap, state->render_layer[2], *state->scrollx1, *state->scrolly1);
|
||||
copy_fixed_2b (bitmap, state->render_layer[1]);
|
||||
copy_fixed_xp (bitmap, state->render_layer[0]);
|
||||
|
||||
// HALF-HACK: apply RGB filter when the following conditions are met
|
||||
i = io_ram[0xa0];
|
||||
j = io_ram[0xa1];
|
||||
if (io_ram[0x2b] && (i>0xc6 && i<0xfe) && (j==0xc0 || j==0xed)) filter_bitmap(bitmap, i);
|
||||
i = state->io_ram[0xa0];
|
||||
j = state->io_ram[0xa1];
|
||||
if (state->io_ram[0x2b] && (i>0xc6 && i<0xfe) && (j==0xc0 || j==0xed)) filter_bitmap(screen->machine, bitmap, i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static SCREEN_UPDATE( benberob )
|
||||
{
|
||||
if (io_ram[0xa0] & 0x80)
|
||||
copy_scroll_op(bitmap, render_layer[2], *scrollx1, *scrolly1);
|
||||
halleys_state *state = screen->machine->driver_data<halleys_state>();
|
||||
if (state->io_ram[0xa0] & 0x80)
|
||||
copy_scroll_op(bitmap, state->render_layer[2], *state->scrollx1, *state->scrolly1);
|
||||
else
|
||||
bitmap_fill(bitmap, cliprect, bgcolor);
|
||||
bitmap_fill(bitmap, cliprect, state->bgcolor);
|
||||
|
||||
copy_fixed_xp (bitmap, render_layer[1]);
|
||||
copy_fixed_xp (bitmap, render_layer[0]);
|
||||
copy_fixed_xp (bitmap, state->render_layer[1]);
|
||||
copy_fixed_xp (bitmap, state->render_layer[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1476,7 +1514,11 @@ static SCREEN_UPDATE( benberob )
|
||||
|
||||
static READ8_HANDLER( zero_r ) { return(0); }
|
||||
|
||||
static READ8_HANDLER( debug_r ) { return(io_ram[offset]); }
|
||||
static READ8_HANDLER( debug_r )
|
||||
{
|
||||
halleys_state *state = space->machine->driver_data<halleys_state>();
|
||||
return(state->io_ram[offset]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1486,7 +1528,7 @@ static READ8_HANDLER( debug_r ) { return(io_ram[offset]); }
|
||||
|
||||
static INTERRUPT_GEN( halleys_interrupt )
|
||||
{
|
||||
static int latch_delay = 0;
|
||||
halleys_state *state = device->machine->driver_data<halleys_state>();
|
||||
UINT8 latch_data;
|
||||
|
||||
switch (cpu_getiloops(device))
|
||||
@ -1505,19 +1547,19 @@ static INTERRUPT_GEN( halleys_interrupt )
|
||||
|
||||
Current implementation is quite safe although not 100% foul-proof.
|
||||
*/
|
||||
if (latch_delay) latch_delay--; else
|
||||
if (ffcount)
|
||||
if (state->latch_delay) state->latch_delay--; else
|
||||
if (state->ffcount)
|
||||
{
|
||||
ffcount--;
|
||||
latch_data = sound_fifo[fftail];
|
||||
fftail = (fftail + 1) & (MAX_SOUNDS - 1);
|
||||
latch_delay = (latch_data) ? 0 : 4;
|
||||
state->ffcount--;
|
||||
latch_data = state->sound_fifo[state->fftail];
|
||||
state->fftail = (state->fftail + 1) & (MAX_SOUNDS - 1);
|
||||
state->latch_delay = (latch_data) ? 0 : 4;
|
||||
soundlatch_w( cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 0, latch_data);
|
||||
cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
// clear collision list of this frame unconditionally
|
||||
collision_count = 0;
|
||||
state->collision_count = 0;
|
||||
break;
|
||||
|
||||
// In Halley's Comet, NMI is used exclusively to handle coin input
|
||||
@ -1527,11 +1569,11 @@ static INTERRUPT_GEN( halleys_interrupt )
|
||||
|
||||
// FIRQ drives gameplay; we need both types of NMI each frame.
|
||||
case 2:
|
||||
mVectorType = 1; cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE);
|
||||
state->mVectorType = 1; cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
mVectorType = 0; cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE);
|
||||
state->mVectorType = 0; cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1539,19 +1581,19 @@ static INTERRUPT_GEN( halleys_interrupt )
|
||||
|
||||
static INTERRUPT_GEN( benberob_interrupt )
|
||||
{
|
||||
static int latch_delay = 0;
|
||||
halleys_state *state = device->machine->driver_data<halleys_state>();
|
||||
UINT8 latch_data;
|
||||
|
||||
switch (cpu_getiloops(device))
|
||||
{
|
||||
case 0:
|
||||
if (latch_delay) latch_delay--; else
|
||||
if (ffcount)
|
||||
if (state->latch_delay) state->latch_delay--; else
|
||||
if (state->ffcount)
|
||||
{
|
||||
ffcount--;
|
||||
latch_data = sound_fifo[fftail];
|
||||
fftail = (fftail + 1) & (MAX_SOUNDS - 1);
|
||||
latch_delay = (latch_data) ? 0 : 4;
|
||||
state->ffcount--;
|
||||
latch_data = state->sound_fifo[state->fftail];
|
||||
state->fftail = (state->fftail + 1) & (MAX_SOUNDS - 1);
|
||||
state->latch_delay = (latch_data) ? 0 : 4;
|
||||
soundlatch_w(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 0, latch_data);
|
||||
cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
@ -1564,7 +1606,7 @@ static INTERRUPT_GEN( benberob_interrupt )
|
||||
case 2:
|
||||
case 3:
|
||||
// FIRQ must not happen when the blitter is being updated or it'll cause serious screen artifacts
|
||||
if (!blitter_busy) cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE); else firq_level++;
|
||||
if (!state->blitter_busy) cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE); else state->firq_level++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1572,32 +1614,36 @@ static INTERRUPT_GEN( benberob_interrupt )
|
||||
|
||||
static READ8_HANDLER( vector_r )
|
||||
{
|
||||
return(cpu1_base[0xffe0 + (offset^(mVectorType<<4))]);
|
||||
halleys_state *state = space->machine->driver_data<halleys_state>();
|
||||
return(state->cpu1_base[0xffe0 + (offset^(state->mVectorType<<4))]);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( firq_ack_w )
|
||||
{
|
||||
io_ram[0x9c] = data;
|
||||
halleys_state *state = space->machine->driver_data<halleys_state>();
|
||||
state->io_ram[0x9c] = data;
|
||||
|
||||
if (firq_level) firq_level--;
|
||||
if (state->firq_level) state->firq_level--;
|
||||
cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( sndnmi_msk_w )
|
||||
{
|
||||
sndnmi_mask = data & 1;
|
||||
halleys_state *state = device->machine->driver_data<halleys_state>();
|
||||
state->sndnmi_mask = data & 1;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( soundcommand_w )
|
||||
{
|
||||
if (ffcount < MAX_SOUNDS)
|
||||
halleys_state *state = space->machine->driver_data<halleys_state>();
|
||||
if (state->ffcount < MAX_SOUNDS)
|
||||
{
|
||||
ffcount++;
|
||||
sound_fifo[ffhead] = io_ram[0x8a] = data;
|
||||
ffhead = (ffhead + 1) & (MAX_SOUNDS - 1);
|
||||
state->ffcount++;
|
||||
state->sound_fifo[state->ffhead] = state->io_ram[0x8a] = data;
|
||||
state->ffhead = (state->ffhead + 1) & (MAX_SOUNDS - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1631,7 +1677,7 @@ static READ8_HANDLER( io_mirror_r )
|
||||
// Memory Maps
|
||||
|
||||
static ADDRESS_MAP_START( halleys_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x0fff) AM_READWRITE(blitter_r, blitter_w) AM_BASE(&blitter_ram) AM_SIZE(&blitter_ramsize)
|
||||
AM_RANGE(0x0000, 0x0fff) AM_READWRITE(blitter_r, blitter_w) AM_BASE_MEMBER(halleys_state, blitter_ram) AM_SIZE_MEMBER(halleys_state, blitter_ramsize)
|
||||
AM_RANGE(0x1f00, 0x1fff) AM_WRITE(bgtile_w) // background tiles?(Ben Bero Beh only)
|
||||
AM_RANGE(0x1000, 0xefff) AM_ROM
|
||||
AM_RANGE(0xf000, 0xfeff) AM_RAM // work ram
|
||||
@ -1649,7 +1695,7 @@ static ADDRESS_MAP_START( halleys_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xff96, 0xff96) AM_READ_PORT("DSW2") // dipswitch 3
|
||||
AM_RANGE(0xff97, 0xff97) AM_READ_PORT("DSW3") // dipswitch 2
|
||||
AM_RANGE(0xff9c, 0xff9c) AM_WRITE(firq_ack_w)
|
||||
AM_RANGE(0xff00, 0xffbf) AM_RAM AM_BASE(&io_ram) AM_SIZE(&io_ramsize) // I/O write fall-through
|
||||
AM_RANGE(0xff00, 0xffbf) AM_RAM AM_BASE_MEMBER(halleys_state, io_ram) AM_SIZE_MEMBER(halleys_state, io_ramsize) // I/O write fall-through
|
||||
|
||||
AM_RANGE(0xffc0, 0xffdf) AM_RAM_WRITE(halleys_paletteram_IIRRGGBB_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xffe0, 0xffff) AM_READ(vector_r)
|
||||
@ -1909,16 +1955,17 @@ INPUT_PORTS_END
|
||||
|
||||
static MACHINE_RESET( halleys )
|
||||
{
|
||||
mVectorType = 0;
|
||||
firq_level = 0;
|
||||
blitter_busy = 0;
|
||||
collision_count = 0;
|
||||
stars_enabled = 0;
|
||||
bgcolor = get_black_pen(machine);
|
||||
fftail = ffhead = ffcount = 0;
|
||||
halleys_state *state = machine->driver_data<halleys_state>();
|
||||
state->mVectorType = 0;
|
||||
state->firq_level = 0;
|
||||
state->blitter_busy = 0;
|
||||
state->collision_count = 0;
|
||||
state->stars_enabled = 0;
|
||||
state->bgcolor = get_black_pen(machine);
|
||||
state->fftail = state->ffhead = state->ffcount = 0;
|
||||
|
||||
memset(io_ram, 0xff, io_ramsize);
|
||||
memset(render_layer[0], 0, SCREEN_BYTESIZE * MAX_LAYERS);
|
||||
memset(state->io_ram, 0xff, state->io_ramsize);
|
||||
memset(state->render_layer[0], 0, SCREEN_BYTESIZE * MAX_LAYERS);
|
||||
}
|
||||
|
||||
|
||||
@ -1933,7 +1980,7 @@ static const ay8910_interface ay8910_config =
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( halleys, driver_device )
|
||||
static MACHINE_CONFIG_START( halleys, halleys_state )
|
||||
MCFG_CPU_ADD("maincpu", M6809, XTAL_19_968MHz/12) /* verified on pcb */
|
||||
MCFG_CPU_PROGRAM_MAP(halleys_map)
|
||||
MCFG_CPU_VBLANK_INT_HACK(halleys_interrupt, 4)
|
||||
@ -2133,6 +2180,7 @@ ROM_END
|
||||
|
||||
static void init_common(running_machine *machine)
|
||||
{
|
||||
halleys_state *state = machine->driver_data<halleys_state>();
|
||||
UINT8 *buf, *rom;
|
||||
int addr, i;
|
||||
UINT8 al, ah, dl, dh;
|
||||
@ -2140,34 +2188,34 @@ static void init_common(running_machine *machine)
|
||||
|
||||
// allocate memory for unpacked graphics
|
||||
buf = auto_alloc_array(machine, UINT8, 0x100000);
|
||||
gfx_plane02 = buf;
|
||||
gfx_plane13 = buf + 0x80000;
|
||||
state->gfx_plane02 = buf;
|
||||
state->gfx_plane13 = buf + 0x80000;
|
||||
|
||||
|
||||
// allocate memory for render layers
|
||||
buf = auto_alloc_array(machine, UINT8, SCREEN_BYTESIZE * MAX_LAYERS);
|
||||
for (i=0; i<MAX_LAYERS; buf+=SCREEN_BYTESIZE, i++) render_layer[i] = (UINT16*)buf;
|
||||
for (i=0; i<MAX_LAYERS; buf+=SCREEN_BYTESIZE, i++) state->render_layer[i] = (UINT16*)buf;
|
||||
|
||||
|
||||
// allocate memory for pre-processed ROMs
|
||||
gfx1_base = auto_alloc_array(machine, UINT8, 0x20000);
|
||||
state->gfx1_base = auto_alloc_array(machine, UINT8, 0x20000);
|
||||
|
||||
|
||||
// allocate memory for alpha table
|
||||
alpha_table = auto_alloc_array(machine, UINT32, 0x10000);
|
||||
state->alpha_table = auto_alloc_array(machine, UINT32, 0x10000);
|
||||
|
||||
|
||||
// allocate memory for internal palette
|
||||
internal_palette = auto_alloc_array(machine, UINT32, PALETTE_SIZE);
|
||||
state->internal_palette = auto_alloc_array(machine, UINT32, PALETTE_SIZE);
|
||||
|
||||
|
||||
// allocate memory for hardware collision list
|
||||
collision_list = auto_alloc_array(machine, UINT8, MAX_SPRITES);
|
||||
state->collision_list = auto_alloc_array(machine, UINT8, MAX_SPRITES);
|
||||
|
||||
|
||||
// decrypt main program ROM
|
||||
rom = cpu1_base = machine->region("maincpu")->base();
|
||||
buf = gfx1_base;
|
||||
rom = state->cpu1_base = machine->region("maincpu")->base();
|
||||
buf = state->gfx1_base;
|
||||
|
||||
for (i=0; i<0x10000; i++)
|
||||
{
|
||||
@ -2180,14 +2228,14 @@ static void init_common(running_machine *machine)
|
||||
|
||||
// swap graphics ROM addresses and unpack each pixel
|
||||
rom = machine->region("gfx1")->base();
|
||||
buf = gfx_plane02;
|
||||
buf = state->gfx_plane02;
|
||||
|
||||
for (i=0xffff; i>=0; i--)
|
||||
{
|
||||
al = rom[i];
|
||||
ah = rom[i+0x10000];
|
||||
gfx1_base[0xffff-i] = al;
|
||||
gfx1_base[0x1ffff-i] = ah;
|
||||
state->gfx1_base[0xffff-i] = al;
|
||||
state->gfx1_base[0x1ffff-i] = ah;
|
||||
|
||||
buf[0] = dl = (al & 1) | (ah<<2 & 4); dl <<= 1;
|
||||
buf[1] = dh = (al>>1 & 1) | (ah<<1 & 4); dh <<= 1;
|
||||
@ -2213,26 +2261,29 @@ static void init_common(running_machine *machine)
|
||||
|
||||
static DRIVER_INIT( benberob )
|
||||
{
|
||||
game_id = GAME_BENBEROB;
|
||||
halleys_state *state = machine->driver_data<halleys_state>();
|
||||
state->game_id = GAME_BENBEROB;
|
||||
|
||||
init_common(machine);
|
||||
|
||||
blitter_reset_timer = machine->scheduler().timer_alloc(FUNC(blitter_reset));
|
||||
state->blitter_reset_timer = machine->scheduler().timer_alloc(FUNC(blitter_reset));
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( halleys )
|
||||
{
|
||||
game_id = GAME_HALLEYS;
|
||||
halleys_collision_detection = 0xb114;
|
||||
halleys_state *state = machine->driver_data<halleys_state>();
|
||||
state->game_id = GAME_HALLEYS;
|
||||
state->collision_detection = 0xb114;
|
||||
|
||||
init_common(machine);
|
||||
}
|
||||
|
||||
static DRIVER_INIT( halley87 )
|
||||
{
|
||||
game_id = GAME_HALLEYS;
|
||||
halleys_collision_detection = 0xb10d;
|
||||
halleys_state *state = machine->driver_data<halleys_state>();
|
||||
state->game_id = GAME_HALLEYS;
|
||||
state->collision_detection = 0xb10d;
|
||||
|
||||
init_common(machine);
|
||||
}
|
||||
|
@ -70,6 +70,17 @@ Notes:
|
||||
#include "machine/nvram.h"
|
||||
|
||||
|
||||
struct blitter_t
|
||||
{
|
||||
|
||||
UINT16 x, y, w, h,
|
||||
gfx_lo, gfx_hi,
|
||||
depth,
|
||||
pen,
|
||||
flags;
|
||||
|
||||
};
|
||||
|
||||
class igs011_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -93,6 +104,7 @@ public:
|
||||
UINT16 igs003_reg[2];
|
||||
UINT16 lhb_irq_enable;
|
||||
UINT16 *vbowl_trackball;
|
||||
blitter_t blitter;
|
||||
};
|
||||
|
||||
|
||||
@ -277,31 +289,68 @@ static WRITE16_HANDLER( igs011_palette )
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static struct
|
||||
|
||||
static WRITE16_HANDLER( igs011_blit_x_w )
|
||||
{
|
||||
igs011_state *state = space->machine->driver_data<igs011_state>();
|
||||
struct blitter_t &blitter = state->blitter;
|
||||
COMBINE_DATA(&blitter.x);
|
||||
}
|
||||
|
||||
UINT16 x, y, w, h,
|
||||
gfx_lo, gfx_hi,
|
||||
depth,
|
||||
pen,
|
||||
flags;
|
||||
static WRITE16_HANDLER( igs011_blit_y_w )
|
||||
{
|
||||
igs011_state *state = space->machine->driver_data<igs011_state>();
|
||||
struct blitter_t &blitter = state->blitter;
|
||||
COMBINE_DATA(&blitter.y);
|
||||
}
|
||||
|
||||
} blitter;
|
||||
static WRITE16_HANDLER( igs011_blit_gfx_lo_w )
|
||||
{
|
||||
igs011_state *state = space->machine->driver_data<igs011_state>();
|
||||
struct blitter_t &blitter = state->blitter;
|
||||
COMBINE_DATA(&blitter.gfx_lo);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( igs011_blit_gfx_hi_w )
|
||||
{
|
||||
igs011_state *state = space->machine->driver_data<igs011_state>();
|
||||
struct blitter_t &blitter = state->blitter;
|
||||
COMBINE_DATA(&blitter.gfx_hi);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( igs011_blit_x_w ) { COMBINE_DATA(&blitter.x); }
|
||||
static WRITE16_HANDLER( igs011_blit_y_w ) { COMBINE_DATA(&blitter.y); }
|
||||
static WRITE16_HANDLER( igs011_blit_gfx_lo_w ) { COMBINE_DATA(&blitter.gfx_lo); }
|
||||
static WRITE16_HANDLER( igs011_blit_gfx_hi_w ) { COMBINE_DATA(&blitter.gfx_hi); }
|
||||
static WRITE16_HANDLER( igs011_blit_w_w ) { COMBINE_DATA(&blitter.w); }
|
||||
static WRITE16_HANDLER( igs011_blit_h_w ) { COMBINE_DATA(&blitter.h); }
|
||||
static WRITE16_HANDLER( igs011_blit_depth_w ) { COMBINE_DATA(&blitter.depth); }
|
||||
static WRITE16_HANDLER( igs011_blit_pen_w ) { COMBINE_DATA(&blitter.pen); }
|
||||
static WRITE16_HANDLER( igs011_blit_w_w )
|
||||
{
|
||||
igs011_state *state = space->machine->driver_data<igs011_state>();
|
||||
struct blitter_t &blitter = state->blitter;
|
||||
COMBINE_DATA(&blitter.w);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( igs011_blit_h_w )
|
||||
{
|
||||
igs011_state *state = space->machine->driver_data<igs011_state>();
|
||||
struct blitter_t &blitter = state->blitter;
|
||||
COMBINE_DATA(&blitter.h);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( igs011_blit_depth_w )
|
||||
{
|
||||
igs011_state *state = space->machine->driver_data<igs011_state>();
|
||||
struct blitter_t &blitter = state->blitter;
|
||||
COMBINE_DATA(&blitter.depth);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( igs011_blit_pen_w )
|
||||
{
|
||||
igs011_state *state = space->machine->driver_data<igs011_state>();
|
||||
struct blitter_t &blitter = state->blitter;
|
||||
COMBINE_DATA(&blitter.pen);
|
||||
}
|
||||
|
||||
|
||||
static WRITE16_HANDLER( igs011_blit_flags_w )
|
||||
{
|
||||
igs011_state *state = space->machine->driver_data<igs011_state>();
|
||||
struct blitter_t &blitter = state->blitter;
|
||||
int x, xstart, xend, xinc, flipx;
|
||||
int y, ystart, yend, yinc, flipy;
|
||||
int depth4, clear, opaque, z;
|
||||
|
@ -68,22 +68,29 @@ Dumping Notes:
|
||||
#include "render.h"
|
||||
#include "machine/laserdsc.h"
|
||||
|
||||
|
||||
class lgp_state : public driver_device
|
||||
{
|
||||
public:
|
||||
lgp_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
device_t *laserdisc;
|
||||
UINT8 *tile_ram;
|
||||
UINT8 *tile_control_ram;
|
||||
emu_timer *irq_timer;
|
||||
};
|
||||
|
||||
|
||||
/* From italiandoh's notes */
|
||||
#define CPU_PCB_CLOCK (8000000)
|
||||
#define SOUND_PCB_CLOCK (6000000)
|
||||
|
||||
/* Misc variables */
|
||||
static device_t *laserdisc;
|
||||
|
||||
static UINT8 *tile_ram;
|
||||
static UINT8 *tile_control_ram;
|
||||
|
||||
static emu_timer *irq_timer;
|
||||
|
||||
|
||||
/* VIDEO GOODS */
|
||||
static SCREEN_UPDATE( lgp )
|
||||
{
|
||||
lgp_state *state = screen->machine->driver_data<lgp_state>();
|
||||
int charx, chary;
|
||||
|
||||
/* make color 0 transparent */
|
||||
@ -102,7 +109,7 @@ static SCREEN_UPDATE( lgp )
|
||||
/* Somewhere there's a flag that offsets the tilemap by 0x100*x */
|
||||
/* Palette is likely set somewhere as well (tile_control_ram?) */
|
||||
drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[0],
|
||||
tile_ram[current_screen_character],
|
||||
state->tile_ram[current_screen_character],
|
||||
0,
|
||||
0, 0, charx*8, chary*8, 0);
|
||||
}
|
||||
@ -116,12 +123,14 @@ static SCREEN_UPDATE( lgp )
|
||||
/* Main Z80 R/W */
|
||||
static READ8_HANDLER(ldp_read)
|
||||
{
|
||||
return laserdisc_data_r(laserdisc);
|
||||
lgp_state *state = space->machine->driver_data<lgp_state>();
|
||||
return laserdisc_data_r(state->laserdisc);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER(ldp_write)
|
||||
{
|
||||
laserdisc_data_w(laserdisc,data);
|
||||
lgp_state *state = space->machine->driver_data<lgp_state>();
|
||||
laserdisc_data_w(state->laserdisc,data);
|
||||
}
|
||||
|
||||
|
||||
@ -131,8 +140,8 @@ static WRITE8_HANDLER(ldp_write)
|
||||
/* PROGRAM MAPS */
|
||||
static ADDRESS_MAP_START( main_program_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000,0x7fff) AM_ROM
|
||||
AM_RANGE(0xe000,0xe3ff) AM_RAM AM_BASE(&tile_ram)
|
||||
AM_RANGE(0xe400,0xe7ff) AM_RAM AM_BASE(&tile_control_ram)
|
||||
AM_RANGE(0xe000,0xe3ff) AM_RAM AM_BASE_MEMBER(lgp_state, tile_ram)
|
||||
AM_RANGE(0xe400,0xe7ff) AM_RAM AM_BASE_MEMBER(lgp_state, tile_control_ram)
|
||||
|
||||
// AM_RANGE(0xef00,0xef00) AM_READ_PORT("IN_TEST")
|
||||
AM_RANGE(0xef80,0xef80) AM_READWRITE(ldp_read,ldp_write)
|
||||
@ -324,24 +333,26 @@ static TIMER_CALLBACK( irq_stop )
|
||||
|
||||
static INTERRUPT_GEN( vblank_callback_lgp )
|
||||
{
|
||||
lgp_state *state = device->machine->driver_data<lgp_state>();
|
||||
// NMI
|
||||
//cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
|
||||
|
||||
// IRQ
|
||||
cpu_set_input_line(device, 0, ASSERT_LINE);
|
||||
irq_timer->adjust(attotime::from_usec(50));
|
||||
state->irq_timer->adjust(attotime::from_usec(50));
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_START( lgp )
|
||||
{
|
||||
laserdisc = machine->device("laserdisc");
|
||||
irq_timer = machine->scheduler().timer_alloc(FUNC(irq_stop));
|
||||
lgp_state *state = machine->driver_data<lgp_state>();
|
||||
state->laserdisc = machine->device("laserdisc");
|
||||
state->irq_timer = machine->scheduler().timer_alloc(FUNC(irq_stop));
|
||||
}
|
||||
|
||||
|
||||
/* DRIVER */
|
||||
static MACHINE_CONFIG_START( lgp, driver_device )
|
||||
static MACHINE_CONFIG_START( lgp, lgp_state )
|
||||
/* main cpu */
|
||||
MCFG_CPU_ADD("maincpu", Z80, CPU_PCB_CLOCK)
|
||||
MCFG_CPU_PROGRAM_MAP(main_program_map)
|
||||
|
@ -35,18 +35,18 @@ Notes:
|
||||
#include "sound/2151intf.h"
|
||||
#include "includes/m90.h"
|
||||
|
||||
static UINT32 bankaddress;
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
static void set_m90_bank(running_machine *machine)
|
||||
{
|
||||
m90_state *state = machine->driver_data<m90_state>();
|
||||
UINT8 *rom = machine->region("user1")->base();
|
||||
|
||||
if (!rom)
|
||||
popmessage("bankswitch with no banked ROM!");
|
||||
else
|
||||
memory_set_bankptr(machine, "bank1",rom + bankaddress);
|
||||
memory_set_bankptr(machine, "bank1",rom + state->bankaddress);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@ -64,9 +64,10 @@ static WRITE16_HANDLER( m90_coincounter_w )
|
||||
|
||||
static WRITE16_HANDLER( quizf1_bankswitch_w )
|
||||
{
|
||||
m90_state *state = space->machine->driver_data<m90_state>();
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
bankaddress = 0x10000 * (data & 0x0f);
|
||||
state->bankaddress = 0x10000 * (data & 0x0f);
|
||||
set_m90_bank(space->machine);
|
||||
}
|
||||
}
|
||||
@ -84,7 +85,7 @@ static ADDRESS_MAP_START( m90_main_cpu_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x00000, 0x7ffff) AM_ROM
|
||||
AM_RANGE(0x80000, 0x8ffff) AM_ROMBANK("bank1") /* Quiz F1 only */
|
||||
AM_RANGE(0xa0000, 0xa3fff) AM_RAM
|
||||
AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE(&m90_video_data)
|
||||
AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE_MEMBER(m90_state, video_data)
|
||||
AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xffff0, 0xfffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
@ -93,7 +94,7 @@ static ADDRESS_MAP_START( dynablsb_main_cpu_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x00000, 0x3ffff) AM_ROM
|
||||
AM_RANGE(0x6000e, 0x60fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xa0000, 0xa3fff) AM_RAM
|
||||
AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE(&m90_video_data)
|
||||
AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE_MEMBER(m90_state, video_data)
|
||||
AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xffff0, 0xfffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
@ -102,7 +103,7 @@ static ADDRESS_MAP_START( bomblord_main_cpu_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x00000, 0x7ffff) AM_ROM
|
||||
AM_RANGE(0xa0000, 0xa3fff) AM_RAM
|
||||
AM_RANGE(0xc000e, 0xc0fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE(&m90_video_data)
|
||||
AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE_MEMBER(m90_state, video_data)
|
||||
AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xffff0, 0xfffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
@ -695,7 +696,7 @@ static INTERRUPT_GEN( bomblord_interrupt )
|
||||
|
||||
|
||||
/* Basic hardware -- no decryption table is setup for CPU */
|
||||
static MACHINE_CONFIG_START( m90, driver_device )
|
||||
static MACHINE_CONFIG_START( m90, m90_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", V35,XTAL_32MHz/2)
|
||||
MCFG_CPU_PROGRAM_MAP(m90_main_cpu_map)
|
||||
@ -1144,10 +1145,11 @@ static STATE_POSTLOAD( quizf1_postload )
|
||||
|
||||
static DRIVER_INIT( quizf1 )
|
||||
{
|
||||
bankaddress = 0;
|
||||
m90_state *state = machine->driver_data<m90_state>();
|
||||
state->bankaddress = 0;
|
||||
set_m90_bank(machine);
|
||||
|
||||
state_save_register_global(machine, bankaddress);
|
||||
state_save_register_global(machine, state->bankaddress);
|
||||
machine->state().register_postload(quizf1_postload, NULL);
|
||||
}
|
||||
|
||||
|
@ -439,23 +439,6 @@
|
||||
#include "sound/msm5205.h"
|
||||
#include "machine/nvram.h"
|
||||
|
||||
/* RAM areas */
|
||||
static UINT8* mastboy_tileram;
|
||||
static UINT8* mastboy_vram;
|
||||
static UINT8* mastboy_colram;
|
||||
static UINT8* mastboy_workram;
|
||||
|
||||
/* Bank Control */
|
||||
static UINT8 mastboy_bank;
|
||||
|
||||
/* General */
|
||||
static int mastboy_irq0_ack;
|
||||
static int mastboy_backupram_enabled;
|
||||
|
||||
/* MSM5205 */
|
||||
static int mastboy_m5205_next;
|
||||
static int mastboy_m5205_part;
|
||||
static int mastboy_m5205_sambit0, mastboy_m5205_sambit1;
|
||||
|
||||
class mastboy_state : public driver_device
|
||||
{
|
||||
@ -465,6 +448,17 @@ public:
|
||||
m_nvram(*this, "nvram") { }
|
||||
|
||||
required_shared_ptr<UINT8> m_nvram;
|
||||
UINT8* tileram;
|
||||
UINT8* vram;
|
||||
UINT8* colram;
|
||||
UINT8* workram;
|
||||
UINT8 bank;
|
||||
int irq0_ack;
|
||||
int backupram_enabled;
|
||||
int m5205_next;
|
||||
int m5205_part;
|
||||
int m5205_sambit0;
|
||||
int m5205_sambit1;
|
||||
};
|
||||
|
||||
|
||||
@ -472,17 +466,19 @@ public:
|
||||
|
||||
static VIDEO_START(mastboy)
|
||||
{
|
||||
gfx_element_set_source(machine->gfx[0], mastboy_vram);
|
||||
mastboy_state *state = machine->driver_data<mastboy_state>();
|
||||
gfx_element_set_source(machine->gfx[0], state->vram);
|
||||
}
|
||||
|
||||
static SCREEN_UPDATE(mastboy)
|
||||
{
|
||||
mastboy_state *state = screen->machine->driver_data<mastboy_state>();
|
||||
int y,x,i;
|
||||
int count = 0x000;
|
||||
|
||||
for (i=0;i<0x200;i+=2)
|
||||
{
|
||||
int coldat = mastboy_colram[i+1] | (mastboy_colram[i+0]<<8);
|
||||
int coldat = state->colram[i+1] | (state->colram[i+0]<<8);
|
||||
|
||||
palette_set_color_rgb(screen->machine,i/2,pal4bit(coldat>>8),pal4bit(coldat>>12),pal4bit(coldat>>4));
|
||||
}
|
||||
@ -492,8 +488,8 @@ static SCREEN_UPDATE(mastboy)
|
||||
for (x=0;x<32;x++)
|
||||
{
|
||||
/* bytes 0 and 3 seem to be unused for rendering , they appear to contain data the game uses internally */
|
||||
int tileno = (mastboy_tileram[count+1]|(mastboy_tileram[count+2]<<8))&0xfff;
|
||||
int attr = (mastboy_tileram[count+2]&0xf0)>>4;
|
||||
int tileno = (state->tileram[count+1]|(state->tileram[count+2]<<8))&0xfff;
|
||||
int attr = (state->tileram[count+2]&0xf0)>>4;
|
||||
gfx_element *gfx;
|
||||
|
||||
if (tileno&0x800)
|
||||
@ -523,11 +519,12 @@ static SCREEN_UPDATE(mastboy)
|
||||
|
||||
static READ8_HANDLER(banked_ram_r)
|
||||
{
|
||||
if ((mastboy_bank&0x80) == 0x00)
|
||||
mastboy_state *state = space->machine->driver_data<mastboy_state>();
|
||||
if ((state->bank&0x80) == 0x00)
|
||||
{
|
||||
int bank;
|
||||
bank = mastboy_bank & 0x07;
|
||||
//if (mastboy_bank&0xf8) printf("invalid bank bits in vram/vrom read\n");
|
||||
bank = state->bank & 0x07;
|
||||
//if (state->bank&0xf8) printf("invalid bank bits in vram/vrom read\n");
|
||||
|
||||
if (bank>0x3) // ROM access
|
||||
{
|
||||
@ -539,14 +536,14 @@ static READ8_HANDLER(banked_ram_r)
|
||||
{
|
||||
bank &=0x3;
|
||||
/* we have to invert the data for the GFX decode */
|
||||
return mastboy_vram[offset+(bank*0x4000)]^0xff;
|
||||
return state->vram[offset+(bank*0x4000)]^0xff;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT8 *src;
|
||||
int bank;
|
||||
bank = mastboy_bank & 0x7f;
|
||||
bank = state->bank & 0x7f;
|
||||
src = space->machine->region ( "user1" )->base() + bank * 0x4000;
|
||||
return src[offset];
|
||||
}
|
||||
@ -554,10 +551,11 @@ static READ8_HANDLER(banked_ram_r)
|
||||
|
||||
static WRITE8_HANDLER( banked_ram_w )
|
||||
{
|
||||
if ((mastboy_bank&0x80) == 0x00)
|
||||
mastboy_state *state = space->machine->driver_data<mastboy_state>();
|
||||
if ((state->bank&0x80) == 0x00)
|
||||
{
|
||||
int bank;
|
||||
bank = mastboy_bank & 0x07;
|
||||
bank = state->bank & 0x07;
|
||||
//if (data&0xf8) printf("invalid bank bits in vram/vrom write\n");
|
||||
|
||||
if (bank>0x3) // ROM access
|
||||
@ -573,7 +571,7 @@ static WRITE8_HANDLER( banked_ram_w )
|
||||
offs = offset+(bank*0x4000);
|
||||
|
||||
/* we have to invert the data for the GFX decode */
|
||||
mastboy_vram[offs] = data^0xff;
|
||||
state->vram[offs] = data^0xff;
|
||||
|
||||
/* Decode the new tile */
|
||||
gfx_element_mark_dirty(space->machine->gfx[0], offs/32);
|
||||
@ -587,8 +585,9 @@ static WRITE8_HANDLER( banked_ram_w )
|
||||
|
||||
static WRITE8_HANDLER( mastboy_bank_w )
|
||||
{
|
||||
mastboy_state *state = space->machine->driver_data<mastboy_state>();
|
||||
// controls access to banked ram / rom
|
||||
mastboy_bank = data;
|
||||
state->bank = data;
|
||||
}
|
||||
|
||||
/* Backup RAM access */
|
||||
@ -602,7 +601,7 @@ static READ8_HANDLER( mastboy_backupram_r )
|
||||
static WRITE8_HANDLER( mastboy_backupram_w )
|
||||
{
|
||||
mastboy_state *state = space->machine->driver_data<mastboy_state>();
|
||||
// if (mastboy_backupram_enabled)
|
||||
// if (state->backupram_enabled)
|
||||
// {
|
||||
state->m_nvram[offset] = data;
|
||||
// }
|
||||
@ -614,52 +613,58 @@ static WRITE8_HANDLER( mastboy_backupram_w )
|
||||
|
||||
static WRITE8_HANDLER( backupram_enable_w )
|
||||
{
|
||||
mastboy_state *state = space->machine->driver_data<mastboy_state>();
|
||||
/* This is some kind of enable / disable control for backup ram (see Charles's notes) but I'm not
|
||||
sure how it works in practice, if we use it then it writes a lot of data with it disabled */
|
||||
mastboy_backupram_enabled = data&1;
|
||||
state->backupram_enabled = data&1;
|
||||
}
|
||||
|
||||
/* MSM5205 Related */
|
||||
|
||||
static WRITE8_HANDLER( msm5205_mastboy_m5205_sambit0_w )
|
||||
{
|
||||
mastboy_state *state = space->machine->driver_data<mastboy_state>();
|
||||
device_t *adpcm = space->machine->device("msm");
|
||||
|
||||
mastboy_m5205_sambit0 = data & 1;
|
||||
msm5205_playmode_w(adpcm, (1 << 2) | (mastboy_m5205_sambit1 << 1) | (mastboy_m5205_sambit0) );
|
||||
state->m5205_sambit0 = data & 1;
|
||||
msm5205_playmode_w(adpcm, (1 << 2) | (state->m5205_sambit1 << 1) | (state->m5205_sambit0) );
|
||||
|
||||
logerror("msm5205 samplerate bit 0, set to %02x\n",data);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( msm5205_mastboy_m5205_sambit1_w )
|
||||
{
|
||||
mastboy_state *state = space->machine->driver_data<mastboy_state>();
|
||||
device_t *adpcm = space->machine->device("msm");
|
||||
|
||||
mastboy_m5205_sambit1 = data & 1;
|
||||
state->m5205_sambit1 = data & 1;
|
||||
|
||||
msm5205_playmode_w(adpcm, (1 << 2) | (mastboy_m5205_sambit1 << 1) | (mastboy_m5205_sambit0) );
|
||||
msm5205_playmode_w(adpcm, (1 << 2) | (state->m5205_sambit1 << 1) | (state->m5205_sambit0) );
|
||||
|
||||
logerror("msm5205 samplerate bit 0, set to %02x\n",data);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( mastboy_msm5205_reset_w )
|
||||
{
|
||||
mastboy_m5205_part = 0;
|
||||
mastboy_state *state = device->machine->driver_data<mastboy_state>();
|
||||
state->m5205_part = 0;
|
||||
msm5205_reset_w(device,data&1);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( mastboy_msm5205_data_w )
|
||||
{
|
||||
mastboy_m5205_next = data;
|
||||
mastboy_state *state = space->machine->driver_data<mastboy_state>();
|
||||
state->m5205_next = data;
|
||||
}
|
||||
|
||||
static void mastboy_adpcm_int(device_t *device)
|
||||
{
|
||||
msm5205_data_w(device, mastboy_m5205_next);
|
||||
mastboy_m5205_next >>= 4;
|
||||
mastboy_state *state = device->machine->driver_data<mastboy_state>();
|
||||
msm5205_data_w(device, state->m5205_next);
|
||||
state->m5205_next >>= 4;
|
||||
|
||||
mastboy_m5205_part ^= 1;
|
||||
if(!mastboy_m5205_part)
|
||||
state->m5205_part ^= 1;
|
||||
if(!state->m5205_part)
|
||||
cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
@ -674,14 +679,16 @@ static const msm5205_interface msm5205_config =
|
||||
|
||||
static WRITE8_HANDLER( mastboy_irq0_ack_w )
|
||||
{
|
||||
mastboy_irq0_ack = data;
|
||||
mastboy_state *state = space->machine->driver_data<mastboy_state>();
|
||||
state->irq0_ack = data;
|
||||
if ((data & 1) == 1)
|
||||
cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
|
||||
}
|
||||
|
||||
static INTERRUPT_GEN( mastboy_interrupt )
|
||||
{
|
||||
if ((mastboy_irq0_ack & 1) == 1)
|
||||
mastboy_state *state = device->machine->driver_data<mastboy_state>();
|
||||
if ((state->irq0_ack & 1) == 1)
|
||||
{
|
||||
cpu_set_input_line(device, 0, ASSERT_LINE);
|
||||
}
|
||||
@ -693,9 +700,9 @@ static ADDRESS_MAP_START( mastboy_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x3fff) AM_ROM // Internal ROM
|
||||
AM_RANGE(0x4000, 0x7fff) AM_ROM // External ROM
|
||||
|
||||
AM_RANGE(0x8000, 0x8fff) AM_RAM AM_BASE(&mastboy_workram)// work ram
|
||||
AM_RANGE(0x9000, 0x9fff) AM_RAM AM_BASE(&mastboy_tileram)// tilemap ram
|
||||
AM_RANGE(0xa000, 0xa1ff) AM_RAM AM_BASE(&mastboy_colram) AM_MIRROR(0x0e00) // colour ram
|
||||
AM_RANGE(0x8000, 0x8fff) AM_RAM AM_BASE_MEMBER(mastboy_state, workram)// work ram
|
||||
AM_RANGE(0x9000, 0x9fff) AM_RAM AM_BASE_MEMBER(mastboy_state, tileram)// tilemap ram
|
||||
AM_RANGE(0xa000, 0xa1ff) AM_RAM AM_BASE_MEMBER(mastboy_state, colram) AM_MIRROR(0x0e00) // colour ram
|
||||
|
||||
AM_RANGE(0xc000, 0xffff) AM_READWRITE(banked_ram_r,banked_ram_w) // mastboy bank area read / write
|
||||
|
||||
@ -856,15 +863,16 @@ GFXDECODE_END
|
||||
|
||||
static MACHINE_RESET( mastboy )
|
||||
{
|
||||
mastboy_state *state = machine->driver_data<mastboy_state>();
|
||||
/* clear some ram */
|
||||
memset( mastboy_workram, 0x00, 0x01000);
|
||||
memset( mastboy_tileram, 0x00, 0x01000);
|
||||
memset( mastboy_colram, 0x00, 0x00200);
|
||||
memset( mastboy_vram, 0x00, 0x10000);
|
||||
memset( state->workram, 0x00, 0x01000);
|
||||
memset( state->tileram, 0x00, 0x01000);
|
||||
memset( state->colram, 0x00, 0x00200);
|
||||
memset( state->vram, 0x00, 0x10000);
|
||||
|
||||
mastboy_m5205_part = 0;
|
||||
state->m5205_part = 0;
|
||||
msm5205_reset_w(machine->device("msm"),1);
|
||||
mastboy_irq0_ack = 0;
|
||||
state->irq0_ack = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -984,7 +992,8 @@ ROM_END
|
||||
|
||||
static DRIVER_INIT( mastboy )
|
||||
{
|
||||
mastboy_vram = machine->region( "gfx1" )->base(); // makes decoding the RAM based tiles easier this way
|
||||
mastboy_state *state = machine->driver_data<mastboy_state>();
|
||||
state->vram = machine->region( "gfx1" )->base(); // makes decoding the RAM based tiles easier this way
|
||||
}
|
||||
|
||||
GAME( 1991, mastboy, 0, mastboy, mastboy, mastboy, ROT0, "Gaelco", "Master Boy (Spanish, PCB Rev A)", 0 )
|
||||
|
@ -27,17 +27,29 @@ TODO:
|
||||
#include "sound/2151intf.h"
|
||||
#include "sound/msm5205.h"
|
||||
|
||||
static UINT16 * ml_tileram;
|
||||
static UINT16 *g_ram;
|
||||
static UINT16 * ml_dotram;
|
||||
static UINT16 *dma_ram;
|
||||
static UINT32 adpcm_pos,adpcm_end;
|
||||
static int adpcm_data;
|
||||
static UINT8 adpcm_idle;
|
||||
static UINT8 pal_fg_bank;
|
||||
static int dma_active;
|
||||
static UINT16 dsp_HOLD_signal;
|
||||
static UINT8 *mecha_ram;
|
||||
|
||||
class mlanding_state : public driver_device
|
||||
{
|
||||
public:
|
||||
mlanding_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT16 * ml_tileram;
|
||||
UINT16 *g_ram;
|
||||
UINT16 * ml_dotram;
|
||||
UINT16 *dma_ram;
|
||||
UINT32 adpcm_pos;
|
||||
UINT32 adpcm_end;
|
||||
int adpcm_data;
|
||||
UINT8 adpcm_idle;
|
||||
UINT8 pal_fg_bank;
|
||||
int dma_active;
|
||||
UINT16 dsp_HOLD_signal;
|
||||
UINT8 *mecha_ram;
|
||||
UINT8 trigger;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static VIDEO_START(mlanding)
|
||||
{
|
||||
@ -49,19 +61,20 @@ static VIDEO_START(mlanding)
|
||||
// 768: plane landing sequence
|
||||
static SCREEN_UPDATE(mlanding)
|
||||
{
|
||||
mlanding_state *state = screen->machine->driver_data<mlanding_state>();
|
||||
int x, y;
|
||||
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; ++y)
|
||||
{
|
||||
UINT16 *src = &g_ram[y * 512/2 + cliprect->min_x];
|
||||
UINT16 *src = &state->g_ram[y * 512/2 + cliprect->min_x];
|
||||
UINT16 *dst = BITMAP_ADDR16(bitmap, y, cliprect->min_x);
|
||||
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x += 2)
|
||||
{
|
||||
UINT16 srcpix = *src++;
|
||||
|
||||
*dst++ = screen->machine->pens[256+(srcpix & 0xff) + (pal_fg_bank & 1 ? 0x100 : 0x000)];
|
||||
*dst++ = screen->machine->pens[256+(srcpix >> 8) + (pal_fg_bank & 1 ? 0x100 : 0x000)];
|
||||
*dst++ = screen->machine->pens[256+(srcpix & 0xff) + (state->pal_fg_bank & 1 ? 0x100 : 0x000)];
|
||||
*dst++ = screen->machine->pens[256+(srcpix >> 8) + (state->pal_fg_bank & 1 ? 0x100 : 0x000)];
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,8 +82,9 @@ static SCREEN_UPDATE(mlanding)
|
||||
}
|
||||
|
||||
/* Return the number of pixels processed for timing purposes? */
|
||||
static int start_dma(void)
|
||||
static int start_dma(running_machine *machine)
|
||||
{
|
||||
mlanding_state *state = machine->driver_data<mlanding_state>();
|
||||
/* Traverse the DMA RAM list */
|
||||
int offs;
|
||||
|
||||
@ -85,14 +99,14 @@ static int start_dma(void)
|
||||
|
||||
int j, k;
|
||||
|
||||
UINT16 attr = dma_ram[offs];
|
||||
UINT16 attr = state->dma_ram[offs];
|
||||
|
||||
if (attr == 0)
|
||||
continue;
|
||||
|
||||
x = dma_ram[offs + 1];
|
||||
y = dma_ram[offs + 2];
|
||||
colour = dma_ram[offs + 3];
|
||||
x = state->dma_ram[offs + 1];
|
||||
y = state->dma_ram[offs + 2];
|
||||
colour = state->dma_ram[offs + 3];
|
||||
|
||||
dx = x >> 11;
|
||||
dy = y >> 11;
|
||||
@ -127,8 +141,8 @@ static int start_dma(void)
|
||||
// Draw the 8x8 chunk
|
||||
for (y1 = 0; y1 < 8; ++y1)
|
||||
{
|
||||
UINT16 *src = &ml_tileram[(code * 2 * 8) + y1*2];
|
||||
UINT16 *dst = &g_ram[(y + k*8+y1)*512/2 + (j*8+x)/2];
|
||||
UINT16 *src = &state->ml_tileram[(code * 2 * 8) + y1*2];
|
||||
UINT16 *dst = &state->g_ram[(y + k*8+y1)*512/2 + (j*8+x)/2];
|
||||
|
||||
UINT8 p2 = *src & 0xff;
|
||||
UINT8 p1 = *src++ >> 8;
|
||||
@ -175,7 +189,7 @@ static int start_dma(void)
|
||||
for(y1 = 0; y1 < dy*8; y1++)
|
||||
{
|
||||
int x1;
|
||||
UINT16 *dst = &g_ram[((y + y1) * 512/2) + x/2];
|
||||
UINT16 *dst = &state->g_ram[((y + y1) * 512/2) + x/2];
|
||||
|
||||
for(x1 = 0; x1 < dx*8; x1+=2)
|
||||
{
|
||||
@ -189,17 +203,20 @@ static int start_dma(void)
|
||||
|
||||
static WRITE16_HANDLER(ml_tileram_w)
|
||||
{
|
||||
COMBINE_DATA(&ml_tileram[offset]);
|
||||
mlanding_state *state = space->machine->driver_data<mlanding_state>();
|
||||
COMBINE_DATA(&state->ml_tileram[offset]);
|
||||
}
|
||||
|
||||
static READ16_HANDLER(ml_tileram_r)
|
||||
{
|
||||
return ml_tileram[offset];
|
||||
mlanding_state *state = space->machine->driver_data<mlanding_state>();
|
||||
return state->ml_tileram[offset];
|
||||
}
|
||||
|
||||
|
||||
static READ16_HANDLER( io1_r ) //240006
|
||||
{
|
||||
mlanding_state *state = space->machine->driver_data<mlanding_state>();
|
||||
/*
|
||||
fedcba9876543210
|
||||
x - mecha driver status
|
||||
@ -211,13 +228,14 @@ static READ16_HANDLER( io1_r ) //240006
|
||||
*/
|
||||
// multiplexed? or just overriden?
|
||||
|
||||
int retval = (dma_active << 15) | (input_port_read(space->machine, "DSW") & 0x7fff);
|
||||
int retval = (state->dma_active << 15) | (input_port_read(space->machine, "DSW") & 0x7fff);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* output */
|
||||
static WRITE16_HANDLER(ml_output_w)
|
||||
{
|
||||
mlanding_state *state = space->machine->driver_data<mlanding_state>();
|
||||
/*
|
||||
x--- ---- palette fg bankswitch
|
||||
---x ---- coin lockout?
|
||||
@ -226,7 +244,7 @@ static WRITE16_HANDLER(ml_output_w)
|
||||
*/
|
||||
// popmessage("%04x",data);
|
||||
|
||||
pal_fg_bank = (data & 0x80)>>7;
|
||||
state->pal_fg_bank = (data & 0x80)>>7;
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
|
||||
@ -237,53 +255,55 @@ static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
|
||||
|
||||
static void ml_msm5205_vck(device_t *device)
|
||||
{
|
||||
static UINT8 trigger;
|
||||
mlanding_state *state = device->machine->driver_data<mlanding_state>();
|
||||
|
||||
// popmessage("%08x",adpcm_pos);
|
||||
// popmessage("%08x",state->adpcm_pos);
|
||||
|
||||
if (adpcm_pos >= 0x50000 || adpcm_idle)
|
||||
if (state->adpcm_pos >= 0x50000 || state->adpcm_idle)
|
||||
{
|
||||
//adpcm_idle = 1;
|
||||
//state->adpcm_idle = 1;
|
||||
msm5205_reset_w(device,1);
|
||||
trigger = 0;
|
||||
state->trigger = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT8 *ROM = device->machine->region("adpcm")->base();
|
||||
|
||||
adpcm_data = ((trigger ? (ROM[adpcm_pos] & 0x0f) : (ROM[adpcm_pos] & 0xf0)>>4) );
|
||||
msm5205_data_w(device,adpcm_data & 0xf);
|
||||
trigger^=1;
|
||||
if(trigger == 0)
|
||||
state->adpcm_data = ((state->trigger ? (ROM[state->adpcm_pos] & 0x0f) : (ROM[state->adpcm_pos] & 0xf0)>>4) );
|
||||
msm5205_data_w(device,state->adpcm_data & 0xf);
|
||||
state->trigger^=1;
|
||||
if(state->trigger == 0)
|
||||
{
|
||||
adpcm_pos++;
|
||||
state->adpcm_pos++;
|
||||
//cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
/*TODO: simplify this */
|
||||
if(ROM[adpcm_pos] == 0x00 && ROM[adpcm_pos+1] == 0x00 && ROM[adpcm_pos+2] == 0x00 && ROM[adpcm_pos+3] == 0x00
|
||||
&& ROM[adpcm_pos+4] == 0x00 && ROM[adpcm_pos+5] == 0x00 && ROM[adpcm_pos+6] == 0x00 && ROM[adpcm_pos+7] == 0x00
|
||||
&& ROM[adpcm_pos+8] == 0x00 && ROM[adpcm_pos+9] == 0x00 && ROM[adpcm_pos+10] == 0x00 && ROM[adpcm_pos+11] == 0x00
|
||||
&& ROM[adpcm_pos+12] == 0x00 && ROM[adpcm_pos+13] == 0x00 && ROM[adpcm_pos+14] == 0x00 && ROM[adpcm_pos+15] == 0x00)
|
||||
adpcm_idle = 1;
|
||||
if(ROM[state->adpcm_pos] == 0x00 && ROM[state->adpcm_pos+1] == 0x00 && ROM[state->adpcm_pos+2] == 0x00 && ROM[state->adpcm_pos+3] == 0x00
|
||||
&& ROM[state->adpcm_pos+4] == 0x00 && ROM[state->adpcm_pos+5] == 0x00 && ROM[state->adpcm_pos+6] == 0x00 && ROM[state->adpcm_pos+7] == 0x00
|
||||
&& ROM[state->adpcm_pos+8] == 0x00 && ROM[state->adpcm_pos+9] == 0x00 && ROM[state->adpcm_pos+10] == 0x00 && ROM[state->adpcm_pos+11] == 0x00
|
||||
&& ROM[state->adpcm_pos+12] == 0x00 && ROM[state->adpcm_pos+13] == 0x00 && ROM[state->adpcm_pos+14] == 0x00 && ROM[state->adpcm_pos+15] == 0x00)
|
||||
state->adpcm_idle = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static TIMER_CALLBACK( dma_complete )
|
||||
{
|
||||
dma_active = 0;
|
||||
mlanding_state *state = machine->driver_data<mlanding_state>();
|
||||
state->dma_active = 0;
|
||||
}
|
||||
|
||||
/* TODO: this uses many bits */
|
||||
static WRITE16_HANDLER( ml_sub_reset_w )
|
||||
{
|
||||
mlanding_state *state = space->machine->driver_data<mlanding_state>();
|
||||
int pixels;
|
||||
|
||||
// Return the number of pixels drawn?
|
||||
pixels = start_dma();
|
||||
pixels = start_dma(space->machine);
|
||||
|
||||
if (pixels)
|
||||
{
|
||||
dma_active = 1;
|
||||
state->dma_active = 1;
|
||||
space->machine->scheduler().timer_set(attotime::from_msec(20), FUNC(dma_complete));
|
||||
}
|
||||
|
||||
@ -295,7 +315,7 @@ static WRITE16_HANDLER( ml_sub_reset_w )
|
||||
if(!(data & 0x80)) // unknown line used
|
||||
{
|
||||
cputag_set_input_line(space->machine, "dsp", INPUT_LINE_RESET, CLEAR_LINE);
|
||||
dsp_HOLD_signal = data & 0x80;
|
||||
state->dsp_HOLD_signal = data & 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,8 +386,8 @@ static READ16_HANDLER( ml_analog1_msb_r )
|
||||
|
||||
static READ16_HANDLER( ml_analog2_msb_r )
|
||||
{
|
||||
static UINT8 res;
|
||||
static UINT16 y_adc,x_adc;
|
||||
UINT8 res;
|
||||
UINT16 y_adc,x_adc;
|
||||
|
||||
y_adc = input_port_read(space->machine, "STICKY");
|
||||
x_adc = input_port_read(space->machine, "STICKZ");
|
||||
@ -391,8 +411,8 @@ static READ16_HANDLER( ml_analog2_msb_r )
|
||||
|
||||
static READ16_HANDLER( ml_analog3_msb_r )
|
||||
{
|
||||
static UINT8 z_adc,res;
|
||||
static UINT16 x_adc;
|
||||
UINT8 z_adc,res;
|
||||
UINT16 x_adc;
|
||||
|
||||
z_adc = input_port_read(space->machine, "STICKX");
|
||||
x_adc = input_port_read(space->machine, "STICKZ");
|
||||
@ -419,24 +439,26 @@ static WRITE16_HANDLER( ml_nmi_to_sound_w )
|
||||
|
||||
static READ16_HANDLER( ml_mecha_ram_r )
|
||||
{
|
||||
return (mecha_ram[offset*2]<<8)|mecha_ram[offset*2+1];
|
||||
mlanding_state *state = space->machine->driver_data<mlanding_state>();
|
||||
return (state->mecha_ram[offset*2]<<8)|state->mecha_ram[offset*2+1];
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( ml_mecha_ram_w )
|
||||
{
|
||||
COMBINE_DATA(mecha_ram+offset*2+1);
|
||||
mlanding_state *state = space->machine->driver_data<mlanding_state>();
|
||||
COMBINE_DATA(state->mecha_ram+offset*2+1);
|
||||
data >>= 8;
|
||||
mem_mask >>= 8;
|
||||
COMBINE_DATA(mecha_ram+offset*2);
|
||||
COMBINE_DATA(state->mecha_ram+offset*2);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( mlanding_mem, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x05ffff) AM_ROM
|
||||
AM_RANGE(0x080000, 0x08ffff) AM_RAM
|
||||
|
||||
AM_RANGE(0x100000, 0x17ffff) AM_RAM AM_BASE(&g_ram)// 512kB G RAM - enough here for double buffered 512x400x8 frame
|
||||
AM_RANGE(0x180000, 0x1bffff) AM_READWRITE(ml_tileram_r, ml_tileram_w) AM_BASE(&ml_tileram)
|
||||
AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM AM_SHARE("share2") AM_BASE(&dma_ram)
|
||||
AM_RANGE(0x100000, 0x17ffff) AM_RAM AM_BASE_MEMBER(mlanding_state, g_ram)// 512kB G RAM - enough here for double buffered 512x400x8 frame
|
||||
AM_RANGE(0x180000, 0x1bffff) AM_READWRITE(ml_tileram_r, ml_tileram_w) AM_BASE_MEMBER(mlanding_state, ml_tileram)
|
||||
AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM AM_SHARE("share2") AM_BASE_MEMBER(mlanding_state, dma_ram)
|
||||
AM_RANGE(0x1c4000, 0x1cffff) AM_RAM AM_SHARE("share1")
|
||||
|
||||
AM_RANGE(0x1d0000, 0x1d0001) AM_WRITE(ml_sub_reset_w)
|
||||
@ -474,20 +496,22 @@ static ADDRESS_MAP_START( mlanding_sub_mem, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x050000, 0x0503ff) AM_RAM AM_SHARE("share3")
|
||||
AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM AM_SHARE("share2")
|
||||
AM_RANGE(0x1c4000, 0x1cffff) AM_RAM AM_SHARE("share1")
|
||||
AM_RANGE(0x200000, 0x203fff) AM_RAM AM_BASE(&ml_dotram)
|
||||
AM_RANGE(0x200000, 0x203fff) AM_RAM AM_BASE_MEMBER(mlanding_state, ml_dotram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( ml_msm_start_lsb_w )
|
||||
{
|
||||
adpcm_pos = (adpcm_pos & 0x0f0000) | ((data & 0xff)<<8) | 0x20;
|
||||
adpcm_idle = 0;
|
||||
mlanding_state *state = device->machine->driver_data<mlanding_state>();
|
||||
state->adpcm_pos = (state->adpcm_pos & 0x0f0000) | ((data & 0xff)<<8) | 0x20;
|
||||
state->adpcm_idle = 0;
|
||||
msm5205_reset_w(device,0);
|
||||
adpcm_end = (adpcm_pos+0x800);
|
||||
state->adpcm_end = (state->adpcm_pos+0x800);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( ml_msm_start_msb_w )
|
||||
{
|
||||
adpcm_pos = (adpcm_pos & 0x00ff00) | ((data & 0x0f)<<16) | 0x20;
|
||||
mlanding_state *state = space->machine->driver_data<mlanding_state>();
|
||||
state->adpcm_pos = (state->adpcm_pos & 0x00ff00) | ((data & 0x0f)<<16) | 0x20;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( mlanding_z80_mem, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
@ -508,17 +532,20 @@ ADDRESS_MAP_END
|
||||
|
||||
static READ16_HANDLER( ml_dotram_r )
|
||||
{
|
||||
return ml_dotram[offset];
|
||||
mlanding_state *state = space->machine->driver_data<mlanding_state>();
|
||||
return state->ml_dotram[offset];
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( ml_dotram_w )
|
||||
{
|
||||
ml_dotram[offset] = data;
|
||||
mlanding_state *state = space->machine->driver_data<mlanding_state>();
|
||||
state->ml_dotram[offset] = data;
|
||||
}
|
||||
|
||||
static READ16_HANDLER( dsp_HOLD_signal_r )
|
||||
{
|
||||
return dsp_HOLD_signal;
|
||||
mlanding_state *state = space->machine->driver_data<mlanding_state>();
|
||||
return state->dsp_HOLD_signal;
|
||||
}
|
||||
|
||||
|
||||
@ -530,7 +557,7 @@ static READ8_HANDLER( test_r )
|
||||
//mecha driver ?
|
||||
static ADDRESS_MAP_START( mlanding_z80_sub_mem, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&mecha_ram)
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE_MEMBER(mlanding_state, mecha_ram)
|
||||
AM_RANGE(0x8800, 0x8fff) AM_RAM
|
||||
|
||||
AM_RANGE(0x9000, 0x9001) AM_READ(test_r)
|
||||
@ -708,16 +735,17 @@ static const tc0140syt_interface mlanding_tc0140syt_intf =
|
||||
|
||||
static MACHINE_RESET( mlanding )
|
||||
{
|
||||
mlanding_state *state = machine->driver_data<mlanding_state>();
|
||||
cputag_set_input_line(machine, "sub", INPUT_LINE_RESET, ASSERT_LINE);
|
||||
cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
|
||||
cputag_set_input_line(machine, "dsp", INPUT_LINE_RESET, ASSERT_LINE);
|
||||
adpcm_pos = 0;
|
||||
adpcm_data = -1;
|
||||
adpcm_idle = 1;
|
||||
dsp_HOLD_signal = 0;
|
||||
state->adpcm_pos = 0;
|
||||
state->adpcm_data = -1;
|
||||
state->adpcm_idle = 1;
|
||||
state->dsp_HOLD_signal = 0;
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( mlanding, driver_device )
|
||||
static MACHINE_CONFIG_START( mlanding, mlanding_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, 12000000 ) /* 12 MHz ??? (guess) */
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -11,39 +11,38 @@ Ping Pong (c) 1985 Konami
|
||||
#include "machine/nvram.h"
|
||||
#include "includes/pingpong.h"
|
||||
|
||||
static int intenable;
|
||||
|
||||
static int question_addr_high = 0;
|
||||
|
||||
static WRITE8_HANDLER( cashquiz_question_bank_high_w )
|
||||
{
|
||||
pingpong_state *state = space->machine->driver_data<pingpong_state>();
|
||||
if( data != 0xff )
|
||||
{
|
||||
switch( ~data & 0xff )
|
||||
{
|
||||
case 0x01:
|
||||
question_addr_high = 0;
|
||||
state->question_addr_high = 0;
|
||||
break;
|
||||
case 0x02:
|
||||
question_addr_high = 0x8000;
|
||||
state->question_addr_high = 0x8000;
|
||||
break;
|
||||
case 0x04:
|
||||
question_addr_high = 0x10000;
|
||||
state->question_addr_high = 0x10000;
|
||||
break;
|
||||
case 0x08:
|
||||
question_addr_high = 0x18000;
|
||||
state->question_addr_high = 0x18000;
|
||||
break;
|
||||
case 0x10:
|
||||
question_addr_high = 0x20000;
|
||||
state->question_addr_high = 0x20000;
|
||||
break;
|
||||
case 0x20:
|
||||
question_addr_high = 0x28000;
|
||||
state->question_addr_high = 0x28000;
|
||||
break;
|
||||
case 0x40:
|
||||
question_addr_high = 0x30000;
|
||||
state->question_addr_high = 0x30000;
|
||||
break;
|
||||
case 0x80:
|
||||
question_addr_high = 0x38000;
|
||||
state->question_addr_high = 0x38000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -51,11 +50,12 @@ static WRITE8_HANDLER( cashquiz_question_bank_high_w )
|
||||
|
||||
static WRITE8_HANDLER( cashquiz_question_bank_low_w )
|
||||
{
|
||||
pingpong_state *state = space->machine->driver_data<pingpong_state>();
|
||||
if(data >= 0x60 && data <= 0xdf)
|
||||
{
|
||||
static const char * const bankname[] = { "bank1", "bank2", "bank3", "bank4", "bank5", "bank6", "bank7", "bank8" };
|
||||
const char *bank = bankname[data & 7];
|
||||
int bankaddr = question_addr_high | ((data - 0x60) * 0x100);
|
||||
int bankaddr = state->question_addr_high | ((data - 0x60) * 0x100);
|
||||
UINT8 *questions = space->machine->region("user1")->base() + bankaddr;
|
||||
memory_set_bankptr(space->machine, bank,questions);
|
||||
|
||||
@ -65,8 +65,9 @@ static WRITE8_HANDLER( cashquiz_question_bank_low_w )
|
||||
|
||||
static WRITE8_HANDLER( coin_w )
|
||||
{
|
||||
pingpong_state *state = space->machine->driver_data<pingpong_state>();
|
||||
/* bit 2 = irq enable, bit 3 = nmi enable */
|
||||
intenable = data & 0x0c;
|
||||
state->intenable = data & 0x0c;
|
||||
|
||||
/* bit 0/1 = coin counters */
|
||||
coin_counter_w(space->machine, 0,data & 1);
|
||||
@ -77,20 +78,21 @@ static WRITE8_HANDLER( coin_w )
|
||||
|
||||
static INTERRUPT_GEN( pingpong_interrupt )
|
||||
{
|
||||
pingpong_state *state = device->machine->driver_data<pingpong_state>();
|
||||
if (cpu_getiloops(device) == 0)
|
||||
{
|
||||
if (intenable & 0x04) cpu_set_input_line(device, 0, HOLD_LINE);
|
||||
if (state->intenable & 0x04) cpu_set_input_line(device, 0, HOLD_LINE);
|
||||
}
|
||||
else if (cpu_getiloops(device) % 2)
|
||||
{
|
||||
if (intenable & 0x08) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
|
||||
if (state->intenable & 0x08) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( pingpong_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(pingpong_colorram_w) AM_BASE(&pingpong_colorram)
|
||||
AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pingpong_videoram_w) AM_BASE(&pingpong_videoram)
|
||||
AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(pingpong_colorram_w) AM_BASE_MEMBER(pingpong_state, colorram)
|
||||
AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pingpong_videoram_w) AM_BASE_MEMBER(pingpong_state, videoram)
|
||||
AM_RANGE(0x9000, 0x9002) AM_RAM
|
||||
AM_RANGE(0x9003, 0x9052) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x9053, 0x97ff) AM_RAM
|
||||
@ -110,8 +112,8 @@ static ADDRESS_MAP_START( merlinmm_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x5400, 0x57ff) AM_RAM
|
||||
AM_RANGE(0x6000, 0x6007) AM_WRITENOP /* solenoid writes */
|
||||
AM_RANGE(0x7000, 0x7000) AM_READ_PORT("IN4")
|
||||
AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(pingpong_colorram_w) AM_BASE(&pingpong_colorram)
|
||||
AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pingpong_videoram_w) AM_BASE(&pingpong_videoram)
|
||||
AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(pingpong_colorram_w) AM_BASE_MEMBER(pingpong_state, colorram)
|
||||
AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pingpong_videoram_w) AM_BASE_MEMBER(pingpong_state, videoram)
|
||||
AM_RANGE(0x9000, 0x9002) AM_RAM
|
||||
AM_RANGE(0x9003, 0x9052) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x9053, 0x97ff) AM_RAM
|
||||
@ -449,7 +451,7 @@ GFXDECODE_END
|
||||
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( pingpong, driver_device )
|
||||
static MACHINE_CONFIG_START( pingpong, pingpong_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu",Z80,18432000/6) /* 3.072 MHz (probably) */
|
||||
|
@ -15,22 +15,19 @@ To Do:
|
||||
#include "machine/nvram.h"
|
||||
#include "includes/triplhnt.h"
|
||||
|
||||
static UINT8 triplhnt_cmos[16];
|
||||
static UINT8 triplhnt_da_latch;
|
||||
static UINT8 triplhnt_misc_flags;
|
||||
static UINT8 triplhnt_cmos_latch;
|
||||
static UINT8 triplhnt_hit_code;
|
||||
|
||||
|
||||
static DRIVER_INIT( triplhnt )
|
||||
{
|
||||
machine->device<nvram_device>("nvram")->set_base(triplhnt_cmos, sizeof(triplhnt_cmos));
|
||||
triplhnt_state *state = machine->driver_data<triplhnt_state>();
|
||||
machine->device<nvram_device>("nvram")->set_base(state->cmos, sizeof(state->cmos));
|
||||
}
|
||||
|
||||
|
||||
void triplhnt_set_collision(running_machine *machine, int code)
|
||||
{
|
||||
triplhnt_hit_code = code;
|
||||
triplhnt_state *state = machine->driver_data<triplhnt_state>();
|
||||
state->hit_code = code;
|
||||
|
||||
cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
|
||||
}
|
||||
@ -38,6 +35,7 @@ void triplhnt_set_collision(running_machine *machine, int code)
|
||||
|
||||
static void triplhnt_update_misc(running_machine *machine, int offset)
|
||||
{
|
||||
triplhnt_state *state = machine->driver_data<triplhnt_state>();
|
||||
device_t *samples = machine->device("samples");
|
||||
device_t *discrete = machine->device("discrete");
|
||||
UINT8 is_witch_hunt;
|
||||
@ -54,32 +52,32 @@ static void triplhnt_update_misc(running_machine *machine, int offset)
|
||||
|
||||
if (offset & 1)
|
||||
{
|
||||
triplhnt_misc_flags |= 1 << bit;
|
||||
state->misc_flags |= 1 << bit;
|
||||
|
||||
if (bit == 5)
|
||||
{
|
||||
triplhnt_cmos[triplhnt_cmos_latch] = triplhnt_da_latch;
|
||||
state->cmos[state->cmos_latch] = state->da_latch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
triplhnt_misc_flags &= ~(1 << bit);
|
||||
state->misc_flags &= ~(1 << bit);
|
||||
}
|
||||
|
||||
triplhnt_sprite_zoom = (triplhnt_misc_flags >> 4) & 1;
|
||||
triplhnt_sprite_bank = (triplhnt_misc_flags >> 7) & 1;
|
||||
state->sprite_zoom = (state->misc_flags >> 4) & 1;
|
||||
state->sprite_bank = (state->misc_flags >> 7) & 1;
|
||||
|
||||
set_led_status(machine, 0, triplhnt_misc_flags & 0x02);
|
||||
set_led_status(machine, 0, state->misc_flags & 0x02);
|
||||
|
||||
coin_lockout_w(machine, 0, !(triplhnt_misc_flags & 0x08));
|
||||
coin_lockout_w(machine, 1, !(triplhnt_misc_flags & 0x08));
|
||||
coin_lockout_w(machine, 0, !(state->misc_flags & 0x08));
|
||||
coin_lockout_w(machine, 1, !(state->misc_flags & 0x08));
|
||||
|
||||
discrete_sound_w(discrete, TRIPLHNT_SCREECH_EN, triplhnt_misc_flags & 0x04); // screech
|
||||
discrete_sound_w(discrete, TRIPLHNT_LAMP_EN, triplhnt_misc_flags & 0x02); // Lamp is used to reset noise
|
||||
discrete_sound_w(discrete, TRIPLHNT_BEAR_EN, triplhnt_misc_flags & 0x80); // bear
|
||||
discrete_sound_w(discrete, TRIPLHNT_SCREECH_EN, state->misc_flags & 0x04); // screech
|
||||
discrete_sound_w(discrete, TRIPLHNT_LAMP_EN, state->misc_flags & 0x02); // Lamp is used to reset noise
|
||||
discrete_sound_w(discrete, TRIPLHNT_BEAR_EN, state->misc_flags & 0x80); // bear
|
||||
|
||||
is_witch_hunt = input_port_read(machine, "0C09") == 0x40;
|
||||
bit = ~triplhnt_misc_flags & 0x40;
|
||||
bit = ~state->misc_flags & 0x40;
|
||||
|
||||
/* if we're not playing the sample yet, start it */
|
||||
if (!sample_playing(samples, 0))
|
||||
@ -101,9 +99,10 @@ static WRITE8_HANDLER( triplhnt_misc_w )
|
||||
|
||||
static READ8_HANDLER( triplhnt_cmos_r )
|
||||
{
|
||||
triplhnt_cmos_latch = offset;
|
||||
triplhnt_state *state = space->machine->driver_data<triplhnt_state>();
|
||||
state->cmos_latch = offset;
|
||||
|
||||
return triplhnt_cmos[triplhnt_cmos_latch] ^ 15;
|
||||
return state->cmos[state->cmos_latch] ^ 15;
|
||||
}
|
||||
|
||||
|
||||
@ -116,17 +115,19 @@ static READ8_HANDLER( triplhnt_input_port_4_r )
|
||||
|
||||
static READ8_HANDLER( triplhnt_misc_r )
|
||||
{
|
||||
triplhnt_state *state = space->machine->driver_data<triplhnt_state>();
|
||||
triplhnt_update_misc(space->machine, offset);
|
||||
return input_port_read(space->machine, "VBLANK") | triplhnt_hit_code;
|
||||
return input_port_read(space->machine, "VBLANK") | state->hit_code;
|
||||
}
|
||||
|
||||
|
||||
static READ8_HANDLER( triplhnt_da_latch_r )
|
||||
{
|
||||
triplhnt_state *state = space->machine->driver_data<triplhnt_state>();
|
||||
int cross_x = input_port_read(space->machine, "STICKX");
|
||||
int cross_y = input_port_read(space->machine, "STICKY");
|
||||
|
||||
triplhnt_da_latch = offset;
|
||||
state->da_latch = offset;
|
||||
|
||||
/* the following is a slight simplification */
|
||||
|
||||
@ -137,11 +138,11 @@ static READ8_HANDLER( triplhnt_da_latch_r )
|
||||
static ADDRESS_MAP_START( triplhnt_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x7fff)
|
||||
AM_RANGE(0x0000, 0x00ff) AM_RAM AM_MIRROR(0x300)
|
||||
AM_RANGE(0x0400, 0x04ff) AM_WRITEONLY AM_BASE(&triplhnt_playfield_ram)
|
||||
AM_RANGE(0x0800, 0x080f) AM_WRITEONLY AM_BASE(&triplhnt_vpos_ram)
|
||||
AM_RANGE(0x0810, 0x081f) AM_WRITEONLY AM_BASE(&triplhnt_hpos_ram)
|
||||
AM_RANGE(0x0820, 0x082f) AM_WRITEONLY AM_BASE(&triplhnt_orga_ram)
|
||||
AM_RANGE(0x0830, 0x083f) AM_WRITEONLY AM_BASE(&triplhnt_code_ram)
|
||||
AM_RANGE(0x0400, 0x04ff) AM_WRITEONLY AM_BASE_MEMBER(triplhnt_state, playfield_ram)
|
||||
AM_RANGE(0x0800, 0x080f) AM_WRITEONLY AM_BASE_MEMBER(triplhnt_state, vpos_ram)
|
||||
AM_RANGE(0x0810, 0x081f) AM_WRITEONLY AM_BASE_MEMBER(triplhnt_state, hpos_ram)
|
||||
AM_RANGE(0x0820, 0x082f) AM_WRITEONLY AM_BASE_MEMBER(triplhnt_state, orga_ram)
|
||||
AM_RANGE(0x0830, 0x083f) AM_WRITEONLY AM_BASE_MEMBER(triplhnt_state, code_ram)
|
||||
AM_RANGE(0x0c00, 0x0c00) AM_READ_PORT("0C00")
|
||||
AM_RANGE(0x0c08, 0x0c08) AM_READ_PORT("0C08")
|
||||
AM_RANGE(0x0c09, 0x0c09) AM_READ_PORT("0C09")
|
||||
@ -309,7 +310,7 @@ static PALETTE_INIT( triplhnt )
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( triplhnt, driver_device )
|
||||
static MACHINE_CONFIG_START( triplhnt, triplhnt_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6800, 800000)
|
||||
|
@ -37,6 +37,10 @@ public:
|
||||
: amiga_state(machine, config) { }
|
||||
|
||||
UINT8 m_nvram[0x100];
|
||||
UINT8 prev_cia1_porta;
|
||||
UINT8 parallel_data;
|
||||
UINT8 nvram_address_latch;
|
||||
UINT8 nvram_data_latch;
|
||||
};
|
||||
|
||||
|
||||
@ -50,19 +54,6 @@ public:
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Globals
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static UINT8 prev_cia1_porta;
|
||||
static UINT8 parallel_data;
|
||||
static UINT8 nvram_address_latch;
|
||||
static UINT8 nvram_data_latch;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Reset state
|
||||
@ -71,7 +62,8 @@ static UINT8 nvram_data_latch;
|
||||
|
||||
static void upscope_reset(running_machine *machine)
|
||||
{
|
||||
prev_cia1_porta = 0xff;
|
||||
upscope_state *state = machine->driver_data<upscope_state>();
|
||||
state->prev_cia1_porta = 0xff;
|
||||
}
|
||||
|
||||
|
||||
@ -125,12 +117,14 @@ static WRITE8_DEVICE_HANDLER( upscope_cia_0_porta_w )
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( upscope_cia_0_portb_w )
|
||||
{
|
||||
parallel_data = data;
|
||||
upscope_state *state = device->machine->driver_data<upscope_state>();
|
||||
state->parallel_data = data;
|
||||
}
|
||||
|
||||
static READ8_DEVICE_HANDLER( upscope_cia_0_portb_r )
|
||||
{
|
||||
return nvram_data_latch;
|
||||
upscope_state *state = device->machine->driver_data<upscope_state>();
|
||||
return state->nvram_data_latch;
|
||||
}
|
||||
|
||||
|
||||
@ -152,25 +146,27 @@ static READ8_DEVICE_HANDLER( upscope_cia_0_portb_r )
|
||||
|
||||
static READ8_DEVICE_HANDLER( upscope_cia_1_porta_r )
|
||||
{
|
||||
return 0xf8 | (prev_cia1_porta & 0x07);
|
||||
upscope_state *state = device->machine->driver_data<upscope_state>();
|
||||
return 0xf8 | (state->prev_cia1_porta & 0x07);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( upscope_cia_1_porta_w )
|
||||
{
|
||||
upscope_state *state = device->machine->driver_data<upscope_state>();
|
||||
/* on a low transition of POUT, we latch stuff for the NVRAM */
|
||||
if ((prev_cia1_porta & 2) && !(data & 2))
|
||||
if ((state->prev_cia1_porta & 2) && !(data & 2))
|
||||
{
|
||||
/* if SEL == 1 && BUSY == 0, we latch an address */
|
||||
if ((data & 5) == 4)
|
||||
{
|
||||
if (LOG_IO) logerror("Latch address: %02X\n", parallel_data);
|
||||
nvram_address_latch = parallel_data;
|
||||
if (LOG_IO) logerror("Latch address: %02X\n", state->parallel_data);
|
||||
state->nvram_address_latch = state->parallel_data;
|
||||
}
|
||||
|
||||
/* if SEL == 1 && BUSY == 1, we write data to internal registers */
|
||||
else if ((data & 5) == 5)
|
||||
{
|
||||
switch (nvram_address_latch)
|
||||
switch (state->nvram_address_latch)
|
||||
{
|
||||
case 0x01:
|
||||
/* lamps:
|
||||
@ -195,7 +191,7 @@ static WRITE8_DEVICE_HANDLER( upscope_cia_1_porta_w )
|
||||
break;
|
||||
|
||||
default:
|
||||
logerror("Internal register (%d) = %02X\n", nvram_address_latch, parallel_data);
|
||||
logerror("Internal register (%d) = %02X\n", state->nvram_address_latch, state->parallel_data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -203,9 +199,8 @@ static WRITE8_DEVICE_HANDLER( upscope_cia_1_porta_w )
|
||||
/* if SEL == 0 && BUSY == 1, we write data to NVRAM */
|
||||
else if ((data & 5) == 1)
|
||||
{
|
||||
upscope_state *state = device->machine->driver_data<upscope_state>();
|
||||
if (LOG_IO) logerror("NVRAM data write @ %02X = %02X\n", nvram_address_latch, parallel_data);
|
||||
state->m_nvram[nvram_address_latch] = parallel_data;
|
||||
if (LOG_IO) logerror("NVRAM data write @ %02X = %02X\n", state->nvram_address_latch, state->parallel_data);
|
||||
state->m_nvram[state->nvram_address_latch] = state->parallel_data;
|
||||
}
|
||||
|
||||
/* if SEL == 0 && BUSY == 0, who knows? */
|
||||
@ -216,26 +211,25 @@ static WRITE8_DEVICE_HANDLER( upscope_cia_1_porta_w )
|
||||
}
|
||||
|
||||
/* on a low transition of BUSY, we latch stuff for reading */
|
||||
else if ((prev_cia1_porta & 1) && !(data & 1))
|
||||
else if ((state->prev_cia1_porta & 1) && !(data & 1))
|
||||
{
|
||||
/* if SEL == 1, we read internal data registers */
|
||||
if (data & 4)
|
||||
{
|
||||
if (LOG_IO) logerror("Internal register (%d) read\n", nvram_address_latch);
|
||||
nvram_data_latch = (nvram_address_latch == 0) ? input_port_read(device->machine, "IO0") : 0xff;
|
||||
if (LOG_IO) logerror("Internal register (%d) read\n", state->nvram_address_latch);
|
||||
state->nvram_data_latch = (state->nvram_address_latch == 0) ? input_port_read(device->machine, "IO0") : 0xff;
|
||||
}
|
||||
|
||||
/* if SEL == 0, we read NVRAM */
|
||||
else
|
||||
{
|
||||
upscope_state *state = device->machine->driver_data<upscope_state>();
|
||||
nvram_data_latch = state->m_nvram[nvram_address_latch];
|
||||
if (LOG_IO) logerror("NVRAM data read @ %02X = %02X\n", nvram_address_latch, nvram_data_latch);
|
||||
state->nvram_data_latch = state->m_nvram[state->nvram_address_latch];
|
||||
if (LOG_IO) logerror("NVRAM data read @ %02X = %02X\n", state->nvram_address_latch, state->nvram_data_latch);
|
||||
}
|
||||
}
|
||||
|
||||
/* remember the previous value */
|
||||
prev_cia1_porta = data;
|
||||
state->prev_cia1_porta = data;
|
||||
}
|
||||
|
||||
|
||||
|
@ -129,8 +129,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xc000, 0xc0ff) AM_READ(victory_video_control_r)
|
||||
AM_RANGE(0xc100, 0xc1ff) AM_WRITE(victory_video_control_w)
|
||||
AM_RANGE(0xc200, 0xc3ff) AM_WRITE(victory_paletteram_w)
|
||||
AM_RANGE(0xc400, 0xc7ff) AM_RAM AM_BASE(&victory_videoram)
|
||||
AM_RANGE(0xc800, 0xdfff) AM_RAM AM_BASE(&victory_charram)
|
||||
AM_RANGE(0xc400, 0xc7ff) AM_RAM AM_BASE_MEMBER(victory_state, videoram)
|
||||
AM_RANGE(0xc800, 0xdfff) AM_RAM AM_BASE_MEMBER(victory_state, charram)
|
||||
AM_RANGE(0xe000, 0xefff) AM_RAM
|
||||
AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("nvram")
|
||||
AM_RANGE(0xf800, 0xf800) AM_MIRROR(0x07fc) AM_DEVREADWRITE("custom", victory_sound_response_r, victory_sound_command_w)
|
||||
@ -208,7 +208,7 @@ INPUT_PORTS_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_CONFIG_START( victory, driver_device )
|
||||
static MACHINE_CONFIG_START( victory, victory_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", Z80, VICTORY_MAIN_CPU_CLOCK)
|
||||
|
@ -515,7 +515,7 @@
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( defender_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_RAM AM_BASE(&williams_videoram)
|
||||
AM_RANGE(0x0000, 0xbfff) AM_RAM AM_BASE_MEMBER(williams_state, videoram)
|
||||
/* range from 0xc000-0xcfff is mapped programmatically below */
|
||||
AM_RANGE(0xc000, 0xc00f) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xc400, 0xc4ff) AM_SHARE("nvram")
|
||||
@ -552,7 +552,7 @@ void defender_install_io_space(address_space *space)
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( williams_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x8fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE(&williams_videoram)
|
||||
AM_RANGE(0x0000, 0x8fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE_MEMBER(williams_state, videoram)
|
||||
AM_RANGE(0x9000, 0xbfff) AM_RAM
|
||||
AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x03f0) AM_WRITEONLY AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pia_0", pia6821_r, pia6821_w)
|
||||
@ -567,7 +567,7 @@ ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( williams_extra_ram_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x8fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE(&williams_videoram)
|
||||
AM_RANGE(0x0000, 0x8fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE_MEMBER(williams_state, videoram)
|
||||
AM_RANGE(0x9000, 0xbfff) AM_RAM
|
||||
AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x03f0) AM_WRITEONLY AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pia_0", pia6821_r, pia6821_w)
|
||||
@ -590,10 +590,10 @@ ADDRESS_MAP_END
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( blaster_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE(&williams_videoram)
|
||||
AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE_MEMBER(williams_state, videoram)
|
||||
AM_RANGE(0x4000, 0x8fff) AM_READ_BANK("bank2") AM_WRITEONLY
|
||||
AM_RANGE(0xbb00, 0xbbff) AM_WRITEONLY AM_BASE(&blaster_palette_0)
|
||||
AM_RANGE(0xbc00, 0xbcff) AM_WRITEONLY AM_BASE(&blaster_scanline_control)
|
||||
AM_RANGE(0xbb00, 0xbbff) AM_WRITEONLY AM_BASE_MEMBER(williams_state, blaster_palette_0)
|
||||
AM_RANGE(0xbc00, 0xbcff) AM_WRITEONLY AM_BASE_MEMBER(williams_state, blaster_scanline_control)
|
||||
AM_RANGE(0x9000, 0xbfff) AM_RAM
|
||||
AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x03f0) AM_WRITEONLY AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pia_0", pia6821_r, pia6821_w)
|
||||
@ -618,9 +618,9 @@ ADDRESS_MAP_END
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( williams2_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE(&williams_videoram)
|
||||
AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE_MEMBER(williams_state, videoram)
|
||||
AM_RANGE(0x8000, 0xbfff) AM_RAM
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(williams2_tileram_w) AM_BASE(&williams2_tileram)
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(williams2_tileram_w) AM_BASE_MEMBER(williams_state, williams2_tileram)
|
||||
AM_RANGE(0xc800, 0xc87f) AM_WRITE(williams2_bank_select_w)
|
||||
AM_RANGE(0xc880, 0xc887) AM_MIRROR(0x0078) AM_WRITE(williams_blitter_w)
|
||||
AM_RANGE(0xc900, 0xc97f) AM_WRITE(williams2_watchdog_reset_w)
|
||||
@ -640,9 +640,9 @@ ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( williams2_extra_ram_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE(&williams_videoram)
|
||||
AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE_MEMBER(williams_state, videoram)
|
||||
AM_RANGE(0x8000, 0xbfff) AM_RAM
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(williams2_tileram_w) AM_BASE(&williams2_tileram)
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(williams2_tileram_w) AM_BASE_MEMBER(williams_state, williams2_tileram)
|
||||
AM_RANGE(0xc800, 0xc87f) AM_WRITE(williams2_bank_select_w)
|
||||
AM_RANGE(0xc880, 0xc887) AM_MIRROR(0x0078) AM_WRITE(williams_blitter_w)
|
||||
AM_RANGE(0xc900, 0xc97f) AM_WRITE(williams2_watchdog_reset_w)
|
||||
@ -2688,11 +2688,11 @@ ROM_END
|
||||
*************************************/
|
||||
|
||||
#define CONFIGURE_BLITTER(x,c) \
|
||||
williams_blitter_config = x; \
|
||||
williams_blitter_clip_address = c
|
||||
state->blitter_config = x; \
|
||||
state->blitter_clip_address = c
|
||||
|
||||
#define CONFIGURE_TILEMAP(x) \
|
||||
williams2_tilemap_config = x
|
||||
state->williams2_tilemap_config = x
|
||||
|
||||
|
||||
|
||||
@ -2704,12 +2704,14 @@ ROM_END
|
||||
|
||||
static DRIVER_INIT( defender )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( defndjeu )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
UINT8 *rom = machine->region("maincpu")->base();
|
||||
int i;
|
||||
|
||||
@ -2723,10 +2725,11 @@ static DRIVER_INIT( defndjeu )
|
||||
|
||||
static DRIVER_INIT( mayday )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000);
|
||||
|
||||
/* install a handler to catch protection checks */
|
||||
mayday_protection = memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa190, 0xa191, 0, 0, mayday_protection_r);
|
||||
state->mayday_protection = memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa190, 0xa191, 0, 0, mayday_protection_r);
|
||||
}
|
||||
|
||||
|
||||
@ -2739,24 +2742,28 @@ static DRIVER_INIT( mayday )
|
||||
|
||||
static DRIVER_INIT( stargate )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( robotron )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( joust )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( bubbles )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
|
||||
|
||||
/* bubbles has a full 8-bit-wide CMOS */
|
||||
@ -2766,36 +2773,42 @@ static DRIVER_INIT( bubbles )
|
||||
|
||||
static DRIVER_INIT( splat )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0xc000);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( sinistar )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0x7400);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( playball )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( blaster )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9700);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( blastkit )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9700);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( spdball )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
device_t *pia_3 = machine->device("pia_3");
|
||||
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
|
||||
@ -2813,6 +2826,7 @@ static DRIVER_INIT( spdball )
|
||||
|
||||
static DRIVER_INIT( alienar )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
|
||||
memory_nop_write(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0);
|
||||
}
|
||||
@ -2820,6 +2834,7 @@ static DRIVER_INIT( alienar )
|
||||
|
||||
static DRIVER_INIT( alienaru )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
|
||||
memory_nop_write(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0);
|
||||
}
|
||||
@ -2827,6 +2842,7 @@ static DRIVER_INIT( alienaru )
|
||||
|
||||
static DRIVER_INIT( lottofun )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
|
||||
}
|
||||
|
||||
@ -2840,6 +2856,7 @@ static DRIVER_INIT( lottofun )
|
||||
|
||||
static DRIVER_INIT( mysticm )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000);
|
||||
CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_MYSTICM);
|
||||
}
|
||||
@ -2847,6 +2864,7 @@ static DRIVER_INIT( mysticm )
|
||||
|
||||
static DRIVER_INIT( tshoot )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000);
|
||||
CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_TSHOOT);
|
||||
}
|
||||
@ -2854,6 +2872,7 @@ static DRIVER_INIT( tshoot )
|
||||
|
||||
static DRIVER_INIT( inferno )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000);
|
||||
CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_TSHOOT);
|
||||
}
|
||||
@ -2861,6 +2880,7 @@ static DRIVER_INIT( inferno )
|
||||
|
||||
static DRIVER_INIT( joust2 )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000);
|
||||
CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_JOUST2);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
UINT16 * sloop_base;
|
||||
|
||||
device_t * rle;
|
||||
UINT32 last_accesses[8];
|
||||
};
|
||||
|
||||
|
||||
|
@ -19,19 +19,36 @@
|
||||
#define EXIDY_VSSTART (0x100)
|
||||
|
||||
|
||||
class exidy_state : public driver_device
|
||||
{
|
||||
public:
|
||||
exidy_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 last_dial;
|
||||
UINT8 *videoram;
|
||||
UINT8 *characterram;
|
||||
UINT8 *color_latch;
|
||||
UINT8 *sprite1_xpos;
|
||||
UINT8 *sprite1_ypos;
|
||||
UINT8 *sprite2_xpos;
|
||||
UINT8 *sprite2_ypos;
|
||||
UINT8 *spriteno;
|
||||
UINT8 *sprite_enable;
|
||||
UINT8 collision_mask;
|
||||
UINT8 collision_invert;
|
||||
int is_2bpp;
|
||||
UINT8 int_condition;
|
||||
bitmap_t *background_bitmap;
|
||||
bitmap_t *motion_object_1_vid;
|
||||
bitmap_t *motion_object_2_vid;
|
||||
bitmap_t *motion_object_2_clip;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/exidy.c -----------*/
|
||||
|
||||
extern UINT8 *exidy_videoram;
|
||||
extern UINT8 *exidy_characterram;
|
||||
extern UINT8 *exidy_color_latch;
|
||||
extern UINT8 *exidy_sprite1_xpos;
|
||||
extern UINT8 *exidy_sprite1_ypos;
|
||||
extern UINT8 *exidy_sprite2_xpos;
|
||||
extern UINT8 *exidy_sprite2_ypos;
|
||||
extern UINT8 *exidy_spriteno;
|
||||
extern UINT8 *exidy_sprite_enable;
|
||||
|
||||
void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp);
|
||||
void exidy_video_config(running_machine *machine, UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp);
|
||||
VIDEO_START( exidy );
|
||||
SCREEN_UPDATE( exidy );
|
||||
|
||||
|
@ -7,6 +7,31 @@
|
||||
#define EXIDY440_MASTER_CLOCK (XTAL_12_9792MHz)
|
||||
|
||||
|
||||
class exidy440_state : public driver_device
|
||||
{
|
||||
public:
|
||||
exidy440_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 bank;
|
||||
const UINT8 *showdown_bank_data[2];
|
||||
INT8 showdown_bank_select;
|
||||
UINT8 showdown_bank_offset;
|
||||
UINT8 *imageram;
|
||||
UINT8 *scanline;
|
||||
UINT8 firq_vblank;
|
||||
UINT8 firq_beam;
|
||||
UINT8 *topsecex_yscroll;
|
||||
UINT8 latched_x;
|
||||
UINT8 *local_videoram;
|
||||
UINT8 *local_paletteram;
|
||||
UINT8 firq_enable;
|
||||
UINT8 firq_select;
|
||||
UINT8 palettebank_io;
|
||||
UINT8 palettebank_vis;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in drivers/exidy440.c -----------*/
|
||||
|
||||
void exidy440_bank_select(running_machine *machine, UINT8 bank);
|
||||
@ -14,12 +39,6 @@ void exidy440_bank_select(running_machine *machine, UINT8 bank);
|
||||
|
||||
/*----------- defined in video/exidy440.c -----------*/
|
||||
|
||||
extern UINT8 *exidy440_imageram;
|
||||
extern UINT8 *exidy440_scanline;
|
||||
extern UINT8 exidy440_firq_vblank;
|
||||
extern UINT8 exidy440_firq_beam;
|
||||
extern UINT8 *topsecex_yscroll;
|
||||
|
||||
INTERRUPT_GEN( exidy440_vblank_interrupt );
|
||||
|
||||
READ8_HANDLER( exidy440_videoram_r );
|
||||
|
@ -5,6 +5,7 @@ public:
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *videoram;
|
||||
tilemap_t *bg_tilemap;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,6 +1,23 @@
|
||||
/*----------- defined in video/m90.c -----------*/
|
||||
class m90_state : public driver_device
|
||||
{
|
||||
public:
|
||||
m90_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
extern UINT16 *m90_video_data;
|
||||
UINT32 bankaddress;
|
||||
UINT16 *video_data;
|
||||
UINT16 *spriteram;
|
||||
UINT16 video_control_data[8];
|
||||
tilemap_t *pf1_layer;
|
||||
tilemap_t *pf2_layer;
|
||||
tilemap_t *pf1_wide_layer;
|
||||
tilemap_t *pf2_wide_layer;
|
||||
int last_pf1;
|
||||
int last_pf2;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/m90.c -----------*/
|
||||
|
||||
VIDEO_START( m90 );
|
||||
VIDEO_START( dynablsb );
|
||||
|
@ -1,7 +1,18 @@
|
||||
/*----------- defined in video/pingpong.c -----------*/
|
||||
class pingpong_state : public driver_device
|
||||
{
|
||||
public:
|
||||
pingpong_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
extern UINT8 *pingpong_videoram;
|
||||
extern UINT8 *pingpong_colorram;
|
||||
int intenable;
|
||||
int question_addr_high;
|
||||
UINT8 *videoram;
|
||||
UINT8 *colorram;
|
||||
tilemap_t *bg_tilemap;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/pingpong.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( pingpong_videoram_w );
|
||||
WRITE8_HANDLER( pingpong_colorram_w );
|
||||
|
@ -5,6 +5,7 @@ public:
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *videoram;
|
||||
tilemap_t *bg_tilemap;
|
||||
};
|
||||
|
||||
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
UINT8 sprite_control[8];
|
||||
UINT32 *spriteram_32bit;
|
||||
void (*system32_prot_vblank)(device_t *device);
|
||||
int print_count;
|
||||
};
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@ public:
|
||||
UINT8 *spriteram;
|
||||
UINT8 *videoram;
|
||||
UINT8 *textram;
|
||||
int bFlicker;
|
||||
};
|
||||
|
||||
|
||||
|
@ -16,6 +16,29 @@
|
||||
#define TRIPLHNT_LAMP_EN NODE_05
|
||||
|
||||
|
||||
class triplhnt_state : public driver_device
|
||||
{
|
||||
public:
|
||||
triplhnt_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 cmos[16];
|
||||
UINT8 da_latch;
|
||||
UINT8 misc_flags;
|
||||
UINT8 cmos_latch;
|
||||
UINT8 hit_code;
|
||||
UINT8* playfield_ram;
|
||||
UINT8* vpos_ram;
|
||||
UINT8* hpos_ram;
|
||||
UINT8* code_ram;
|
||||
UINT8* orga_ram;
|
||||
int sprite_zoom;
|
||||
int sprite_bank;
|
||||
bitmap_t* helper;
|
||||
tilemap_t* bg_tilemap;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in drivers/triplhnt.c -----------*/
|
||||
|
||||
void triplhnt_set_collision(running_machine *machine, int data);
|
||||
@ -32,11 +55,4 @@ extern const samples_interface triplhnt_samples_interface;
|
||||
VIDEO_START( triplhnt );
|
||||
SCREEN_UPDATE( triplhnt );
|
||||
|
||||
extern UINT8* triplhnt_playfield_ram;
|
||||
extern UINT8* triplhnt_vpos_ram;
|
||||
extern UINT8* triplhnt_hpos_ram;
|
||||
extern UINT8* triplhnt_code_ram;
|
||||
extern UINT8* triplhnt_orga_ram;
|
||||
|
||||
extern int triplhnt_sprite_zoom;
|
||||
extern int triplhnt_sprite_bank;
|
||||
|
@ -16,10 +16,48 @@
|
||||
#define VICTORY_VBSTART (0x100)
|
||||
|
||||
|
||||
/*----------- defined in video/victory.c -----------*/
|
||||
/* microcode state */
|
||||
struct micro_t
|
||||
{
|
||||
UINT16 i;
|
||||
UINT16 pc;
|
||||
UINT8 r,g,b;
|
||||
UINT8 x,xp,y,yp;
|
||||
UINT8 cmd,cmdlo;
|
||||
emu_timer * timer;
|
||||
UINT8 timer_active;
|
||||
attotime endtime;
|
||||
};
|
||||
|
||||
extern UINT8 *victory_videoram;
|
||||
extern UINT8 *victory_charram;
|
||||
class victory_state : public driver_device
|
||||
{
|
||||
public:
|
||||
victory_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *videoram;
|
||||
UINT8 *charram;
|
||||
UINT16 paletteram[0x40];
|
||||
UINT8 *bgbitmap;
|
||||
UINT8 *fgbitmap;
|
||||
UINT8 *rram;
|
||||
UINT8 *gram;
|
||||
UINT8 *bram;
|
||||
UINT8 vblank_irq;
|
||||
UINT8 fgcoll;
|
||||
UINT8 fgcollx;
|
||||
UINT8 fgcolly;
|
||||
UINT8 bgcoll;
|
||||
UINT8 bgcollx;
|
||||
UINT8 bgcolly;
|
||||
UINT8 scrollx;
|
||||
UINT8 scrolly;
|
||||
UINT8 video_control;
|
||||
struct micro_t micro;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/victory.c -----------*/
|
||||
|
||||
VIDEO_START( victory );
|
||||
SCREEN_UPDATE( victory );
|
||||
|
@ -5,6 +5,14 @@ public:
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *videoram;
|
||||
int horiz_scroll_low;
|
||||
int horiz_scroll_high;
|
||||
int rear_horiz_scroll_low;
|
||||
int rear_horiz_scroll_high;
|
||||
int rear_color;
|
||||
int rear_disable;
|
||||
int rear_refresh;
|
||||
bitmap_t *bg_bitmap;
|
||||
};
|
||||
|
||||
|
||||
|
@ -15,6 +15,36 @@ public:
|
||||
m_nvram(*this, "nvram") { }
|
||||
|
||||
required_shared_ptr<UINT8> m_nvram;
|
||||
UINT8 sound_int_state;
|
||||
UINT8 audio_talkback;
|
||||
UINT8 audio_sync;
|
||||
device_t *sound_cpu;
|
||||
device_t *soundalt_cpu;
|
||||
UINT8 *mayday_protection;
|
||||
UINT8 *videoram;
|
||||
UINT8 *williams2_tileram;
|
||||
UINT8 *blaster_palette_0;
|
||||
UINT8 *blaster_scanline_control;
|
||||
UINT8 blitter_config;
|
||||
UINT16 blitter_clip_address;
|
||||
UINT8 blitter_window_enable;
|
||||
UINT8 williams2_tilemap_config;
|
||||
UINT8 cocktail;
|
||||
UINT8 blaster_bank;
|
||||
UINT8 vram_bank;
|
||||
UINT16 joust2_current_sound_data;
|
||||
UINT8 port_select;
|
||||
rgb_t *palette_lookup;
|
||||
UINT8 blitterram[8];
|
||||
UINT8 blitter_xor;
|
||||
UINT8 blitter_remap_index;
|
||||
const UINT8 *blitter_remap;
|
||||
UINT8 *blitter_remap_lookup;
|
||||
rgb_t blaster_color0;
|
||||
UINT8 blaster_video_control;
|
||||
tilemap_t *bg_tilemap;
|
||||
UINT16 tilemap_xscroll;
|
||||
UINT8 williams2_fg_color;
|
||||
};
|
||||
|
||||
|
||||
@ -87,7 +117,6 @@ WRITE8_HANDLER( williams2_7segment_w );
|
||||
CUSTOM_INPUT( williams_mux_r );
|
||||
|
||||
/* Mayday protection */
|
||||
extern UINT8 *mayday_protection;
|
||||
READ8_HANDLER( mayday_protection_r );
|
||||
|
||||
WRITE8_HANDLER( defender_video_control_w );
|
||||
@ -102,24 +131,6 @@ WRITE8_HANDLER( defender_video_control_w );
|
||||
#define WILLIAMS_TILEMAP_TSHOOT 1 /* IC79 is a 74LS157 selector jumpered to be enabled */
|
||||
#define WILLIAMS_TILEMAP_JOUST2 2 /* IC79 is a 74LS157 selector jumpered to be disabled */
|
||||
|
||||
/* RAM globals */
|
||||
extern UINT8 *williams_videoram;
|
||||
extern UINT8 *williams2_tileram;
|
||||
extern UINT8 *blaster_palette_0;
|
||||
extern UINT8 *blaster_scanline_control;
|
||||
|
||||
/* blitter globals */
|
||||
extern UINT8 williams_blitter_config;
|
||||
extern UINT16 williams_blitter_clip_address;
|
||||
extern UINT8 williams_blitter_window_enable;
|
||||
|
||||
/* tilemap globals */
|
||||
extern UINT8 williams2_tilemap_config;
|
||||
|
||||
/* rendering globals */
|
||||
extern UINT8 williams_cocktail;
|
||||
|
||||
|
||||
WRITE8_HANDLER( williams_blitter_w );
|
||||
WRITE8_HANDLER( blaster_remap_select_w );
|
||||
WRITE8_HANDLER( blaster_video_control_w );
|
||||
|
@ -5,6 +5,7 @@ public:
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT16 *videoram;
|
||||
tilemap_t *bg_tilemap;
|
||||
};
|
||||
|
||||
|
||||
|
@ -15,16 +15,6 @@
|
||||
#include "sound/hc55516.h"
|
||||
|
||||
|
||||
/* banking addresses set by the drivers */
|
||||
UINT8 *mayday_protection;
|
||||
|
||||
/* internal bank switching tracking */
|
||||
static UINT8 blaster_bank;
|
||||
static UINT8 vram_bank;
|
||||
|
||||
/* other stuff */
|
||||
static UINT16 joust2_current_sound_data;
|
||||
|
||||
/* older-Williams routines */
|
||||
static void williams_main_irq(device_t *device, int state);
|
||||
static void williams_main_firq(device_t *device, int state);
|
||||
@ -33,7 +23,6 @@ static WRITE8_DEVICE_HANDLER( williams_snd_cmd_w );
|
||||
static WRITE8_DEVICE_HANDLER( playball_snd_cmd_w );
|
||||
|
||||
/* input port mapping */
|
||||
static UINT8 port_select;
|
||||
static WRITE8_DEVICE_HANDLER( williams_port_select_w );
|
||||
static READ8_DEVICE_HANDLER( williams_input_port_49way_0_5_r );
|
||||
static READ8_DEVICE_HANDLER( williams_49way_port_0_r );
|
||||
@ -352,11 +341,12 @@ static void tshoot_main_irq(device_t *device, int state)
|
||||
|
||||
static MACHINE_START( williams_common )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
/* configure the memory bank */
|
||||
memory_configure_bank(machine, "bank1", 0, 1, williams_videoram, 0);
|
||||
memory_configure_bank(machine, "bank1", 0, 1, state->videoram, 0);
|
||||
memory_configure_bank(machine, "bank1", 1, 1, machine->region("maincpu")->base() + 0x10000, 0);
|
||||
|
||||
state_save_register_global(machine, vram_bank);
|
||||
state_save_register_global(machine, state->vram_bank);
|
||||
}
|
||||
|
||||
|
||||
@ -441,19 +431,21 @@ TIMER_DEVICE_CALLBACK( williams2_endscreen_callback )
|
||||
|
||||
static STATE_POSTLOAD( williams2_postload )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
williams2_bank_select_w(space, 0, vram_bank);
|
||||
williams2_bank_select_w(space, 0, state->vram_bank);
|
||||
}
|
||||
|
||||
|
||||
MACHINE_START( williams2 )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
/* configure memory banks */
|
||||
memory_configure_bank(machine, "bank1", 0, 1, williams_videoram, 0);
|
||||
memory_configure_bank(machine, "bank1", 0, 1, state->videoram, 0);
|
||||
memory_configure_bank(machine, "bank1", 1, 4, machine->region("maincpu")->base() + 0x10000, 0x10000);
|
||||
|
||||
/* register for save states */
|
||||
state_save_register_global(machine, vram_bank);
|
||||
state_save_register_global(machine, state->vram_bank);
|
||||
machine->state().register_postload(williams2_postload, NULL);
|
||||
}
|
||||
|
||||
@ -484,28 +476,30 @@ MACHINE_RESET( williams2 )
|
||||
|
||||
WRITE8_HANDLER( williams_vram_select_w )
|
||||
{
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
/* VRAM/ROM banking from bit 0 */
|
||||
vram_bank = data & 0x01;
|
||||
memory_set_bank(space->machine, "bank1", vram_bank);
|
||||
state->vram_bank = data & 0x01;
|
||||
memory_set_bank(space->machine, "bank1", state->vram_bank);
|
||||
|
||||
/* cocktail flip from bit 1 */
|
||||
williams_cocktail = data & 0x02;
|
||||
state->cocktail = data & 0x02;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( williams2_bank_select_w )
|
||||
{
|
||||
vram_bank = data & 0x07;
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
state->vram_bank = data & 0x07;
|
||||
|
||||
/* the low two bits control the paging */
|
||||
switch (vram_bank & 0x03)
|
||||
switch (state->vram_bank & 0x03)
|
||||
{
|
||||
/* page 0 is video ram */
|
||||
case 0:
|
||||
memory_install_read_bank(space, 0x0000, 0x8fff, 0, 0, "bank1");
|
||||
memory_install_write_bank(space, 0x8000, 0x87ff, 0, 0, "bank4");
|
||||
memory_set_bank(space->machine, "bank1", 0);
|
||||
memory_set_bankptr(space->machine, "bank4", &williams_videoram[0x8000]);
|
||||
memory_set_bankptr(space->machine, "bank4", &state->videoram[0x8000]);
|
||||
break;
|
||||
|
||||
/* pages 1 and 2 are ROM */
|
||||
@ -513,15 +507,15 @@ WRITE8_HANDLER( williams2_bank_select_w )
|
||||
case 2:
|
||||
memory_install_read_bank(space, 0x0000, 0x8fff, 0, 0, "bank1");
|
||||
memory_install_write_bank(space, 0x8000, 0x87ff, 0, 0, "bank4");
|
||||
memory_set_bank(space->machine, "bank1", 1 + ((vram_bank & 6) >> 1));
|
||||
memory_set_bankptr(space->machine, "bank4", &williams_videoram[0x8000]);
|
||||
memory_set_bank(space->machine, "bank1", 1 + ((state->vram_bank & 6) >> 1));
|
||||
memory_set_bankptr(space->machine, "bank4", &state->videoram[0x8000]);
|
||||
break;
|
||||
|
||||
/* page 3 accesses palette RAM; the remaining areas are as if page 1 ROM was selected */
|
||||
case 3:
|
||||
memory_install_read_bank(space, 0x8000, 0x87ff, 0, 0, "bank4");
|
||||
memory_install_write8_handler(space, 0x8000, 0x87ff, 0, 0, williams2_paletteram_w);
|
||||
memory_set_bank(space->machine, "bank1", 1 + ((vram_bank & 4) >> 1));
|
||||
memory_set_bank(space->machine, "bank1", 1 + ((state->vram_bank & 4) >> 1));
|
||||
memory_set_bankptr(space->machine, "bank4", space->machine->generic.paletteram.v);
|
||||
break;
|
||||
}
|
||||
@ -577,14 +571,16 @@ static WRITE8_DEVICE_HANDLER( williams2_snd_cmd_w )
|
||||
|
||||
WRITE8_DEVICE_HANDLER( williams_port_select_w )
|
||||
{
|
||||
port_select = data;
|
||||
williams_state *state = device->machine->driver_data<williams_state>();
|
||||
state->port_select = data;
|
||||
}
|
||||
|
||||
CUSTOM_INPUT( williams_mux_r )
|
||||
{
|
||||
williams_state *state = field->port->machine->driver_data<williams_state>();
|
||||
const char *tag = (const char *)param;
|
||||
|
||||
if (port_select != 0)
|
||||
if (state->port_select != 0)
|
||||
tag += strlen(tag) + 1;
|
||||
|
||||
return input_port_read(field->port->machine, tag);
|
||||
@ -624,7 +620,8 @@ READ8_DEVICE_HANDLER( williams_49way_port_0_r )
|
||||
|
||||
READ8_DEVICE_HANDLER( williams_input_port_49way_0_5_r )
|
||||
{
|
||||
if (port_select)
|
||||
williams_state *state = device->machine->driver_data<williams_state>();
|
||||
if (state->port_select)
|
||||
return williams_49way_port_0_r(device, 0);
|
||||
else
|
||||
return input_port_read(device->machine, "IN3");
|
||||
@ -727,8 +724,9 @@ WRITE8_HANDLER( williams2_7segment_w )
|
||||
|
||||
static STATE_POSTLOAD( defender_postload )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
defender_bank_select_w(space, 0, vram_bank);
|
||||
defender_bank_select_w(space, 0, state->vram_bank);
|
||||
}
|
||||
|
||||
|
||||
@ -755,13 +753,15 @@ MACHINE_RESET( defender )
|
||||
|
||||
WRITE8_HANDLER( defender_video_control_w )
|
||||
{
|
||||
williams_cocktail = data & 0x01;
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
state->cocktail = data & 0x01;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( defender_bank_select_w )
|
||||
{
|
||||
vram_bank = data & 0x0f;
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
state->vram_bank = data & 0x0f;
|
||||
|
||||
/* set bank address */
|
||||
switch (data)
|
||||
@ -783,7 +783,7 @@ WRITE8_HANDLER( defender_bank_select_w )
|
||||
case 9:
|
||||
memory_install_read_bank(space, 0xc000, 0xcfff, 0, 0, "bank1");
|
||||
memory_unmap_write(space, 0xc000, 0xcfff, 0, 0);
|
||||
memory_set_bank(space->machine, "bank1", vram_bank - 1);
|
||||
memory_set_bank(space->machine, "bank1", state->vram_bank - 1);
|
||||
break;
|
||||
|
||||
/* pages A-F are not connected */
|
||||
@ -803,12 +803,13 @@ WRITE8_HANDLER( defender_bank_select_w )
|
||||
|
||||
READ8_HANDLER( mayday_protection_r )
|
||||
{
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
/* Mayday does some kind of protection check that is not currently understood */
|
||||
/* However, the results of that protection check are stored at $a190 and $a191 */
|
||||
/* These are compared against $a193 and $a194, respectively. Thus, to prevent */
|
||||
/* the protection from resetting the space->machine, we just return $a193 for $a190, */
|
||||
/* and $a194 for $a191. */
|
||||
return mayday_protection[offset + 3];
|
||||
return state->mayday_protection[offset + 3];
|
||||
}
|
||||
|
||||
|
||||
@ -821,11 +822,12 @@ READ8_HANDLER( mayday_protection_r )
|
||||
|
||||
WRITE8_HANDLER( sinistar_vram_select_w )
|
||||
{
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
/* low two bits are standard */
|
||||
williams_vram_select_w(space, offset, data);
|
||||
|
||||
/* window enable from bit 2 (clips to 0x7400) */
|
||||
williams_blitter_window_enable = data & 0x04;
|
||||
state->blitter_window_enable = data & 0x04;
|
||||
}
|
||||
|
||||
|
||||
@ -838,16 +840,17 @@ WRITE8_HANDLER( sinistar_vram_select_w )
|
||||
|
||||
MACHINE_START( blaster )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
MACHINE_START_CALL(williams_common);
|
||||
|
||||
/* banking is different for blaster */
|
||||
memory_configure_bank(machine, "bank1", 0, 1, williams_videoram, 0);
|
||||
memory_configure_bank(machine, "bank1", 0, 1, state->videoram, 0);
|
||||
memory_configure_bank(machine, "bank1", 1, 16, machine->region("maincpu")->base() + 0x18000, 0x4000);
|
||||
|
||||
memory_configure_bank(machine, "bank2", 0, 1, williams_videoram + 0x4000, 0);
|
||||
memory_configure_bank(machine, "bank2", 0, 1, state->videoram + 0x4000, 0);
|
||||
memory_configure_bank(machine, "bank2", 1, 16, machine->region("maincpu")->base() + 0x10000, 0x0000);
|
||||
|
||||
state_save_register_global(machine, blaster_bank);
|
||||
state_save_register_global(machine, state->blaster_bank);
|
||||
}
|
||||
|
||||
|
||||
@ -859,28 +862,31 @@ MACHINE_RESET( blaster )
|
||||
|
||||
INLINE void update_blaster_banking(running_machine *machine)
|
||||
{
|
||||
memory_set_bank(machine, "bank1", vram_bank * (blaster_bank + 1));
|
||||
memory_set_bank(machine, "bank2", vram_bank * (blaster_bank + 1));
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
memory_set_bank(machine, "bank1", state->vram_bank * (state->blaster_bank + 1));
|
||||
memory_set_bank(machine, "bank2", state->vram_bank * (state->blaster_bank + 1));
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( blaster_vram_select_w )
|
||||
{
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
/* VRAM/ROM banking from bit 0 */
|
||||
vram_bank = data & 0x01;
|
||||
state->vram_bank = data & 0x01;
|
||||
update_blaster_banking(space->machine);
|
||||
|
||||
/* cocktail flip from bit 1 */
|
||||
williams_cocktail = data & 0x02;
|
||||
state->cocktail = data & 0x02;
|
||||
|
||||
/* window enable from bit 2 (clips to 0x9700) */
|
||||
williams_blitter_window_enable = data & 0x04;
|
||||
state->blitter_window_enable = data & 0x04;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( blaster_bank_select_w )
|
||||
{
|
||||
blaster_bank = data & 15;
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
state->blaster_bank = data & 15;
|
||||
update_blaster_banking(space->machine);
|
||||
}
|
||||
|
||||
@ -947,9 +953,10 @@ static WRITE8_DEVICE_HANDLER( tshoot_lamp_w )
|
||||
|
||||
MACHINE_START( joust2 )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
MACHINE_START_CALL(williams2);
|
||||
williams_cvsd_init(machine);
|
||||
state_save_register_global(machine, joust2_current_sound_data);
|
||||
state_save_register_global(machine, state->joust2_current_sound_data);
|
||||
}
|
||||
|
||||
|
||||
@ -972,16 +979,18 @@ static TIMER_CALLBACK( joust2_deferred_snd_cmd_w )
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( joust2_pia_3_cb1_w )
|
||||
{
|
||||
williams_state *state = device->machine->driver_data<williams_state>();
|
||||
pia6821_device *pia_3 = device->machine->device<pia6821_device>("cvsdpia");
|
||||
|
||||
joust2_current_sound_data = (joust2_current_sound_data & ~0x100) | ((data << 8) & 0x100);
|
||||
state->joust2_current_sound_data = (state->joust2_current_sound_data & ~0x100) | ((data << 8) & 0x100);
|
||||
pia6821_cb1_w(pia_3, data);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( joust2_snd_cmd_w )
|
||||
{
|
||||
joust2_current_sound_data = (joust2_current_sound_data & ~0xff) | (data & 0xff);
|
||||
williams_cvsd_data_w(device->machine, joust2_current_sound_data);
|
||||
device->machine->scheduler().synchronize(FUNC(joust2_deferred_snd_cmd_w), joust2_current_sound_data);
|
||||
williams_state *state = device->machine->driver_data<williams_state>();
|
||||
state->joust2_current_sound_data = (state->joust2_current_sound_data & ~0xff) | (data & 0xff);
|
||||
williams_cvsd_data_w(device->machine, state->joust2_current_sound_data);
|
||||
device->machine->scheduler().synchronize(FUNC(joust2_deferred_snd_cmd_w), state->joust2_current_sound_data);
|
||||
}
|
||||
|
@ -914,7 +914,7 @@ static void valtric_draw_mosaic(screen_device &screen, bitmap_t *bitmap, const r
|
||||
{
|
||||
int step=state->mosaic;
|
||||
UINT32 *dest;
|
||||
int x,y,xx,yy;
|
||||
int x,y,xx,yy,c=0;
|
||||
int width = screen.width();
|
||||
int height = screen.height();
|
||||
|
||||
@ -923,9 +923,7 @@ static void valtric_draw_mosaic(screen_device &screen, bitmap_t *bitmap, const r
|
||||
for (y=0;y<width+step;y+=step)
|
||||
for (x=0;x<height+step;x+=step)
|
||||
{
|
||||
static int c=0;
|
||||
|
||||
if (y<height && x< width)
|
||||
if (y < height && x < width)
|
||||
c=*BITMAP_ADDR32(state->mosaicbitmap, y, x);
|
||||
|
||||
if (state->mosaic<0)
|
||||
@ -958,15 +956,13 @@ static void valtric_draw_mosaic(screen_device &screen, bitmap_t *bitmap, const r
|
||||
tilemap_draw(state->mosaicbitmap, cliprect, state->bg1_tilemap, 0, 0);
|
||||
{
|
||||
UINT32 *dest;
|
||||
int x,y,xx,yy;
|
||||
int x,y,xx,yy,c=0;
|
||||
int width = screen.width();
|
||||
int height = screen.height();
|
||||
|
||||
for (y = 0; y < width+step; y += step)
|
||||
for (x = 0; x < height+step; x += step)
|
||||
{
|
||||
static int c = 0;
|
||||
|
||||
if (y < height && x < width)
|
||||
c = *BITMAP_ADDR32(state->mosaicbitmap, y, x);
|
||||
|
||||
|
@ -1110,7 +1110,6 @@ if (input_code_pressed(machine, KEYCODE_X))
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
static int show_unknown;
|
||||
#define CISCHEAT_LAYERSCTRL \
|
||||
state->debugsprites = 0; \
|
||||
if ( input_code_pressed(screen->machine, KEYCODE_Z) || input_code_pressed(screen->machine, KEYCODE_X) ) \
|
||||
@ -1131,8 +1130,8 @@ if ( input_code_pressed(screen->machine, KEYCODE_Z) || input_code_pressed(screen
|
||||
\
|
||||
{ \
|
||||
if ( input_code_pressed(screen->machine, KEYCODE_Z) && input_code_pressed_once(screen->machine, KEYCODE_U) ) \
|
||||
show_unknown ^= 1; \
|
||||
if (show_unknown) \
|
||||
state->show_unknown ^= 1; \
|
||||
if (state->show_unknown) \
|
||||
popmessage("0:%04X 2:%04X 4:%04X 6:%04X c:%04X", \
|
||||
megasys1_vregs[0],megasys1_vregs[1],megasys1_vregs[2],megasys1_vregs[3],megasys1_vregs[0xc/2] ); \
|
||||
}
|
||||
|
@ -9,27 +9,6 @@
|
||||
#include "includes/exidy.h"
|
||||
|
||||
|
||||
UINT8 *exidy_videoram;
|
||||
UINT8 *exidy_characterram;
|
||||
UINT8 *exidy_color_latch;
|
||||
UINT8 *exidy_sprite1_xpos;
|
||||
UINT8 *exidy_sprite1_ypos;
|
||||
UINT8 *exidy_sprite2_xpos;
|
||||
UINT8 *exidy_sprite2_ypos;
|
||||
UINT8 *exidy_spriteno;
|
||||
UINT8 *exidy_sprite_enable;
|
||||
|
||||
static UINT8 collision_mask;
|
||||
static UINT8 collision_invert;
|
||||
static int is_2bpp;
|
||||
static UINT8 int_condition;
|
||||
|
||||
static bitmap_t *background_bitmap;
|
||||
static bitmap_t *motion_object_1_vid;
|
||||
static bitmap_t *motion_object_2_vid;
|
||||
static bitmap_t *motion_object_2_clip;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
@ -37,11 +16,12 @@ static bitmap_t *motion_object_2_clip;
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp)
|
||||
void exidy_video_config(running_machine *machine, UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp)
|
||||
{
|
||||
collision_mask = _collision_mask;
|
||||
collision_invert = _collision_invert;
|
||||
is_2bpp = _is_2bpp;
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
state->collision_mask = _collision_mask;
|
||||
state->collision_invert = _collision_invert;
|
||||
state->is_2bpp = _is_2bpp;
|
||||
}
|
||||
|
||||
|
||||
@ -54,21 +34,22 @@ void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_
|
||||
|
||||
VIDEO_START( exidy )
|
||||
{
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
bitmap_format format = machine->primary_screen->format();
|
||||
|
||||
background_bitmap = machine->primary_screen->alloc_compatible_bitmap();
|
||||
motion_object_1_vid = auto_bitmap_alloc(machine, 16, 16, format);
|
||||
motion_object_2_vid = auto_bitmap_alloc(machine, 16, 16, format);
|
||||
motion_object_2_clip = auto_bitmap_alloc(machine, 16, 16, format);
|
||||
state->background_bitmap = machine->primary_screen->alloc_compatible_bitmap();
|
||||
state->motion_object_1_vid = auto_bitmap_alloc(machine, 16, 16, format);
|
||||
state->motion_object_2_vid = auto_bitmap_alloc(machine, 16, 16, format);
|
||||
state->motion_object_2_clip = auto_bitmap_alloc(machine, 16, 16, format);
|
||||
|
||||
state_save_register_global(machine, collision_mask);
|
||||
state_save_register_global(machine, collision_invert);
|
||||
state_save_register_global(machine, is_2bpp);
|
||||
state_save_register_global(machine, int_condition);
|
||||
state_save_register_global_bitmap(machine, background_bitmap);
|
||||
state_save_register_global_bitmap(machine, motion_object_1_vid);
|
||||
state_save_register_global_bitmap(machine, motion_object_2_vid);
|
||||
state_save_register_global_bitmap(machine, motion_object_2_clip);
|
||||
state_save_register_global(machine, state->collision_mask);
|
||||
state_save_register_global(machine, state->collision_invert);
|
||||
state_save_register_global(machine, state->is_2bpp);
|
||||
state_save_register_global(machine, state->int_condition);
|
||||
state_save_register_global_bitmap(machine, state->background_bitmap);
|
||||
state_save_register_global_bitmap(machine, state->motion_object_1_vid);
|
||||
state_save_register_global_bitmap(machine, state->motion_object_2_vid);
|
||||
state_save_register_global_bitmap(machine, state->motion_object_2_clip);
|
||||
}
|
||||
|
||||
|
||||
@ -81,16 +62,18 @@ VIDEO_START( exidy )
|
||||
|
||||
INLINE void latch_condition(running_machine *machine, int collision)
|
||||
{
|
||||
collision ^= collision_invert;
|
||||
int_condition = (input_port_read(machine, "INTSOURCE") & ~0x1c) | (collision & collision_mask);
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
collision ^= state->collision_invert;
|
||||
state->int_condition = (input_port_read(machine, "INTSOURCE") & ~0x1c) | (collision & state->collision_mask);
|
||||
}
|
||||
|
||||
|
||||
INTERRUPT_GEN( exidy_vblank_interrupt )
|
||||
{
|
||||
exidy_state *state = device->machine->driver_data<exidy_state>();
|
||||
/* latch the current condition */
|
||||
latch_condition(device->machine, 0);
|
||||
int_condition &= ~0x80;
|
||||
state->int_condition &= ~0x80;
|
||||
|
||||
/* set the IRQ line */
|
||||
cpu_set_input_line(device, 0, ASSERT_LINE);
|
||||
@ -110,11 +93,12 @@ INTERRUPT_GEN( teetert_vblank_interrupt )
|
||||
|
||||
READ8_HANDLER( exidy_interrupt_r )
|
||||
{
|
||||
exidy_state *state = space->machine->driver_data<exidy_state>();
|
||||
/* clear any interrupts */
|
||||
cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
|
||||
|
||||
/* return the latched condition */
|
||||
return int_condition;
|
||||
return state->int_condition;
|
||||
}
|
||||
|
||||
|
||||
@ -127,10 +111,11 @@ READ8_HANDLER( exidy_interrupt_r )
|
||||
|
||||
INLINE void set_1_color(running_machine *machine, int index, int which)
|
||||
{
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
palette_set_color_rgb(machine, index,
|
||||
pal1bit(exidy_color_latch[2] >> which),
|
||||
pal1bit(exidy_color_latch[1] >> which),
|
||||
pal1bit(exidy_color_latch[0] >> which));
|
||||
pal1bit(state->color_latch[2] >> which),
|
||||
pal1bit(state->color_latch[1] >> which),
|
||||
pal1bit(state->color_latch[0] >> which));
|
||||
}
|
||||
|
||||
static void set_colors(running_machine *machine)
|
||||
@ -158,8 +143,9 @@ static void set_colors(running_machine *machine)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void draw_background(void)
|
||||
static void draw_background(running_machine *machine)
|
||||
{
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
offs_t offs;
|
||||
|
||||
pen_t off_pen = 0;
|
||||
@ -170,9 +156,9 @@ static void draw_background(void)
|
||||
pen_t on_pen_1, on_pen_2;
|
||||
|
||||
UINT8 y = offs >> 5 << 3;
|
||||
UINT8 code = exidy_videoram[offs];
|
||||
UINT8 code = state->videoram[offs];
|
||||
|
||||
if (is_2bpp)
|
||||
if (state->is_2bpp)
|
||||
{
|
||||
on_pen_1 = 4 + ((code >> 6) & 0x02);
|
||||
on_pen_2 = 5 + ((code >> 6) & 0x02);
|
||||
@ -188,17 +174,17 @@ static void draw_background(void)
|
||||
int i;
|
||||
UINT8 x = offs << 3;
|
||||
|
||||
if (is_2bpp)
|
||||
if (state->is_2bpp)
|
||||
{
|
||||
UINT8 data1 = exidy_characterram[0x000 | (code << 3) | cy];
|
||||
UINT8 data2 = exidy_characterram[0x800 | (code << 3) | cy];
|
||||
UINT8 data1 = state->characterram[0x000 | (code << 3) | cy];
|
||||
UINT8 data2 = state->characterram[0x800 | (code << 3) | cy];
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
if (data1 & 0x80)
|
||||
*BITMAP_ADDR16(background_bitmap, y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1;
|
||||
*BITMAP_ADDR16(state->background_bitmap, y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1;
|
||||
else
|
||||
*BITMAP_ADDR16(background_bitmap, y, x) = off_pen;
|
||||
*BITMAP_ADDR16(state->background_bitmap, y, x) = off_pen;
|
||||
|
||||
x = x + 1;
|
||||
data1 = data1 << 1;
|
||||
@ -208,11 +194,11 @@ static void draw_background(void)
|
||||
/* 1bpp */
|
||||
else
|
||||
{
|
||||
UINT8 data = exidy_characterram[(code << 3) | cy];
|
||||
UINT8 data = state->characterram[(code << 3) | cy];
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
*BITMAP_ADDR16(background_bitmap, y, x) = (data & 0x80) ? on_pen_1 : off_pen;
|
||||
*BITMAP_ADDR16(state->background_bitmap, y, x) = (data & 0x80) ? on_pen_1 : off_pen;
|
||||
|
||||
x = x + 1;
|
||||
data = data << 1;
|
||||
@ -232,38 +218,39 @@ static void draw_background(void)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
INLINE int sprite_1_enabled(void)
|
||||
INLINE int sprite_1_enabled(exidy_state *state)
|
||||
{
|
||||
/* if the collision_mask is 0x00, then we are on old hardware that always has */
|
||||
/* sprite 1 enabled regardless */
|
||||
return (!(*exidy_sprite_enable & 0x80) || (*exidy_sprite_enable & 0x10) || (collision_mask == 0x00));
|
||||
return (!(*state->sprite_enable & 0x80) || (*state->sprite_enable & 0x10) || (state->collision_mask == 0x00));
|
||||
}
|
||||
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
{
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
/* draw sprite 2 first */
|
||||
int sprite_set_2 = ((*exidy_sprite_enable & 0x40) != 0);
|
||||
int sprite_set_2 = ((*state->sprite_enable & 0x40) != 0);
|
||||
|
||||
int sx = 236 - *exidy_sprite2_xpos - 4;
|
||||
int sy = 244 - *exidy_sprite2_ypos - 4;
|
||||
int sx = 236 - *state->sprite2_xpos - 4;
|
||||
int sy = 244 - *state->sprite2_ypos - 4;
|
||||
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[0],
|
||||
((*exidy_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 1,
|
||||
((*state->spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 1,
|
||||
0, 0, sx, sy, 0);
|
||||
|
||||
/* draw sprite 1 next */
|
||||
if (sprite_1_enabled())
|
||||
if (sprite_1_enabled(state))
|
||||
{
|
||||
int sprite_set_1 = ((*exidy_sprite_enable & 0x20) != 0);
|
||||
int sprite_set_1 = ((*state->sprite_enable & 0x20) != 0);
|
||||
|
||||
sx = 236 - *exidy_sprite1_xpos - 4;
|
||||
sy = 244 - *exidy_sprite1_ypos - 4;
|
||||
sx = 236 - *state->sprite1_xpos - 4;
|
||||
sy = 244 - *state->sprite1_ypos - 4;
|
||||
|
||||
if (sy < 0) sy = 0;
|
||||
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[0],
|
||||
(*exidy_spriteno & 0x0f) + 16 * sprite_set_1, 0,
|
||||
(*state->spriteno & 0x0f) + 16 * sprite_set_1, 0,
|
||||
0, 0, sx, sy, 0);
|
||||
}
|
||||
|
||||
@ -301,45 +288,46 @@ static TIMER_CALLBACK( collision_irq_callback )
|
||||
|
||||
static void check_collision(running_machine *machine)
|
||||
{
|
||||
UINT8 sprite_set_1 = ((*exidy_sprite_enable & 0x20) != 0);
|
||||
UINT8 sprite_set_2 = ((*exidy_sprite_enable & 0x40) != 0);
|
||||
static const rectangle clip = { 0, 15, 0, 15 };
|
||||
int org_1_x = 0, org_1_y = 0;
|
||||
int org_2_x = 0, org_2_y = 0;
|
||||
int sx, sy;
|
||||
exidy_state *state = machine->driver_data<exidy_state>();
|
||||
UINT8 sprite_set_1 = ((*state->sprite_enable & 0x20) != 0);
|
||||
UINT8 sprite_set_2 = ((*state->sprite_enable & 0x40) != 0);
|
||||
static const rectangle clip = { 0, 15, 0, 15 };
|
||||
int org_1_x = 0, org_1_y = 0;
|
||||
int org_2_x = 0, org_2_y = 0;
|
||||
int sx, sy;
|
||||
int count = 0;
|
||||
|
||||
/* if there is nothing to detect, bail */
|
||||
if (collision_mask == 0)
|
||||
if (state->collision_mask == 0)
|
||||
return;
|
||||
|
||||
/* draw sprite 1 */
|
||||
bitmap_fill(motion_object_1_vid, &clip, 0xff);
|
||||
if (sprite_1_enabled())
|
||||
bitmap_fill(state->motion_object_1_vid, &clip, 0xff);
|
||||
if (sprite_1_enabled(state))
|
||||
{
|
||||
org_1_x = 236 - *exidy_sprite1_xpos - 4;
|
||||
org_1_y = 244 - *exidy_sprite1_ypos - 4;
|
||||
drawgfx_transpen(motion_object_1_vid, &clip, machine->gfx[0],
|
||||
(*exidy_spriteno & 0x0f) + 16 * sprite_set_1, 0,
|
||||
org_1_x = 236 - *state->sprite1_xpos - 4;
|
||||
org_1_y = 244 - *state->sprite1_ypos - 4;
|
||||
drawgfx_transpen(state->motion_object_1_vid, &clip, machine->gfx[0],
|
||||
(*state->spriteno & 0x0f) + 16 * sprite_set_1, 0,
|
||||
0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* draw sprite 2 */
|
||||
bitmap_fill(motion_object_2_vid, &clip, 0xff);
|
||||
org_2_x = 236 - *exidy_sprite2_xpos - 4;
|
||||
org_2_y = 244 - *exidy_sprite2_ypos - 4;
|
||||
drawgfx_transpen(motion_object_2_vid, &clip, machine->gfx[0],
|
||||
((*exidy_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
|
||||
bitmap_fill(state->motion_object_2_vid, &clip, 0xff);
|
||||
org_2_x = 236 - *state->sprite2_xpos - 4;
|
||||
org_2_y = 244 - *state->sprite2_ypos - 4;
|
||||
drawgfx_transpen(state->motion_object_2_vid, &clip, machine->gfx[0],
|
||||
((*state->spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
|
||||
0, 0, 0, 0, 0);
|
||||
|
||||
/* draw sprite 2 clipped to sprite 1's location */
|
||||
bitmap_fill(motion_object_2_clip, &clip, 0xff);
|
||||
if (sprite_1_enabled())
|
||||
bitmap_fill(state->motion_object_2_clip, &clip, 0xff);
|
||||
if (sprite_1_enabled(state))
|
||||
{
|
||||
sx = org_2_x - org_1_x;
|
||||
sy = org_2_y - org_1_y;
|
||||
drawgfx_transpen(motion_object_2_clip, &clip, machine->gfx[0],
|
||||
((*exidy_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
|
||||
drawgfx_transpen(state->motion_object_2_clip, &clip, machine->gfx[0],
|
||||
((*state->spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
|
||||
0, 0, sx, sy, 0);
|
||||
}
|
||||
|
||||
@ -347,28 +335,28 @@ static void check_collision(running_machine *machine)
|
||||
for (sy = 0; sy < 16; sy++)
|
||||
for (sx = 0; sx < 16; sx++)
|
||||
{
|
||||
if (*BITMAP_ADDR16(motion_object_1_vid, sy, sx) != 0xff)
|
||||
if (*BITMAP_ADDR16(state->motion_object_1_vid, sy, sx) != 0xff)
|
||||
{
|
||||
UINT8 current_collision_mask = 0;
|
||||
|
||||
/* check for background collision (M1CHAR) */
|
||||
if (*BITMAP_ADDR16(background_bitmap, org_1_y + sy, org_1_x + sx) != 0)
|
||||
if (*BITMAP_ADDR16(state->background_bitmap, org_1_y + sy, org_1_x + sx) != 0)
|
||||
current_collision_mask |= 0x04;
|
||||
|
||||
/* check for motion object collision (M1M2) */
|
||||
if (*BITMAP_ADDR16(motion_object_2_clip, sy, sx) != 0xff)
|
||||
if (*BITMAP_ADDR16(state->motion_object_2_clip, sy, sx) != 0xff)
|
||||
current_collision_mask |= 0x10;
|
||||
|
||||
/* if we got one, trigger an interrupt */
|
||||
if ((current_collision_mask & collision_mask) && (count++ < 128))
|
||||
if ((current_collision_mask & state->collision_mask) && (count++ < 128))
|
||||
machine->scheduler().timer_set(machine->primary_screen->time_until_pos(org_1_x + sx, org_1_y + sy), FUNC(collision_irq_callback), current_collision_mask);
|
||||
}
|
||||
|
||||
if (*BITMAP_ADDR16(motion_object_2_vid, sy, sx) != 0xff)
|
||||
if (*BITMAP_ADDR16(state->motion_object_2_vid, sy, sx) != 0xff)
|
||||
{
|
||||
/* check for background collision (M2CHAR) */
|
||||
if (*BITMAP_ADDR16(background_bitmap, org_2_y + sy, org_2_x + sx) != 0)
|
||||
if ((collision_mask & 0x08) && (count++ < 128))
|
||||
if (*BITMAP_ADDR16(state->background_bitmap, org_2_y + sy, org_2_x + sx) != 0)
|
||||
if ((state->collision_mask & 0x08) && (count++ < 128))
|
||||
machine->scheduler().timer_set(machine->primary_screen->time_until_pos(org_2_x + sx, org_2_y + sy), FUNC(collision_irq_callback), 0x08);
|
||||
}
|
||||
}
|
||||
@ -384,12 +372,13 @@ static void check_collision(running_machine *machine)
|
||||
|
||||
SCREEN_UPDATE( exidy )
|
||||
{
|
||||
exidy_state *state = screen->machine->driver_data<exidy_state>();
|
||||
/* refresh the colors from the palette (static or dynamic) */
|
||||
set_colors(screen->machine);
|
||||
|
||||
/* update the background and draw it */
|
||||
draw_background();
|
||||
copybitmap(bitmap, background_bitmap, 0, 0, 0, 0, cliprect);
|
||||
draw_background(screen->machine);
|
||||
copybitmap(bitmap, state->background_bitmap, 0, 0, 0, 0, cliprect);
|
||||
|
||||
/* draw the sprites */
|
||||
draw_sprites(screen->machine, bitmap, NULL);
|
||||
|
@ -26,24 +26,6 @@
|
||||
#define SPRITE_COUNT (0x28)
|
||||
|
||||
|
||||
/* globals */
|
||||
UINT8 *exidy440_scanline;
|
||||
UINT8 *exidy440_imageram;
|
||||
UINT8 exidy440_firq_vblank;
|
||||
UINT8 exidy440_firq_beam;
|
||||
UINT8 *topsecex_yscroll;
|
||||
|
||||
/* local allocated storage */
|
||||
static UINT8 exidy440_latched_x;
|
||||
static UINT8 *local_videoram;
|
||||
static UINT8 *local_paletteram;
|
||||
|
||||
/* local variables */
|
||||
static UINT8 firq_enable;
|
||||
static UINT8 firq_select;
|
||||
static UINT8 palettebank_io;
|
||||
static UINT8 palettebank_vis;
|
||||
|
||||
/* function prototypes */
|
||||
static void exidy440_update_firq(running_machine *machine);
|
||||
|
||||
@ -57,29 +39,31 @@ static void exidy440_update_firq(running_machine *machine);
|
||||
|
||||
static VIDEO_START( exidy440 )
|
||||
{
|
||||
exidy440_state *state = machine->driver_data<exidy440_state>();
|
||||
/* reset the system */
|
||||
firq_enable = 0;
|
||||
firq_select = 0;
|
||||
palettebank_io = 0;
|
||||
palettebank_vis = 0;
|
||||
exidy440_firq_vblank = 0;
|
||||
exidy440_firq_beam = 0;
|
||||
state->firq_enable = 0;
|
||||
state->firq_select = 0;
|
||||
state->palettebank_io = 0;
|
||||
state->palettebank_vis = 0;
|
||||
state->firq_vblank = 0;
|
||||
state->firq_beam = 0;
|
||||
|
||||
/* allocate a buffer for VRAM */
|
||||
local_videoram = auto_alloc_array(machine, UINT8, 256 * 256 * 2);
|
||||
memset(local_videoram, 0, 256 * 256 * 2);
|
||||
state->local_videoram = auto_alloc_array(machine, UINT8, 256 * 256 * 2);
|
||||
memset(state->local_videoram, 0, 256 * 256 * 2);
|
||||
|
||||
/* allocate a buffer for palette RAM */
|
||||
local_paletteram = auto_alloc_array(machine, UINT8, 512 * 2);
|
||||
memset(local_paletteram, 0, 512 * 2);
|
||||
state->local_paletteram = auto_alloc_array(machine, UINT8, 512 * 2);
|
||||
memset(state->local_paletteram, 0, 512 * 2);
|
||||
}
|
||||
|
||||
|
||||
static VIDEO_START( topsecex )
|
||||
{
|
||||
exidy440_state *state = machine->driver_data<exidy440_state>();
|
||||
VIDEO_START_CALL(exidy440);
|
||||
|
||||
*topsecex_yscroll = 0;
|
||||
*state->topsecex_yscroll = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -92,7 +76,8 @@ static VIDEO_START( topsecex )
|
||||
|
||||
READ8_HANDLER( exidy440_videoram_r )
|
||||
{
|
||||
UINT8 *base = &local_videoram[(*exidy440_scanline * 256 + offset) * 2];
|
||||
exidy440_state *state = space->machine->driver_data<exidy440_state>();
|
||||
UINT8 *base = &state->local_videoram[(*state->scanline * 256 + offset) * 2];
|
||||
|
||||
/* combine the two pixel values into one byte */
|
||||
return (base[0] << 4) | base[1];
|
||||
@ -101,7 +86,8 @@ READ8_HANDLER( exidy440_videoram_r )
|
||||
|
||||
WRITE8_HANDLER( exidy440_videoram_w )
|
||||
{
|
||||
UINT8 *base = &local_videoram[(*exidy440_scanline * 256 + offset) * 2];
|
||||
exidy440_state *state = space->machine->driver_data<exidy440_state>();
|
||||
UINT8 *base = &state->local_videoram[(*state->scanline * 256 + offset) * 2];
|
||||
|
||||
/* expand the two pixel values into two bytes */
|
||||
base[0] = (data >> 4) & 15;
|
||||
@ -118,23 +104,25 @@ WRITE8_HANDLER( exidy440_videoram_w )
|
||||
|
||||
READ8_HANDLER( exidy440_paletteram_r )
|
||||
{
|
||||
return local_paletteram[palettebank_io * 512 + offset];
|
||||
exidy440_state *state = space->machine->driver_data<exidy440_state>();
|
||||
return state->local_paletteram[state->palettebank_io * 512 + offset];
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( exidy440_paletteram_w )
|
||||
{
|
||||
exidy440_state *state = space->machine->driver_data<exidy440_state>();
|
||||
/* update palette ram in the I/O bank */
|
||||
local_paletteram[palettebank_io * 512 + offset] = data;
|
||||
state->local_paletteram[state->palettebank_io * 512 + offset] = data;
|
||||
|
||||
/* if we're modifying the active palette, change the color immediately */
|
||||
if (palettebank_io == palettebank_vis)
|
||||
if (state->palettebank_io == state->palettebank_vis)
|
||||
{
|
||||
int word;
|
||||
|
||||
/* combine two bytes into a word */
|
||||
offset = palettebank_vis * 512 + (offset & 0x1fe);
|
||||
word = (local_paletteram[offset] << 8) + local_paletteram[offset + 1];
|
||||
offset = state->palettebank_vis * 512 + (offset & 0x1fe);
|
||||
word = (state->local_paletteram[offset] << 8) + state->local_paletteram[offset + 1];
|
||||
|
||||
/* extract the 5-5-5 RGB colors */
|
||||
palette_set_color_rgb(space->machine, offset / 2, pal5bit(word >> 10), pal5bit(word >> 5), pal5bit(word >> 0));
|
||||
@ -151,13 +139,14 @@ WRITE8_HANDLER( exidy440_paletteram_w )
|
||||
|
||||
READ8_HANDLER( exidy440_horizontal_pos_r )
|
||||
{
|
||||
exidy440_state *state = space->machine->driver_data<exidy440_state>();
|
||||
/* clear the FIRQ on a read here */
|
||||
exidy440_firq_beam = 0;
|
||||
state->firq_beam = 0;
|
||||
exidy440_update_firq(space->machine);
|
||||
|
||||
/* according to the schems, this value is only latched on an FIRQ
|
||||
* caused by collision or beam */
|
||||
return exidy440_latched_x;
|
||||
return state->latched_x;
|
||||
}
|
||||
|
||||
|
||||
@ -197,29 +186,30 @@ WRITE8_HANDLER( exidy440_spriteram_w )
|
||||
|
||||
WRITE8_HANDLER( exidy440_control_w )
|
||||
{
|
||||
int oldvis = palettebank_vis;
|
||||
exidy440_state *state = space->machine->driver_data<exidy440_state>();
|
||||
int oldvis = state->palettebank_vis;
|
||||
|
||||
/* extract the various bits */
|
||||
exidy440_bank_select(space->machine, data >> 4);
|
||||
firq_enable = (data >> 3) & 1;
|
||||
firq_select = (data >> 2) & 1;
|
||||
palettebank_io = (data >> 1) & 1;
|
||||
palettebank_vis = data & 1;
|
||||
state->firq_enable = (data >> 3) & 1;
|
||||
state->firq_select = (data >> 2) & 1;
|
||||
state->palettebank_io = (data >> 1) & 1;
|
||||
state->palettebank_vis = data & 1;
|
||||
|
||||
/* update the FIRQ in case we enabled something */
|
||||
exidy440_update_firq(space->machine);
|
||||
|
||||
/* if we're swapping palettes, change all the colors */
|
||||
if (oldvis != palettebank_vis)
|
||||
if (oldvis != state->palettebank_vis)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* pick colors from the visible bank */
|
||||
offset = palettebank_vis * 512;
|
||||
offset = state->palettebank_vis * 512;
|
||||
for (i = 0; i < 256; i++, offset += 2)
|
||||
{
|
||||
/* extract a word and the 5-5-5 RGB components */
|
||||
int word = (local_paletteram[offset] << 8) + local_paletteram[offset + 1];
|
||||
int word = (state->local_paletteram[offset] << 8) + state->local_paletteram[offset + 1];
|
||||
palette_set_color_rgb(space->machine, i, pal5bit(word >> 10), pal5bit(word >> 5), pal5bit(word >> 0));
|
||||
}
|
||||
}
|
||||
@ -228,8 +218,9 @@ WRITE8_HANDLER( exidy440_control_w )
|
||||
|
||||
WRITE8_HANDLER( exidy440_interrupt_clear_w )
|
||||
{
|
||||
exidy440_state *state = space->machine->driver_data<exidy440_state>();
|
||||
/* clear the VBLANK FIRQ on a write here */
|
||||
exidy440_firq_vblank = 0;
|
||||
state->firq_vblank = 0;
|
||||
exidy440_update_firq(space->machine);
|
||||
}
|
||||
|
||||
@ -243,7 +234,8 @@ WRITE8_HANDLER( exidy440_interrupt_clear_w )
|
||||
|
||||
static void exidy440_update_firq(running_machine *machine)
|
||||
{
|
||||
if (exidy440_firq_vblank || (firq_enable && exidy440_firq_beam))
|
||||
exidy440_state *state = machine->driver_data<exidy440_state>();
|
||||
if (state->firq_vblank || (state->firq_enable && state->firq_beam))
|
||||
cputag_set_input_line(machine, "maincpu", 1, ASSERT_LINE);
|
||||
else
|
||||
cputag_set_input_line(machine, "maincpu", 1, CLEAR_LINE);
|
||||
@ -252,8 +244,9 @@ static void exidy440_update_firq(running_machine *machine)
|
||||
|
||||
INTERRUPT_GEN( exidy440_vblank_interrupt )
|
||||
{
|
||||
exidy440_state *state = device->machine->driver_data<exidy440_state>();
|
||||
/* set the FIRQ line on a VBLANK */
|
||||
exidy440_firq_vblank = 1;
|
||||
state->firq_vblank = 1;
|
||||
exidy440_update_firq(device->machine);
|
||||
}
|
||||
|
||||
@ -267,10 +260,11 @@ INTERRUPT_GEN( exidy440_vblank_interrupt )
|
||||
|
||||
static TIMER_CALLBACK( beam_firq_callback )
|
||||
{
|
||||
exidy440_state *state = machine->driver_data<exidy440_state>();
|
||||
/* generate the interrupt, if we're selected */
|
||||
if (firq_select && firq_enable)
|
||||
if (state->firq_select && state->firq_enable)
|
||||
{
|
||||
exidy440_firq_beam = 1;
|
||||
state->firq_beam = 1;
|
||||
exidy440_update_firq(machine);
|
||||
}
|
||||
|
||||
@ -278,16 +272,17 @@ static TIMER_CALLBACK( beam_firq_callback )
|
||||
param = (param + 1) / 2;
|
||||
|
||||
/* latch the x value; this convolution comes from the read routine */
|
||||
exidy440_latched_x = (param + 3) ^ 2;
|
||||
state->latched_x = (param + 3) ^ 2;
|
||||
}
|
||||
|
||||
|
||||
static TIMER_CALLBACK( collide_firq_callback )
|
||||
{
|
||||
exidy440_state *state = machine->driver_data<exidy440_state>();
|
||||
/* generate the interrupt, if we're selected */
|
||||
if (!firq_select && firq_enable)
|
||||
if (!state->firq_select && state->firq_enable)
|
||||
{
|
||||
exidy440_firq_beam = 1;
|
||||
state->firq_beam = 1;
|
||||
exidy440_update_firq(machine);
|
||||
}
|
||||
|
||||
@ -295,7 +290,7 @@ static TIMER_CALLBACK( collide_firq_callback )
|
||||
param = (param + 1) / 2;
|
||||
|
||||
/* latch the x value; this convolution comes from the read routine */
|
||||
exidy440_latched_x = (param + 3) ^ 2;
|
||||
state->latched_x = (param + 3) ^ 2;
|
||||
}
|
||||
|
||||
|
||||
@ -309,10 +304,11 @@ static TIMER_CALLBACK( collide_firq_callback )
|
||||
static void draw_sprites(screen_device &screen, bitmap_t *bitmap, const rectangle *cliprect,
|
||||
int scroll_offset, int check_collision)
|
||||
{
|
||||
exidy440_state *state = screen.machine->driver_data<exidy440_state>();
|
||||
int i;
|
||||
|
||||
/* get a pointer to the palette to look for collision flags */
|
||||
UINT8 *palette = &local_paletteram[palettebank_vis * 512];
|
||||
UINT8 *palette = &state->local_paletteram[state->palettebank_vis * 512];
|
||||
int count = 0;
|
||||
|
||||
/* draw the sprite images, checking for collisions along the way */
|
||||
@ -331,7 +327,7 @@ static void draw_sprites(screen_device &screen, bitmap_t *bitmap, const rectangl
|
||||
continue;
|
||||
|
||||
/* get a pointer to the source image */
|
||||
src = &exidy440_imageram[image * 128];
|
||||
src = &state->imageram[image * 128];
|
||||
|
||||
/* account for large positive offsets meaning small negative values */
|
||||
if (xoffs >= 0x1ff - 16)
|
||||
@ -354,7 +350,7 @@ static void draw_sprites(screen_device &screen, bitmap_t *bitmap, const rectangl
|
||||
/* only draw scanlines that are in this cliprect */
|
||||
if (yoffs <= cliprect->max_y)
|
||||
{
|
||||
UINT8 *old = &local_videoram[sy * 512 + xoffs];
|
||||
UINT8 *old = &state->local_videoram[sy * 512 + xoffs];
|
||||
int currx = xoffs;
|
||||
|
||||
/* loop over x */
|
||||
@ -409,6 +405,7 @@ static void draw_sprites(screen_device &screen, bitmap_t *bitmap, const rectangl
|
||||
static void update_screen(screen_device &screen, bitmap_t *bitmap, const rectangle *cliprect,
|
||||
int scroll_offset, int check_collision)
|
||||
{
|
||||
exidy440_state *state = screen.machine->driver_data<exidy440_state>();
|
||||
int y, sy;
|
||||
|
||||
/* draw any dirty scanlines from the VRAM directly */
|
||||
@ -420,7 +417,7 @@ static void update_screen(screen_device &screen, bitmap_t *bitmap, const rectang
|
||||
sy -= (VBSTART - VBEND);
|
||||
|
||||
/* draw line */
|
||||
draw_scanline8(bitmap, 0, y, (HBSTART - HBEND), &local_videoram[sy * 512], NULL);
|
||||
draw_scanline8(bitmap, 0, y, (HBSTART - HBEND), &state->local_videoram[sy * 512], NULL);
|
||||
}
|
||||
|
||||
/* draw the sprites */
|
||||
@ -469,8 +466,9 @@ static SCREEN_UPDATE( exidy440 )
|
||||
|
||||
static SCREEN_UPDATE( topsecex )
|
||||
{
|
||||
exidy440_state *state = screen->machine->driver_data<exidy440_state>();
|
||||
/* redraw the screen */
|
||||
update_screen(*screen, bitmap, cliprect, *topsecex_yscroll, FALSE);
|
||||
update_screen(*screen, bitmap, cliprect, *state->topsecex_yscroll, FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -20,15 +20,13 @@
|
||||
#include "emu.h"
|
||||
#include "includes/gatron.h"
|
||||
|
||||
static tilemap_t *bg_tilemap;
|
||||
|
||||
|
||||
WRITE8_HANDLER( gat_videoram_w )
|
||||
{
|
||||
gatron_state *state = space->machine->driver_data<gatron_state>();
|
||||
UINT8 *videoram = state->videoram;
|
||||
videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
@ -49,12 +47,14 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( gat )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols, 8, 16, 48, 16);
|
||||
gatron_state *state = machine->driver_data<gatron_state>();
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols, 8, 16, 48, 16);
|
||||
}
|
||||
|
||||
SCREEN_UPDATE( gat )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
gatron_state *state = screen->machine->driver_data<gatron_state>();
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -29,18 +29,15 @@
|
||||
#include "emu.h"
|
||||
#include "includes/m90.h"
|
||||
|
||||
static UINT16 *m90_spriteram;
|
||||
UINT16 *m90_video_data;
|
||||
static UINT16 m90_video_control_data[8];
|
||||
static tilemap_t *pf1_layer,*pf2_layer,*pf1_wide_layer,*pf2_wide_layer;
|
||||
|
||||
INLINE void get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer,int page_mask)
|
||||
{
|
||||
m90_state *state = machine->driver_data<m90_state>();
|
||||
int tile,color;
|
||||
tile_index = 2*tile_index + ((m90_video_control_data[5+layer] & page_mask) * 0x2000);
|
||||
tile_index = 2*tile_index + ((state->video_control_data[5+layer] & page_mask) * 0x2000);
|
||||
|
||||
tile=m90_video_data[tile_index];
|
||||
color=m90_video_data[tile_index+1];
|
||||
tile=state->video_data[tile_index];
|
||||
color=state->video_data[tile_index+1];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
tile,
|
||||
@ -51,11 +48,12 @@ INLINE void get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_
|
||||
|
||||
INLINE void bomblord_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer)
|
||||
{
|
||||
m90_state *state = machine->driver_data<m90_state>();
|
||||
int tile,color;
|
||||
tile_index = 2*tile_index + (layer * 0x2000);
|
||||
|
||||
tile=m90_video_data[tile_index];
|
||||
color=m90_video_data[tile_index+1];
|
||||
tile=state->video_data[tile_index];
|
||||
color=state->video_data[tile_index+1];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
tile,
|
||||
@ -66,11 +64,12 @@ INLINE void bomblord_get_tile_info(running_machine *machine,tile_data *tileinfo,
|
||||
|
||||
INLINE void dynablsb_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer)
|
||||
{
|
||||
m90_state *state = machine->driver_data<m90_state>();
|
||||
int tile,color;
|
||||
tile_index = 2*tile_index + (layer * 0x2000);
|
||||
|
||||
tile=m90_video_data[tile_index];
|
||||
color=m90_video_data[tile_index+1];
|
||||
tile=state->video_data[tile_index];
|
||||
color=state->video_data[tile_index+1];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
tile,
|
||||
@ -96,71 +95,75 @@ static TILE_GET_INFO( dynablsb_get_pf2w_tile_info ) { dynablsb_get_tile_info(mac
|
||||
|
||||
VIDEO_START( m90 )
|
||||
{
|
||||
pf1_layer = tilemap_create(machine, get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
pf1_wide_layer = tilemap_create(machine, get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
pf2_layer = tilemap_create(machine, get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
pf2_wide_layer = tilemap_create(machine, get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
m90_state *state = machine->driver_data<m90_state>();
|
||||
state->pf1_layer = tilemap_create(machine, get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
state->pf1_wide_layer = tilemap_create(machine, get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
state->pf2_layer = tilemap_create(machine, get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
state->pf2_wide_layer = tilemap_create(machine, get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
|
||||
tilemap_set_transparent_pen(pf1_layer,0);
|
||||
tilemap_set_transparent_pen(pf1_wide_layer,0);
|
||||
tilemap_set_transparent_pen(state->pf1_layer,0);
|
||||
tilemap_set_transparent_pen(state->pf1_wide_layer,0);
|
||||
|
||||
state_save_register_global_array(machine, m90_video_control_data);
|
||||
state_save_register_global_array(machine, state->video_control_data);
|
||||
}
|
||||
|
||||
VIDEO_START( bomblord )
|
||||
{
|
||||
pf1_layer = tilemap_create(machine, bomblord_get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
pf1_wide_layer = tilemap_create(machine, bomblord_get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
pf2_layer = tilemap_create(machine, bomblord_get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
pf2_wide_layer = tilemap_create(machine, bomblord_get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
m90_state *state = machine->driver_data<m90_state>();
|
||||
state->pf1_layer = tilemap_create(machine, bomblord_get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
state->pf1_wide_layer = tilemap_create(machine, bomblord_get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
state->pf2_layer = tilemap_create(machine, bomblord_get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
state->pf2_wide_layer = tilemap_create(machine, bomblord_get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
|
||||
tilemap_set_transparent_pen(pf2_layer,0);
|
||||
tilemap_set_transparent_pen(pf2_wide_layer,0);
|
||||
tilemap_set_transparent_pen(pf1_layer,0);
|
||||
tilemap_set_transparent_pen(pf1_wide_layer,0);
|
||||
tilemap_set_transparent_pen(state->pf2_layer,0);
|
||||
tilemap_set_transparent_pen(state->pf2_wide_layer,0);
|
||||
tilemap_set_transparent_pen(state->pf1_layer,0);
|
||||
tilemap_set_transparent_pen(state->pf1_wide_layer,0);
|
||||
|
||||
state_save_register_global_array(machine, m90_video_control_data);
|
||||
state_save_register_global_array(machine, state->video_control_data);
|
||||
}
|
||||
|
||||
VIDEO_START( dynablsb )
|
||||
{
|
||||
pf1_layer = tilemap_create(machine, dynablsb_get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
pf1_wide_layer = tilemap_create(machine, dynablsb_get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
pf2_layer = tilemap_create(machine, dynablsb_get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
pf2_wide_layer = tilemap_create(machine, dynablsb_get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
m90_state *state = machine->driver_data<m90_state>();
|
||||
state->pf1_layer = tilemap_create(machine, dynablsb_get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
state->pf1_wide_layer = tilemap_create(machine, dynablsb_get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
state->pf2_layer = tilemap_create(machine, dynablsb_get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
|
||||
state->pf2_wide_layer = tilemap_create(machine, dynablsb_get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
|
||||
|
||||
tilemap_set_transparent_pen(pf2_layer,0);
|
||||
tilemap_set_transparent_pen(pf2_wide_layer,0);
|
||||
tilemap_set_transparent_pen(state->pf2_layer,0);
|
||||
tilemap_set_transparent_pen(state->pf2_wide_layer,0);
|
||||
|
||||
state_save_register_global_array(machine, m90_video_control_data);
|
||||
state_save_register_global_array(machine, state->video_control_data);
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
|
||||
{
|
||||
m90_state *state = machine->driver_data<m90_state>();
|
||||
int offs;
|
||||
|
||||
for (offs = 0x1f2/2; offs >= 0; offs -= 3)
|
||||
{
|
||||
int x,y,sprite,colour,fx,fy,y_multi,i;
|
||||
|
||||
sprite = m90_spriteram[offs+1];
|
||||
colour = (m90_spriteram[offs+0] >> 9) & 0x0f;
|
||||
sprite = state->spriteram[offs+1];
|
||||
colour = (state->spriteram[offs+0] >> 9) & 0x0f;
|
||||
|
||||
y = m90_spriteram[offs+0] & 0x1ff;
|
||||
x = m90_spriteram[offs+2] & 0x1ff;
|
||||
y = state->spriteram[offs+0] & 0x1ff;
|
||||
x = state->spriteram[offs+2] & 0x1ff;
|
||||
|
||||
x = x - 16;
|
||||
y = 512 - y;
|
||||
|
||||
fx = (m90_spriteram[offs+2] >> 8) & 0x02;
|
||||
fy = (m90_spriteram[offs+0] >> 8) & 0x80;
|
||||
fx = (state->spriteram[offs+2] >> 8) & 0x02;
|
||||
fy = (state->spriteram[offs+0] >> 8) & 0x80;
|
||||
|
||||
y_multi = 1 << ((m90_spriteram[offs+0] & 0x6000) >> 13);
|
||||
y_multi = 1 << ((state->spriteram[offs+0] & 0x6000) >> 13);
|
||||
y -= 16 * y_multi;
|
||||
|
||||
for (i = 0;i < y_multi;i++)
|
||||
|
||||
if (m90_video_control_data[7] & 0x01)
|
||||
if (state->video_control_data[7] & 0x01)
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine->gfx[1],
|
||||
sprite + (fy ? y_multi-1 - i : i),
|
||||
colour,
|
||||
@ -168,7 +171,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
x,y+i*16,
|
||||
machine->priority_bitmap,
|
||||
(colour & 0x08) ? 0x00 : 0x02,0);
|
||||
else if (m90_video_control_data[7] & 0x02)
|
||||
else if (state->video_control_data[7] & 0x02)
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine->gfx[1],
|
||||
sprite + (fy ? y_multi-1 - i : i),
|
||||
colour,
|
||||
@ -266,7 +269,8 @@ static void dynablsb_draw_sprites(running_machine *machine, bitmap_t *bitmap,con
|
||||
|
||||
WRITE16_HANDLER( m90_video_control_w )
|
||||
{
|
||||
COMBINE_DATA(&m90_video_control_data[offset]);
|
||||
m90_state *state = space->machine->driver_data<m90_state>();
|
||||
COMBINE_DATA(&state->video_control_data[offset]);
|
||||
}
|
||||
|
||||
static void markdirty(tilemap_t *tmap,int page,offs_t offset)
|
||||
@ -279,80 +283,81 @@ static void markdirty(tilemap_t *tmap,int page,offs_t offset)
|
||||
|
||||
WRITE16_HANDLER( m90_video_w )
|
||||
{
|
||||
COMBINE_DATA(&m90_video_data[offset]);
|
||||
m90_state *state = space->machine->driver_data<m90_state>();
|
||||
COMBINE_DATA(&state->video_data[offset]);
|
||||
|
||||
markdirty(pf1_layer, m90_video_control_data[5] & 0x3,offset);
|
||||
markdirty(pf1_wide_layer,m90_video_control_data[5] & 0x2,offset);
|
||||
markdirty(pf2_layer, m90_video_control_data[6] & 0x3,offset);
|
||||
markdirty(pf2_wide_layer,m90_video_control_data[6] & 0x2,offset);
|
||||
markdirty(state->pf1_layer, state->video_control_data[5] & 0x3,offset);
|
||||
markdirty(state->pf1_wide_layer,state->video_control_data[5] & 0x2,offset);
|
||||
markdirty(state->pf2_layer, state->video_control_data[6] & 0x3,offset);
|
||||
markdirty(state->pf2_wide_layer,state->video_control_data[6] & 0x2,offset);
|
||||
}
|
||||
|
||||
SCREEN_UPDATE( m90 )
|
||||
{
|
||||
static int last_pf1,last_pf2;
|
||||
int pf1_base = m90_video_control_data[5] & 0x3;
|
||||
int pf2_base = m90_video_control_data[6] & 0x3;
|
||||
m90_state *state = screen->machine->driver_data<m90_state>();
|
||||
int pf1_base = state->video_control_data[5] & 0x3;
|
||||
int pf2_base = state->video_control_data[6] & 0x3;
|
||||
int i,pf1_enable,pf2_enable, video_enable;
|
||||
|
||||
if (m90_video_control_data[7]&0x04) video_enable=0; else video_enable=1;
|
||||
if (m90_video_control_data[5]&0x10) pf1_enable=0; else pf1_enable=1;
|
||||
if (m90_video_control_data[6]&0x10) pf2_enable=0; else pf2_enable=1;
|
||||
if (state->video_control_data[7]&0x04) video_enable=0; else video_enable=1;
|
||||
if (state->video_control_data[5]&0x10) pf1_enable=0; else pf1_enable=1;
|
||||
if (state->video_control_data[6]&0x10) pf2_enable=0; else pf2_enable=1;
|
||||
|
||||
// tilemap_set_enable(pf1_layer,pf1_enable);
|
||||
// tilemap_set_enable(pf2_layer,pf2_enable);
|
||||
// tilemap_set_enable(pf1_wide_layer,pf1_enable);
|
||||
// tilemap_set_enable(pf2_wide_layer,pf2_enable);
|
||||
// tilemap_set_enable(state->pf1_layer,pf1_enable);
|
||||
// tilemap_set_enable(state->pf2_layer,pf2_enable);
|
||||
// tilemap_set_enable(state->pf1_wide_layer,pf1_enable);
|
||||
// tilemap_set_enable(state->pf2_wide_layer,pf2_enable);
|
||||
|
||||
/* Dirty tilemaps if VRAM base changes */
|
||||
if (pf1_base!=last_pf1)
|
||||
if (pf1_base!=state->last_pf1)
|
||||
{
|
||||
tilemap_mark_all_tiles_dirty(pf1_layer);
|
||||
tilemap_mark_all_tiles_dirty(pf1_wide_layer);
|
||||
tilemap_mark_all_tiles_dirty(state->pf1_layer);
|
||||
tilemap_mark_all_tiles_dirty(state->pf1_wide_layer);
|
||||
}
|
||||
if (pf2_base!=last_pf2)
|
||||
if (pf2_base!=state->last_pf2)
|
||||
{
|
||||
tilemap_mark_all_tiles_dirty(pf2_layer);
|
||||
tilemap_mark_all_tiles_dirty(pf2_wide_layer);
|
||||
tilemap_mark_all_tiles_dirty(state->pf2_layer);
|
||||
tilemap_mark_all_tiles_dirty(state->pf2_wide_layer);
|
||||
}
|
||||
last_pf1=pf1_base;
|
||||
last_pf2=pf2_base;
|
||||
state->last_pf1=pf1_base;
|
||||
state->last_pf2=pf2_base;
|
||||
|
||||
m90_spriteram=m90_video_data+0xee00/2;
|
||||
state->spriteram=state->video_data+0xee00/2;
|
||||
|
||||
/* Setup scrolling */
|
||||
if (m90_video_control_data[5]&0x20)
|
||||
if (state->video_control_data[5]&0x20)
|
||||
{
|
||||
tilemap_set_scroll_rows(pf1_layer,512);
|
||||
tilemap_set_scroll_rows(pf1_wide_layer,512);
|
||||
tilemap_set_scroll_rows(state->pf1_layer,512);
|
||||
tilemap_set_scroll_rows(state->pf1_wide_layer,512);
|
||||
|
||||
for (i=0; i<512; i++)
|
||||
tilemap_set_scrollx( pf1_layer,i, m90_video_data[0xf000/2+i]+2);
|
||||
tilemap_set_scrollx( state->pf1_layer,i, state->video_data[0xf000/2+i]+2);
|
||||
for (i=0; i<512; i++)
|
||||
tilemap_set_scrollx( pf1_wide_layer,i, m90_video_data[0xf000/2+i]+256+2);
|
||||
tilemap_set_scrollx( state->pf1_wide_layer,i, state->video_data[0xf000/2+i]+256+2);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
tilemap_set_scroll_rows(pf1_layer,1);
|
||||
tilemap_set_scroll_rows(pf1_wide_layer,1);
|
||||
tilemap_set_scrollx( pf1_layer,0, m90_video_control_data[1]+2);
|
||||
tilemap_set_scrollx( pf1_wide_layer,0, m90_video_control_data[1]+256+2);
|
||||
tilemap_set_scroll_rows(state->pf1_layer,1);
|
||||
tilemap_set_scroll_rows(state->pf1_wide_layer,1);
|
||||
tilemap_set_scrollx( state->pf1_layer,0, state->video_control_data[1]+2);
|
||||
tilemap_set_scrollx( state->pf1_wide_layer,0, state->video_control_data[1]+256+2);
|
||||
}
|
||||
|
||||
/* Setup scrolling */
|
||||
if (m90_video_control_data[6]&0x20)
|
||||
if (state->video_control_data[6]&0x20)
|
||||
{
|
||||
tilemap_set_scroll_rows(pf2_layer,512);
|
||||
tilemap_set_scroll_rows(pf2_wide_layer,512);
|
||||
tilemap_set_scroll_rows(state->pf2_layer,512);
|
||||
tilemap_set_scroll_rows(state->pf2_wide_layer,512);
|
||||
for (i=0; i<512; i++)
|
||||
tilemap_set_scrollx( pf2_layer,i, m90_video_data[0xf400/2+i]-2);
|
||||
tilemap_set_scrollx( state->pf2_layer,i, state->video_data[0xf400/2+i]-2);
|
||||
for (i=0; i<512; i++)
|
||||
tilemap_set_scrollx( pf2_wide_layer,i, m90_video_data[0xf400/2+i]+256-2);
|
||||
tilemap_set_scrollx( state->pf2_wide_layer,i, state->video_data[0xf400/2+i]+256-2);
|
||||
} else {
|
||||
tilemap_set_scroll_rows(pf2_layer,1);
|
||||
tilemap_set_scroll_rows(pf2_wide_layer,1);
|
||||
tilemap_set_scrollx( pf2_layer,0, m90_video_control_data[3]-2);
|
||||
tilemap_set_scrollx( pf2_wide_layer,0, m90_video_control_data[3]+256-2 );
|
||||
tilemap_set_scroll_rows(state->pf2_layer,1);
|
||||
tilemap_set_scroll_rows(state->pf2_wide_layer,1);
|
||||
tilemap_set_scrollx( state->pf2_layer,0, state->video_control_data[3]-2);
|
||||
tilemap_set_scrollx( state->pf2_wide_layer,0, state->video_control_data[3]+256-2 );
|
||||
}
|
||||
|
||||
bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
|
||||
@ -363,7 +368,7 @@ SCREEN_UPDATE( m90 )
|
||||
if (pf2_enable)
|
||||
{
|
||||
// use the playfield 2 y-offset table for each scanline
|
||||
if (m90_video_control_data[6] & 0x40)
|
||||
if (state->video_control_data[6] & 0x40)
|
||||
{
|
||||
int line;
|
||||
rectangle clip;
|
||||
@ -374,29 +379,29 @@ SCREEN_UPDATE( m90 )
|
||||
{
|
||||
clip.min_y = clip.max_y = line;
|
||||
|
||||
if (m90_video_control_data[6] & 0x4)
|
||||
if (state->video_control_data[6] & 0x4)
|
||||
{
|
||||
tilemap_set_scrolly(pf2_wide_layer, 0, 0x200 + m90_video_data[0xfc00/2 + line]);
|
||||
tilemap_draw(bitmap,&clip,pf2_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,&clip,pf2_wide_layer,1,1);
|
||||
tilemap_set_scrolly(state->pf2_wide_layer, 0, 0x200 + state->video_data[0xfc00/2 + line]);
|
||||
tilemap_draw(bitmap,&clip,state->pf2_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,&clip,state->pf2_wide_layer,1,1);
|
||||
} else {
|
||||
tilemap_set_scrolly(pf2_layer, 0, 0x200 + m90_video_data[0xfc00/2 + line]);
|
||||
tilemap_draw(bitmap,&clip,pf2_layer,0,0);
|
||||
tilemap_draw(bitmap,&clip,pf2_layer,1,1);
|
||||
tilemap_set_scrolly(state->pf2_layer, 0, 0x200 + state->video_data[0xfc00/2 + line]);
|
||||
tilemap_draw(bitmap,&clip,state->pf2_layer,0,0);
|
||||
tilemap_draw(bitmap,&clip,state->pf2_layer,1,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m90_video_control_data[6] & 0x4)
|
||||
if (state->video_control_data[6] & 0x4)
|
||||
{
|
||||
tilemap_set_scrolly( pf2_wide_layer,0, m90_video_control_data[2] );
|
||||
tilemap_draw(bitmap,cliprect,pf2_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf2_wide_layer,1,1);
|
||||
tilemap_set_scrolly( state->pf2_wide_layer,0, state->video_control_data[2] );
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,1,1);
|
||||
} else {
|
||||
tilemap_set_scrolly( pf2_layer,0, m90_video_control_data[2] );
|
||||
tilemap_draw(bitmap,cliprect,pf2_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf2_layer,1,1);
|
||||
tilemap_set_scrolly( state->pf2_layer,0, state->video_control_data[2] );
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_layer,1,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -408,7 +413,7 @@ SCREEN_UPDATE( m90 )
|
||||
if (pf1_enable)
|
||||
{
|
||||
// use the playfield 1 y-offset table for each scanline
|
||||
if (m90_video_control_data[5] & 0x40)
|
||||
if (state->video_control_data[5] & 0x40)
|
||||
{
|
||||
int line;
|
||||
rectangle clip;
|
||||
@ -419,29 +424,29 @@ SCREEN_UPDATE( m90 )
|
||||
{
|
||||
clip.min_y = clip.max_y = line;
|
||||
|
||||
if (m90_video_control_data[5] & 0x4)
|
||||
if (state->video_control_data[5] & 0x4)
|
||||
{
|
||||
tilemap_set_scrolly(pf1_wide_layer, 0, 0x200 + m90_video_data[0xf800/2 + line]);
|
||||
tilemap_draw(bitmap,&clip,pf1_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,&clip,pf1_wide_layer,1,1);
|
||||
tilemap_set_scrolly(state->pf1_wide_layer, 0, 0x200 + state->video_data[0xf800/2 + line]);
|
||||
tilemap_draw(bitmap,&clip,state->pf1_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,&clip,state->pf1_wide_layer,1,1);
|
||||
} else {
|
||||
tilemap_set_scrolly(pf1_layer, 0, 0x200 + m90_video_data[0xf800/2 + line]);
|
||||
tilemap_draw(bitmap,&clip,pf1_layer,0,0);
|
||||
tilemap_draw(bitmap,&clip,pf1_layer,1,1);
|
||||
tilemap_set_scrolly(state->pf1_layer, 0, 0x200 + state->video_data[0xf800/2 + line]);
|
||||
tilemap_draw(bitmap,&clip,state->pf1_layer,0,0);
|
||||
tilemap_draw(bitmap,&clip,state->pf1_layer,1,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m90_video_control_data[5] & 0x4)
|
||||
if (state->video_control_data[5] & 0x4)
|
||||
{
|
||||
tilemap_set_scrolly( pf1_wide_layer,0, m90_video_control_data[0] );
|
||||
tilemap_draw(bitmap,cliprect,pf1_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf1_wide_layer,1,1);
|
||||
tilemap_set_scrolly( state->pf1_wide_layer,0, state->video_control_data[0] );
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,1,1);
|
||||
} else {
|
||||
tilemap_set_scrolly( pf1_layer,0, m90_video_control_data[0] );
|
||||
tilemap_draw(bitmap,cliprect,pf1_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf1_layer,1,1);
|
||||
tilemap_set_scrolly( state->pf1_layer,0, state->video_control_data[0] );
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_layer,1,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -457,49 +462,50 @@ SCREEN_UPDATE( m90 )
|
||||
|
||||
SCREEN_UPDATE( bomblord )
|
||||
{
|
||||
m90_state *state = screen->machine->driver_data<m90_state>();
|
||||
int i;
|
||||
bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
|
||||
bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
|
||||
|
||||
/* Setup scrolling */
|
||||
if (m90_video_control_data[6]&0x20) {
|
||||
tilemap_set_scroll_rows(pf1_layer,512);
|
||||
tilemap_set_scroll_rows(pf1_wide_layer,512);
|
||||
if (state->video_control_data[6]&0x20) {
|
||||
tilemap_set_scroll_rows(state->pf1_layer,512);
|
||||
tilemap_set_scroll_rows(state->pf1_wide_layer,512);
|
||||
for (i=0; i<512; i++)
|
||||
tilemap_set_scrollx( pf1_layer,i, m90_video_data[0xf400/2+i]-12);
|
||||
tilemap_set_scrollx( state->pf1_layer,i, state->video_data[0xf400/2+i]-12);
|
||||
for (i=0; i<512; i++)
|
||||
tilemap_set_scrollx( pf1_wide_layer,i, m90_video_data[0xf400/2+i]-12+256);
|
||||
tilemap_set_scrollx( state->pf1_wide_layer,i, state->video_data[0xf400/2+i]-12+256);
|
||||
} else {
|
||||
tilemap_set_scroll_rows(pf1_layer,1);
|
||||
tilemap_set_scroll_rows(pf1_wide_layer,1);
|
||||
tilemap_set_scrollx( pf1_layer,0, m90_video_data[0xf004/2]-12);
|
||||
tilemap_set_scrollx( pf1_wide_layer,0, m90_video_data[0xf004/2]-12 );
|
||||
tilemap_set_scroll_rows(state->pf1_layer,1);
|
||||
tilemap_set_scroll_rows(state->pf1_wide_layer,1);
|
||||
tilemap_set_scrollx( state->pf1_layer,0, state->video_data[0xf004/2]-12);
|
||||
tilemap_set_scrollx( state->pf1_wide_layer,0, state->video_data[0xf004/2]-12 );
|
||||
}
|
||||
|
||||
if (m90_video_control_data[6] & 0x02) {
|
||||
tilemap_mark_all_tiles_dirty(pf2_wide_layer);
|
||||
tilemap_set_scrollx( pf2_wide_layer,0, m90_video_data[0xf000/2]-16 );
|
||||
tilemap_set_scrolly( pf2_wide_layer,0, m90_video_data[0xf008/2]+388 );
|
||||
tilemap_draw(bitmap,cliprect,pf2_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf2_wide_layer,1,1);
|
||||
if (state->video_control_data[6] & 0x02) {
|
||||
tilemap_mark_all_tiles_dirty(state->pf2_wide_layer);
|
||||
tilemap_set_scrollx( state->pf2_wide_layer,0, state->video_data[0xf000/2]-16 );
|
||||
tilemap_set_scrolly( state->pf2_wide_layer,0, state->video_data[0xf008/2]+388 );
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,1,1);
|
||||
} else {
|
||||
tilemap_mark_all_tiles_dirty(pf2_layer);
|
||||
tilemap_set_scrollx( pf2_layer,0, m90_video_data[0xf000/2]-16 );
|
||||
tilemap_set_scrolly( pf2_layer,0, m90_video_data[0xf008/2]-120 );
|
||||
tilemap_draw(bitmap,cliprect,pf2_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf2_layer,1,1);
|
||||
tilemap_mark_all_tiles_dirty(state->pf2_layer);
|
||||
tilemap_set_scrollx( state->pf2_layer,0, state->video_data[0xf000/2]-16 );
|
||||
tilemap_set_scrolly( state->pf2_layer,0, state->video_data[0xf008/2]-120 );
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_layer,1,1);
|
||||
}
|
||||
|
||||
if (m90_video_control_data[6] & 0x04) {
|
||||
tilemap_mark_all_tiles_dirty(pf1_wide_layer);
|
||||
tilemap_set_scrolly( pf1_wide_layer,0, m90_video_data[0xf00c/2]+392 );
|
||||
tilemap_draw(bitmap,cliprect,pf1_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf1_wide_layer,1,1);
|
||||
if (state->video_control_data[6] & 0x04) {
|
||||
tilemap_mark_all_tiles_dirty(state->pf1_wide_layer);
|
||||
tilemap_set_scrolly( state->pf1_wide_layer,0, state->video_data[0xf00c/2]+392 );
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,1,1);
|
||||
} else {
|
||||
tilemap_mark_all_tiles_dirty(pf1_layer);
|
||||
tilemap_set_scrolly( pf1_layer,0, m90_video_data[0xf00c/2]-116 );
|
||||
tilemap_draw(bitmap,cliprect,pf1_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf1_layer,1,1);
|
||||
tilemap_mark_all_tiles_dirty(state->pf1_layer);
|
||||
tilemap_set_scrolly( state->pf1_layer,0, state->video_data[0xf00c/2]-116 );
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_layer,1,1);
|
||||
}
|
||||
|
||||
bomblord_draw_sprites(screen->machine,bitmap,cliprect);
|
||||
@ -509,39 +515,40 @@ SCREEN_UPDATE( bomblord )
|
||||
|
||||
SCREEN_UPDATE( dynablsb )
|
||||
{
|
||||
m90_state *state = screen->machine->driver_data<m90_state>();
|
||||
bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
|
||||
bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
|
||||
|
||||
if (!(m90_video_data[0xf008/2] & 0x4000)) {
|
||||
tilemap_mark_all_tiles_dirty(pf1_wide_layer);
|
||||
tilemap_set_scroll_rows(pf1_wide_layer,1);
|
||||
tilemap_set_scrollx( pf1_wide_layer,0, m90_video_data[0xf004/2]+64);
|
||||
tilemap_set_scrolly( pf1_wide_layer,0, m90_video_data[0xf006/2]+512);
|
||||
tilemap_draw(bitmap,cliprect,pf1_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf1_wide_layer,1,1);
|
||||
if (!(state->video_data[0xf008/2] & 0x4000)) {
|
||||
tilemap_mark_all_tiles_dirty(state->pf1_wide_layer);
|
||||
tilemap_set_scroll_rows(state->pf1_wide_layer,1);
|
||||
tilemap_set_scrollx( state->pf1_wide_layer,0, state->video_data[0xf004/2]+64);
|
||||
tilemap_set_scrolly( state->pf1_wide_layer,0, state->video_data[0xf006/2]+512);
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,1,1);
|
||||
} else {
|
||||
tilemap_mark_all_tiles_dirty(pf1_layer);
|
||||
tilemap_set_scroll_rows(pf1_layer,1);
|
||||
tilemap_set_scrollx( pf1_layer,0, m90_video_data[0xf004/2]+64);
|
||||
tilemap_set_scrolly( pf1_layer,0, m90_video_data[0xf006/2]+4);
|
||||
tilemap_draw(bitmap,cliprect,pf1_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf1_layer,1,1);
|
||||
tilemap_mark_all_tiles_dirty(state->pf1_layer);
|
||||
tilemap_set_scroll_rows(state->pf1_layer,1);
|
||||
tilemap_set_scrollx( state->pf1_layer,0, state->video_data[0xf004/2]+64);
|
||||
tilemap_set_scrolly( state->pf1_layer,0, state->video_data[0xf006/2]+4);
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_layer,1,1);
|
||||
}
|
||||
|
||||
if (!(m90_video_data[0xf008/2] & 0x8000)) {
|
||||
tilemap_mark_all_tiles_dirty(pf2_wide_layer);
|
||||
tilemap_set_scroll_rows(pf2_wide_layer,1);
|
||||
tilemap_set_scrollx( pf2_wide_layer,0, m90_video_data[0xf000/2]+68);
|
||||
tilemap_set_scrolly( pf2_wide_layer,0, m90_video_data[0xf002/2]+512);
|
||||
tilemap_draw(bitmap,cliprect,pf2_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf2_wide_layer,1,1);
|
||||
if (!(state->video_data[0xf008/2] & 0x8000)) {
|
||||
tilemap_mark_all_tiles_dirty(state->pf2_wide_layer);
|
||||
tilemap_set_scroll_rows(state->pf2_wide_layer,1);
|
||||
tilemap_set_scrollx( state->pf2_wide_layer,0, state->video_data[0xf000/2]+68);
|
||||
tilemap_set_scrolly( state->pf2_wide_layer,0, state->video_data[0xf002/2]+512);
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,1,1);
|
||||
} else {
|
||||
tilemap_mark_all_tiles_dirty(pf2_layer);
|
||||
tilemap_set_scroll_rows(pf2_layer,1);
|
||||
tilemap_set_scrollx( pf2_layer,0, m90_video_data[0xf000/2]+68);
|
||||
tilemap_set_scrolly( pf2_layer,0, m90_video_data[0xf002/2]+4);
|
||||
tilemap_draw(bitmap,cliprect,pf2_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf2_layer,1,1);
|
||||
tilemap_mark_all_tiles_dirty(state->pf2_layer);
|
||||
tilemap_set_scroll_rows(state->pf2_layer,1);
|
||||
tilemap_set_scrollx( state->pf2_layer,0, state->video_data[0xf000/2]+68);
|
||||
tilemap_set_scrolly( state->pf2_layer,0, state->video_data[0xf002/2]+4);
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_layer,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_layer,1,1);
|
||||
}
|
||||
|
||||
dynablsb_draw_sprites(screen->machine,bitmap,cliprect);
|
||||
|
@ -9,9 +9,6 @@
|
||||
#include "emu.h"
|
||||
#include "includes/pingpong.h"
|
||||
|
||||
static tilemap_t *bg_tilemap;
|
||||
UINT8 *pingpong_videoram;
|
||||
UINT8 *pingpong_colorram;
|
||||
|
||||
|
||||
/* This is strange; it's unlikely that the sprites actually have a hardware */
|
||||
@ -98,20 +95,23 @@ PALETTE_INIT( pingpong )
|
||||
|
||||
WRITE8_HANDLER( pingpong_videoram_w )
|
||||
{
|
||||
pingpong_videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
pingpong_state *state = space->machine->driver_data<pingpong_state>();
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( pingpong_colorram_w )
|
||||
{
|
||||
pingpong_colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
pingpong_state *state = space->machine->driver_data<pingpong_state>();
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int attr = pingpong_colorram[tile_index];
|
||||
int code = pingpong_videoram[tile_index] + ((attr & 0x20) << 3);
|
||||
pingpong_state *state = machine->driver_data<pingpong_state>();
|
||||
int attr = state->colorram[tile_index];
|
||||
int code = state->videoram[tile_index] + ((attr & 0x20) << 3);
|
||||
int color = attr & 0x1f;
|
||||
int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
|
||||
|
||||
@ -120,7 +120,8 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( pingpong )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
pingpong_state *state = machine->driver_data<pingpong_state>();
|
||||
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 )
|
||||
@ -152,7 +153,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
SCREEN_UPDATE( pingpong )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
pingpong_state *state = screen->machine->driver_data<pingpong_state>();
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -3,14 +3,13 @@
|
||||
#include "emu.h"
|
||||
#include "includes/pokechmp.h"
|
||||
|
||||
static tilemap_t *bg_tilemap;
|
||||
|
||||
WRITE8_HANDLER( pokechmp_videoram_w )
|
||||
{
|
||||
pokechmp_state *state = space->machine->driver_data<pokechmp_state>();
|
||||
UINT8 *videoram = state->videoram;
|
||||
videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset / 2);
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( pokechmp_flipscreen_w )
|
||||
@ -34,7 +33,8 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( pokechmp )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
|
||||
pokechmp_state *state = machine->driver_data<pokechmp_state>();
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
|
||||
8, 8, 32, 32);
|
||||
}
|
||||
|
||||
@ -73,7 +73,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
SCREEN_UPDATE( pokechmp )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
pokechmp_state *state = screen->machine->driver_data<pokechmp_state>();
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2353,8 +2353,7 @@ static void mix_all_layers(segas32_state *state, int which, int xoffs, bitmap_t
|
||||
|
||||
static void print_mixer_data(segas32_state *state, int which)
|
||||
{
|
||||
static int count = 0;
|
||||
if (++count > 60 * 5)
|
||||
if (++state->print_count > 60 * 5)
|
||||
{
|
||||
mame_printf_debug("\n");
|
||||
mame_printf_debug("OP: %04X\n", state->system32_videoram[0x1ff8e/2]);
|
||||
@ -2418,7 +2417,7 @@ static void print_mixer_data(segas32_state *state, int which)
|
||||
state->mixer_control[which][0x2d],
|
||||
state->mixer_control[which][0x2e],
|
||||
state->mixer_control[which][0x2f]);
|
||||
count = 0;
|
||||
state->print_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,12 +95,11 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
{
|
||||
shootout_state *state = machine->driver_data<shootout_state>();
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
static int bFlicker;
|
||||
const gfx_element *gfx = machine->gfx[1];
|
||||
const UINT8 *source = spriteram+127*4;
|
||||
int count;
|
||||
|
||||
bFlicker = !bFlicker;
|
||||
state->bFlicker = !state->bFlicker;
|
||||
|
||||
for( count=0; count<128; count++ )
|
||||
{
|
||||
@ -115,7 +114,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
-------x enable
|
||||
*/
|
||||
if ( attributes & 0x01 ){ /* visible */
|
||||
if( bFlicker || (attributes&0x02)==0 ){
|
||||
if( state->bFlicker || (attributes&0x02)==0 ){
|
||||
int priority_mask = (attributes&0x08)?0x2:0;
|
||||
int sx = (240 - source[2])&0xff;
|
||||
int sy = (240 - source[0])&0xff;
|
||||
|
@ -8,22 +8,10 @@ Atari Triple Hunt video emulation
|
||||
#include "includes/triplhnt.h"
|
||||
|
||||
|
||||
UINT8* triplhnt_playfield_ram;
|
||||
UINT8* triplhnt_hpos_ram;
|
||||
UINT8* triplhnt_vpos_ram;
|
||||
UINT8* triplhnt_code_ram;
|
||||
UINT8* triplhnt_orga_ram;
|
||||
|
||||
int triplhnt_sprite_zoom;
|
||||
int triplhnt_sprite_bank;
|
||||
|
||||
static bitmap_t* helper;
|
||||
static tilemap_t* bg_tilemap;
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
int code = triplhnt_playfield_ram[tile_index] & 0x3f;
|
||||
triplhnt_state *state = machine->driver_data<triplhnt_state>();
|
||||
int code = state->playfield_ram[tile_index] & 0x3f;
|
||||
|
||||
SET_TILE_INFO(2, code, code == 0x3f ? 1 : 0, 0);
|
||||
}
|
||||
@ -31,9 +19,10 @@ static TILE_GET_INFO( get_tile_info )
|
||||
|
||||
VIDEO_START( triplhnt )
|
||||
{
|
||||
helper = machine->primary_screen->alloc_compatible_bitmap();
|
||||
triplhnt_state *state = machine->driver_data<triplhnt_state>();
|
||||
state->helper = machine->primary_screen->alloc_compatible_bitmap();
|
||||
|
||||
bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 16, 16, 16, 16);
|
||||
state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 16, 16, 16, 16);
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +34,7 @@ static TIMER_CALLBACK( triplhnt_hit_callback )
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
|
||||
{
|
||||
triplhnt_state *state = machine->driver_data<triplhnt_state>();
|
||||
int i;
|
||||
|
||||
int hit_line = 999;
|
||||
@ -54,20 +44,20 @@ static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const recta
|
||||
{
|
||||
rectangle rect;
|
||||
|
||||
int j = (triplhnt_orga_ram[i] & 15) ^ 15;
|
||||
int j = (state->orga_ram[i] & 15) ^ 15;
|
||||
|
||||
/* software sorts sprites by x and stores order in orga RAM */
|
||||
|
||||
int hpos = triplhnt_hpos_ram[j] ^ 255;
|
||||
int vpos = triplhnt_vpos_ram[j] ^ 255;
|
||||
int code = triplhnt_code_ram[j] ^ 255;
|
||||
int hpos = state->hpos_ram[j] ^ 255;
|
||||
int vpos = state->vpos_ram[j] ^ 255;
|
||||
int code = state->code_ram[j] ^ 255;
|
||||
|
||||
if (hpos == 255)
|
||||
continue;
|
||||
|
||||
/* sprite placement might be wrong */
|
||||
|
||||
if (triplhnt_sprite_zoom)
|
||||
if (state->sprite_zoom)
|
||||
{
|
||||
rect.min_x = hpos - 16;
|
||||
rect.min_y = 196 - vpos;
|
||||
@ -84,8 +74,8 @@ static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const recta
|
||||
|
||||
/* render sprite to auxiliary bitmap */
|
||||
|
||||
drawgfx_opaque(helper, cliprect, machine->gfx[triplhnt_sprite_zoom],
|
||||
2 * code + triplhnt_sprite_bank, 0, code & 8, 0,
|
||||
drawgfx_opaque(state->helper, cliprect, machine->gfx[state->sprite_zoom],
|
||||
2 * code + state->sprite_bank, 0, code & 8, 0,
|
||||
rect.min_x, rect.min_y);
|
||||
|
||||
if (rect.min_x < cliprect->min_x)
|
||||
@ -107,7 +97,7 @@ static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const recta
|
||||
{
|
||||
for (y = rect.min_y; y <= rect.max_y; y++)
|
||||
{
|
||||
pen_t a = *BITMAP_ADDR16(helper, y, x);
|
||||
pen_t a = *BITMAP_ADDR16(state->helper, y, x);
|
||||
pen_t b = *BITMAP_ADDR16(bitmap, y, x);
|
||||
|
||||
if (a == 2 && b == 7)
|
||||
@ -130,15 +120,16 @@ static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const recta
|
||||
|
||||
SCREEN_UPDATE( triplhnt )
|
||||
{
|
||||
triplhnt_state *state = screen->machine->driver_data<triplhnt_state>();
|
||||
device_t *discrete = screen->machine->device("discrete");
|
||||
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap);
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
||||
discrete_sound_w(discrete, TRIPLHNT_BEAR_ROAR_DATA, triplhnt_playfield_ram[0xfa] & 15);
|
||||
discrete_sound_w(discrete, TRIPLHNT_SHOT_DATA, triplhnt_playfield_ram[0xfc] & 15);
|
||||
discrete_sound_w(discrete, TRIPLHNT_BEAR_ROAR_DATA, state->playfield_ram[0xfa] & 15);
|
||||
discrete_sound_w(discrete, TRIPLHNT_SHOT_DATA, state->playfield_ram[0xfc] & 15);
|
||||
return 0;
|
||||
}
|
||||
|
@ -8,36 +8,6 @@
|
||||
#include "includes/victory.h"
|
||||
|
||||
|
||||
/* globally-accessible storage */
|
||||
UINT8 *victory_videoram;
|
||||
UINT8 *victory_charram;
|
||||
|
||||
/* local allocated storage */
|
||||
static UINT16 victory_paletteram[0x40]; /* 9 bits used */
|
||||
static UINT8 *bgbitmap;
|
||||
static UINT8 *fgbitmap;
|
||||
static UINT8 *rram, *gram, *bram;
|
||||
|
||||
/* interrupt, collision, and control states */
|
||||
static UINT8 vblank_irq;
|
||||
static UINT8 fgcoll, fgcollx, fgcolly;
|
||||
static UINT8 bgcoll, bgcollx, bgcolly;
|
||||
static UINT8 scrollx, scrolly;
|
||||
static UINT8 video_control;
|
||||
|
||||
/* microcode state */
|
||||
static struct
|
||||
{
|
||||
UINT16 i;
|
||||
UINT16 pc;
|
||||
UINT8 r,g,b;
|
||||
UINT8 x,xp,y,yp;
|
||||
UINT8 cmd,cmdlo;
|
||||
emu_timer * timer;
|
||||
UINT8 timer_active;
|
||||
attotime endtime;
|
||||
} micro;
|
||||
|
||||
|
||||
/* number of ticks per clock of the microcode state machine */
|
||||
/* from what I can tell, this should be divided by 32, not 8 */
|
||||
@ -53,11 +23,11 @@ static struct
|
||||
|
||||
|
||||
/* function prototypes */
|
||||
static int command2(void);
|
||||
static int command2(running_machine *machine);
|
||||
static int command3(running_machine *machine);
|
||||
static int command4(running_machine *machine);
|
||||
static int command5(running_machine *machine);
|
||||
static int command6(void);
|
||||
static int command6(running_machine *machine);
|
||||
static int command7(running_machine *machine);
|
||||
|
||||
|
||||
@ -70,26 +40,27 @@ static int command7(running_machine *machine);
|
||||
|
||||
VIDEO_START( victory )
|
||||
{
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
/* allocate bitmapram */
|
||||
rram = auto_alloc_array(machine, UINT8, 0x4000);
|
||||
gram = auto_alloc_array(machine, UINT8, 0x4000);
|
||||
bram = auto_alloc_array(machine, UINT8, 0x4000);
|
||||
state->rram = auto_alloc_array(machine, UINT8, 0x4000);
|
||||
state->gram = auto_alloc_array(machine, UINT8, 0x4000);
|
||||
state->bram = auto_alloc_array(machine, UINT8, 0x4000);
|
||||
|
||||
/* allocate bitmaps */
|
||||
bgbitmap = auto_alloc_array(machine, UINT8, 256 * 256);
|
||||
fgbitmap = auto_alloc_array(machine, UINT8, 256 * 256);
|
||||
state->bgbitmap = auto_alloc_array(machine, UINT8, 256 * 256);
|
||||
state->fgbitmap = auto_alloc_array(machine, UINT8, 256 * 256);
|
||||
|
||||
/* reset globals */
|
||||
vblank_irq = 0;
|
||||
fgcoll = fgcollx = fgcolly = 0;
|
||||
bgcoll = bgcollx = bgcolly = 0;
|
||||
scrollx = scrolly = 0;
|
||||
video_control = 0;
|
||||
memset(µ, 0, sizeof(micro));
|
||||
micro.timer = machine->scheduler().timer_alloc(FUNC(NULL));
|
||||
state->vblank_irq = 0;
|
||||
state->fgcoll = state->fgcollx = state->fgcolly = 0;
|
||||
state->bgcoll = state->bgcollx = state->bgcolly = 0;
|
||||
state->scrollx = state->scrolly = 0;
|
||||
state->video_control = 0;
|
||||
memset(&state->micro, 0, sizeof(state->micro));
|
||||
state->micro.timer = machine->scheduler().timer_alloc(FUNC(NULL));
|
||||
|
||||
/* register for state saving */
|
||||
state_save_register_global_array(machine, victory_paletteram);
|
||||
state_save_register_global_array(machine, state->paletteram);
|
||||
}
|
||||
|
||||
|
||||
@ -102,7 +73,8 @@ VIDEO_START( victory )
|
||||
|
||||
static void victory_update_irq(running_machine *machine)
|
||||
{
|
||||
if (vblank_irq || fgcoll || (bgcoll && (video_control & 0x20)))
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
if (state->vblank_irq || state->fgcoll || (state->bgcoll && (state->video_control & 0x20)))
|
||||
cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
|
||||
else
|
||||
cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
|
||||
@ -111,7 +83,8 @@ static void victory_update_irq(running_machine *machine)
|
||||
|
||||
INTERRUPT_GEN( victory_vblank_interrupt )
|
||||
{
|
||||
vblank_irq = 1;
|
||||
victory_state *state = device->machine->driver_data<victory_state>();
|
||||
state->vblank_irq = 1;
|
||||
|
||||
victory_update_irq(device->machine);
|
||||
}
|
||||
@ -126,17 +99,19 @@ INTERRUPT_GEN( victory_vblank_interrupt )
|
||||
|
||||
WRITE8_HANDLER( victory_paletteram_w )
|
||||
{
|
||||
victory_paletteram[offset & 0x3f] = ((offset & 0x80) << 1) | data;
|
||||
victory_state *state = space->machine->driver_data<victory_state>();
|
||||
state->paletteram[offset & 0x3f] = ((offset & 0x80) << 1) | data;
|
||||
}
|
||||
|
||||
|
||||
static void set_palette(running_machine *machine)
|
||||
{
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
offs_t offs;
|
||||
|
||||
for (offs = 0; offs < 0x40; offs++)
|
||||
{
|
||||
UINT16 data = victory_paletteram[offs];
|
||||
UINT16 data = state->paletteram[offs];
|
||||
|
||||
palette_set_color_rgb(machine, offs, pal3bit(data >> 6), pal3bit(data >> 0), pal3bit(data >> 3));
|
||||
}
|
||||
@ -152,35 +127,36 @@ static void set_palette(running_machine *machine)
|
||||
|
||||
READ8_HANDLER( victory_video_control_r )
|
||||
{
|
||||
victory_state *state = space->machine->driver_data<victory_state>();
|
||||
int result = 0;
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
case 0x00: /* 5XFIQ */
|
||||
result = fgcollx;
|
||||
result = state->fgcollx;
|
||||
if (LOG_COLLISION) logerror("%04X:5XFIQ read = %02X\n", cpu_get_previouspc(space->cpu), result);
|
||||
return result;
|
||||
|
||||
case 0x01: /* 5CLFIQ */
|
||||
result = fgcolly;
|
||||
if (fgcoll)
|
||||
result = state->fgcolly;
|
||||
if (state->fgcoll)
|
||||
{
|
||||
fgcoll = 0;
|
||||
state->fgcoll = 0;
|
||||
victory_update_irq(space->machine);
|
||||
}
|
||||
if (LOG_COLLISION) logerror("%04X:5CLFIQ read = %02X\n", cpu_get_previouspc(space->cpu), result);
|
||||
return result;
|
||||
|
||||
case 0x02: /* 5BACKX */
|
||||
result = bgcollx & 0xfc;
|
||||
result = state->bgcollx & 0xfc;
|
||||
if (LOG_COLLISION) logerror("%04X:5BACKX read = %02X\n", cpu_get_previouspc(space->cpu), result);
|
||||
return result;
|
||||
|
||||
case 0x03: /* 5BACKY */
|
||||
result = bgcolly;
|
||||
if (bgcoll)
|
||||
result = state->bgcolly;
|
||||
if (state->bgcoll)
|
||||
{
|
||||
bgcoll = 0;
|
||||
state->bgcoll = 0;
|
||||
victory_update_irq(space->machine);
|
||||
}
|
||||
if (LOG_COLLISION) logerror("%04X:5BACKY read = %02X\n", cpu_get_previouspc(space->cpu), result);
|
||||
@ -192,11 +168,11 @@ READ8_HANDLER( victory_video_control_r )
|
||||
// D5 = 5VIRQ
|
||||
// D4 = 5BCIRQ (3B1)
|
||||
// D3 = SL256
|
||||
if (micro.timer_active && micro.timer->elapsed() < micro.endtime)
|
||||
if (state->micro.timer_active && state->micro.timer->elapsed() < state->micro.endtime)
|
||||
result |= 0x80;
|
||||
result |= (~fgcoll & 1) << 6;
|
||||
result |= (~vblank_irq & 1) << 5;
|
||||
result |= (~bgcoll & 1) << 4;
|
||||
result |= (~state->fgcoll & 1) << 6;
|
||||
result |= (~state->vblank_irq & 1) << 5;
|
||||
result |= (~state->bgcoll & 1) << 4;
|
||||
result |= (space->machine->primary_screen->vpos() & 0x100) >> 5;
|
||||
if (LOG_COLLISION) logerror("%04X:5STAT read = %02X\n", cpu_get_previouspc(space->cpu), result);
|
||||
return result;
|
||||
@ -218,6 +194,8 @@ READ8_HANDLER( victory_video_control_r )
|
||||
|
||||
WRITE8_HANDLER( victory_video_control_w )
|
||||
{
|
||||
victory_state *state = space->machine->driver_data<victory_state>();
|
||||
struct micro_t µ = state->micro;
|
||||
switch (offset)
|
||||
{
|
||||
case 0x00: /* LOAD IL */
|
||||
@ -246,7 +224,7 @@ WRITE8_HANDLER( victory_video_control_w )
|
||||
else if (micro.cmdlo == 6)
|
||||
{
|
||||
if (LOG_MICROCODE) logerror(" Command 6 triggered\n");
|
||||
command6();
|
||||
command6(space->machine);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -286,7 +264,7 @@ WRITE8_HANDLER( victory_video_control_w )
|
||||
if (micro.cmdlo == 2)
|
||||
{
|
||||
if (LOG_MICROCODE) logerror(" Command 2 triggered by write to B\n");
|
||||
command2();
|
||||
command2(space->machine);
|
||||
}
|
||||
else if (micro.cmdlo == 7)
|
||||
{
|
||||
@ -297,12 +275,12 @@ WRITE8_HANDLER( victory_video_control_w )
|
||||
|
||||
case 0x08: /* SCROLLX */
|
||||
if (LOG_MICROCODE) logerror("%04X:SCROLLX write = %02X\n", cpu_get_previouspc(space->cpu), data);
|
||||
scrollx = data;
|
||||
state->scrollx = data;
|
||||
break;
|
||||
|
||||
case 0x09: /* SCROLLY */
|
||||
if (LOG_MICROCODE) logerror("%04X:SCROLLY write = %02X\n", cpu_get_previouspc(space->cpu), data);
|
||||
scrolly = data;
|
||||
state->scrolly = data;
|
||||
break;
|
||||
|
||||
case 0x0a: /* CONTROL */
|
||||
@ -314,12 +292,12 @@ WRITE8_HANDLER( victory_video_control_w )
|
||||
// D2 = BIR12
|
||||
// D1 = SELOVER
|
||||
if (LOG_MICROCODE) logerror("%04X:CONTROL write = %02X\n", cpu_get_previouspc(space->cpu), data);
|
||||
video_control = data;
|
||||
state->video_control = data;
|
||||
break;
|
||||
|
||||
case 0x0b: /* CLRVIRQ */
|
||||
if (LOG_MICROCODE) logerror("%04X:CLRVIRQ write = %02X\n", cpu_get_previouspc(space->cpu), data);
|
||||
vblank_irq = 0;
|
||||
state->vblank_irq = 0;
|
||||
victory_update_irq(space->machine);
|
||||
break;
|
||||
|
||||
@ -524,7 +502,7 @@ Registers:
|
||||
*
|
||||
*************************************/
|
||||
|
||||
INLINE void count_states(int states)
|
||||
INLINE void count_states(struct micro_t µ, int states)
|
||||
{
|
||||
attotime state_time = MICRO_STATE_CLOCK_PERIOD * states;
|
||||
|
||||
@ -552,8 +530,10 @@ INLINE void count_states(int states)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static int command2(void)
|
||||
static int command2(running_machine *machine)
|
||||
{
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
struct micro_t µ = state->micro;
|
||||
/*
|
||||
Actual microcode:
|
||||
02 00 0 0 ZERORAM, INCI, SWVRAM
|
||||
@ -566,13 +546,13 @@ static int command2(void)
|
||||
int addr = micro.i++ & 0x3fff;
|
||||
|
||||
if (micro.cmd & 0x10)
|
||||
gram[addr] = micro.g;
|
||||
state->gram[addr] = micro.g;
|
||||
if (micro.cmd & 0x20)
|
||||
bram[addr] = micro.b;
|
||||
state->bram[addr] = micro.b;
|
||||
if (micro.cmd & 0x40)
|
||||
rram[addr] = micro.r;
|
||||
state->rram[addr] = micro.r;
|
||||
|
||||
count_states(3);
|
||||
count_states(micro, 3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -586,6 +566,8 @@ static int command2(void)
|
||||
|
||||
static int command3(running_machine *machine)
|
||||
{
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
struct micro_t µ = state->micro;
|
||||
/*
|
||||
Actual microcode:
|
||||
03 1C 2 0 SLOADLH, SXFERY
|
||||
@ -624,25 +606,25 @@ static int command3(running_machine *machine)
|
||||
UINT8 src;
|
||||
|
||||
/* non-collision-detect case */
|
||||
if (!(micro.cmd & 0x08) || fgcoll)
|
||||
if (!(micro.cmd & 0x08) || state->fgcoll)
|
||||
{
|
||||
if (micro.cmd & 0x10)
|
||||
{
|
||||
src = gram[srcoffs];
|
||||
gram[dstoffs + 0] ^= src >> shift;
|
||||
gram[dstoffs + 1] ^= src << nshift;
|
||||
src = state->gram[srcoffs];
|
||||
state->gram[dstoffs + 0] ^= src >> shift;
|
||||
state->gram[dstoffs + 1] ^= src << nshift;
|
||||
}
|
||||
if (micro.cmd & 0x20)
|
||||
{
|
||||
src = bram[srcoffs];
|
||||
bram[dstoffs + 0] ^= src >> shift;
|
||||
bram[dstoffs + 1] ^= src << nshift;
|
||||
src = state->bram[srcoffs];
|
||||
state->bram[dstoffs + 0] ^= src >> shift;
|
||||
state->bram[dstoffs + 1] ^= src << nshift;
|
||||
}
|
||||
if (micro.cmd & 0x40)
|
||||
{
|
||||
src = rram[srcoffs];
|
||||
rram[dstoffs + 0] ^= src >> shift;
|
||||
rram[dstoffs + 1] ^= src << nshift;
|
||||
src = state->rram[srcoffs];
|
||||
state->rram[dstoffs + 0] ^= src >> shift;
|
||||
state->rram[dstoffs + 1] ^= src << nshift;
|
||||
}
|
||||
}
|
||||
|
||||
@ -651,34 +633,34 @@ static int command3(running_machine *machine)
|
||||
{
|
||||
if (micro.cmd & 0x10)
|
||||
{
|
||||
src = gram[srcoffs];
|
||||
if ((gram[dstoffs + 0] & (src >> shift)) | (gram[dstoffs + 1] & (src << nshift)))
|
||||
fgcoll = 1, fgcollx = micro.xp, fgcolly = sy - 1;
|
||||
gram[dstoffs + 0] ^= src >> shift;
|
||||
gram[dstoffs + 1] ^= src << nshift;
|
||||
src = state->gram[srcoffs];
|
||||
if ((state->gram[dstoffs + 0] & (src >> shift)) | (state->gram[dstoffs + 1] & (src << nshift)))
|
||||
state->fgcoll = 1, state->fgcollx = micro.xp, state->fgcolly = sy - 1;
|
||||
state->gram[dstoffs + 0] ^= src >> shift;
|
||||
state->gram[dstoffs + 1] ^= src << nshift;
|
||||
}
|
||||
if (micro.cmd & 0x20)
|
||||
{
|
||||
src = bram[srcoffs];
|
||||
if ((bram[dstoffs + 0] & (src >> shift)) | (bram[dstoffs + 1] & (src << nshift)))
|
||||
fgcoll = 1, fgcollx = micro.xp, fgcolly = sy - 1;
|
||||
bram[dstoffs + 0] ^= src >> shift;
|
||||
bram[dstoffs + 1] ^= src << nshift;
|
||||
src = state->bram[srcoffs];
|
||||
if ((state->bram[dstoffs + 0] & (src >> shift)) | (state->bram[dstoffs + 1] & (src << nshift)))
|
||||
state->fgcoll = 1, state->fgcollx = micro.xp, state->fgcolly = sy - 1;
|
||||
state->bram[dstoffs + 0] ^= src >> shift;
|
||||
state->bram[dstoffs + 1] ^= src << nshift;
|
||||
}
|
||||
if (micro.cmd & 0x40)
|
||||
{
|
||||
src = rram[srcoffs];
|
||||
if ((rram[dstoffs + 0] & (src >> shift)) | (rram[dstoffs + 1] & (src << nshift)))
|
||||
fgcoll = 1, fgcollx = micro.xp, fgcolly = sy - 1;
|
||||
rram[dstoffs + 0] ^= src >> shift;
|
||||
rram[dstoffs + 1] ^= src << nshift;
|
||||
src = state->rram[srcoffs];
|
||||
if ((state->rram[dstoffs + 0] & (src >> shift)) | (state->rram[dstoffs + 1] & (src << nshift)))
|
||||
state->fgcoll = 1, state->fgcollx = micro.xp, state->fgcolly = sy - 1;
|
||||
state->rram[dstoffs + 0] ^= src >> shift;
|
||||
state->rram[dstoffs + 1] ^= src << nshift;
|
||||
}
|
||||
if (fgcoll) victory_update_irq(machine);
|
||||
if (state->fgcoll) victory_update_irq(machine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
count_states(3 + (2 + 2 * ycount) * xcount);
|
||||
count_states(micro, 3 + (2 + 2 * ycount) * xcount);
|
||||
|
||||
return micro.cmd & 0x80;
|
||||
}
|
||||
@ -693,6 +675,8 @@ static int command3(running_machine *machine)
|
||||
|
||||
static int command4(running_machine *machine)
|
||||
{
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
struct micro_t µ = state->micro;
|
||||
/*
|
||||
Actual microcode:
|
||||
04 1A 2 0 SLOADPC
|
||||
@ -714,17 +698,17 @@ static int command4(running_machine *machine)
|
||||
|
||||
if (LOG_MICROCODE) logerror("================= EXECUTE BEGIN\n");
|
||||
|
||||
count_states(4);
|
||||
count_states(micro, 4);
|
||||
|
||||
micro.pc = micro.yp << 1;
|
||||
do
|
||||
{
|
||||
micro.cmd = gram[0x2000 + micro.pc];
|
||||
micro.cmd = state->gram[0x2000 + micro.pc];
|
||||
micro.cmdlo = micro.cmd & 7;
|
||||
micro.i = (bram[0x2000 + micro.pc] << 8) | rram[0x2000 + micro.pc];
|
||||
micro.r = gram[0x2001 + micro.pc];
|
||||
micro.xp = rram[0x2001 + micro.pc];
|
||||
micro.yp = bram[0x2001 + micro.pc];
|
||||
micro.i = (state->bram[0x2000 + micro.pc] << 8) | state->rram[0x2000 + micro.pc];
|
||||
micro.r = state->gram[0x2001 + micro.pc];
|
||||
micro.xp = state->rram[0x2001 + micro.pc];
|
||||
micro.yp = state->bram[0x2001 + micro.pc];
|
||||
if (LOG_MICROCODE) logerror("PC=%03X CMD=%02X I=%04X R=%02X X=%02X Y=%02X\n", micro.pc, micro.cmd, micro.i, micro.r, micro.xp, micro.yp);
|
||||
micro.pc = (micro.pc + 2) & 0x1ff;
|
||||
|
||||
@ -732,11 +716,11 @@ static int command4(running_machine *machine)
|
||||
{
|
||||
case 0: break;
|
||||
case 1: break;
|
||||
case 2: keep_going = command2(); break;
|
||||
case 2: keep_going = command2(machine); break;
|
||||
case 3: keep_going = command3(machine); break;
|
||||
case 4: micro.pc = micro.yp << 1; keep_going = 1; break;
|
||||
case 5: keep_going = command5(machine); break;
|
||||
case 6: keep_going = command6(); break;
|
||||
case 6: keep_going = command6(machine); break;
|
||||
case 7: keep_going = command7(machine); break;
|
||||
}
|
||||
} while (keep_going);
|
||||
@ -756,6 +740,8 @@ static int command4(running_machine *machine)
|
||||
|
||||
static int command5(running_machine *machine)
|
||||
{
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
struct micro_t µ = state->micro;
|
||||
/*
|
||||
Actual microcode:
|
||||
05 0A 1 0 SXFERY, ADD128+SACCCLEAR, SACCCLK
|
||||
@ -809,7 +795,7 @@ static int command5(running_machine *machine)
|
||||
int c;
|
||||
|
||||
/* non-collision-detect case */
|
||||
if (!(micro.cmd & 0x08) || fgcoll)
|
||||
if (!(micro.cmd & 0x08) || state->fgcoll)
|
||||
{
|
||||
for (c = micro.i & 0xff; c < 0x100; c++)
|
||||
{
|
||||
@ -817,12 +803,12 @@ static int command5(running_machine *machine)
|
||||
int shift = x & 7;
|
||||
int nshift = 8 - shift;
|
||||
|
||||
gram[addr + 0] ^= micro.g >> shift;
|
||||
gram[addr + 1] ^= micro.g << nshift;
|
||||
bram[addr + 0] ^= micro.b >> shift;
|
||||
bram[addr + 1] ^= micro.b << nshift;
|
||||
rram[addr + 0] ^= micro.r >> shift;
|
||||
rram[addr + 1] ^= micro.r << nshift;
|
||||
state->gram[addr + 0] ^= micro.g >> shift;
|
||||
state->gram[addr + 1] ^= micro.g << nshift;
|
||||
state->bram[addr + 0] ^= micro.b >> shift;
|
||||
state->bram[addr + 1] ^= micro.b << nshift;
|
||||
state->rram[addr + 0] ^= micro.r >> shift;
|
||||
state->rram[addr + 1] ^= micro.r << nshift;
|
||||
|
||||
acc += i;
|
||||
if (acc & 0x100)
|
||||
@ -848,17 +834,17 @@ static int command5(running_machine *machine)
|
||||
int shift = x & 7;
|
||||
int nshift = 8 - shift;
|
||||
|
||||
if ((gram[addr + 0] & (micro.g >> shift)) | (gram[addr + 1] & (micro.g << nshift)) |
|
||||
(bram[addr + 0] & (micro.b >> shift)) | (bram[addr + 1] & (micro.b << nshift)) |
|
||||
(rram[addr + 0] & (micro.r >> shift)) | (rram[addr + 1] & (micro.r << nshift)))
|
||||
fgcoll = 1, fgcollx = x, fgcolly = y;
|
||||
if ((state->gram[addr + 0] & (micro.g >> shift)) | (state->gram[addr + 1] & (micro.g << nshift)) |
|
||||
(state->bram[addr + 0] & (micro.b >> shift)) | (state->bram[addr + 1] & (micro.b << nshift)) |
|
||||
(state->rram[addr + 0] & (micro.r >> shift)) | (state->rram[addr + 1] & (micro.r << nshift)))
|
||||
state->fgcoll = 1, state->fgcollx = x, state->fgcolly = y;
|
||||
|
||||
gram[addr + 0] ^= micro.g >> shift;
|
||||
gram[addr + 1] ^= micro.g << nshift;
|
||||
bram[addr + 0] ^= micro.b >> shift;
|
||||
bram[addr + 1] ^= micro.b << nshift;
|
||||
rram[addr + 0] ^= micro.r >> shift;
|
||||
rram[addr + 1] ^= micro.r << nshift;
|
||||
state->gram[addr + 0] ^= micro.g >> shift;
|
||||
state->gram[addr + 1] ^= micro.g << nshift;
|
||||
state->bram[addr + 0] ^= micro.b >> shift;
|
||||
state->bram[addr + 1] ^= micro.b << nshift;
|
||||
state->rram[addr + 0] ^= micro.r >> shift;
|
||||
state->rram[addr + 1] ^= micro.r << nshift;
|
||||
|
||||
acc += i;
|
||||
if (acc & 0x100)
|
||||
@ -873,12 +859,12 @@ static int command5(running_machine *machine)
|
||||
}
|
||||
acc &= 0xff;
|
||||
}
|
||||
if (fgcoll) victory_update_irq(machine);
|
||||
if (state->fgcoll) victory_update_irq(machine);
|
||||
}
|
||||
|
||||
micro.xp = x;
|
||||
|
||||
count_states(3 + 2 * (0x100 - (micro.i & 0xff)));
|
||||
count_states(micro, 3 + 2 * (0x100 - (micro.i & 0xff)));
|
||||
|
||||
return micro.cmd & 0x80;
|
||||
}
|
||||
@ -891,8 +877,10 @@ static int command5(running_machine *machine)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static int command6(void)
|
||||
static int command6(running_machine *machine)
|
||||
{
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
struct micro_t µ = state->micro;
|
||||
/*
|
||||
Actual microcode:
|
||||
06 0C 0 0 SLOADLH, SLOADPC
|
||||
@ -920,14 +908,14 @@ static int command6(void)
|
||||
micro.pc &= 0x1ff;
|
||||
|
||||
if (micro.cmd & 0x10)
|
||||
gram[daddr] = gram[saddr];
|
||||
state->gram[daddr] = state->gram[saddr];
|
||||
if (micro.cmd & 0x20)
|
||||
bram[daddr] = bram[saddr];
|
||||
state->bram[daddr] = state->bram[saddr];
|
||||
if (micro.cmd & 0x40)
|
||||
rram[daddr] = rram[saddr];
|
||||
state->rram[daddr] = state->rram[saddr];
|
||||
}
|
||||
|
||||
count_states(3 + 2 * (64 - (micro.r & 31) * 2));
|
||||
count_states(micro, 3 + 2 * (64 - (micro.r & 31) * 2));
|
||||
|
||||
return micro.cmd & 0x80;
|
||||
}
|
||||
@ -942,6 +930,8 @@ static int command6(void)
|
||||
|
||||
static int command7(running_machine *machine)
|
||||
{
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
struct micro_t µ = state->micro;
|
||||
/*
|
||||
Actual microcode:
|
||||
07 08 1 0 SXFERY, SXFERX+INCX
|
||||
@ -960,22 +950,22 @@ static int command7(running_machine *machine)
|
||||
int nshift = 8 - shift;
|
||||
|
||||
/* non-collision-detect case */
|
||||
if (!(micro.cmd & 0x08) || fgcoll)
|
||||
if (!(micro.cmd & 0x08) || state->fgcoll)
|
||||
{
|
||||
if (micro.cmd & 0x10)
|
||||
{
|
||||
gram[addr + 0] ^= micro.g >> shift;
|
||||
gram[addr + 1] ^= micro.g << nshift;
|
||||
state->gram[addr + 0] ^= micro.g >> shift;
|
||||
state->gram[addr + 1] ^= micro.g << nshift;
|
||||
}
|
||||
if (micro.cmd & 0x20)
|
||||
{
|
||||
bram[addr + 0] ^= micro.b >> shift;
|
||||
bram[addr + 1] ^= micro.b << nshift;
|
||||
state->bram[addr + 0] ^= micro.b >> shift;
|
||||
state->bram[addr + 1] ^= micro.b << nshift;
|
||||
}
|
||||
if (micro.cmd & 0x40)
|
||||
{
|
||||
rram[addr + 0] ^= micro.r >> shift;
|
||||
rram[addr + 1] ^= micro.r << nshift;
|
||||
state->rram[addr + 0] ^= micro.r >> shift;
|
||||
state->rram[addr + 1] ^= micro.r << nshift;
|
||||
}
|
||||
}
|
||||
|
||||
@ -984,29 +974,29 @@ static int command7(running_machine *machine)
|
||||
{
|
||||
if (micro.cmd & 0x10)
|
||||
{
|
||||
if ((gram[addr + 0] & (micro.g >> shift)) | (gram[addr + 1] & (micro.g << nshift)))
|
||||
fgcoll = 1, fgcollx = micro.xp + 8, fgcolly = micro.yp;
|
||||
gram[addr + 0] ^= micro.g >> shift;
|
||||
gram[addr + 1] ^= micro.g << nshift;
|
||||
if ((state->gram[addr + 0] & (micro.g >> shift)) | (state->gram[addr + 1] & (micro.g << nshift)))
|
||||
state->fgcoll = 1, state->fgcollx = micro.xp + 8, state->fgcolly = micro.yp;
|
||||
state->gram[addr + 0] ^= micro.g >> shift;
|
||||
state->gram[addr + 1] ^= micro.g << nshift;
|
||||
}
|
||||
if (micro.cmd & 0x20)
|
||||
{
|
||||
if ((bram[addr + 0] & (micro.b >> shift)) | (bram[addr + 1] & (micro.b << nshift)))
|
||||
fgcoll = 1, fgcollx = micro.xp + 8, fgcolly = micro.yp;
|
||||
bram[addr + 0] ^= micro.b >> shift;
|
||||
bram[addr + 1] ^= micro.b << nshift;
|
||||
if ((state->bram[addr + 0] & (micro.b >> shift)) | (state->bram[addr + 1] & (micro.b << nshift)))
|
||||
state->fgcoll = 1, state->fgcollx = micro.xp + 8, state->fgcolly = micro.yp;
|
||||
state->bram[addr + 0] ^= micro.b >> shift;
|
||||
state->bram[addr + 1] ^= micro.b << nshift;
|
||||
}
|
||||
if (micro.cmd & 0x40)
|
||||
{
|
||||
if ((rram[addr + 0] & (micro.r >> shift)) | (rram[addr + 1] & (micro.r << nshift)))
|
||||
fgcoll = 1, fgcollx = micro.xp + 8, fgcolly = micro.yp;
|
||||
rram[addr + 0] ^= micro.r >> shift;
|
||||
rram[addr + 1] ^= micro.r << nshift;
|
||||
if ((state->rram[addr + 0] & (micro.r >> shift)) | (state->rram[addr + 1] & (micro.r << nshift)))
|
||||
state->fgcoll = 1, state->fgcollx = micro.xp + 8, state->fgcolly = micro.yp;
|
||||
state->rram[addr + 0] ^= micro.r >> shift;
|
||||
state->rram[addr + 1] ^= micro.r << nshift;
|
||||
}
|
||||
if (fgcoll) victory_update_irq(machine);
|
||||
if (state->fgcoll) victory_update_irq(machine);
|
||||
}
|
||||
|
||||
count_states(4);
|
||||
count_states(micro, 4);
|
||||
|
||||
return micro.cmd & 0x80;
|
||||
}
|
||||
@ -1018,21 +1008,22 @@ static int command7(running_machine *machine)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void update_background(void)
|
||||
static void update_background(running_machine *machine)
|
||||
{
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
int x, y, row, offs;
|
||||
|
||||
for (y = offs = 0; y < 32; y++)
|
||||
for (x = 0; x < 32; x++, offs++)
|
||||
{
|
||||
int code = victory_videoram[offs];
|
||||
int code = state->videoram[offs];
|
||||
|
||||
for (row = 0; row < 8; row++)
|
||||
{
|
||||
UINT8 pix2 = victory_charram[0x0000 + 8 * code + row];
|
||||
UINT8 pix1 = victory_charram[0x0800 + 8 * code + row];
|
||||
UINT8 pix0 = victory_charram[0x1000 + 8 * code + row];
|
||||
UINT8 *dst = &bgbitmap[(y * 8 + row) * 256 + x * 8];
|
||||
UINT8 pix2 = state->charram[0x0000 + 8 * code + row];
|
||||
UINT8 pix1 = state->charram[0x0800 + 8 * code + row];
|
||||
UINT8 pix0 = state->charram[0x1000 + 8 * code + row];
|
||||
UINT8 *dst = &state->bgbitmap[(y * 8 + row) * 256 + x * 8];
|
||||
|
||||
*dst++ = ((pix2 & 0x80) >> 5) | ((pix1 & 0x80) >> 6) | ((pix0 & 0x80) >> 7);
|
||||
*dst++ = ((pix2 & 0x40) >> 4) | ((pix1 & 0x40) >> 5) | ((pix0 & 0x40) >> 6);
|
||||
@ -1053,20 +1044,21 @@ static void update_background(void)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void update_foreground(void)
|
||||
static void update_foreground(running_machine *machine)
|
||||
{
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < 256; y++)
|
||||
{
|
||||
UINT8 *dst = &fgbitmap[y * 256];
|
||||
UINT8 *dst = &state->fgbitmap[y * 256];
|
||||
|
||||
/* assemble the RGB bits for each 8-pixel chunk */
|
||||
for (x = 0; x < 256; x += 8)
|
||||
{
|
||||
UINT8 g = gram[y * 32 + x / 8];
|
||||
UINT8 b = bram[y * 32 + x / 8];
|
||||
UINT8 r = rram[y * 32 + x / 8];
|
||||
UINT8 g = state->gram[y * 32 + x / 8];
|
||||
UINT8 b = state->bram[y * 32 + x / 8];
|
||||
UINT8 r = state->rram[y * 32 + x / 8];
|
||||
|
||||
*dst++ = ((r & 0x80) >> 5) | ((b & 0x80) >> 6) | ((g & 0x80) >> 7);
|
||||
*dst++ = ((r & 0x40) >> 4) | ((b & 0x40) >> 5) | ((g & 0x40) >> 6);
|
||||
@ -1083,9 +1075,10 @@ static void update_foreground(void)
|
||||
|
||||
static TIMER_CALLBACK( bgcoll_irq_callback )
|
||||
{
|
||||
bgcollx = param & 0xff;
|
||||
bgcolly = param >> 8;
|
||||
bgcoll = 1;
|
||||
victory_state *state = machine->driver_data<victory_state>();
|
||||
state->bgcollx = param & 0xff;
|
||||
state->bgcolly = param >> 8;
|
||||
state->bgcoll = 1;
|
||||
victory_update_irq(machine);
|
||||
}
|
||||
|
||||
@ -1099,7 +1092,8 @@ static TIMER_CALLBACK( bgcoll_irq_callback )
|
||||
|
||||
SCREEN_UPDATE( victory )
|
||||
{
|
||||
int bgcollmask = (video_control & 4) ? 4 : 7;
|
||||
victory_state *state = screen->machine->driver_data<victory_state>();
|
||||
int bgcollmask = (state->video_control & 4) ? 4 : 7;
|
||||
int count = 0;
|
||||
int x, y;
|
||||
|
||||
@ -1107,22 +1101,22 @@ SCREEN_UPDATE( victory )
|
||||
set_palette(screen->machine);
|
||||
|
||||
/* update the foreground & background */
|
||||
update_foreground();
|
||||
update_background();
|
||||
update_foreground(screen->machine);
|
||||
update_background(screen->machine);
|
||||
|
||||
/* blend the bitmaps and do collision detection */
|
||||
for (y = 0; y < 256; y++)
|
||||
{
|
||||
UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0);
|
||||
UINT8 sy = scrolly + y;
|
||||
UINT8 *fg = &fgbitmap[y * 256];
|
||||
UINT8 *bg = &bgbitmap[sy * 256];
|
||||
UINT8 sy = state->scrolly + y;
|
||||
UINT8 *fg = &state->fgbitmap[y * 256];
|
||||
UINT8 *bg = &state->bgbitmap[sy * 256];
|
||||
|
||||
/* do the blending */
|
||||
for (x = 0; x < 256; x++)
|
||||
{
|
||||
int fpix = *fg++;
|
||||
int bpix = bg[(x + scrollx) & 255];
|
||||
int bpix = bg[(x + state->scrollx) & 255];
|
||||
scanline[x] = bpix | (fpix << 3);
|
||||
if (fpix && (bpix & bgcollmask) && count++ < 128)
|
||||
screen->machine->scheduler().timer_set(screen->time_until_pos(y, x), FUNC(bgcoll_irq_callback), x | (y << 8));
|
||||
|
@ -24,36 +24,24 @@ static const rectangle bottomvisiblearea =
|
||||
6*8, 32*8-1
|
||||
};
|
||||
|
||||
//UINT8 *vigilant_paletteram;
|
||||
//UINT8 *vigilant_sprite_paletteram;
|
||||
|
||||
static int horiz_scroll_low=0;
|
||||
static int horiz_scroll_high=0;
|
||||
static int rear_horiz_scroll_low=0;
|
||||
static int rear_horiz_scroll_high=0;
|
||||
static int rear_color=0;
|
||||
static int rear_disable;
|
||||
|
||||
static int rear_refresh;
|
||||
|
||||
static bitmap_t *bg_bitmap;
|
||||
|
||||
|
||||
VIDEO_START( vigilant )
|
||||
{
|
||||
bg_bitmap = auto_bitmap_alloc(machine,512*4,256,machine->primary_screen->format());
|
||||
vigilant_state *state = machine->driver_data<vigilant_state>();
|
||||
state->bg_bitmap = auto_bitmap_alloc(machine,512*4,256,machine->primary_screen->format());
|
||||
}
|
||||
|
||||
|
||||
VIDEO_RESET( vigilant )
|
||||
{
|
||||
horiz_scroll_low = 0;
|
||||
horiz_scroll_high = 0;
|
||||
rear_horiz_scroll_low = 0;
|
||||
rear_horiz_scroll_high = 0;
|
||||
rear_color = 0;
|
||||
rear_disable = 1;
|
||||
rear_refresh = 1;
|
||||
vigilant_state *state = machine->driver_data<vigilant_state>();
|
||||
state->horiz_scroll_low = 0;
|
||||
state->horiz_scroll_high = 0;
|
||||
state->rear_horiz_scroll_low = 0;
|
||||
state->rear_horiz_scroll_high = 0;
|
||||
state->rear_color = 0;
|
||||
state->rear_disable = 1;
|
||||
state->rear_refresh = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -65,6 +53,7 @@ VIDEO_RESET( vigilant )
|
||||
**************************************************************************/
|
||||
static void update_background(running_machine *machine)
|
||||
{
|
||||
vigilant_state *state = machine->driver_data<vigilant_state>();
|
||||
int row,col,page;
|
||||
int charcode;
|
||||
|
||||
@ -78,7 +67,7 @@ static void update_background(running_machine *machine)
|
||||
{
|
||||
for( col=0; col<512; col+=32 )
|
||||
{
|
||||
drawgfx_opaque(bg_bitmap,
|
||||
drawgfx_opaque(state->bg_bitmap,
|
||||
0,machine->gfx[2],
|
||||
charcode,
|
||||
row < 128 ? 0 : 1,
|
||||
@ -133,10 +122,11 @@ WRITE8_HANDLER( vigilant_paletteram_w )
|
||||
**************************************************************************/
|
||||
WRITE8_HANDLER( vigilant_horiz_scroll_w )
|
||||
{
|
||||
vigilant_state *state = space->machine->driver_data<vigilant_state>();
|
||||
if (offset==0)
|
||||
horiz_scroll_low = data;
|
||||
state->horiz_scroll_low = data;
|
||||
else
|
||||
horiz_scroll_high = (data & 0x01) * 256;
|
||||
state->horiz_scroll_high = (data & 0x01) * 256;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -147,10 +137,11 @@ WRITE8_HANDLER( vigilant_horiz_scroll_w )
|
||||
***************************************************************************/
|
||||
WRITE8_HANDLER( vigilant_rear_horiz_scroll_w )
|
||||
{
|
||||
vigilant_state *state = space->machine->driver_data<vigilant_state>();
|
||||
if (offset==0)
|
||||
rear_horiz_scroll_low = data;
|
||||
state->rear_horiz_scroll_low = data;
|
||||
else
|
||||
rear_horiz_scroll_high = (data & 0x07) * 256;
|
||||
state->rear_horiz_scroll_high = (data & 0x07) * 256;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -170,8 +161,9 @@ WRITE8_HANDLER( vigilant_rear_horiz_scroll_w )
|
||||
**************************************************************************/
|
||||
WRITE8_HANDLER( vigilant_rear_color_w )
|
||||
{
|
||||
rear_disable = data & 0x40;
|
||||
rear_color = (data & 0x0d);
|
||||
vigilant_state *state = space->machine->driver_data<vigilant_state>();
|
||||
state->rear_disable = data & 0x40;
|
||||
state->rear_color = (data & 0x0d);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -185,7 +177,7 @@ static void draw_foreground(running_machine *machine, bitmap_t *bitmap, const re
|
||||
vigilant_state *state = machine->driver_data<vigilant_state>();
|
||||
UINT8 *videoram = state->videoram;
|
||||
int offs;
|
||||
int scroll = -(horiz_scroll_low + horiz_scroll_high);
|
||||
int scroll = -(state->horiz_scroll_low + state->horiz_scroll_high);
|
||||
|
||||
|
||||
for (offs = 0; offs < 0x1000; offs += 2)
|
||||
@ -231,16 +223,17 @@ static void draw_foreground(running_machine *machine, bitmap_t *bitmap, const re
|
||||
|
||||
static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
{
|
||||
int scrollx = 0x17a + 16*8 - (rear_horiz_scroll_low + rear_horiz_scroll_high);
|
||||
vigilant_state *state = machine->driver_data<vigilant_state>();
|
||||
int scrollx = 0x17a + 16*8 - (state->rear_horiz_scroll_low + state->rear_horiz_scroll_high);
|
||||
|
||||
|
||||
if (rear_refresh)
|
||||
if (state->rear_refresh)
|
||||
{
|
||||
update_background(machine);
|
||||
rear_refresh=0;
|
||||
state->rear_refresh=0;
|
||||
}
|
||||
|
||||
copyscrollbitmap(bitmap,bg_bitmap,1,&scrollx,0,0,&bottomvisiblearea);
|
||||
copyscrollbitmap(bitmap,state->bg_bitmap,1,&scrollx,0,0,&bottomvisiblearea);
|
||||
}
|
||||
|
||||
|
||||
@ -307,6 +300,7 @@ SCREEN_UPDATE( kikcubic )
|
||||
|
||||
SCREEN_UPDATE( vigilant )
|
||||
{
|
||||
vigilant_state *state = screen->machine->driver_data<vigilant_state>();
|
||||
int i;
|
||||
|
||||
/* copy the background palette */
|
||||
@ -315,20 +309,20 @@ SCREEN_UPDATE( vigilant )
|
||||
int r,g,b;
|
||||
|
||||
|
||||
r = (screen->machine->generic.paletteram.u8[0x400 + 16 * rear_color + i] << 3) & 0xFF;
|
||||
g = (screen->machine->generic.paletteram.u8[0x500 + 16 * rear_color + i] << 3) & 0xFF;
|
||||
b = (screen->machine->generic.paletteram.u8[0x600 + 16 * rear_color + i] << 3) & 0xFF;
|
||||
r = (screen->machine->generic.paletteram.u8[0x400 + 16 * state->rear_color + i] << 3) & 0xFF;
|
||||
g = (screen->machine->generic.paletteram.u8[0x500 + 16 * state->rear_color + i] << 3) & 0xFF;
|
||||
b = (screen->machine->generic.paletteram.u8[0x600 + 16 * state->rear_color + i] << 3) & 0xFF;
|
||||
|
||||
palette_set_color(screen->machine,512 + i,MAKE_RGB(r,g,b));
|
||||
|
||||
r = (screen->machine->generic.paletteram.u8[0x400 + 16 * rear_color + 32 + i] << 3) & 0xFF;
|
||||
g = (screen->machine->generic.paletteram.u8[0x500 + 16 * rear_color + 32 + i] << 3) & 0xFF;
|
||||
b = (screen->machine->generic.paletteram.u8[0x600 + 16 * rear_color + 32 + i] << 3) & 0xFF;
|
||||
r = (screen->machine->generic.paletteram.u8[0x400 + 16 * state->rear_color + 32 + i] << 3) & 0xFF;
|
||||
g = (screen->machine->generic.paletteram.u8[0x500 + 16 * state->rear_color + 32 + i] << 3) & 0xFF;
|
||||
b = (screen->machine->generic.paletteram.u8[0x600 + 16 * state->rear_color + 32 + i] << 3) & 0xFF;
|
||||
|
||||
palette_set_color(screen->machine,512 + 16 + i,MAKE_RGB(r,g,b));
|
||||
}
|
||||
|
||||
if (rear_disable) /* opaque foreground */
|
||||
if (state->rear_disable) /* opaque foreground */
|
||||
{
|
||||
draw_foreground(screen->machine,bitmap,cliprect,0,1);
|
||||
draw_sprites(screen->machine,bitmap,&bottomvisiblearea);
|
||||
|
@ -97,58 +97,6 @@
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Global variables
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/* RAM globals */
|
||||
UINT8 *williams_videoram;
|
||||
UINT8 *williams2_tileram;
|
||||
UINT8 *blaster_palette_0;
|
||||
UINT8 *blaster_scanline_control;
|
||||
|
||||
/* blitter globals */
|
||||
UINT8 williams_blitter_config;
|
||||
UINT16 williams_blitter_clip_address;
|
||||
UINT8 williams_blitter_window_enable;
|
||||
|
||||
/* tilemap globals */
|
||||
UINT8 williams2_tilemap_config;
|
||||
|
||||
/* rendering globals */
|
||||
UINT8 williams_cocktail;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Static global variables
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/* palette variables */
|
||||
static rgb_t *palette_lookup;
|
||||
|
||||
/* blitter variables */
|
||||
static UINT8 blitterram[8];
|
||||
static UINT8 blitter_xor;
|
||||
static UINT8 blitter_remap_index;
|
||||
static const UINT8 *blitter_remap;
|
||||
static UINT8 *blitter_remap_lookup;
|
||||
|
||||
/* Blaster-specific variables */
|
||||
static rgb_t blaster_color0;
|
||||
static UINT8 blaster_video_control;
|
||||
|
||||
/* tilemap variables */
|
||||
static tilemap_t *bg_tilemap;
|
||||
static UINT16 tilemap_xscroll;
|
||||
static UINT8 williams2_fg_color;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Prototypes
|
||||
@ -170,20 +118,22 @@ static int blitter_core(address_space *space, int sstart, int dstart, int w, int
|
||||
|
||||
static void state_save_register(running_machine *machine)
|
||||
{
|
||||
state_save_register_global(machine, williams_blitter_window_enable);
|
||||
state_save_register_global(machine, williams_cocktail);
|
||||
state_save_register_global_array(machine, blitterram);
|
||||
state_save_register_global(machine, blitter_remap_index);
|
||||
state_save_register_global(machine, blaster_color0);
|
||||
state_save_register_global(machine, blaster_video_control);
|
||||
state_save_register_global(machine, tilemap_xscroll);
|
||||
state_save_register_global(machine, williams2_fg_color);
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
state_save_register_global(machine, state->blitter_window_enable);
|
||||
state_save_register_global(machine, state->cocktail);
|
||||
state_save_register_global_array(machine, state->blitterram);
|
||||
state_save_register_global(machine, state->blitter_remap_index);
|
||||
state_save_register_global(machine, state->blaster_color0);
|
||||
state_save_register_global(machine, state->blaster_video_control);
|
||||
state_save_register_global(machine, state->tilemap_xscroll);
|
||||
state_save_register_global(machine, state->williams2_fg_color);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( williams )
|
||||
{
|
||||
blitter_init(machine, williams_blitter_config, NULL);
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
blitter_init(machine, state->blitter_config, NULL);
|
||||
create_palette_lookup(machine);
|
||||
state_save_register(machine);
|
||||
}
|
||||
@ -191,7 +141,8 @@ VIDEO_START( williams )
|
||||
|
||||
VIDEO_START( blaster )
|
||||
{
|
||||
blitter_init(machine, williams_blitter_config, machine->region("proms")->base());
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
blitter_init(machine, state->blitter_config, machine->region("proms")->base());
|
||||
create_palette_lookup(machine);
|
||||
state_save_register(machine);
|
||||
}
|
||||
@ -199,15 +150,16 @@ VIDEO_START( blaster )
|
||||
|
||||
VIDEO_START( williams2 )
|
||||
{
|
||||
blitter_init(machine, williams_blitter_config, NULL);
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
blitter_init(machine, state->blitter_config, NULL);
|
||||
|
||||
/* allocate paletteram */
|
||||
machine->generic.paletteram.u8 = auto_alloc_array(machine, UINT8, 0x400 * 2);
|
||||
state_save_register_global_pointer(machine, machine->generic.paletteram.u8, 0x400 * 2);
|
||||
|
||||
/* create the tilemap */
|
||||
bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_cols, 24,16, 128,16);
|
||||
tilemap_set_scrolldx(bg_tilemap, 2, 0);
|
||||
state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_cols, 24,16, 128,16);
|
||||
tilemap_set_scrolldx(state->bg_tilemap, 2, 0);
|
||||
|
||||
state_save_register(machine);
|
||||
}
|
||||
@ -222,17 +174,18 @@ VIDEO_START( williams2 )
|
||||
|
||||
SCREEN_UPDATE( williams )
|
||||
{
|
||||
williams_state *state = screen->machine->driver_data<williams_state>();
|
||||
rgb_t pens[16];
|
||||
int x, y;
|
||||
|
||||
/* precompute the palette */
|
||||
for (x = 0; x < 16; x++)
|
||||
pens[x] = palette_lookup[screen->machine->generic.paletteram.u8[x]];
|
||||
pens[x] = state->palette_lookup[screen->machine->generic.paletteram.u8[x]];
|
||||
|
||||
/* loop over rows */
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
|
||||
{
|
||||
UINT8 *source = &williams_videoram[y];
|
||||
UINT8 *source = &state->videoram[y];
|
||||
UINT32 *dest = BITMAP_ADDR32(bitmap, y, 0);
|
||||
|
||||
/* loop over columns */
|
||||
@ -249,27 +202,28 @@ SCREEN_UPDATE( williams )
|
||||
|
||||
SCREEN_UPDATE( blaster )
|
||||
{
|
||||
williams_state *state = screen->machine->driver_data<williams_state>();
|
||||
rgb_t pens[16];
|
||||
int x, y;
|
||||
|
||||
/* precompute the palette */
|
||||
for (x = 0; x < 16; x++)
|
||||
pens[x] = palette_lookup[screen->machine->generic.paletteram.u8[x]];
|
||||
pens[x] = state->palette_lookup[screen->machine->generic.paletteram.u8[x]];
|
||||
|
||||
/* if we're blitting from the top, start with a 0 for color 0 */
|
||||
if (cliprect->min_y == screen->visible_area().min_y || !(blaster_video_control & 1))
|
||||
blaster_color0 = pens[0];
|
||||
if (cliprect->min_y == screen->visible_area().min_y || !(state->blaster_video_control & 1))
|
||||
state->blaster_color0 = pens[0];
|
||||
|
||||
/* loop over rows */
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
|
||||
{
|
||||
int erase_behind = blaster_video_control & blaster_scanline_control[y] & 2;
|
||||
UINT8 *source = &williams_videoram[y];
|
||||
int erase_behind = state->blaster_video_control & state->blaster_scanline_control[y] & 2;
|
||||
UINT8 *source = &state->videoram[y];
|
||||
UINT32 *dest = BITMAP_ADDR32(bitmap, y, 0);
|
||||
|
||||
/* latch a new color0 pen? */
|
||||
if (blaster_video_control & blaster_scanline_control[y] & 1)
|
||||
blaster_color0 = palette_lookup[blaster_palette_0[y] ^ 0xff];
|
||||
if (state->blaster_video_control & state->blaster_scanline_control[y] & 1)
|
||||
state->blaster_color0 = state->palette_lookup[state->blaster_palette_0[y] ^ 0xff];
|
||||
|
||||
/* loop over columns */
|
||||
for (x = cliprect->min_x & ~1; x <= cliprect->max_x; x += 2)
|
||||
@ -281,8 +235,8 @@ SCREEN_UPDATE( blaster )
|
||||
source[(x/2) * 256] = 0;
|
||||
|
||||
/* now draw */
|
||||
dest[x+0] = (pix & 0xf0) ? pens[pix >> 4] : blaster_color0;
|
||||
dest[x+1] = (pix & 0x0f) ? pens[pix & 0x0f] : blaster_color0;
|
||||
dest[x+0] = (pix & 0xf0) ? pens[pix >> 4] : state->blaster_color0;
|
||||
dest[x+1] = (pix & 0x0f) ? pens[pix & 0x0f] : state->blaster_color0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -291,20 +245,21 @@ SCREEN_UPDATE( blaster )
|
||||
|
||||
SCREEN_UPDATE( williams2 )
|
||||
{
|
||||
williams_state *state = screen->machine->driver_data<williams_state>();
|
||||
rgb_t pens[16];
|
||||
int x, y;
|
||||
|
||||
/* draw the background */
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
|
||||
/* fetch the relevant pens */
|
||||
for (x = 1; x < 16; x++)
|
||||
pens[x] = palette_get_color(screen->machine, williams2_fg_color * 16 + x);
|
||||
pens[x] = palette_get_color(screen->machine, state->williams2_fg_color * 16 + x);
|
||||
|
||||
/* loop over rows */
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
|
||||
{
|
||||
UINT8 *source = &williams_videoram[y];
|
||||
UINT8 *source = &state->videoram[y];
|
||||
UINT32 *dest = BITMAP_ADDR32(bitmap, y, 0);
|
||||
|
||||
/* loop over columns */
|
||||
@ -331,6 +286,7 @@ SCREEN_UPDATE( williams2 )
|
||||
|
||||
static void create_palette_lookup(running_machine *machine)
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
static const int resistances_rg[3] = { 1200, 560, 330 };
|
||||
static const int resistances_b[2] = { 560, 330 };
|
||||
double weights_r[3], weights_g[3], weights_b[2];
|
||||
@ -345,14 +301,14 @@ static void create_palette_lookup(running_machine *machine)
|
||||
2, resistances_b, weights_b, 0, 0);
|
||||
|
||||
/* build a palette lookup */
|
||||
palette_lookup = auto_alloc_array(machine, rgb_t, 256);
|
||||
state->palette_lookup = auto_alloc_array(machine, rgb_t, 256);
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
int r = combine_3_weights(weights_r, BIT(i,0), BIT(i,1), BIT(i,2));
|
||||
int g = combine_3_weights(weights_g, BIT(i,3), BIT(i,4), BIT(i,5));
|
||||
int b = combine_2_weights(weights_b, BIT(i,6), BIT(i,7));
|
||||
|
||||
palette_lookup[i] = MAKE_RGB(r, g, b);
|
||||
state->palette_lookup[i] = MAKE_RGB(r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
@ -384,7 +340,8 @@ WRITE8_HANDLER( williams2_paletteram_w )
|
||||
|
||||
WRITE8_HANDLER( williams2_fg_select_w )
|
||||
{
|
||||
williams2_fg_color = data & 0x3f;
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
state->williams2_fg_color = data & 0x3f;
|
||||
}
|
||||
|
||||
|
||||
@ -416,12 +373,13 @@ READ8_HANDLER( williams2_video_counter_r )
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
int mask = machine->gfx[0]->total_elements - 1;
|
||||
int data = williams2_tileram[tile_index];
|
||||
int data = state->williams2_tileram[tile_index];
|
||||
int y = (tile_index >> 1) & 7;
|
||||
int color = 0;
|
||||
|
||||
switch (williams2_tilemap_config)
|
||||
switch (state->williams2_tilemap_config)
|
||||
{
|
||||
case WILLIAMS_TILEMAP_MYSTICM:
|
||||
{
|
||||
@ -450,9 +408,10 @@ static TILE_GET_INFO( get_tile_info )
|
||||
|
||||
WRITE8_HANDLER( williams2_bg_select_w )
|
||||
{
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
/* based on the tilemap config, only certain bits are used */
|
||||
/* the rest are determined by other factors */
|
||||
switch (williams2_tilemap_config)
|
||||
switch (state->williams2_tilemap_config)
|
||||
{
|
||||
case WILLIAMS_TILEMAP_MYSTICM:
|
||||
/* IC79 is a 74LS85 comparator that controls the low bit */
|
||||
@ -469,28 +428,31 @@ WRITE8_HANDLER( williams2_bg_select_w )
|
||||
data &= 0x3f;
|
||||
break;
|
||||
}
|
||||
tilemap_set_palette_offset(bg_tilemap, data * 16);
|
||||
tilemap_set_palette_offset(state->bg_tilemap, data * 16);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( williams2_tileram_w )
|
||||
{
|
||||
williams2_tileram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
state->williams2_tileram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( williams2_xscroll_low_w )
|
||||
{
|
||||
tilemap_xscroll = (tilemap_xscroll & ~0x00f) | ((data & 0x80) >> 4) | (data & 0x07);
|
||||
tilemap_set_scrollx(bg_tilemap, 0, (tilemap_xscroll & 7) + ((tilemap_xscroll >> 3) * 6));
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
state->tilemap_xscroll = (state->tilemap_xscroll & ~0x00f) | ((data & 0x80) >> 4) | (data & 0x07);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, (state->tilemap_xscroll & 7) + ((state->tilemap_xscroll >> 3) * 6));
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( williams2_xscroll_high_w )
|
||||
{
|
||||
tilemap_xscroll = (tilemap_xscroll & 0x00f) | (data << 4);
|
||||
tilemap_set_scrollx(bg_tilemap, 0, (tilemap_xscroll & 7) + ((tilemap_xscroll >> 3) * 6));
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
state->tilemap_xscroll = (state->tilemap_xscroll & 0x00f) | (data << 4);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, (state->tilemap_xscroll & 7) + ((state->tilemap_xscroll >> 3) * 6));
|
||||
}
|
||||
|
||||
|
||||
@ -503,14 +465,16 @@ WRITE8_HANDLER( williams2_xscroll_high_w )
|
||||
|
||||
WRITE8_HANDLER( blaster_remap_select_w )
|
||||
{
|
||||
blitter_remap_index = data;
|
||||
blitter_remap = blitter_remap_lookup + data * 256;
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
state->blitter_remap_index = data;
|
||||
state->blitter_remap = state->blitter_remap_lookup + data * 256;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( blaster_video_control_w )
|
||||
{
|
||||
blaster_video_control = data;
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
state->blaster_video_control = data;
|
||||
}
|
||||
|
||||
|
||||
@ -523,47 +487,49 @@ WRITE8_HANDLER( blaster_video_control_w )
|
||||
|
||||
static void blitter_init(running_machine *machine, int blitter_config, const UINT8 *remap_prom)
|
||||
{
|
||||
williams_state *state = machine->driver_data<williams_state>();
|
||||
static const UINT8 dummy_table[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
|
||||
int i,j;
|
||||
|
||||
/* by default, there is no clipping window - this will be touched only by games that have one */
|
||||
williams_blitter_window_enable = 0;
|
||||
state->blitter_window_enable = 0;
|
||||
|
||||
/* switch off the video config */
|
||||
blitter_xor = (blitter_config == WILLIAMS_BLITTER_SC01) ? 4 : 0;
|
||||
state->blitter_xor = (blitter_config == WILLIAMS_BLITTER_SC01) ? 4 : 0;
|
||||
|
||||
/* create the remap table; if no PROM, make an identity remap table */
|
||||
blitter_remap_lookup = auto_alloc_array(machine, UINT8, 256 * 256);
|
||||
blitter_remap_index = 0;
|
||||
blitter_remap = blitter_remap_lookup;
|
||||
state->blitter_remap_lookup = auto_alloc_array(machine, UINT8, 256 * 256);
|
||||
state->blitter_remap_index = 0;
|
||||
state->blitter_remap = state->blitter_remap_lookup;
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
const UINT8 *table = remap_prom ? (remap_prom + (i & 0x7f) * 16) : dummy_table;
|
||||
for (j = 0; j < 256; j++)
|
||||
blitter_remap_lookup[i * 256 + j] = (table[j >> 4] << 4) | table[j & 0x0f];
|
||||
state->blitter_remap_lookup[i * 256 + j] = (table[j >> 4] << 4) | table[j & 0x0f];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( williams_blitter_w )
|
||||
{
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
int sstart, dstart, w, h, accesses;
|
||||
int estimated_clocks_at_4MHz;
|
||||
|
||||
/* store the data */
|
||||
blitterram[offset] = data;
|
||||
state->blitterram[offset] = data;
|
||||
|
||||
/* only writes to location 0 trigger the blit */
|
||||
if (offset != 0)
|
||||
return;
|
||||
|
||||
/* compute the starting locations */
|
||||
sstart = (blitterram[2] << 8) + blitterram[3];
|
||||
dstart = (blitterram[4] << 8) + blitterram[5];
|
||||
sstart = (state->blitterram[2] << 8) + state->blitterram[3];
|
||||
dstart = (state->blitterram[4] << 8) + state->blitterram[5];
|
||||
|
||||
/* compute the width and height */
|
||||
w = blitterram[6] ^ blitter_xor;
|
||||
h = blitterram[7] ^ blitter_xor;
|
||||
w = state->blitterram[6] ^ state->blitter_xor;
|
||||
h = state->blitterram[7] ^ state->blitter_xor;
|
||||
|
||||
/* adjust the width and height */
|
||||
if (w == 0) w = 1;
|
||||
@ -582,17 +548,18 @@ WRITE8_HANDLER( williams_blitter_w )
|
||||
/* Log blits */
|
||||
logerror("%04X:Blit @ %3d : %02X%02X -> %02X%02X, %3dx%3d, mask=%02X, flags=%02X, icount=%d, win=%d\n",
|
||||
cpu_get_pc(space->cpu), space->machine->primary_screen->vpos(),
|
||||
blitterram[2], blitterram[3],
|
||||
blitterram[4], blitterram[5],
|
||||
blitterram[6], blitterram[7],
|
||||
blitterram[1], blitterram[0],
|
||||
((estimated_clocks_at_4MHz + 3) / 4), williams_blitter_window_enable);
|
||||
state->blitterram[2], state->blitterram[3],
|
||||
state->blitterram[4], state->blitterram[5],
|
||||
state->blitterram[6], state->blitterram[7],
|
||||
state->blitterram[1], state->blitterram[0],
|
||||
((estimated_clocks_at_4MHz + 3) / 4), state->blitter_window_enable);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( williams2_blit_window_enable_w )
|
||||
{
|
||||
williams_blitter_window_enable = data & 0x01;
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
state->blitter_window_enable = data & 0x01;
|
||||
}
|
||||
|
||||
|
||||
@ -605,8 +572,9 @@ WRITE8_HANDLER( williams2_blit_window_enable_w )
|
||||
|
||||
INLINE void blit_pixel(address_space *space, int offset, int srcdata, int data, int mask, int solid)
|
||||
{
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
/* always read from video RAM regardless of the bank setting */
|
||||
int pix = (offset < 0xc000) ? williams_videoram[offset] : space->read_byte(offset);
|
||||
int pix = (offset < 0xc000) ? state->videoram[offset] : space->read_byte(offset);
|
||||
|
||||
/* handle transparency */
|
||||
if (data & 0x08)
|
||||
@ -625,13 +593,14 @@ INLINE void blit_pixel(address_space *space, int offset, int srcdata, int data,
|
||||
/* if the window is enabled, only blit to videoram below the clipping address */
|
||||
/* note that we have to allow blits to non-video RAM (e.g. tileram) because those */
|
||||
/* are not blocked by the window enable */
|
||||
if (!williams_blitter_window_enable || offset < williams_blitter_clip_address || offset >= 0xc000)
|
||||
if (!state->blitter_window_enable || offset < state->blitter_clip_address || offset >= 0xc000)
|
||||
space->write_byte(offset, pix);
|
||||
}
|
||||
|
||||
|
||||
static int blitter_core(address_space *space, int sstart, int dstart, int w, int h, int data)
|
||||
{
|
||||
williams_state *state = space->machine->driver_data<williams_state>();
|
||||
int source, sxadv, syadv;
|
||||
int dest, dxadv, dyadv;
|
||||
int i, j, solid;
|
||||
@ -652,7 +621,7 @@ static int blitter_core(address_space *space, int sstart, int dstart, int w, int
|
||||
return accesses;
|
||||
|
||||
/* set the solid pixel value to the mask value */
|
||||
solid = blitterram[1];
|
||||
solid = state->blitterram[1];
|
||||
|
||||
/* first case: no shifting */
|
||||
if (!(data & 0x20))
|
||||
@ -666,7 +635,7 @@ static int blitter_core(address_space *space, int sstart, int dstart, int w, int
|
||||
/* loop over the width */
|
||||
for (j = w; j > 0; j--)
|
||||
{
|
||||
blit_pixel(space, dest, blitter_remap[space->read_byte(source)], data, keepmask, solid);
|
||||
blit_pixel(space, dest, state->blitter_remap[space->read_byte(source)], data, keepmask, solid);
|
||||
accesses += 2;
|
||||
|
||||
/* advance */
|
||||
@ -700,7 +669,7 @@ static int blitter_core(address_space *space, int sstart, int dstart, int w, int
|
||||
dest = dstart & 0xffff;
|
||||
|
||||
/* left edge case */
|
||||
pixdata = blitter_remap[space->read_byte(source)];
|
||||
pixdata = state->blitter_remap[space->read_byte(source)];
|
||||
blit_pixel(space, dest, (pixdata >> 4) & 0x0f, data, keepmask | 0xf0, solid);
|
||||
accesses += 2;
|
||||
|
||||
@ -710,7 +679,7 @@ static int blitter_core(address_space *space, int sstart, int dstart, int w, int
|
||||
/* loop over the width */
|
||||
for (j = w - 1; j > 0; j--)
|
||||
{
|
||||
pixdata = (pixdata << 8) | blitter_remap[space->read_byte(source)];
|
||||
pixdata = (pixdata << 8) | state->blitter_remap[space->read_byte(source)];
|
||||
blit_pixel(space, dest, (pixdata >> 4) & 0xff, data, keepmask, solid);
|
||||
accesses += 2;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "emu.h"
|
||||
#include "includes/xorworld.h"
|
||||
|
||||
static tilemap_t *bg_tilemap;
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -54,7 +53,7 @@ WRITE16_HANDLER( xorworld_videoram16_w )
|
||||
xorworld_state *state = space->machine->driver_data<xorworld_state>();
|
||||
UINT16 *videoram = state->videoram;
|
||||
COMBINE_DATA(&videoram[offset]);
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -79,7 +78,8 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( xorworld )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
|
||||
xorworld_state *state = machine->driver_data<xorworld_state>();
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
|
||||
8, 8, 32, 32);
|
||||
}
|
||||
|
||||
@ -114,7 +114,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
SCREEN_UPDATE( xorworld )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
xorworld_state *state = screen->machine->driver_data<xorworld_state>();
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user