mirror of
https://github.com/holub/mame
synced 2025-05-28 16:43:04 +03:00
Added driver data struct to cvs.c
Added driver data struct and save states to: cbasebal.c, chinsan.c, mitchell.c and quasar.c Not to be mentioned: I also removed use of memory_set_bankptr from CPS1 sound banking and renamed a couple of rallyx.c constants to be less generic
This commit is contained in:
parent
9ccef5fb60
commit
30e421aac2
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -2373,6 +2373,7 @@ src/mame/includes/capbowl.h svneol=native#text/plain
|
||||
src/mame/includes/carjmbre.h svneol=native#text/plain
|
||||
src/mame/includes/carpolo.h svneol=native#text/plain
|
||||
src/mame/includes/cave.h svneol=native#text/plain
|
||||
src/mame/includes/cbasebal.h svneol=native#text/plain
|
||||
src/mame/includes/ccastles.h svneol=native#text/plain
|
||||
src/mame/includes/cchasm.h svneol=native#text/plain
|
||||
src/mame/includes/cchip.h svneol=native#text/plain
|
||||
@ -2568,6 +2569,7 @@ src/mame/includes/midvunit.h svneol=native#text/plain
|
||||
src/mame/includes/midwunit.h svneol=native#text/plain
|
||||
src/mame/includes/midyunit.h svneol=native#text/plain
|
||||
src/mame/includes/midzeus.h svneol=native#text/plain
|
||||
src/mame/includes/mitchell.h svneol=native#text/plain
|
||||
src/mame/includes/mjkjidai.h svneol=native#text/plain
|
||||
src/mame/includes/model1.h svneol=native#text/plain
|
||||
src/mame/includes/model2.h svneol=native#text/plain
|
||||
|
@ -1,97 +1,103 @@
|
||||
/***************************************************************************
|
||||
|
||||
Capcom Baseball
|
||||
Capcom Baseball
|
||||
|
||||
|
||||
Somewhat similar to the "Mitchell hardware", but different enough to
|
||||
deserve its own driver.
|
||||
Somewhat similar to the "Mitchell hardware", but different enough to
|
||||
deserve its own driver.
|
||||
|
||||
TODO:
|
||||
- understand what bit 6 of input port 0x12 is
|
||||
- unknown bit 5 of bankswitch register
|
||||
TODO:
|
||||
- understand what bit 6 of input port 0x12 is
|
||||
- unknown bit 5 of bankswitch register
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "includes/cps1.h" // needed for decoding functions only
|
||||
#include "machine/eeprom.h"
|
||||
#include "includes/cbasebal.h"
|
||||
#include "machine/eepromdev.h"
|
||||
#include "sound/okim6295.h"
|
||||
#include "sound/2413intf.h"
|
||||
|
||||
|
||||
VIDEO_START( cbasebal );
|
||||
WRITE8_HANDLER( cbasebal_textram_w );
|
||||
READ8_HANDLER( cbasebal_textram_r );
|
||||
WRITE8_HANDLER( cbasebal_scrollram_w );
|
||||
READ8_HANDLER( cbasebal_scrollram_r );
|
||||
WRITE8_HANDLER( cbasebal_gfxctrl_w );
|
||||
WRITE8_HANDLER( cbasebal_scrollx_w );
|
||||
WRITE8_HANDLER( cbasebal_scrolly_w );
|
||||
VIDEO_UPDATE( cbasebal );
|
||||
|
||||
|
||||
static UINT8 rambank;
|
||||
/*************************************
|
||||
*
|
||||
* Memory handlers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static WRITE8_HANDLER( cbasebal_bankswitch_w )
|
||||
{
|
||||
cbasebal_state *state = (cbasebal_state *)space->machine->driver_data;
|
||||
|
||||
/* bits 0-4 select ROM bank */
|
||||
//logerror("%04x: bankswitch %02x\n",cpu_get_pc(space->cpu),data);
|
||||
//logerror("%04x: bankswitch %02x\n", cpu_get_pc(space->cpu), data);
|
||||
memory_set_bank(space->machine, "bank1", data & 0x1f);
|
||||
|
||||
/* bit 5 used but unknown */
|
||||
|
||||
/* bits 6-7 select RAM bank */
|
||||
rambank = (data & 0xc0) >> 6;
|
||||
state->rambank = (data & 0xc0) >> 6;
|
||||
}
|
||||
|
||||
|
||||
static READ8_HANDLER( bankedram_r )
|
||||
{
|
||||
if (rambank == 2)
|
||||
return cbasebal_textram_r(space,offset); /* VRAM */
|
||||
else if (rambank == 1)
|
||||
cbasebal_state *state = (cbasebal_state *)space->machine->driver_data;
|
||||
|
||||
switch (state->rambank)
|
||||
{
|
||||
case 2:
|
||||
return cbasebal_textram_r(space, offset); /* VRAM */
|
||||
break;
|
||||
case 1:
|
||||
if (offset < 0x800)
|
||||
return space->machine->generic.paletteram.u8[offset];
|
||||
else return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return cbasebal_scrollram_r(space,offset); /* SCROLL */
|
||||
else
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
return cbasebal_scrollram_r(space, offset); /* SCROLL */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( bankedram_w )
|
||||
{
|
||||
if (rambank == 2)
|
||||
cbasebal_textram_w(space,offset,data);
|
||||
else if (rambank == 1)
|
||||
cbasebal_state *state = (cbasebal_state *)space->machine->driver_data;
|
||||
|
||||
switch (state->rambank)
|
||||
{
|
||||
case 2:
|
||||
cbasebal_textram_w(space, offset, data);
|
||||
break;
|
||||
case 1:
|
||||
if (offset < 0x800)
|
||||
paletteram_xxxxBBBBRRRRGGGG_le_w(space,offset,data);
|
||||
paletteram_xxxxBBBBRRRRGGGG_le_w(space, offset, data);
|
||||
break;
|
||||
default:
|
||||
cbasebal_scrollram_w(space, offset, data);
|
||||
break;
|
||||
}
|
||||
else
|
||||
cbasebal_scrollram_w(space,offset,data);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( cbasebal_coinctrl_w )
|
||||
{
|
||||
coin_lockout_w(space->machine, 0,~data & 0x04);
|
||||
coin_lockout_w(space->machine, 1,~data & 0x08);
|
||||
coin_counter_w(space->machine, 0,data & 0x01);
|
||||
coin_counter_w(space->machine, 1,data & 0x02);
|
||||
coin_lockout_w(space->machine, 0, ~data & 0x04);
|
||||
coin_lockout_w(space->machine, 1, ~data & 0x08);
|
||||
coin_counter_w(space->machine, 0, data & 0x01);
|
||||
coin_counter_w(space->machine, 1, data & 0x02);
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* EEPROM
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
EEPROM
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static const eeprom_interface eeprom_intf =
|
||||
static const eeprom_interface cbasebal_eeprom_intf =
|
||||
{
|
||||
6, /* address bits */
|
||||
16, /* data bits */
|
||||
@ -101,50 +107,26 @@ static const eeprom_interface eeprom_intf =
|
||||
};
|
||||
|
||||
|
||||
static NVRAM_HANDLER( cbasebal )
|
||||
{
|
||||
if (read_or_write)
|
||||
eeprom_save(file);
|
||||
else
|
||||
{
|
||||
eeprom_init(machine, &eeprom_intf);
|
||||
|
||||
if (file)
|
||||
eeprom_load(file);
|
||||
}
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( eeprom_cs_w )
|
||||
{
|
||||
eeprom_set_cs_line(data ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( eeprom_clock_w )
|
||||
{
|
||||
eeprom_set_clock_line(data ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( eeprom_serial_w )
|
||||
{
|
||||
eeprom_write_bit(data);
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Address maps
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( cbasebal_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0xc000, 0xcfff) AM_READWRITE(bankedram_r, bankedram_w) AM_BASE_GENERIC(paletteram) /* palette + vram + scrollram */
|
||||
AM_RANGE(0xe000, 0xfdff) AM_RAM /* work RAM */
|
||||
AM_RANGE(0xfe00, 0xffff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xfe00, 0xffff) AM_RAM AM_BASE_SIZE_MEMBER(cbasebal_state, spriteram, spriteram_size)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( cbasebal_portmap, ADDRESS_SPACE_IO, 8 )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x00) AM_WRITE(cbasebal_bankswitch_w)
|
||||
AM_RANGE(0x01, 0x01) AM_WRITE(eeprom_cs_w)
|
||||
AM_RANGE(0x02, 0x02) AM_WRITE(eeprom_clock_w)
|
||||
AM_RANGE(0x03, 0x03) AM_WRITE(eeprom_serial_w)
|
||||
AM_RANGE(0x01, 0x01) AM_WRITE_PORT("IO_01")
|
||||
AM_RANGE(0x02, 0x02) AM_WRITE_PORT("IO_02")
|
||||
AM_RANGE(0x03, 0x03) AM_WRITE_PORT("IO_03")
|
||||
AM_RANGE(0x05, 0x05) AM_DEVWRITE("oki", okim6295_w)
|
||||
AM_RANGE(0x06, 0x07) AM_DEVWRITE("ymsnd", ym2413_w)
|
||||
AM_RANGE(0x08, 0x09) AM_WRITE(cbasebal_scrollx_w)
|
||||
@ -157,6 +139,12 @@ static ADDRESS_MAP_START( cbasebal_portmap, ADDRESS_SPACE_IO, 8 )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Input ports
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INPUT_PORTS_START( cbasebal )
|
||||
PORT_START("P1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
@ -186,11 +174,25 @@ static INPUT_PORTS_START( cbasebal )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_VBLANK ) /* ? */
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(eeprom_bit_r, NULL)
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("eeprom", eepromdev_read_bit)
|
||||
|
||||
PORT_START( "IO_01" )
|
||||
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE("eeprom", eepromdev_set_cs_line)
|
||||
|
||||
PORT_START( "IO_02" )
|
||||
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE("eeprom", eepromdev_set_clock_line)
|
||||
|
||||
PORT_START( "IO_03" )
|
||||
PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE("eeprom", eepromdev_write_bit)
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Graphics definitions
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const gfx_layout cbasebal_textlayout =
|
||||
{
|
||||
@ -236,16 +238,61 @@ static GFXDECODE_START( cbasebal )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine driver
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( cbasebal )
|
||||
{
|
||||
cbasebal_state *state = (cbasebal_state *)machine->driver_data;
|
||||
|
||||
memory_configure_bank(machine, "bank1", 0, 32, memory_region(machine, "maincpu") + 0x10000, 0x4000);
|
||||
|
||||
state_save_register_global(machine, state->rambank);
|
||||
state_save_register_global(machine, state->tilebank);
|
||||
state_save_register_global(machine, state->spritebank);
|
||||
state_save_register_global(machine, state->text_on);
|
||||
state_save_register_global(machine, state->bg_on);
|
||||
state_save_register_global(machine, state->obj_on);
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
state_save_register_global_array(machine, state->scroll_x);
|
||||
state_save_register_global_array(machine, state->scroll_y);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( cbasebal )
|
||||
{
|
||||
cbasebal_state *state = (cbasebal_state *)machine->driver_data;
|
||||
|
||||
state->rambank = 0;
|
||||
state->tilebank = 0;
|
||||
state->spritebank = 0;
|
||||
state->text_on = 0;
|
||||
state->bg_on = 0;
|
||||
state->obj_on = 0;
|
||||
state->flipscreen = 0;
|
||||
state->scroll_x[0] = 0;
|
||||
state->scroll_x[1] = 0;
|
||||
state->scroll_y[0] = 0;
|
||||
state->scroll_y[1] = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( cbasebal )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(cbasebal_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, 6000000) /* ??? */
|
||||
MDRV_CPU_PROGRAM_MAP(cbasebal_map)
|
||||
MDRV_CPU_IO_MAP(cbasebal_portmap)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) /* ??? */
|
||||
|
||||
MDRV_NVRAM_HANDLER(cbasebal)
|
||||
MDRV_MACHINE_START(cbasebal)
|
||||
MDRV_MACHINE_RESET(cbasebal)
|
||||
|
||||
MDRV_EEPROM_NODEFAULT_ADD("eeprom", cbasebal_eeprom_intf)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
|
||||
@ -276,6 +323,12 @@ MACHINE_DRIVER_END
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* ROM definition(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
ROM_START( cbasebal )
|
||||
ROM_REGION( 0x90000, "maincpu", 0 )
|
||||
ROM_LOAD( "cbj10.11j", 0x00000, 0x08000, CRC(bbff0acc) SHA1(db9e2c89e030255851789caaf85f24dc73609d9b) )
|
||||
@ -304,11 +357,22 @@ ROM_START( cbasebal )
|
||||
ROM_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Driver initialization
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static DRIVER_INIT( cbasebal )
|
||||
{
|
||||
memory_configure_bank(machine, "bank1", 0, 32, memory_region(machine, "maincpu") + 0x10000, 0x4000);
|
||||
pang_decode(machine);
|
||||
}
|
||||
|
||||
|
||||
GAME( 1989, cbasebal, 0, cbasebal, cbasebal, cbasebal, ROT0, "Capcom", "Capcom Baseball (Japan)", 0 )
|
||||
/*************************************
|
||||
*
|
||||
* Game driver(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1989, cbasebal, 0, cbasebal, cbasebal, cbasebal, ROT0, "Capcom", "Capcom Baseball (Japan)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -47,27 +47,51 @@ MM63.10N
|
||||
#include "sound/2203intf.h"
|
||||
#include "sound/msm5205.h"
|
||||
|
||||
static UINT8* chinsan_video;
|
||||
static UINT8 chinsan_port_select;
|
||||
typedef struct _chinsan_state chinsan_state;
|
||||
struct _chinsan_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * video;
|
||||
|
||||
static UINT32 adpcm_pos;
|
||||
static UINT8 adpcm_idle,adpcm_data;
|
||||
/* misc */
|
||||
UINT8 port_select;
|
||||
UINT32 adpcm_pos;
|
||||
UINT8 adpcm_idle, adpcm_data;
|
||||
UINT8 trigger;
|
||||
};
|
||||
|
||||
static VIDEO_START(chinsan)
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Video emulation
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static PALETTE_INIT( chinsan )
|
||||
{
|
||||
UINT8 *src = memory_region( machine, "color_proms" );
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0x100; i++)
|
||||
palette_set_color_rgb(machine, i, pal4bit(src[i + 0x200]), pal4bit(src[i + 0x100]), pal4bit(src[i + 0x000]));
|
||||
}
|
||||
|
||||
static VIDEO_START( chinsan )
|
||||
{
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE(chinsan)
|
||||
static VIDEO_UPDATE( chinsan )
|
||||
{
|
||||
int y,x, count;
|
||||
chinsan_state *state = (chinsan_state *)screen->machine->driver_data;
|
||||
int y, x, count;
|
||||
count = 0;
|
||||
for(y=0;y<32;y++)
|
||||
for (y = 0; y < 32; y++)
|
||||
{
|
||||
for (x=0;x<64;x++)
|
||||
for (x = 0; x < 64; x++)
|
||||
{
|
||||
int tileno,colour;
|
||||
tileno = chinsan_video[count] | (chinsan_video[count+0x800]<<8);
|
||||
colour = chinsan_video[count+0x1000]>>3;
|
||||
int tileno, colour;
|
||||
tileno = state->video[count] | (state->video[count + 0x800] << 8);
|
||||
colour = state->video[count + 0x1000] >> 3;
|
||||
drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tileno,colour,0,0,x*8,y*8);
|
||||
count++;
|
||||
}
|
||||
@ -78,28 +102,26 @@ static VIDEO_UPDATE(chinsan)
|
||||
|
||||
|
||||
|
||||
static MACHINE_RESET( chinsan )
|
||||
{
|
||||
memory_configure_bank(machine, "bank1", 0, 4, memory_region(machine, "maincpu") + 0x10000, 0x4000);
|
||||
/*************************************
|
||||
*
|
||||
* Memory handlers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
adpcm_idle = 1;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER(ctrl_w)
|
||||
static WRITE8_HANDLER( ctrl_w )
|
||||
{
|
||||
memory_set_bank(space->machine, "bank1", data >> 6);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( ym_port_w1 )
|
||||
{
|
||||
logerror("ym_write port 1 %02x\n",data);
|
||||
logerror("ym_write port 1 %02x\n", data);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( ym_port_w2 )
|
||||
{
|
||||
logerror("ym_write port 2 %02x\n",data);
|
||||
logerror("ym_write port 2 %02x\n", data);
|
||||
}
|
||||
|
||||
|
||||
@ -117,27 +139,29 @@ static const ym2203_interface ym2203_config =
|
||||
|
||||
static WRITE8_HANDLER( chinsan_port00_w )
|
||||
{
|
||||
chinsan_state *state = (chinsan_state *)space->machine->driver_data;
|
||||
|
||||
chinsan_port_select = data;
|
||||
state->port_select = data;
|
||||
|
||||
if (
|
||||
(data!=0x40) &&
|
||||
(data!=0x4f) &&
|
||||
(data!=0x53) &&
|
||||
(data!=0x57) &&
|
||||
(data!=0x5b) &&
|
||||
(data!=0x5d) &&
|
||||
(data!=0x5e))
|
||||
logerror("write port 00 %02x\n",data);
|
||||
(data != 0x40) &&
|
||||
(data != 0x4f) &&
|
||||
(data != 0x53) &&
|
||||
(data != 0x57) &&
|
||||
(data != 0x5b) &&
|
||||
(data != 0x5d) &&
|
||||
(data != 0x5e))
|
||||
logerror("write port 00 %02x\n", data);
|
||||
|
||||
}
|
||||
|
||||
static READ8_HANDLER( chinsan_input_port_0_r )
|
||||
{
|
||||
chinsan_state *state = (chinsan_state *)space->machine->driver_data;
|
||||
|
||||
//return 0xff; // the inputs don't seem to work, so just return ff for now
|
||||
|
||||
switch (chinsan_port_select)
|
||||
switch (state->port_select)
|
||||
{
|
||||
/* i doubt these are both really the same.. */
|
||||
case 0x40:
|
||||
@ -160,13 +184,15 @@ static READ8_HANDLER( chinsan_input_port_0_r )
|
||||
return input_port_read(space->machine, "MAHJONG_P2_6");
|
||||
}
|
||||
|
||||
printf("chinsan_input_port_0_r unk_r %02x\n", chinsan_port_select);
|
||||
printf("chinsan_input_port_0_r unk_r %02x\n", state->port_select);
|
||||
return mame_rand(space->machine);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( chinsan_input_port_1_r )
|
||||
{
|
||||
switch (chinsan_port_select)
|
||||
chinsan_state *state = (chinsan_state *)space->machine->driver_data;
|
||||
|
||||
switch (state->port_select)
|
||||
{
|
||||
/* i doubt these are both really the same.. */
|
||||
case 0x40:
|
||||
@ -189,22 +215,29 @@ static READ8_HANDLER( chinsan_input_port_1_r )
|
||||
return input_port_read(space->machine, "MAHJONG_P1_6");
|
||||
}
|
||||
|
||||
printf("chinsan_input_port_1_r unk_r %02x\n", chinsan_port_select);
|
||||
printf("chinsan_input_port_1_r unk_r %02x\n", state->port_select);
|
||||
return mame_rand(space->machine);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( chin_adpcm_w )
|
||||
{
|
||||
adpcm_pos = (data & 0xff) * 0x100;
|
||||
adpcm_idle = 0;
|
||||
msm5205_reset_w(device,0);
|
||||
chinsan_state *state = (chinsan_state *)device->machine->driver_data;
|
||||
state->adpcm_pos = (data & 0xff) * 0x100;
|
||||
state->adpcm_idle = 0;
|
||||
msm5205_reset_w(device, 0);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Address maps
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( chinsan_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0xc000, 0xdfff) AM_RAM
|
||||
AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_BASE(&chinsan_video)
|
||||
AM_RANGE(0xe000, 0xf7ff) AM_RAM AM_BASE_MEMBER(chinsan_state, video)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( chinsan_io, ADDRESS_SPACE_IO, 8 )
|
||||
@ -218,6 +251,12 @@ static ADDRESS_MAP_START( chinsan_io, ADDRESS_SPACE_IO, 8 )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Input ports
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INPUT_PORTS_START( chinsan )
|
||||
PORT_START("DSW1")
|
||||
PORT_DIPNAME( 0x01, 0x01, "DSW1" )
|
||||
@ -457,6 +496,12 @@ INPUT_PORTS_END
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Graphics definitions
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const gfx_layout tiles8x8_layout =
|
||||
{
|
||||
8,8,
|
||||
@ -472,28 +517,34 @@ static GFXDECODE_START( chinsan )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 32 )
|
||||
GFXDECODE_END
|
||||
|
||||
static void chin_adpcm_int(const device_config *device)
|
||||
{
|
||||
static UINT8 trigger;
|
||||
/*************************************
|
||||
*
|
||||
* Sound interface
|
||||
*
|
||||
*************************************/
|
||||
|
||||
if (adpcm_pos >= 0x10000 || adpcm_idle)
|
||||
static void chin_adpcm_int( const device_config *device )
|
||||
{
|
||||
chinsan_state *state = (chinsan_state *)device->machine->driver_data;
|
||||
|
||||
if (state->adpcm_pos >= 0x10000 || state->adpcm_idle)
|
||||
{
|
||||
//adpcm_idle = 1;
|
||||
msm5205_reset_w(device,1);
|
||||
trigger = 0;
|
||||
//state->adpcm_idle = 1;
|
||||
msm5205_reset_w(device, 1);
|
||||
state->trigger = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT8 *ROM = memory_region(device->machine, "adpcm");
|
||||
|
||||
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++;
|
||||
if((ROM[adpcm_pos] & 0xff) == 0x70)
|
||||
adpcm_idle = 1;
|
||||
state->adpcm_pos++;
|
||||
if ((ROM[state->adpcm_pos] & 0xff) == 0x70)
|
||||
state->adpcm_idle = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -504,24 +555,49 @@ static const msm5205_interface msm5205_config =
|
||||
MSM5205_S64_4B /* 8kHz */
|
||||
};
|
||||
|
||||
static PALETTE_INIT( chinsan )
|
||||
{
|
||||
UINT8 *src = memory_region( machine, "color_proms" );
|
||||
int i;
|
||||
/*************************************
|
||||
*
|
||||
* Machine driver
|
||||
*
|
||||
*************************************/
|
||||
|
||||
for (i=0;i<0x100;i++)
|
||||
{
|
||||
palette_set_color_rgb(machine,i,pal4bit(src[i+0x200]),pal4bit(src[i+0x100]),pal4bit(src[i+0x000]));
|
||||
}
|
||||
static MACHINE_START( chinsan )
|
||||
{
|
||||
chinsan_state *state = (chinsan_state *)machine->driver_data;
|
||||
|
||||
memory_configure_bank(machine, "bank1", 0, 4, memory_region(machine, "maincpu") + 0x10000, 0x4000);
|
||||
|
||||
state_save_register_global(machine, state->adpcm_idle);
|
||||
state_save_register_global(machine, state->port_select);
|
||||
state_save_register_global(machine, state->adpcm_pos);
|
||||
state_save_register_global(machine, state->adpcm_data);
|
||||
state_save_register_global(machine, state->trigger);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( chinsan )
|
||||
{
|
||||
chinsan_state *state = (chinsan_state *)machine->driver_data;
|
||||
|
||||
state->adpcm_idle = 1;
|
||||
state->port_select = 0;
|
||||
state->adpcm_pos = 0;
|
||||
state->adpcm_data = 0;
|
||||
state->trigger = 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( chinsan )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(chinsan_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,10000000/2) /* ? MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(chinsan_map)
|
||||
MDRV_CPU_IO_MAP(chinsan_io)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
|
||||
|
||||
MDRV_MACHINE_START( chinsan )
|
||||
MDRV_MACHINE_RESET( chinsan )
|
||||
|
||||
/* video hardware */
|
||||
@ -539,7 +615,7 @@ static MACHINE_DRIVER_START( chinsan )
|
||||
MDRV_VIDEO_START(chinsan)
|
||||
MDRV_VIDEO_UPDATE(chinsan)
|
||||
|
||||
// sound hardware
|
||||
/* sound hardware */
|
||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MDRV_SOUND_ADD("ymsnd", YM2203, 1500000) /* ? Mhz */
|
||||
@ -556,6 +632,12 @@ MACHINE_DRIVER_END
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* ROM definition(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
ROM_START( chinsan )
|
||||
ROM_REGION( 0x20000, "maincpu", 0 ) /* encrypted code / data */
|
||||
ROM_LOAD( "mm00.7d", 0x00000, 0x08000, CRC(f7a4414f) SHA1(f65223b2928f610ab97fda2f2c008806cf2420e5) )
|
||||
@ -583,10 +665,22 @@ ROM_START( chinsan )
|
||||
ROM_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Driver initialization
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static DRIVER_INIT( chinsan )
|
||||
{
|
||||
mc8123_decrypt_rom(machine, "maincpu", "user1", "bank1", 4);
|
||||
}
|
||||
|
||||
|
||||
GAME( 1987, chinsan, 0, chinsan, chinsan, chinsan, ROT0, "Sanritsu", "Ganbare Chinsan Ooshoubu (MC-8123A, 317-5012)", 0 )
|
||||
/*************************************
|
||||
*
|
||||
* Game driver(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1987, chinsan, 0, chinsan, chinsan, chinsan, ROT0, "Sanritsu", "Ganbare Chinsan Ooshoubu (MC-8123A, 317-5012)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -284,11 +284,7 @@ static WRITE16_HANDLER( forgottn_dial_1_reset_w )
|
||||
|
||||
static WRITE8_HANDLER( cps1_snd_bankswitch_w )
|
||||
{
|
||||
UINT8 *RAM = memory_region(space->machine, "audiocpu");
|
||||
int bankaddr;
|
||||
|
||||
bankaddr = ((data & 1) * 0x4000);
|
||||
memory_set_bankptr(space->machine, "bank1",&RAM[0x10000 + bankaddr]);
|
||||
memory_set_bank(space->machine, "bank1", data & 0x01);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( cps1_oki_pin7_w )
|
||||
@ -396,18 +392,15 @@ static WRITE16_HANDLER( qsound_sharedram2_w )
|
||||
|
||||
static WRITE8_HANDLER( qsound_banksw_w )
|
||||
{
|
||||
/*
|
||||
Z80 bank register for music note data. It's odd that it isn't encrypted
|
||||
though.
|
||||
*/
|
||||
UINT8 *RAM = memory_region(space->machine, "audiocpu");
|
||||
int bankaddress=0x10000+((data&0x0f)*0x4000);
|
||||
if (bankaddress >= memory_region_length(space->machine, "audiocpu"))
|
||||
/* Z80 bank register for music note data. It's odd that it isn't encrypted though. */
|
||||
int bank = data & 0x0f;
|
||||
if ((0x10000 + (bank * 0x4000)) >= memory_region_length(space->machine, "audiocpu"))
|
||||
{
|
||||
logerror("WARNING: Q sound bank overflow (%02x)\n", data);
|
||||
bankaddress=0x10000;
|
||||
bank = 0;
|
||||
}
|
||||
memory_set_bankptr(space->machine, "bank1", &RAM[bankaddress]);
|
||||
|
||||
memory_set_bank(space->machine, "bank1", bank);
|
||||
}
|
||||
|
||||
|
||||
@ -2766,7 +2759,7 @@ static const ym2151_interface ym2151_config =
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
static MACHINE_START( cps1 )
|
||||
static MACHINE_START( common )
|
||||
{
|
||||
cps_state *state = (cps_state *)machine->driver_data;
|
||||
|
||||
@ -2774,6 +2767,24 @@ static MACHINE_START( cps1 )
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
}
|
||||
|
||||
static MACHINE_START( cps1 )
|
||||
{
|
||||
MACHINE_START_CALL(common);
|
||||
memory_configure_bank(machine, "bank1", 0, 2, memory_region(machine, "audiocpu") + 0x10000, 0x4000);
|
||||
}
|
||||
|
||||
static MACHINE_START( qsound )
|
||||
{
|
||||
MACHINE_START_CALL(common);
|
||||
memory_configure_bank(machine, "bank1", 0, 6, memory_region(machine, "audiocpu") + 0x10000, 0x4000);
|
||||
}
|
||||
|
||||
static MACHINE_START( cpspicb )
|
||||
{
|
||||
MACHINE_START_CALL(common);
|
||||
memory_configure_bank(machine, "bank1", 0, 6, memory_region(machine, "audiocpu") + 0x10000, 0x4000);
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( cps1_10MHz )
|
||||
|
||||
@ -2849,6 +2860,8 @@ static MACHINE_DRIVER_START( qsound )
|
||||
MDRV_CPU_PROGRAM_MAP(qsound_sub_map)
|
||||
MDRV_CPU_PERIODIC_INT(irq0_line_hold, 250) /* ?? */
|
||||
|
||||
MDRV_MACHINE_START(qsound)
|
||||
|
||||
MDRV_EEPROM_NODEFAULT_ADD("eeprom", qsound_eeprom_interface)
|
||||
|
||||
/* sound hardware */
|
||||
@ -2878,7 +2891,7 @@ static MACHINE_DRIVER_START( cpspicb )
|
||||
MDRV_CPU_ADD("audiocpu", PIC16C57, 12000000)
|
||||
MDRV_CPU_FLAGS(CPU_DISABLE) /* no valid dumps .. */
|
||||
|
||||
MDRV_MACHINE_START(cps1)
|
||||
MDRV_MACHINE_START(cpspicb)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -2958,7 +2971,7 @@ static MACHINE_DRIVER_START( sf2mdt )
|
||||
MDRV_CPU_ADD("audiocpu", Z80, 3579545)
|
||||
MDRV_CPU_PROGRAM_MAP(sf2mdt_z80map)
|
||||
|
||||
MDRV_MACHINE_START(cps1)
|
||||
MDRV_MACHINE_START(common)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -3046,7 +3059,7 @@ static MACHINE_DRIVER_START( knightsb )
|
||||
MDRV_CPU_ADD("audiocpu", Z80, 29821000 / 8)
|
||||
MDRV_CPU_PROGRAM_MAP(sf2mdt_z80map)
|
||||
|
||||
MDRV_MACHINE_START(cps1)
|
||||
MDRV_MACHINE_START(common)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
|
@ -95,7 +95,7 @@ Todo & FIXME:
|
||||
#include "sound/dac.h"
|
||||
#include "sound/tms5110.h"
|
||||
#include "video/s2636.h"
|
||||
#include "cvs.h"
|
||||
#include "includes/cvs.h"
|
||||
|
||||
|
||||
/* Turn to 1 so all inputs are always available (this shall only be a debug feature) */
|
||||
@ -106,40 +106,6 @@ Todo & FIXME:
|
||||
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Global variables
|
||||
*
|
||||
*************************************/
|
||||
|
||||
UINT8 *cvs_color_ram;
|
||||
UINT8 *cvs_video_ram;
|
||||
UINT8 *cvs_bullet_ram;
|
||||
UINT8 *cvs_palette_ram;
|
||||
static UINT8 *cvs_character_ram;
|
||||
UINT8 *cvs_fo_state;
|
||||
|
||||
static emu_timer *cvs_393hz_timer;
|
||||
static UINT8 cvs_393hz_clock;
|
||||
static UINT8 *cvs_4_bit_dac_data;
|
||||
static UINT8 *cvs_tms5110_ctl_data;
|
||||
static UINT8 *dac3_state;
|
||||
|
||||
static UINT8 character_banking_mode;
|
||||
static UINT16 character_ram_page_start;
|
||||
static UINT16 speech_rom_bit_address;
|
||||
|
||||
|
||||
|
||||
|
||||
UINT8 cvs_get_character_banking_mode(void)
|
||||
{
|
||||
return character_banking_mode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Multiplexed memory access
|
||||
@ -148,110 +114,118 @@ UINT8 cvs_get_character_banking_mode(void)
|
||||
|
||||
READ8_HANDLER( cvs_video_or_color_ram_r )
|
||||
{
|
||||
if (*cvs_fo_state)
|
||||
return cvs_video_ram[offset];
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
if (*state->fo_state)
|
||||
return state->video_ram[offset];
|
||||
else
|
||||
return cvs_color_ram[offset];
|
||||
return state->color_ram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cvs_video_or_color_ram_w )
|
||||
{
|
||||
if (*cvs_fo_state)
|
||||
cvs_video_ram[offset] = data;
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
if (*state->fo_state)
|
||||
state->video_ram[offset] = data;
|
||||
else
|
||||
cvs_color_ram[offset] = data;
|
||||
state->color_ram[offset] = data;
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( cvs_bullet_ram_or_palette_r )
|
||||
{
|
||||
if (*cvs_fo_state)
|
||||
return cvs_palette_ram[offset & 0x0f];
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
if (*state->fo_state)
|
||||
return state->palette_ram[offset & 0x0f];
|
||||
else
|
||||
return cvs_bullet_ram[offset];
|
||||
return state->bullet_ram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cvs_bullet_ram_or_palette_w )
|
||||
{
|
||||
if (*cvs_fo_state)
|
||||
cvs_palette_ram[offset & 0x0f] = data;
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
if (*state->fo_state)
|
||||
state->palette_ram[offset & 0x0f] = data;
|
||||
else
|
||||
cvs_bullet_ram[offset] = data;
|
||||
state->bullet_ram[offset] = data;
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( cvs_s2636_0_or_character_ram_r )
|
||||
{
|
||||
const device_config *s2636_0 = devtag_get_device(space->machine, "s2636_0");
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
if (*cvs_fo_state)
|
||||
return cvs_character_ram[(0 * 0x800) | 0x400 | character_ram_page_start | offset];
|
||||
if (*state->fo_state)
|
||||
return state->character_ram[(0 * 0x800) | 0x400 | state->character_ram_page_start | offset];
|
||||
else
|
||||
return s2636_work_ram_r(s2636_0, offset);
|
||||
return s2636_work_ram_r(state->s2636_0, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cvs_s2636_0_or_character_ram_w )
|
||||
{
|
||||
const device_config *s2636_0 = devtag_get_device(space->machine, "s2636_0");
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
if (*cvs_fo_state)
|
||||
if (*state->fo_state)
|
||||
{
|
||||
offset |= (0 * 0x800) | 0x400 | character_ram_page_start;
|
||||
cvs_character_ram[offset] = data;
|
||||
gfx_element_mark_dirty(space->machine->gfx[1], (offset/8) % 256);
|
||||
offset |= (0 * 0x800) | 0x400 | state->character_ram_page_start;
|
||||
state->character_ram[offset] = data;
|
||||
gfx_element_mark_dirty(space->machine->gfx[1], (offset / 8) % 256);
|
||||
}
|
||||
else
|
||||
s2636_work_ram_w(s2636_0, offset, data);
|
||||
s2636_work_ram_w(state->s2636_0, offset, data);
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( cvs_s2636_1_or_character_ram_r )
|
||||
{
|
||||
const device_config *s2636_1 = devtag_get_device(space->machine, "s2636_1");
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
if (*cvs_fo_state)
|
||||
return cvs_character_ram[(1 * 0x800) | 0x400 | character_ram_page_start | offset];
|
||||
if (*state->fo_state)
|
||||
return state->character_ram[(1 * 0x800) | 0x400 | state->character_ram_page_start | offset];
|
||||
else
|
||||
return s2636_work_ram_r(s2636_1, offset);
|
||||
return s2636_work_ram_r(state->s2636_1, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cvs_s2636_1_or_character_ram_w )
|
||||
{
|
||||
const device_config *s2636_1 = devtag_get_device(space->machine, "s2636_1");
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
if (*cvs_fo_state)
|
||||
if (*state->fo_state)
|
||||
{
|
||||
offset |= (1 * 0x800) | 0x400 | character_ram_page_start;
|
||||
cvs_character_ram[offset] = data;
|
||||
gfx_element_mark_dirty(space->machine->gfx[1], (offset/8) % 256);
|
||||
offset |= (1 * 0x800) | 0x400 | state->character_ram_page_start;
|
||||
state->character_ram[offset] = data;
|
||||
gfx_element_mark_dirty(space->machine->gfx[1], (offset / 8) % 256);
|
||||
}
|
||||
else
|
||||
s2636_work_ram_w(s2636_1, offset, data);
|
||||
s2636_work_ram_w(state->s2636_1, offset, data);
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( cvs_s2636_2_or_character_ram_r )
|
||||
{
|
||||
const device_config *s2636_2 = devtag_get_device(space->machine, "s2636_2");
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
if (*cvs_fo_state)
|
||||
return cvs_character_ram[(2 * 0x800) | 0x400 | character_ram_page_start | offset];
|
||||
if (*state->fo_state)
|
||||
return state->character_ram[(2 * 0x800) | 0x400 | state->character_ram_page_start | offset];
|
||||
else
|
||||
return s2636_work_ram_r(s2636_2, offset);
|
||||
return s2636_work_ram_r(state->s2636_2, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cvs_s2636_2_or_character_ram_w )
|
||||
{
|
||||
const device_config *s2636_2 = devtag_get_device(space->machine, "s2636_2");
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
if (*cvs_fo_state)
|
||||
if (*state->fo_state)
|
||||
{
|
||||
offset |= (2 * 0x800) | 0x400 | character_ram_page_start;
|
||||
cvs_character_ram[offset] = data;
|
||||
gfx_element_mark_dirty(space->machine->gfx[1], (offset/8) % 256);
|
||||
offset |= (2 * 0x800) | 0x400 | state->character_ram_page_start;
|
||||
state->character_ram[offset] = data;
|
||||
gfx_element_mark_dirty(space->machine->gfx[1], (offset / 8) % 256);
|
||||
}
|
||||
else
|
||||
s2636_work_ram_w(s2636_2, offset, data);
|
||||
s2636_work_ram_w(state->s2636_2, offset, data);
|
||||
}
|
||||
|
||||
|
||||
@ -267,15 +241,15 @@ static INTERRUPT_GEN( cvs_main_cpu_interrupt )
|
||||
cpu_set_input_line_vector(device, 0, 0x03);
|
||||
generic_pulse_irq_line(device, 0);
|
||||
|
||||
cvs_scroll_stars();
|
||||
cvs_scroll_stars(device->machine);
|
||||
}
|
||||
|
||||
|
||||
static void cvs_slave_cpu_interrupt(running_machine *machine, const char *cpu, int state)
|
||||
static void cvs_slave_cpu_interrupt( const device_config *cpu, int state )
|
||||
{
|
||||
cpu_set_input_line_vector(cputag_get_cpu(machine, cpu), 0, 0x03);
|
||||
//cputag_set_input_line(machine, cpu, 0, state ? ASSERT_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(machine, cpu, 0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
cpu_set_input_line_vector(cpu, 0, 0x03);
|
||||
//cpu_set_input_line(cpu, 0, state ? ASSERT_LINE : CLEAR_LINE);
|
||||
cpu_set_input_line(cpu, 0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -288,11 +262,12 @@ static void cvs_slave_cpu_interrupt(running_machine *machine, const char *cpu, i
|
||||
|
||||
static READ8_HANDLER( cvs_input_r )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
UINT8 ret = 0;
|
||||
|
||||
/* the upper 4 bits of the address is used to select the character banking attributes */
|
||||
character_banking_mode = (offset >> 4) & 0x03;
|
||||
character_ram_page_start = (offset << 2) & 0x300;
|
||||
state->character_banking_mode = (offset >> 4) & 0x03;
|
||||
state->character_ram_page_start = (offset << 2) & 0x300;
|
||||
|
||||
/* the lower 4 (or 3?) bits select the port to read */
|
||||
switch (offset & 0x0f) /* might be 0x07 */
|
||||
@ -319,7 +294,8 @@ static READ8_HANDLER( cvs_input_r )
|
||||
#if 0
|
||||
static READ8_HANDLER( cvs_393hz_clock_r )
|
||||
{
|
||||
return cvs_393hz_clock ? 0x80 : 0;
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
return state->cvs_393hz_clock ? 0x80 : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -330,22 +306,23 @@ static READ8_DEVICE_HANDLER( tms_clock_r )
|
||||
|
||||
static TIMER_CALLBACK( cvs_393hz_timer_cb )
|
||||
{
|
||||
const device_config *dac3 = devtag_get_device(machine, "dac3");
|
||||
cvs_393hz_clock = !cvs_393hz_clock;
|
||||
cvs_state *state = (cvs_state *)machine->driver_data;
|
||||
state->cvs_393hz_clock = !state->cvs_393hz_clock;
|
||||
|
||||
/* quasar.c games use this timer but have no dac3! */
|
||||
if (dac3 != NULL)
|
||||
if (state->dac3 != NULL)
|
||||
{
|
||||
if (dac3_state[2])
|
||||
dac_w(dac3, 0, cvs_393hz_clock * 0xff);
|
||||
if (state->dac3_state[2])
|
||||
dac_w(state->dac3, 0, state->cvs_393hz_clock * 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void start_393hz_timer(running_machine *machine)
|
||||
{
|
||||
cvs_393hz_timer = timer_alloc(machine, cvs_393hz_timer_cb, NULL);
|
||||
timer_adjust_periodic(cvs_393hz_timer, ATTOTIME_IN_HZ(30*393), 0, ATTOTIME_IN_HZ(30*393));
|
||||
cvs_state *state = (cvs_state *)machine->driver_data;
|
||||
state->cvs_393hz_timer = timer_alloc(machine, cvs_393hz_timer_cb, NULL);
|
||||
timer_adjust_periodic(state->cvs_393hz_timer, ATTOTIME_IN_HZ(30*393), 0, ATTOTIME_IN_HZ(30*393));
|
||||
}
|
||||
|
||||
|
||||
@ -358,6 +335,7 @@ static void start_393hz_timer(running_machine *machine)
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( cvs_4_bit_dac_data_w )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)device->machine->driver_data;
|
||||
UINT8 dac_value;
|
||||
static int old_data[4] = {0,0,0,0};
|
||||
|
||||
@ -366,13 +344,13 @@ static WRITE8_DEVICE_HANDLER( cvs_4_bit_dac_data_w )
|
||||
LOG(("4BIT: %02x %02x\n", offset, data));
|
||||
old_data[offset] = data;
|
||||
}
|
||||
cvs_4_bit_dac_data[offset] = data >> 7;
|
||||
state->cvs_4_bit_dac_data[offset] = data >> 7;
|
||||
|
||||
/* merge into D0-D3 */
|
||||
dac_value = (cvs_4_bit_dac_data[0] << 0) |
|
||||
(cvs_4_bit_dac_data[1] << 1) |
|
||||
(cvs_4_bit_dac_data[2] << 2) |
|
||||
(cvs_4_bit_dac_data[3] << 3);
|
||||
dac_value = (state->cvs_4_bit_dac_data[0] << 0) |
|
||||
(state->cvs_4_bit_dac_data[1] << 1) |
|
||||
(state->cvs_4_bit_dac_data[2] << 2) |
|
||||
(state->cvs_4_bit_dac_data[3] << 3);
|
||||
|
||||
/* scale up to a full byte and output */
|
||||
dac_data_w(device, (dac_value << 4) | dac_value);
|
||||
@ -380,6 +358,8 @@ static WRITE8_DEVICE_HANDLER( cvs_4_bit_dac_data_w )
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( cvs_unknown_w )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)device->machine->driver_data;
|
||||
|
||||
/* offset 2 is used in 8ball
|
||||
* offset 0 is used in spacefrt
|
||||
* offset 3 is used in darkwar
|
||||
@ -387,11 +367,11 @@ static WRITE8_DEVICE_HANDLER( cvs_unknown_w )
|
||||
* offset 1 is not used (no trace in disassembly)
|
||||
*/
|
||||
|
||||
if (data != dac3_state[offset])
|
||||
if (data != state->dac3_state[offset])
|
||||
{
|
||||
if (offset != 2)
|
||||
popmessage("Unknown: %02x %02x\n", offset, data);
|
||||
dac3_state[offset] = data;
|
||||
state->dac3_state[offset] = data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,38 +385,44 @@ static WRITE8_DEVICE_HANDLER( cvs_unknown_w )
|
||||
|
||||
static WRITE8_HANDLER( cvs_speech_rom_address_lo_w )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
/* assuming that d0-d2 are cleared here */
|
||||
speech_rom_bit_address = (speech_rom_bit_address & 0xf800) | (data << 3);
|
||||
LOG(("%04x : CVS: Speech Lo %02x Address = %04x\n", cpu_get_pc(space->cpu), data, speech_rom_bit_address >> 3));
|
||||
state->speech_rom_bit_address = (state->speech_rom_bit_address & 0xf800) | (data << 3);
|
||||
LOG(("%04x : CVS: Speech Lo %02x Address = %04x\n", cpu_get_pc(space->cpu), data, state->speech_rom_bit_address >> 3));
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( cvs_speech_rom_address_hi_w )
|
||||
{
|
||||
speech_rom_bit_address = (speech_rom_bit_address & 0x07ff) | (data << 11);
|
||||
LOG(("%04x : CVS: Speech Hi %02x Address = %04x\n", cpu_get_pc(space->cpu), data, speech_rom_bit_address >> 3));
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
state->speech_rom_bit_address = (state->speech_rom_bit_address & 0x07ff) | (data << 11);
|
||||
LOG(("%04x : CVS: Speech Hi %02x Address = %04x\n", cpu_get_pc(space->cpu), data, state->speech_rom_bit_address >> 3));
|
||||
}
|
||||
|
||||
|
||||
static READ8_HANDLER( cvs_speech_command_r )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
/* FIXME: this was by observation on board ???
|
||||
* -bit 7 is TMS status (active LO) */
|
||||
return ((tms5110_ctl_r(devtag_get_device(space->machine, "tms"), 0) ^ 1) << 7) | (soundlatch_r(space, 0) & 0x7f);
|
||||
return ((tms5110_ctl_r(state->tms, 0) ^ 1) << 7) | (soundlatch_r(space, 0) & 0x7f);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( cvs_tms5110_ctl_w )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)device->machine->driver_data;
|
||||
UINT8 ctl;
|
||||
/*
|
||||
* offset 0: CS ?
|
||||
*/
|
||||
cvs_tms5110_ctl_data[offset] = (~data >> 7) & 0x01;
|
||||
state->tms5110_ctl_data[offset] = (~data >> 7) & 0x01;
|
||||
|
||||
ctl = 0 | /* CTL1 */
|
||||
(cvs_tms5110_ctl_data[1] << 1) | /* CTL2 */
|
||||
(cvs_tms5110_ctl_data[2] << 2) | /* CTL4 */
|
||||
(cvs_tms5110_ctl_data[1] << 3); /* CTL8 */
|
||||
(state->tms5110_ctl_data[1] << 1) | /* CTL2 */
|
||||
(state->tms5110_ctl_data[2] << 2) | /* CTL4 */
|
||||
(state->tms5110_ctl_data[1] << 3); /* CTL8 */
|
||||
|
||||
LOG(("CVS: Speech CTL = %04x %02x %02x\n", ctl, offset, data));
|
||||
tms5110_ctl_w(device, 0, ctl);
|
||||
@ -451,18 +437,19 @@ static WRITE8_DEVICE_HANDLER( cvs_tms5110_pdc_w )
|
||||
}
|
||||
|
||||
|
||||
static int speech_rom_read_bit(const device_config *device)
|
||||
static int speech_rom_read_bit( const device_config *device )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)device->machine->driver_data;
|
||||
running_machine *machine = device->machine;
|
||||
UINT8 *ROM = memory_region(machine, "speechdata");
|
||||
int bit;
|
||||
|
||||
/* before reading the bit, clamp the address to the region length */
|
||||
speech_rom_bit_address = speech_rom_bit_address & ((memory_region_length(machine, "speechdata") * 8) - 1);
|
||||
bit = (ROM[speech_rom_bit_address >> 3] >> (speech_rom_bit_address & 0x07)) & 0x01;
|
||||
state->speech_rom_bit_address = state->speech_rom_bit_address & ((memory_region_length(machine, "speechdata") * 8) - 1);
|
||||
bit = (ROM[state->speech_rom_bit_address >> 3] >> (state->speech_rom_bit_address & 0x07)) & 0x01;
|
||||
|
||||
/* prepare for next bit */
|
||||
speech_rom_bit_address = speech_rom_bit_address + 1;
|
||||
state->speech_rom_bit_address = state->speech_rom_bit_address + 1;
|
||||
|
||||
return bit;
|
||||
}
|
||||
@ -484,42 +471,12 @@ static const tms5110_interface tms5100_interface =
|
||||
|
||||
static WRITE8_HANDLER( audio_command_w )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
LOG(("data %02x\n", data));
|
||||
/* cause interrupt on audio CPU if bit 7 set */
|
||||
soundlatch_w(space, 0, data);
|
||||
cvs_slave_cpu_interrupt(space->machine, "audiocpu", data & 0x80 ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine initialization
|
||||
*
|
||||
*************************************/
|
||||
|
||||
MACHINE_START( cvs )
|
||||
{
|
||||
/* allocate memory */
|
||||
cvs_color_ram = auto_alloc_array(machine, UINT8, 0x400);
|
||||
cvs_palette_ram = auto_alloc_array(machine, UINT8, 0x10);
|
||||
cvs_character_ram = auto_alloc_array(machine, UINT8, 3 * 0x800); /* only half is used, but
|
||||
by allocating twice the amount,
|
||||
we can use the same gfx_layout */
|
||||
|
||||
if (machine->gfx[1] != NULL)
|
||||
gfx_element_set_source(machine->gfx[1], cvs_character_ram);
|
||||
|
||||
start_393hz_timer(machine);
|
||||
|
||||
/* register state save */
|
||||
state_save_register_global_pointer(machine, cvs_color_ram, 0x400);
|
||||
state_save_register_global_pointer(machine, cvs_palette_ram, 0x10);
|
||||
state_save_register_global_pointer(machine, cvs_character_ram, 3 * 0x800);
|
||||
state_save_register_global(machine, character_banking_mode);
|
||||
state_save_register_global(machine, character_ram_page_start);
|
||||
state_save_register_global(machine, speech_rom_bit_address);
|
||||
state_save_register_global(machine, cvs_393hz_clock);
|
||||
cvs_slave_cpu_interrupt(state->audiocpu, data & 0x80 ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
@ -533,11 +490,11 @@ MACHINE_START( cvs )
|
||||
static ADDRESS_MAP_START( cvs_main_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x7fff)
|
||||
AM_RANGE(0x0000, 0x13ff) AM_ROM
|
||||
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_bullet_ram_or_palette_r, cvs_bullet_ram_or_palette_w) AM_BASE(&cvs_bullet_ram)
|
||||
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_bullet_ram_or_palette_r, cvs_bullet_ram_or_palette_w) AM_BASE_MEMBER(cvs_state, bullet_ram)
|
||||
AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w)
|
||||
AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w)
|
||||
AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w)
|
||||
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE(cvs_video_or_color_ram_r, cvs_video_or_color_ram_w) AM_BASE(&cvs_video_ram)
|
||||
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE(cvs_video_or_color_ram_r, cvs_video_or_color_ram_w) AM_BASE_MEMBER(cvs_state, video_ram)
|
||||
AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
|
||||
AM_RANGE(0x2000, 0x33ff) AM_ROM
|
||||
AM_RANGE(0x4000, 0x53ff) AM_ROM
|
||||
@ -550,7 +507,7 @@ static ADDRESS_MAP_START( cvs_main_cpu_io_map, ADDRESS_SPACE_IO, 8 )
|
||||
AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE(cvs_collision_clear, cvs_video_fx_w)
|
||||
AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_READWRITE(cvs_collision_r, audio_command_w)
|
||||
AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
|
||||
AM_RANGE(S2650_FO_PORT, S2650_FO_PORT) AM_RAM AM_BASE(&cvs_fo_state)
|
||||
AM_RANGE(S2650_FO_PORT, S2650_FO_PORT) AM_RAM AM_BASE_MEMBER(cvs_state, fo_state)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -567,8 +524,8 @@ static ADDRESS_MAP_START( cvs_dac_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x1000, 0x107f) AM_RAM
|
||||
AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_r)
|
||||
AM_RANGE(0x1840, 0x1840) AM_DEVWRITE("dac1", dac_w)
|
||||
AM_RANGE(0x1880, 0x1883) AM_DEVWRITE("dac2", cvs_4_bit_dac_data_w) AM_BASE(&cvs_4_bit_dac_data)
|
||||
AM_RANGE(0x1884, 0x1887) AM_DEVWRITE("dac3", cvs_unknown_w) AM_BASE(&dac3_state) /* ???? not connected to anything */
|
||||
AM_RANGE(0x1880, 0x1883) AM_DEVWRITE("dac2", cvs_4_bit_dac_data_w) AM_BASE_MEMBER(cvs_state, cvs_4_bit_dac_data)
|
||||
AM_RANGE(0x1884, 0x1887) AM_DEVWRITE("dac3", cvs_unknown_w) AM_BASE_MEMBER(cvs_state, dac3_state) /* ???? not connected to anything */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -591,7 +548,7 @@ static ADDRESS_MAP_START( cvs_speech_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x1d00, 0x1d00) AM_WRITE(cvs_speech_rom_address_lo_w)
|
||||
AM_RANGE(0x1d40, 0x1d40) AM_WRITE(cvs_speech_rom_address_hi_w)
|
||||
AM_RANGE(0x1d80, 0x1d80) AM_READ(cvs_speech_command_r)
|
||||
AM_RANGE(0x1ddc, 0x1dde) AM_DEVWRITE("tms", cvs_tms5110_ctl_w) AM_BASE(&cvs_tms5110_ctl_data)
|
||||
AM_RANGE(0x1ddc, 0x1dde) AM_DEVWRITE("tms", cvs_tms5110_ctl_w) AM_BASE_MEMBER(cvs_state, tms5110_ctl_data)
|
||||
AM_RANGE(0x1ddf, 0x1ddf) AM_DEVWRITE("tms", cvs_tms5110_pdc_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -620,7 +577,7 @@ static INPUT_PORTS_START( cvs )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("IN1") /* Dunno */
|
||||
PORT_START("IN1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL /* "Green button" */
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* "Green button" */
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
|
||||
@ -630,11 +587,11 @@ static INPUT_PORTS_START( cvs )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("IN2") /* Dunno */
|
||||
PORT_START("IN2")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) /* not sure it's SERVICE1 : it uses "Coin B" coinage and doesn't say "CREDIT" */
|
||||
PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("IN3") /* Dunno */
|
||||
PORT_START("IN3")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL
|
||||
@ -644,7 +601,7 @@ static INPUT_PORTS_START( cvs )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("DSW3") /* SW BANK 3 */
|
||||
PORT_START("DSW3")
|
||||
PORT_DIPUNUSED( 0x01, IP_ACTIVE_HIGH ) /* can't tell if it's ACTIVE_HIGH or ACTIVE_LOW */
|
||||
PORT_DIPUNUSED( 0x02, IP_ACTIVE_HIGH ) /* can't tell if it's ACTIVE_HIGH or ACTIVE_LOW */
|
||||
PORT_DIPUNUSED( 0x04, IP_ACTIVE_HIGH ) /* can't tell if it's ACTIVE_HIGH or ACTIVE_LOW */
|
||||
@ -654,7 +611,7 @@ static INPUT_PORTS_START( cvs )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Cocktail ) )
|
||||
PORT_DIPUNUSED( 0x20, IP_ACTIVE_HIGH ) /* can't tell if it's ACTIVE_HIGH or ACTIVE_LOW */
|
||||
|
||||
PORT_START("DSW2") /* SW BANK 2 */
|
||||
PORT_START("DSW2")
|
||||
PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
|
||||
PORT_DIPSETTING( 0x03, DEF_STR( 4C_1C ) )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) )
|
||||
@ -670,7 +627,7 @@ static INPUT_PORTS_START( cvs )
|
||||
PORT_DIPSETTING( 0x10, "5" )
|
||||
PORT_DIPUNUSED( 0x20, IP_ACTIVE_HIGH ) /* can't tell if it's ACTIVE_HIGH or ACTIVE_LOW */
|
||||
|
||||
PORT_START("SENSE") /* SENSE */
|
||||
PORT_START("SENSE")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
|
||||
INPUT_PORTS_END
|
||||
|
||||
@ -909,7 +866,7 @@ INPUT_PORTS_END
|
||||
static INPUT_PORTS_START( heartatk )
|
||||
PORT_INCLUDE(cvs_registration)
|
||||
|
||||
/* DSW3 bits 2 and 3 stored at 0x1c61 (0, 2, 1, 3) - code at 0x0c52
|
||||
/* DSW3 bits 2 and 3 stored at 0x1c61 (0, 2, 1, 3) - code at 0x0c52
|
||||
read back code at 0x2197 but untested value : bonus life always at 100000 */
|
||||
|
||||
/* DSW2 bit 5 stored at 0x1e76 - code at 0x0c5c - read back code at 0x00e4 */
|
||||
@ -1045,8 +1002,68 @@ static const s2636_interface s2636_2_config =
|
||||
};
|
||||
|
||||
|
||||
MACHINE_START( cvs )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)machine->driver_data;
|
||||
|
||||
/* allocate memory */
|
||||
state->color_ram = auto_alloc_array(machine, UINT8, 0x400);
|
||||
state->palette_ram = auto_alloc_array(machine, UINT8, 0x10);
|
||||
state->character_ram = auto_alloc_array(machine, UINT8, 3 * 0x800); /* only half is used, but
|
||||
by allocating twice the amount,
|
||||
we can use the same gfx_layout */
|
||||
|
||||
if (machine->gfx[1] != NULL)
|
||||
gfx_element_set_source(machine->gfx[1], state->character_ram);
|
||||
|
||||
start_393hz_timer(machine);
|
||||
|
||||
/* set devices */
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
state->speech = devtag_get_device(machine, "speech");
|
||||
state->dac3 = devtag_get_device(machine, "dac3");
|
||||
state->tms = devtag_get_device(machine, "tms");
|
||||
state->s2636_0 = devtag_get_device(machine, "s2636_0");
|
||||
state->s2636_1 = devtag_get_device(machine, "s2636_1");
|
||||
state->s2636_2 = devtag_get_device(machine, "s2636_2");
|
||||
|
||||
/* register state save */
|
||||
state_save_register_global_pointer(machine, state->color_ram, 0x400);
|
||||
state_save_register_global_pointer(machine, state->palette_ram, 0x10);
|
||||
state_save_register_global_pointer(machine, state->character_ram, 3 * 0x800);
|
||||
state_save_register_global(machine, state->character_banking_mode);
|
||||
state_save_register_global(machine, state->character_ram_page_start);
|
||||
state_save_register_global(machine, state->speech_rom_bit_address);
|
||||
state_save_register_global(machine, state->cvs_393hz_clock);
|
||||
state_save_register_global(machine, state->collision_register);
|
||||
state_save_register_global(machine, state->total_stars);
|
||||
state_save_register_global(machine, state->stars_on);
|
||||
state_save_register_global(machine, state->scroll_reg);
|
||||
state_save_register_global(machine, state->stars_scroll);
|
||||
}
|
||||
|
||||
MACHINE_RESET( cvs )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)machine->driver_data;
|
||||
|
||||
state->character_banking_mode = 0;
|
||||
state->character_ram_page_start = 0;
|
||||
state->speech_rom_bit_address = 0;
|
||||
state->cvs_393hz_clock = 0;
|
||||
state->collision_register = 0;
|
||||
state->total_stars = 0;
|
||||
state->stars_on = 0;
|
||||
state->scroll_reg = 0;
|
||||
state->stars_scroll = 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( cvs )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(cvs_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", S2650, 894886.25)
|
||||
MDRV_CPU_PROGRAM_MAP(cvs_main_cpu_map)
|
||||
@ -1062,6 +1079,7 @@ static MACHINE_DRIVER_START( cvs )
|
||||
MDRV_CPU_IO_MAP(cvs_speech_cpu_io_map)
|
||||
|
||||
MDRV_MACHINE_START(cvs)
|
||||
MDRV_MACHINE_RESET(cvs)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -58,24 +58,11 @@ Sound Board 1b11107
|
||||
************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "cvs.h"
|
||||
#include "cpu/s2650/s2650.h"
|
||||
#include "cpu/mcs48/mcs48.h"
|
||||
#include "sound/dac.h"
|
||||
#include "video/s2636.h"
|
||||
|
||||
|
||||
PALETTE_INIT( quasar );
|
||||
VIDEO_UPDATE( quasar );
|
||||
VIDEO_START( quasar );
|
||||
|
||||
|
||||
extern UINT8 *quasar_effectram;
|
||||
extern UINT8 quasar_effectcontrol;
|
||||
|
||||
static UINT8 page = 0;
|
||||
static UINT8 IOpage;
|
||||
|
||||
#include "includes/cvs.h"
|
||||
|
||||
/************************************************************************
|
||||
|
||||
@ -89,44 +76,51 @@ static UINT8 IOpage;
|
||||
|
||||
static WRITE8_HANDLER( video_page_select_w )
|
||||
{
|
||||
page = offset & 0x03;
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
state->page = offset & 0x03;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( io_page_select_w )
|
||||
{
|
||||
IOpage = offset & 0x03;
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
state->io_page = offset & 0x03;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( quasar_video_w )
|
||||
{
|
||||
switch (page)
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
switch (state->page)
|
||||
{
|
||||
case 0: cvs_video_ram[offset] = data; break;
|
||||
case 1: cvs_color_ram[offset] = data & 7; break; // 3 bits of ram only - 3 x 2102
|
||||
case 2: quasar_effectram[offset] = data; break;
|
||||
case 3: quasar_effectcontrol = data; break;
|
||||
case 0: state->video_ram[offset] = data; break;
|
||||
case 1: state->color_ram[offset] = data & 7; break; // 3 bits of ram only - 3 x 2102
|
||||
case 2: state->effectram[offset] = data; break;
|
||||
case 3: state->effectcontrol = data; break;
|
||||
}
|
||||
}
|
||||
|
||||
static READ8_HANDLER( quasar_IO_r )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
UINT8 ans = 0;
|
||||
|
||||
if (IOpage == 0) ans = input_port_read(space->machine, "IN0");
|
||||
if (IOpage == 1) ans = input_port_read(space->machine, "IN1");
|
||||
if (IOpage == 2) ans = input_port_read(space->machine, "DSW0");
|
||||
if (IOpage == 3) ans = input_port_read(space->machine, "DSW1");
|
||||
switch (state->io_page)
|
||||
{
|
||||
case 0: ans = input_port_read(space->machine, "IN0"); break;
|
||||
case 1: ans = input_port_read(space->machine, "IN1"); break;
|
||||
case 2: ans = input_port_read(space->machine, "DSW0"); break;
|
||||
case 3: ans = input_port_read(space->machine, "DSW1"); break;
|
||||
}
|
||||
|
||||
return ans;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( quasar_bullet_w )
|
||||
{
|
||||
cvs_bullet_ram[offset] = (data ^ 0xff);
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
state->bullet_ram[offset] = (data ^ 0xff);
|
||||
}
|
||||
|
||||
//static int sh_page=0;
|
||||
|
||||
static WRITE8_HANDLER( quasar_sh_command_w )
|
||||
{
|
||||
// bit 4 = Sound Invader : Linked to an NE555V circuit
|
||||
@ -152,11 +146,11 @@ static READ8_HANDLER( audio_t1_r )
|
||||
|
||||
static ADDRESS_MAP_START( quasar, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x13ff) AM_ROM
|
||||
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_bullet_ram_or_palette_r, quasar_bullet_w) AM_BASE(&cvs_bullet_ram)
|
||||
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_bullet_ram_or_palette_r, quasar_bullet_w) AM_BASE_MEMBER(cvs_state, bullet_ram)
|
||||
AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w)
|
||||
AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w)
|
||||
AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w)
|
||||
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE(cvs_video_or_color_ram_r, quasar_video_w) AM_BASE(&cvs_video_ram)
|
||||
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE(cvs_video_or_color_ram_r, quasar_video_w) AM_BASE_MEMBER(cvs_state, video_ram)
|
||||
AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
|
||||
AM_RANGE(0x2000, 0x33ff) AM_ROM
|
||||
AM_RANGE(0x4000, 0x53ff) AM_ROM
|
||||
@ -169,7 +163,7 @@ static ADDRESS_MAP_START( quasar_io, ADDRESS_SPACE_IO, 8 )
|
||||
AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE(cvs_collision_clear, quasar_sh_command_w)
|
||||
AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_READ(cvs_collision_r) AM_WRITENOP
|
||||
AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
|
||||
AM_RANGE(S2650_FO_PORT, S2650_FO_PORT) AM_RAM AM_BASE(&cvs_fo_state)
|
||||
AM_RANGE(S2650_FO_PORT, S2650_FO_PORT) AM_RAM AM_BASE_MEMBER(cvs_state, fo_state)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/*************************************
|
||||
@ -196,7 +190,7 @@ ADDRESS_MAP_END
|
||||
************************************************************************/
|
||||
|
||||
static INPUT_PORTS_START( quasar )
|
||||
PORT_START("IN0") /* Controls 0 */
|
||||
PORT_START("IN0")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
|
||||
@ -206,7 +200,7 @@ static INPUT_PORTS_START( quasar )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) /* switch collaudo */
|
||||
|
||||
PORT_START("IN1") /* Controls 1 */
|
||||
PORT_START("IN1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) /* tavalino */
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
|
||||
@ -216,7 +210,7 @@ static INPUT_PORTS_START( quasar )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 ) /* count enable */
|
||||
|
||||
PORT_START("DSW0") /* DSW0 */
|
||||
PORT_START("DSW0")
|
||||
PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Coin_A ) ) /* confirmed */
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) )
|
||||
@ -239,7 +233,7 @@ static INPUT_PORTS_START( quasar )
|
||||
PORT_DIPSETTING( 0x00, "Collisions excluded" )
|
||||
PORT_DIPSETTING( 0x80, "Collisions included" )
|
||||
|
||||
PORT_START("DSW1") /* DSW1 */
|
||||
PORT_START("DSW1")
|
||||
PORT_DIPNAME( 0x07, 0x01, "High Score" )
|
||||
PORT_DIPSETTING( 0x00, "No H.S." ) // this option only wants bit 0 OFF
|
||||
PORT_DIPSETTING( 0x01, "Normal H.S." )
|
||||
@ -260,10 +254,10 @@ static INPUT_PORTS_START( quasar )
|
||||
PORT_DIPSETTING( 0x80, "Stop at edge" )
|
||||
PORT_DIPSETTING( 0x00, "Wrap Around" )
|
||||
|
||||
PORT_START("SENSE") /* SENSE */
|
||||
PORT_START("SENSE")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
|
||||
|
||||
PORT_START("DSW2") /* Sound DIP switch */
|
||||
PORT_START("DSW2")
|
||||
#if 0
|
||||
PORT_DIPNAME( 0x0f, 0x00, "Noise to play" )
|
||||
PORT_DIPSETTING( 0x00, "00" )
|
||||
@ -311,7 +305,7 @@ GFXDECODE_END
|
||||
|
||||
static INTERRUPT_GEN( quasar_interrupt )
|
||||
{
|
||||
generic_pulse_irq_line_and_vector(device,0,0x03);
|
||||
generic_pulse_irq_line_and_vector(device, 0, 0x03);
|
||||
}
|
||||
|
||||
static const s2636_interface s2636_0_config =
|
||||
@ -339,8 +333,35 @@ static const s2636_interface s2636_2_config =
|
||||
// Quasar S2650 Main CPU, I8035 sound board
|
||||
// ****************************************
|
||||
|
||||
MACHINE_START( quasar )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)machine->driver_data;
|
||||
|
||||
MACHINE_START_CALL(cvs);
|
||||
|
||||
/* register state save */
|
||||
state_save_register_global(machine, state->effectcontrol);
|
||||
state_save_register_global(machine, state->page);
|
||||
state_save_register_global(machine, state->io_page);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( quasar )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)machine->driver_data;
|
||||
|
||||
MACHINE_RESET_CALL(cvs);
|
||||
|
||||
state->effectcontrol = 0;
|
||||
state->page = 0;
|
||||
state->io_page = 8;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( quasar )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(cvs_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", S2650, 14318000/4) /* 14 mhz crystal divide by 4 on board */
|
||||
MDRV_CPU_PROGRAM_MAP(quasar)
|
||||
MDRV_CPU_IO_MAP(quasar_io)
|
||||
@ -350,7 +371,8 @@ static MACHINE_DRIVER_START( quasar )
|
||||
MDRV_CPU_PROGRAM_MAP(sound_map)
|
||||
MDRV_CPU_IO_MAP(sound_portmap)
|
||||
|
||||
MDRV_MACHINE_START( cvs )
|
||||
MDRV_MACHINE_START(quasar)
|
||||
MDRV_MACHINE_RESET(quasar)
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(6000))
|
||||
|
||||
@ -440,11 +462,6 @@ ROM_START( quasara )
|
||||
ROM_LOAD( "12m_q.bin", 0x0000, 0x0200, CRC(1ab8633d) SHA1(3aed29f2326676a8d8a5de6f6bb923b6510896d8) )
|
||||
ROM_END
|
||||
|
||||
static DRIVER_INIT( quasar )
|
||||
{
|
||||
page = 0;
|
||||
IOpage = 8;
|
||||
}
|
||||
|
||||
GAME( 1980, quasar, 0, quasar, quasar, quasar, ROT90, "Zelco / Zaccaria", "Quasar", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
|
||||
GAME( 1980, quasara, quasar, quasar, quasar, quasar, ROT90, "Zelco / Zaccaria", "Quasar (Alternate)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
|
||||
GAME( 1980, quasar, 0, quasar, quasar, 0, ROT90, "Zelco / Zaccaria", "Quasar", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1980, quasara, quasar, quasar, quasar, 0, ROT90, "Zelco / Zaccaria", "Quasar (Alternate)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
38
src/mame/includes/cbasebal.h
Normal file
38
src/mame/includes/cbasebal.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*************************************************************************
|
||||
|
||||
Capcom Baseball
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _cbasebal_state cbasebal_state;
|
||||
struct _cbasebal_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * spriteram;
|
||||
// UINT8 * paletteram; // currently this uses generic palette handling
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *fg_tilemap, *bg_tilemap;
|
||||
UINT8 *textram, *scrollram;
|
||||
UINT8 scroll_x[2], scroll_y[2];
|
||||
int tilebank, spritebank;
|
||||
int text_on, bg_on, obj_on;
|
||||
int flipscreen;
|
||||
|
||||
/* misc */
|
||||
UINT8 rambank;
|
||||
};
|
||||
|
||||
/*----------- defined in video/cbasebal.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( cbasebal_textram_w );
|
||||
READ8_HANDLER( cbasebal_textram_r );
|
||||
WRITE8_HANDLER( cbasebal_scrollram_w );
|
||||
READ8_HANDLER( cbasebal_scrollram_r );
|
||||
WRITE8_HANDLER( cbasebal_gfxctrl_w );
|
||||
WRITE8_HANDLER( cbasebal_scrollx_w );
|
||||
WRITE8_HANDLER( cbasebal_scrolly_w );
|
||||
|
||||
VIDEO_START( cbasebal );
|
||||
VIDEO_UPDATE( cbasebal );
|
@ -2,22 +2,72 @@
|
||||
|
||||
Century CVS System
|
||||
|
||||
(and Quasar)
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#define CVS_S2636_Y_OFFSET (3)
|
||||
#define CVS_S2636_X_OFFSET (-26)
|
||||
#define CVS_S2636_Y_OFFSET (3)
|
||||
#define CVS_S2636_X_OFFSET (-26)
|
||||
#define CVS_MAX_STARS 250
|
||||
|
||||
struct cvs_star
|
||||
{
|
||||
int x, y, code;
|
||||
};
|
||||
|
||||
typedef struct _cvs_state cvs_state;
|
||||
struct _cvs_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * video_ram;
|
||||
UINT8 * bullet_ram;
|
||||
UINT8 * fo_state;
|
||||
UINT8 * cvs_4_bit_dac_data;
|
||||
UINT8 * tms5110_ctl_data;
|
||||
UINT8 * dac3_state;
|
||||
UINT8 * color_ram;
|
||||
UINT8 * palette_ram;
|
||||
UINT8 * character_ram;
|
||||
UINT8 * effectram; // quasar
|
||||
|
||||
/* video-related */
|
||||
struct cvs_star stars[CVS_MAX_STARS];
|
||||
bitmap_t *collision_background;
|
||||
bitmap_t *background_bitmap;
|
||||
bitmap_t *scrolled_collision_background;
|
||||
int collision_register;
|
||||
int total_stars;
|
||||
int stars_on;
|
||||
UINT8 scroll_reg;
|
||||
UINT8 effectcontrol; // quasar
|
||||
int stars_scroll;
|
||||
|
||||
/* misc */
|
||||
emu_timer *cvs_393hz_timer;
|
||||
UINT8 cvs_393hz_clock;
|
||||
|
||||
UINT8 character_banking_mode;
|
||||
UINT16 character_ram_page_start;
|
||||
UINT16 speech_rom_bit_address;
|
||||
|
||||
UINT8 page, io_page; // quasar
|
||||
|
||||
/* devices */
|
||||
const device_config *maincpu;
|
||||
const device_config *audiocpu;
|
||||
const device_config *speech;
|
||||
const device_config *dac3;
|
||||
const device_config *tms;
|
||||
const device_config *s2636_0;
|
||||
const device_config *s2636_1;
|
||||
const device_config *s2636_2;
|
||||
};
|
||||
|
||||
/*----------- defined in drivers/cvs.c -----------*/
|
||||
|
||||
extern UINT8 *cvs_color_ram;
|
||||
extern UINT8 *cvs_video_ram;
|
||||
extern UINT8 *cvs_bullet_ram;
|
||||
extern UINT8 *cvs_palette_ram;
|
||||
extern UINT8 *cvs_fo_state;
|
||||
|
||||
MACHINE_START( cvs );
|
||||
MACHINE_RESET( cvs );
|
||||
|
||||
READ8_HANDLER( cvs_video_or_color_ram_r );
|
||||
WRITE8_HANDLER( cvs_video_or_color_ram_w );
|
||||
@ -32,22 +82,22 @@ WRITE8_HANDLER( cvs_s2636_1_or_character_ram_w );
|
||||
READ8_HANDLER( cvs_s2636_2_or_character_ram_r );
|
||||
WRITE8_HANDLER( cvs_s2636_2_or_character_ram_w );
|
||||
|
||||
UINT8 cvs_get_character_banking_mode(void);
|
||||
|
||||
|
||||
/*----------- defined in video/cvs.c -----------*/
|
||||
|
||||
extern bitmap_t *cvs_collision_background;
|
||||
extern int cvs_collision_register;
|
||||
|
||||
PALETTE_INIT( cvs );
|
||||
VIDEO_UPDATE( cvs );
|
||||
VIDEO_START( cvs );
|
||||
|
||||
WRITE8_HANDLER( cvs_scroll_w );
|
||||
WRITE8_HANDLER( cvs_video_fx_w );
|
||||
|
||||
READ8_HANDLER( cvs_collision_r );
|
||||
READ8_HANDLER( cvs_collision_clear );
|
||||
|
||||
void cvs_scroll_stars(void);
|
||||
void cvs_scroll_stars(running_machine *machine);
|
||||
|
||||
PALETTE_INIT( cvs );
|
||||
VIDEO_UPDATE( cvs );
|
||||
VIDEO_START( cvs );
|
||||
|
||||
/*----------- defined in video/quasar.c -----------*/
|
||||
|
||||
PALETTE_INIT( quasar );
|
||||
VIDEO_UPDATE( quasar );
|
||||
VIDEO_START( quasar );
|
||||
|
61
src/mame/includes/mitchell.h
Normal file
61
src/mame/includes/mitchell.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*************************************************************************
|
||||
|
||||
Mitchell hardware
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _mitchell_state mitchell_state;
|
||||
struct _mitchell_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * colorram;
|
||||
size_t videoram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
UINT8 *objram; /* Sprite RAM */
|
||||
int flipscreen;
|
||||
int video_bank;
|
||||
int paletteram_bank;
|
||||
|
||||
/* sound-related */
|
||||
int sample_buffer;
|
||||
int sample_select;
|
||||
|
||||
/* misc */
|
||||
UINT8 port5_kludge;
|
||||
int input_type;
|
||||
int dial[2], dial_selected;
|
||||
int dir[2];
|
||||
int keymatrix;
|
||||
|
||||
/* devices */
|
||||
const device_config *audiocpu;
|
||||
const device_config *oki;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/mitchell.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( mgakuen_paletteram_w );
|
||||
READ8_HANDLER( mgakuen_paletteram_r );
|
||||
WRITE8_HANDLER( mgakuen_videoram_w );
|
||||
READ8_HANDLER( mgakuen_videoram_r );
|
||||
WRITE8_HANDLER( mgakuen_objram_w );
|
||||
READ8_HANDLER( mgakuen_objram_r );
|
||||
|
||||
WRITE8_HANDLER( pang_video_bank_w );
|
||||
WRITE8_HANDLER( pang_videoram_w );
|
||||
READ8_HANDLER( pang_videoram_r );
|
||||
WRITE8_HANDLER( pang_colorram_w );
|
||||
READ8_HANDLER( pang_colorram_r );
|
||||
WRITE8_HANDLER( pang_gfxctrl_w );
|
||||
WRITE8_HANDLER( pang_paletteram_w );
|
||||
READ8_HANDLER( pang_paletteram_r );
|
||||
|
||||
WRITE8_HANDLER( mstworld_gfxctrl_w );
|
||||
WRITE8_HANDLER( mstworld_video_bank_w );
|
||||
|
||||
VIDEO_START( pang );
|
||||
VIDEO_UPDATE( pang );
|
@ -17,7 +17,7 @@ struct jungler_star
|
||||
int x, y, color;
|
||||
};
|
||||
|
||||
#define MAX_STARS 1000
|
||||
#define JUNGLER_MAX_STARS 1000
|
||||
|
||||
typedef struct _timeplt_state timeplt_state;
|
||||
struct _timeplt_state
|
||||
@ -52,7 +52,7 @@ struct _timeplt_state
|
||||
int last_bang; // jungler
|
||||
int spriteram_base, stars_enable, total_stars; // jungler
|
||||
UINT8 drawmode_table[4]; // jungler
|
||||
struct jungler_star stars[MAX_STARS]; // jungler
|
||||
struct jungler_star stars[JUNGLER_MAX_STARS]; // jungler
|
||||
|
||||
/* devices */
|
||||
const device_config *maincpu;
|
||||
|
@ -1,12 +1,5 @@
|
||||
#include "driver.h"
|
||||
|
||||
|
||||
static UINT8 *cbasebal_textram,*cbasebal_scrollram;
|
||||
static tilemap *fg_tilemap,*bg_tilemap;
|
||||
static int tilebank,spritebank;
|
||||
static int text_on,bg_on,obj_on;
|
||||
static int flipscreen;
|
||||
|
||||
#include "includes/cbasebal.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@ -17,20 +10,22 @@ static int flipscreen;
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
UINT8 attr = cbasebal_scrollram[2*tile_index+1];
|
||||
cbasebal_state *state = (cbasebal_state *)machine->driver_data;
|
||||
UINT8 attr = state->scrollram[2 * tile_index + 1];
|
||||
SET_TILE_INFO(
|
||||
1,
|
||||
cbasebal_scrollram[2*tile_index] + ((attr & 0x07) << 8) + 0x800 * tilebank,
|
||||
state->scrollram[2 * tile_index] + ((attr & 0x07) << 8) + 0x800 * state->tilebank,
|
||||
(attr & 0xf0) >> 4,
|
||||
(attr & 0x08) ? TILE_FLIPX : 0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
UINT8 attr = cbasebal_textram[tile_index+0x800];
|
||||
cbasebal_state *state = (cbasebal_state *)machine->driver_data;
|
||||
UINT8 attr = state->textram[tile_index + 0x800];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
cbasebal_textram[tile_index] + ((attr & 0xf0) << 4),
|
||||
state->textram[tile_index] + ((attr & 0xf0) << 4),
|
||||
attr & 0x07,
|
||||
(attr & 0x08) ? TILE_FLIPX : 0);
|
||||
}
|
||||
@ -45,13 +40,18 @@ static TILE_GET_INFO( get_fg_tile_info )
|
||||
|
||||
VIDEO_START( cbasebal )
|
||||
{
|
||||
cbasebal_textram = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
cbasebal_scrollram = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
cbasebal_state *state = (cbasebal_state *)machine->driver_data;
|
||||
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows, 16,16,64,32);
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,64,32);
|
||||
state->textram = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
state->scrollram = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap,3);
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16, 16, 64, 32);
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
|
||||
|
||||
tilemap_set_transparent_pen(state->fg_tilemap, 3);
|
||||
|
||||
state_save_register_global_pointer(machine, state->textram, 0x1000);
|
||||
state_save_register_global_pointer(machine, state->scrollram, 0x1000);
|
||||
}
|
||||
|
||||
|
||||
@ -64,70 +64,76 @@ VIDEO_START( cbasebal )
|
||||
|
||||
WRITE8_HANDLER( cbasebal_textram_w )
|
||||
{
|
||||
cbasebal_textram[offset] = data;
|
||||
tilemap_mark_tile_dirty(fg_tilemap,offset & 0x7ff);
|
||||
cbasebal_state *state = (cbasebal_state *)space->machine->driver_data;
|
||||
|
||||
state->textram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset & 0x7ff);
|
||||
}
|
||||
|
||||
READ8_HANDLER( cbasebal_textram_r )
|
||||
{
|
||||
return cbasebal_textram[offset];
|
||||
cbasebal_state *state = (cbasebal_state *)space->machine->driver_data;
|
||||
return state->textram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cbasebal_scrollram_w )
|
||||
{
|
||||
cbasebal_scrollram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset/2);
|
||||
cbasebal_state *state = (cbasebal_state *)space->machine->driver_data;
|
||||
|
||||
state->scrollram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
READ8_HANDLER( cbasebal_scrollram_r )
|
||||
{
|
||||
return cbasebal_scrollram[offset];
|
||||
cbasebal_state *state = (cbasebal_state *)space->machine->driver_data;
|
||||
return state->scrollram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cbasebal_gfxctrl_w )
|
||||
{
|
||||
cbasebal_state *state = (cbasebal_state *)space->machine->driver_data;
|
||||
|
||||
/* bit 0 is unknown - toggles continuously */
|
||||
|
||||
/* bit 1 is flip screen */
|
||||
flipscreen = data & 0x02;
|
||||
tilemap_set_flip_all(space->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
state->flipscreen = data & 0x02;
|
||||
tilemap_set_flip_all(space->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
/* bit 2 is unknown - unused? */
|
||||
|
||||
/* bit 3 is tile bank */
|
||||
if (tilebank != ((data & 0x08) >> 3))
|
||||
if (state->tilebank != ((data & 0x08) >> 3))
|
||||
{
|
||||
tilebank = (data & 0x08) >> 3;
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap);
|
||||
state->tilebank = (data & 0x08) >> 3;
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
}
|
||||
|
||||
/* bit 4 is sprite bank */
|
||||
spritebank = (data & 0x10) >> 4;
|
||||
state->spritebank = (data & 0x10) >> 4;
|
||||
|
||||
/* bits 5 is text enable */
|
||||
text_on = ~data & 0x20;
|
||||
state->text_on = ~data & 0x20;
|
||||
|
||||
/* bits 6-7 are bg/sprite enable (don't know which is which) */
|
||||
bg_on = ~data & 0x40;
|
||||
obj_on = ~data & 0x80;
|
||||
state->bg_on = ~data & 0x40;
|
||||
state->obj_on = ~data & 0x80;
|
||||
|
||||
/* other bits unknown, but used */
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cbasebal_scrollx_w )
|
||||
{
|
||||
static UINT8 scroll[2];
|
||||
|
||||
scroll[offset] = data;
|
||||
tilemap_set_scrollx(bg_tilemap,0,scroll[0] + 256 * scroll[1]);
|
||||
cbasebal_state *state = (cbasebal_state *)space->machine->driver_data;
|
||||
state->scroll_x[offset] = data;
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, state->scroll_x[0] + 256 * state->scroll_x[1]);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cbasebal_scrolly_w )
|
||||
{
|
||||
static UINT8 scroll[2];
|
||||
|
||||
scroll[offset] = data;
|
||||
tilemap_set_scrolly(bg_tilemap,0,scroll[0] + 256 * scroll[1]);
|
||||
cbasebal_state *state = (cbasebal_state *)space->machine->driver_data;
|
||||
state->scroll_y[offset] = data;
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, state->scroll_y[0] + 256 * state->scroll_y[1]);
|
||||
}
|
||||
|
||||
|
||||
@ -138,25 +144,26 @@ WRITE8_HANDLER( cbasebal_scrolly_w )
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
int offs,sx,sy;
|
||||
cbasebal_state *state = (cbasebal_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs, sx, sy;
|
||||
|
||||
/* the last entry is not a sprite, we skip it otherwise spang shows a bubble */
|
||||
/* moving diagonally across the screen */
|
||||
for (offs = machine->generic.spriteram_size-8;offs >= 0;offs -= 4)
|
||||
for (offs = state->spriteram_size - 8; offs >= 0; offs -= 4)
|
||||
{
|
||||
int code = spriteram[offs];
|
||||
int attr = spriteram[offs+1];
|
||||
int attr = spriteram[offs + 1];
|
||||
int color = attr & 0x07;
|
||||
int flipx = attr & 0x08;
|
||||
sx = spriteram[offs+3] + ((attr & 0x10) << 4);
|
||||
sy = ((spriteram[offs+2] + 8) & 0xff) - 8;
|
||||
sx = spriteram[offs + 3] + ((attr & 0x10) << 4);
|
||||
sy = ((spriteram[offs + 2] + 8) & 0xff) - 8;
|
||||
code += (attr & 0xe0) << 3;
|
||||
code += spritebank * 0x800;
|
||||
code += state->spritebank * 0x800;
|
||||
|
||||
if (flipscreen)
|
||||
if (state->flipscreen)
|
||||
{
|
||||
sx = 496 - sx;
|
||||
sy = 240 - sy;
|
||||
@ -166,22 +173,24 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
code,
|
||||
color,
|
||||
flipx,flipscreen,
|
||||
flipx,state->flipscreen,
|
||||
sx,sy,15);
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( cbasebal )
|
||||
{
|
||||
if (bg_on)
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
cbasebal_state *state = (cbasebal_state *)screen->machine->driver_data;
|
||||
|
||||
if (state->bg_on)
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
else
|
||||
bitmap_fill(bitmap,cliprect,768);
|
||||
bitmap_fill(bitmap, cliprect, 768);
|
||||
|
||||
if (obj_on)
|
||||
draw_sprites(screen->machine, bitmap,cliprect);
|
||||
if (state->obj_on)
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
||||
if (text_on)
|
||||
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
|
||||
if (state->text_on)
|
||||
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,37 +7,17 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "video/s2636.h"
|
||||
#include "cpu/s2650/s2650.h"
|
||||
#include "cvs.h"
|
||||
#include "includes/cvs.h"
|
||||
#include "video/s2636.h"
|
||||
|
||||
|
||||
#define SPRITE_PEN_BASE (0x820)
|
||||
#define BULLET_STAR_PEN (0x828)
|
||||
|
||||
#define MAX_STARS 250
|
||||
#define STARS_COLOR_BASE 16
|
||||
|
||||
|
||||
static bitmap_t *background_bitmap;
|
||||
bitmap_t *cvs_collision_background;
|
||||
static bitmap_t *scrolled_collision_background;
|
||||
|
||||
int cvs_collision_register;
|
||||
|
||||
struct star
|
||||
{
|
||||
int x,y,code;
|
||||
};
|
||||
|
||||
|
||||
static struct star stars[MAX_STARS];
|
||||
static int total_stars;
|
||||
static int stars_on;
|
||||
static UINT8 scroll_reg;
|
||||
static int stars_scroll;
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Convert Colour prom to format for Mame Colour Map *
|
||||
* *
|
||||
@ -86,17 +66,18 @@ PALETTE_INIT( cvs )
|
||||
}
|
||||
|
||||
|
||||
static void set_pens(colortable_t *colortable)
|
||||
static void set_pens( running_machine *machine )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0x10; i++)
|
||||
{
|
||||
int r = pal2bit(~cvs_palette_ram[i] >> 0);
|
||||
int g = pal3bit(~cvs_palette_ram[i] >> 2);
|
||||
int b = pal3bit(~cvs_palette_ram[i] >> 5);
|
||||
int r = pal2bit(~state->palette_ram[i] >> 0);
|
||||
int g = pal3bit(~state->palette_ram[i] >> 2);
|
||||
int b = pal3bit(~state->palette_ram[i] >> 5);
|
||||
|
||||
colortable_palette_set_color(colortable, i, MAKE_RGB(r, g, b));
|
||||
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,132 +85,131 @@ static void set_pens(colortable_t *colortable)
|
||||
|
||||
WRITE8_HANDLER( cvs_video_fx_w )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
|
||||
if (data & 0xce)
|
||||
logerror("%4x : CVS: Unimplemented CVS video fx = %2x\n",cpu_get_pc(space->cpu), data & 0xce);
|
||||
|
||||
stars_on = data & 0x01;
|
||||
state->stars_on = data & 0x01;
|
||||
|
||||
if (data & 0x02) logerror(" SHADE BRIGHTER TO RIGHT\n");
|
||||
if (data & 0x04) logerror(" SCREEN ROTATE\n");
|
||||
if (data & 0x08) logerror(" SHADE BRIGHTER TO LEFT\n");
|
||||
if (data & 0x02) logerror(" SHADE BRIGHTER TO RIGHT\n");
|
||||
if (data & 0x04) logerror(" SCREEN ROTATE\n");
|
||||
if (data & 0x08) logerror(" SHADE BRIGHTER TO LEFT\n");
|
||||
|
||||
set_led_status(space->machine, 1, data & 0x10); /* lamp 1 */
|
||||
set_led_status(space->machine, 2, data & 0x20); /* lamp 2 */
|
||||
set_led_status(space->machine, 1, data & 0x10); /* lamp 1 */
|
||||
set_led_status(space->machine, 2, data & 0x20); /* lamp 2 */
|
||||
|
||||
if (data & 0x40) logerror(" SHADE BRIGHTER TO BOTTOM\n");
|
||||
if (data & 0x80) logerror(" SHADE BRIGHTER TO TOP\n");
|
||||
if (data & 0x40) logerror(" SHADE BRIGHTER TO BOTTOM\n");
|
||||
if (data & 0x80) logerror(" SHADE BRIGHTER TO TOP\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
READ8_HANDLER( cvs_collision_r )
|
||||
{
|
||||
return cvs_collision_register;
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
return state->collision_register;
|
||||
}
|
||||
|
||||
READ8_HANDLER( cvs_collision_clear )
|
||||
{
|
||||
cvs_collision_register = 0;
|
||||
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
state->collision_register = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( cvs_scroll_w )
|
||||
{
|
||||
scroll_reg = 255 - data;
|
||||
cvs_state *state = (cvs_state *)space->machine->driver_data;
|
||||
state->scroll_reg = 255 - data;
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( cvs )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)machine->driver_data;
|
||||
int generator = 0;
|
||||
int y;
|
||||
|
||||
/* precalculate the star background */
|
||||
|
||||
total_stars = 0;
|
||||
state->total_stars = 0;
|
||||
|
||||
for (y = 255;y >= 0;y--)
|
||||
for (y = 255; y >= 0; y--)
|
||||
{
|
||||
int x;
|
||||
|
||||
for (x = 511;x >= 0;x--)
|
||||
for (x = 511; x >= 0; x--)
|
||||
{
|
||||
int bit1,bit2;
|
||||
int bit1, bit2;
|
||||
|
||||
generator <<= 1;
|
||||
bit1 = (~generator >> 17) & 1;
|
||||
bit2 = (generator >> 5) & 1;
|
||||
|
||||
if (bit1 ^ bit2) generator |= 1;
|
||||
if (bit1 ^ bit2)
|
||||
generator |= 1;
|
||||
|
||||
if (((~generator >> 16) & 1) && (generator & 0xfe) == 0xfe)
|
||||
{
|
||||
if(((~(generator >> 12)) & 0x01) && ((~(generator >> 13)) & 0x01))
|
||||
{
|
||||
if (total_stars < MAX_STARS)
|
||||
{
|
||||
stars[total_stars].x = x;
|
||||
stars[total_stars].y = y;
|
||||
stars[total_stars].code = 1;
|
||||
if(((~(generator >> 12)) & 0x01) && ((~(generator >> 13)) & 0x01))
|
||||
{
|
||||
if (state->total_stars < CVS_MAX_STARS)
|
||||
{
|
||||
state->stars[state->total_stars].x = x;
|
||||
state->stars[state->total_stars].y = y;
|
||||
state->stars[state->total_stars].code = 1;
|
||||
|
||||
total_stars++;
|
||||
}
|
||||
}
|
||||
state->total_stars++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* create helper bitmaps */
|
||||
background_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
|
||||
cvs_collision_background = video_screen_auto_bitmap_alloc(machine->primary_screen);
|
||||
scrolled_collision_background = video_screen_auto_bitmap_alloc(machine->primary_screen);
|
||||
state->background_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
|
||||
state->collision_background = video_screen_auto_bitmap_alloc(machine->primary_screen);
|
||||
state->scrolled_collision_background = video_screen_auto_bitmap_alloc(machine->primary_screen);
|
||||
|
||||
/* register save */
|
||||
state_save_register_global_bitmap(machine, state->background_bitmap);
|
||||
state_save_register_global_bitmap(machine, state->collision_background);
|
||||
state_save_register_global_bitmap(machine, state->scrolled_collision_background);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void cvs_scroll_stars(void)
|
||||
void cvs_scroll_stars( running_machine *machine )
|
||||
{
|
||||
stars_scroll++;
|
||||
cvs_state *state = (cvs_state *)machine->driver_data;
|
||||
state->stars_scroll++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VIDEO_UPDATE( cvs )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)screen->machine->driver_data;
|
||||
static const int ram_based_char_start_indices[] = { 0xe0, 0xc0, 0x100, 0x80 };
|
||||
offs_t offs;
|
||||
int scroll[8];
|
||||
UINT8 character_banking_mode;
|
||||
bitmap_t *s2636_0_bitmap;
|
||||
bitmap_t *s2636_1_bitmap;
|
||||
bitmap_t *s2636_2_bitmap;
|
||||
const device_config *s2636_0 = devtag_get_device(screen->machine, "s2636_0");
|
||||
const device_config *s2636_1 = devtag_get_device(screen->machine, "s2636_1");
|
||||
const device_config *s2636_2 = devtag_get_device(screen->machine, "s2636_2");
|
||||
bitmap_t *s2636_0_bitmap, *s2636_1_bitmap, *s2636_2_bitmap;
|
||||
|
||||
set_pens(screen->machine->colortable);
|
||||
|
||||
/* create our background character set, which is a software
|
||||
selectable mixture of RAM and ROM based tiles */
|
||||
|
||||
character_banking_mode = cvs_get_character_banking_mode();
|
||||
set_pens(screen->machine);
|
||||
|
||||
/* draw the background */
|
||||
for (offs = 0; offs < 0x0400; offs++)
|
||||
{
|
||||
int collision_color = 0x100;
|
||||
|
||||
UINT8 code = cvs_video_ram[offs];
|
||||
UINT8 color = cvs_color_ram[offs];
|
||||
UINT8 code = state->video_ram[offs];
|
||||
UINT8 color = state->color_ram[offs];
|
||||
|
||||
UINT8 x = offs << 3;
|
||||
UINT8 y = offs >> 5 << 3;
|
||||
|
||||
int gfxnum = (code < ram_based_char_start_indices[character_banking_mode]) ? 0 : 1;
|
||||
int gfxnum = (code < ram_based_char_start_indices[state->character_banking_mode]) ? 0 : 1;
|
||||
|
||||
drawgfx_opaque(background_bitmap, 0, screen->machine->gfx[gfxnum],
|
||||
drawgfx_opaque(state->background_bitmap, 0, screen->machine->gfx[gfxnum],
|
||||
code, color,
|
||||
0, 0,
|
||||
x, y);
|
||||
@ -245,56 +225,55 @@ VIDEO_UPDATE( cvs )
|
||||
collision_color = 0x102;
|
||||
}
|
||||
|
||||
drawgfx_opaque(cvs_collision_background, 0, screen->machine->gfx[gfxnum],
|
||||
drawgfx_opaque(state->collision_background, 0, screen->machine->gfx[gfxnum],
|
||||
code, collision_color,
|
||||
0, 0,
|
||||
x, y);
|
||||
}
|
||||
|
||||
|
||||
/* Update screen - 8 regions, fixed scrolling area */
|
||||
/* Update screen - 8 regions, fixed scrolling area */
|
||||
scroll[0] = 0;
|
||||
scroll[1] = state->scroll_reg;
|
||||
scroll[2] = state->scroll_reg;
|
||||
scroll[3] = state->scroll_reg;
|
||||
scroll[4] = state->scroll_reg;
|
||||
scroll[5] = state->scroll_reg;
|
||||
scroll[6] = 0;
|
||||
scroll[7] = 0;
|
||||
|
||||
scroll[0] = 0;
|
||||
scroll[1] = scroll_reg;
|
||||
scroll[2] = scroll_reg;
|
||||
scroll[3] = scroll_reg;
|
||||
scroll[4] = scroll_reg;
|
||||
scroll[5] = scroll_reg;
|
||||
scroll[6] = 0;
|
||||
scroll[7] = 0;
|
||||
copyscrollbitmap(bitmap, state->background_bitmap, 0, 0, 8, scroll, cliprect);
|
||||
copyscrollbitmap(state->scrolled_collision_background, state->collision_background, 0, 0, 8, scroll, cliprect);
|
||||
|
||||
copyscrollbitmap(bitmap, background_bitmap, 0, 0, 8, scroll, cliprect);
|
||||
copyscrollbitmap(scrolled_collision_background, cvs_collision_background, 0, 0, 8, scroll, cliprect);
|
||||
/* update the S2636 chips */
|
||||
s2636_0_bitmap = s2636_update(state->s2636_0, cliprect);
|
||||
s2636_1_bitmap = s2636_update(state->s2636_1, cliprect);
|
||||
s2636_2_bitmap = s2636_update(state->s2636_2, cliprect);
|
||||
|
||||
/* update the S2636 chips */
|
||||
s2636_0_bitmap = s2636_update(s2636_0, cliprect);
|
||||
s2636_1_bitmap = s2636_update(s2636_1, cliprect);
|
||||
s2636_2_bitmap = s2636_update(s2636_2, cliprect);
|
||||
/* Bullet Hardware */
|
||||
for (offs = 8; offs < 256; offs++ )
|
||||
{
|
||||
if (state->bullet_ram[offs] != 0)
|
||||
{
|
||||
int ct;
|
||||
for (ct = 0; ct < 4; ct++)
|
||||
{
|
||||
int bx = 255 - 7 - state->bullet_ram[offs] - ct;
|
||||
|
||||
/* Bullet Hardware */
|
||||
for (offs = 8; offs < 256; offs++ )
|
||||
{
|
||||
if (cvs_bullet_ram[offs] != 0)
|
||||
{
|
||||
int ct;
|
||||
for(ct=0;ct<4;ct++)
|
||||
{
|
||||
int bx=255-7-cvs_bullet_ram[offs]-ct;
|
||||
|
||||
/* Bullet/Object Collision */
|
||||
/* Bullet/Object Collision */
|
||||
if ((*BITMAP_ADDR16(s2636_0_bitmap, offs, bx) != 0) ||
|
||||
(*BITMAP_ADDR16(s2636_1_bitmap, offs, bx) != 0) ||
|
||||
(*BITMAP_ADDR16(s2636_2_bitmap, offs, bx) != 0))
|
||||
cvs_collision_register |= 0x08;
|
||||
state->collision_register |= 0x08;
|
||||
|
||||
/* Bullet/Background Collision */
|
||||
if (colortable_entry_get_value(screen->machine->colortable, *BITMAP_ADDR16(scrolled_collision_background, offs, bx)))
|
||||
cvs_collision_register |= 0x80;
|
||||
/* Bullet/Background Collision */
|
||||
if (colortable_entry_get_value(screen->machine->colortable, *BITMAP_ADDR16(state->scrolled_collision_background, offs, bx)))
|
||||
state->collision_register |= 0x80;
|
||||
|
||||
*BITMAP_ADDR16(bitmap, offs, bx) = BULLET_STAR_PEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* mix and copy the S2636 images into the main bitmap, also check for collision */
|
||||
@ -318,31 +297,29 @@ VIDEO_UPDATE( cvs )
|
||||
*BITMAP_ADDR16(bitmap, y, x) = SPRITE_PEN_BASE + S2636_PIXEL_COLOR(pixel);
|
||||
|
||||
/* S2636 vs. S2636 collision detection */
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) cvs_collision_register |= 0x01;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) cvs_collision_register |= 0x02;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel2)) cvs_collision_register |= 0x04;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) state->collision_register |= 0x01;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) state->collision_register |= 0x02;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel2)) state->collision_register |= 0x04;
|
||||
|
||||
/* S2636 vs. background collision detection */
|
||||
if (colortable_entry_get_value(screen->machine->colortable, *BITMAP_ADDR16(scrolled_collision_background, y, x)))
|
||||
if (colortable_entry_get_value(screen->machine->colortable, *BITMAP_ADDR16(state->scrolled_collision_background, y, x)))
|
||||
{
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0)) cvs_collision_register |= 0x10;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1)) cvs_collision_register |= 0x20;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2)) cvs_collision_register |= 0x40;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0)) state->collision_register |= 0x10;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1)) state->collision_register |= 0x20;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2)) state->collision_register |= 0x40;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* stars circuit */
|
||||
|
||||
if (stars_on)
|
||||
/* stars circuit */
|
||||
if (state->stars_on)
|
||||
{
|
||||
for (offs = 0;offs < total_stars;offs++)
|
||||
for (offs = 0; offs < state->total_stars; offs++)
|
||||
{
|
||||
UINT8 x = (stars[offs].x + stars_scroll) >> 1;
|
||||
UINT8 y = stars[offs].y + ((stars_scroll + stars[offs].x) >> 9);
|
||||
UINT8 x = (state->stars[offs].x + state->stars_scroll) >> 1;
|
||||
UINT8 y = state->stars[offs].y + ((state->stars_scroll + state->stars[offs].x) >> 9);
|
||||
|
||||
if ((y & 1) ^ ((x >> 4) & 1))
|
||||
{
|
||||
|
@ -6,20 +6,7 @@
|
||||
|
||||
#include "driver.h"
|
||||
#include "sound/okim6295.h"
|
||||
|
||||
|
||||
/* Globals */
|
||||
size_t pang_videoram_size;
|
||||
UINT8 *pang_videoram;
|
||||
UINT8 *pang_colorram;
|
||||
|
||||
/* Private */
|
||||
static UINT8 *pang_objram; /* Sprite RAM */
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
static int flipscreen;
|
||||
|
||||
|
||||
#include "includes/mitchell.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -29,8 +16,9 @@ static int flipscreen;
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
UINT8 attr = pang_colorram[tile_index];
|
||||
int code = pang_videoram[2*tile_index] + (pang_videoram[2*tile_index+1] << 8);
|
||||
mitchell_state *state = (mitchell_state *)machine->driver_data;
|
||||
UINT8 attr = state->colorram[tile_index];
|
||||
int code = state->videoram[2 * tile_index] + (state->videoram[2 * tile_index + 1] << 8);
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
code,
|
||||
@ -48,23 +36,19 @@ static TILE_GET_INFO( get_tile_info )
|
||||
|
||||
VIDEO_START( pang )
|
||||
{
|
||||
pang_objram=NULL;
|
||||
machine->generic.paletteram.u8=NULL;
|
||||
mitchell_state *state = (mitchell_state *)machine->driver_data;
|
||||
|
||||
state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
|
||||
tilemap_set_transparent_pen(state->bg_tilemap, 15);
|
||||
|
||||
bg_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_rows,8,8,64,32);
|
||||
/* OBJ RAM */
|
||||
state->objram = auto_alloc_array_clear(machine, UINT8, state->videoram_size);
|
||||
|
||||
tilemap_set_transparent_pen(bg_tilemap,15);
|
||||
/* Palette RAM */
|
||||
machine->generic.paletteram.u8 = auto_alloc_array_clear(machine, UINT8, 2 * machine->config->total_colors);
|
||||
|
||||
/*
|
||||
OBJ RAM
|
||||
*/
|
||||
pang_objram=auto_alloc_array_clear(machine, UINT8, pang_videoram_size);
|
||||
|
||||
/*
|
||||
Palette RAM
|
||||
*/
|
||||
machine->generic.paletteram.u8 = auto_alloc_array_clear(machine, UINT8, 2*machine->config->total_colors);
|
||||
state_save_register_global_pointer(machine, state->objram, state->videoram_size);
|
||||
state_save_register_global_pointer(machine, machine->generic.paletteram.u8, 2 * machine->config->total_colors);
|
||||
}
|
||||
|
||||
|
||||
@ -79,52 +63,67 @@ VIDEO_START( pang )
|
||||
OBJ / CHAR RAM HANDLERS (BANK 0 = CHAR, BANK 1=OBJ)
|
||||
***************************************************************************/
|
||||
|
||||
static int video_bank;
|
||||
|
||||
WRITE8_HANDLER( pang_video_bank_w )
|
||||
{
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
|
||||
/* Bank handler (sets base pointers for video write) (doesn't apply to mgakuen) */
|
||||
video_bank = data;
|
||||
state->video_bank = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( mstworld_video_bank_w )
|
||||
{
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
|
||||
/* Monsters World seems to freak out if more bits are used.. */
|
||||
video_bank = data&1;
|
||||
state->video_bank = data & 1;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( mgakuen_videoram_w )
|
||||
{
|
||||
pang_videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset/2);
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
READ8_HANDLER( mgakuen_videoram_r )
|
||||
{
|
||||
return pang_videoram[offset];
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
return state->videoram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( mgakuen_objram_w )
|
||||
{
|
||||
pang_objram[offset]=data;
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
state->objram[offset] = data;
|
||||
}
|
||||
|
||||
READ8_HANDLER( mgakuen_objram_r )
|
||||
{
|
||||
return pang_objram[offset];
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
return state->objram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( pang_videoram_w )
|
||||
{
|
||||
if (video_bank) mgakuen_objram_w(space,offset,data);
|
||||
else mgakuen_videoram_w(space,offset,data);
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
|
||||
if (state->video_bank)
|
||||
mgakuen_objram_w(space, offset, data);
|
||||
else
|
||||
mgakuen_videoram_w(space, offset, data);
|
||||
}
|
||||
|
||||
READ8_HANDLER( pang_videoram_r )
|
||||
{
|
||||
if (video_bank) return mgakuen_objram_r(space,offset);
|
||||
else return mgakuen_videoram_r(space,offset);
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
|
||||
if (state->video_bank)
|
||||
return mgakuen_objram_r(space, offset);
|
||||
else
|
||||
return mgakuen_videoram_r(space, offset);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -133,24 +132,26 @@ READ8_HANDLER( pang_videoram_r )
|
||||
|
||||
WRITE8_HANDLER( pang_colorram_w )
|
||||
{
|
||||
pang_colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset);
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
READ8_HANDLER( pang_colorram_r )
|
||||
{
|
||||
return pang_colorram[offset];
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
return state->colorram[offset];
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
PALETTE HANDLERS (COLOURS: BANK 0 = 0x00-0x3f BANK 1=0x40-0xff)
|
||||
****************************************************************************/
|
||||
|
||||
static int paletteram_bank;
|
||||
|
||||
WRITE8_HANDLER( pang_gfxctrl_w )
|
||||
{
|
||||
const device_config *oki = devtag_get_device(space->machine, "oki");
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
|
||||
logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(space->cpu),data);
|
||||
{
|
||||
#if 0
|
||||
@ -163,22 +164,23 @@ logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(space->cpu),data);
|
||||
/* bit 0 is unknown (used, maybe back color enable?) */
|
||||
|
||||
/* bit 1 is coin counter */
|
||||
coin_counter_w(space->machine, 0,data & 2);
|
||||
coin_counter_w(space->machine, 0, data & 2);
|
||||
|
||||
/* bit 2 is flip screen */
|
||||
if (flipscreen != (data & 0x04))
|
||||
if (state->flipscreen != (data & 0x04))
|
||||
{
|
||||
flipscreen = data & 0x04;
|
||||
tilemap_set_flip_all(space->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
state->flipscreen = data & 0x04;
|
||||
tilemap_set_flip_all(space->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
}
|
||||
|
||||
/* bit 3 is unknown (used, e.g. marukin pulses it on the title screen) */
|
||||
|
||||
/* bit 4 selects OKI M6295 bank */
|
||||
if (oki != NULL && sound_get_type(oki) == SOUND_OKIM6295) okim6295_set_bank_base(oki, (data & 0x10) ? 0x40000 : 0x00000);
|
||||
if (state->oki != NULL && sound_get_type(state->oki) == SOUND_OKIM6295)
|
||||
okim6295_set_bank_base(state->oki, (data & 0x10) ? 0x40000 : 0x00000);
|
||||
|
||||
/* bit 5 is palette RAM bank selector (doesn't apply to mgakuen) */
|
||||
paletteram_bank = data & 0x20;
|
||||
state->paletteram_bank = data & 0x20;
|
||||
|
||||
/* bits 6 and 7 are unknown, used in several places. At first I thought */
|
||||
/* they were bg and sprites enable, but this screws up spang (screen flickers */
|
||||
@ -188,6 +190,8 @@ logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(space->cpu),data);
|
||||
|
||||
WRITE8_HANDLER( mstworld_gfxctrl_w )
|
||||
{
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
|
||||
logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(space->cpu),data);
|
||||
{
|
||||
char baf[40];
|
||||
@ -198,23 +202,21 @@ logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(space->cpu),data);
|
||||
/* bit 0 is unknown (used, maybe back color enable?) */
|
||||
|
||||
/* bit 1 is coin counter */
|
||||
coin_counter_w(space->machine, 0,data & 2);
|
||||
coin_counter_w(space->machine, 0, data & 2);
|
||||
|
||||
/* bit 2 is flip screen */
|
||||
if (flipscreen != (data & 0x04))
|
||||
if (state->flipscreen != (data & 0x04))
|
||||
{
|
||||
flipscreen = data & 0x04;
|
||||
tilemap_set_flip_all(space->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
state->flipscreen = data & 0x04;
|
||||
tilemap_set_flip_all(space->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
}
|
||||
|
||||
/* bit 3 is unknown (used, e.g. marukin pulses it on the title screen) */
|
||||
|
||||
/* bit 4 selects OKI M6295 bank */
|
||||
// okim6295_set_bank_base(devtag_get_device(space->machine, "oki"), (data & 0x10) ? 0x40000 : 0x00000);
|
||||
/* not here.. it has its own z80 + sound banking */
|
||||
/* bit 4 here does not select OKI M6295 bank: mstworld has its own z80 + sound banking */
|
||||
|
||||
/* bit 5 is palette RAM bank selector (doesn't apply to mgakuen) */
|
||||
paletteram_bank = data & 0x20;
|
||||
state->paletteram_bank = data & 0x20;
|
||||
|
||||
/* bits 6 and 7 are unknown, used in several places. At first I thought */
|
||||
/* they were bg and sprites enable, but this screws up spang (screen flickers */
|
||||
@ -224,19 +226,27 @@ logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(space->cpu),data);
|
||||
|
||||
WRITE8_HANDLER( pang_paletteram_w )
|
||||
{
|
||||
if (paletteram_bank) paletteram_xxxxRRRRGGGGBBBB_le_w(space,offset + 0x800,data);
|
||||
else paletteram_xxxxRRRRGGGGBBBB_le_w(space,offset,data);
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
|
||||
if (state->paletteram_bank)
|
||||
paletteram_xxxxRRRRGGGGBBBB_le_w(space, offset + 0x800, data);
|
||||
else
|
||||
paletteram_xxxxRRRRGGGGBBBB_le_w(space, offset, data);
|
||||
}
|
||||
|
||||
READ8_HANDLER( pang_paletteram_r )
|
||||
{
|
||||
if (paletteram_bank) return space->machine->generic.paletteram.u8[offset + 0x800];
|
||||
mitchell_state *state = (mitchell_state *)space->machine->driver_data;
|
||||
|
||||
if (state->paletteram_bank)
|
||||
return space->machine->generic.paletteram.u8[offset + 0x800];
|
||||
|
||||
return space->machine->generic.paletteram.u8[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( mgakuen_paletteram_w )
|
||||
{
|
||||
paletteram_xxxxRRRRGGGGBBBB_le_w(space,offset,data);
|
||||
paletteram_xxxxRRRRGGGGBBBB_le_w(space, offset, data);
|
||||
}
|
||||
|
||||
READ8_HANDLER( mgakuen_paletteram_r )
|
||||
@ -252,21 +262,22 @@ READ8_HANDLER( mgakuen_paletteram_r )
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
int offs,sx,sy;
|
||||
mitchell_state *state = (mitchell_state *)machine->driver_data;
|
||||
int offs, sx, sy;
|
||||
|
||||
/* the last entry is not a sprite, we skip it otherwise spang shows a bubble */
|
||||
/* moving diagonally across the screen */
|
||||
for (offs = 0x1000-0x40;offs >= 0;offs -= 0x20)
|
||||
for (offs = 0x1000 - 0x40; offs >= 0; offs -= 0x20)
|
||||
{
|
||||
int code = pang_objram[offs];
|
||||
int attr = pang_objram[offs+1];
|
||||
int code = state->objram[offs];
|
||||
int attr = state->objram[offs + 1];
|
||||
int color = attr & 0x0f;
|
||||
sx = pang_objram[offs+3] + ((attr & 0x10) << 4);
|
||||
sy = ((pang_objram[offs+2] + 8) & 0xff) - 8;
|
||||
sx = state->objram[offs + 3] + ((attr & 0x10) << 4);
|
||||
sy = ((state->objram[offs + 2] + 8) & 0xff) - 8;
|
||||
code += (attr & 0xe0) << 3;
|
||||
if (flipscreen)
|
||||
if (state->flipscreen)
|
||||
{
|
||||
sx = 496 - sx;
|
||||
sy = 240 - sy;
|
||||
@ -274,15 +285,17 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
|
||||
code,
|
||||
color,
|
||||
flipscreen,flipscreen,
|
||||
state->flipscreen, state->flipscreen,
|
||||
sx,sy,15);
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( pang )
|
||||
{
|
||||
bitmap_fill(bitmap,cliprect,0);
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
draw_sprites(screen->machine, bitmap,cliprect);
|
||||
mitchell_state *state = (mitchell_state *)screen->machine->driver_data;
|
||||
|
||||
bitmap_fill(bitmap, cliprect, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -15,13 +15,9 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "cvs.h"
|
||||
#include "video/s2636.h"
|
||||
#include "cpu/s2650/s2650.h"
|
||||
|
||||
|
||||
UINT8 *quasar_effectram;
|
||||
UINT8 quasar_effectcontrol;
|
||||
#include "includes/cvs.h"
|
||||
|
||||
PALETTE_INIT( quasar )
|
||||
{
|
||||
@ -96,54 +92,52 @@ PALETTE_INIT( quasar )
|
||||
|
||||
VIDEO_START( quasar )
|
||||
{
|
||||
quasar_effectram = auto_alloc_array(machine, UINT8, 0x400);
|
||||
cvs_state *state = (cvs_state *)machine->driver_data;
|
||||
state->effectram = auto_alloc_array(machine, UINT8, 0x400);
|
||||
|
||||
/* create helper bitmaps */
|
||||
cvs_collision_background = video_screen_auto_bitmap_alloc(machine->primary_screen);
|
||||
/* create helper bitmap */
|
||||
state->collision_background = video_screen_auto_bitmap_alloc(machine->primary_screen);
|
||||
|
||||
/* register save */
|
||||
state_save_register_global_bitmap(machine, state->collision_background);
|
||||
state_save_register_global_pointer(machine, state->effectram, 0x400);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( quasar )
|
||||
{
|
||||
cvs_state *state = (cvs_state *)screen->machine->driver_data;
|
||||
int offs;
|
||||
bitmap_t *s2636_0_bitmap;
|
||||
bitmap_t *s2636_1_bitmap;
|
||||
bitmap_t *s2636_2_bitmap;
|
||||
const device_config *s2636_0 = devtag_get_device(screen->machine, "s2636_0");
|
||||
const device_config *s2636_1 = devtag_get_device(screen->machine, "s2636_1");
|
||||
const device_config *s2636_2 = devtag_get_device(screen->machine, "s2636_2");
|
||||
bitmap_t *s2636_0_bitmap, *s2636_1_bitmap, *s2636_2_bitmap;
|
||||
|
||||
/* for every character in the video RAM */
|
||||
for (offs = 0; offs < 0x0400; offs++)
|
||||
{
|
||||
int ox, oy;
|
||||
UINT8 code = cvs_video_ram[offs];
|
||||
|
||||
UINT8 code = state->video_ram[offs];
|
||||
UINT8 x = (offs & 0x1f) << 3;
|
||||
UINT8 y = (offs >> 5) << 3;
|
||||
|
||||
// While we have the current character code, draw the effects layer
|
||||
// intensity / on and off controlled by latch
|
||||
|
||||
int forecolor = 0x208 + quasar_effectram[offs] + (256 * (((quasar_effectcontrol >> 4) ^ 3) & 3));
|
||||
int forecolor = 0x208 + state->effectram[offs] + (256 * (((state->effectcontrol >> 4) ^ 3) & 3));
|
||||
|
||||
for(ox=0;ox<8;ox++)
|
||||
for(oy=0;oy<8;oy++)
|
||||
*BITMAP_ADDR16(bitmap, y+oy, x+ox) = forecolor;
|
||||
for (ox = 0; ox < 8; ox++)
|
||||
for (oy = 0; oy < 8; oy++)
|
||||
*BITMAP_ADDR16(bitmap, y + oy, x + ox) = forecolor;
|
||||
|
||||
/* Main Screen */
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],
|
||||
code,
|
||||
cvs_color_ram[offs] & 0x3f,
|
||||
state->color_ram[offs] & 0x3f,
|
||||
0,0,
|
||||
x,y,0);
|
||||
|
||||
|
||||
/* background for Collision Detection (it can only hit certain items) */
|
||||
|
||||
if((cvs_color_ram[offs] & 7) == 0)
|
||||
if((state->color_ram[offs] & 7) == 0)
|
||||
{
|
||||
drawgfx_opaque(cvs_collision_background,cliprect,screen->machine->gfx[0],
|
||||
drawgfx_opaque(state->collision_background,cliprect,screen->machine->gfx[0],
|
||||
code,
|
||||
64,
|
||||
0,0,
|
||||
@ -152,23 +146,23 @@ VIDEO_UPDATE( quasar )
|
||||
}
|
||||
|
||||
/* update the S2636 chips */
|
||||
s2636_0_bitmap = s2636_update(s2636_0, cliprect);
|
||||
s2636_1_bitmap = s2636_update(s2636_1, cliprect);
|
||||
s2636_2_bitmap = s2636_update(s2636_2, cliprect);
|
||||
s2636_0_bitmap = s2636_update(state->s2636_0, cliprect);
|
||||
s2636_1_bitmap = s2636_update(state->s2636_1, cliprect);
|
||||
s2636_2_bitmap = s2636_update(state->s2636_2, cliprect);
|
||||
|
||||
/* Bullet Hardware */
|
||||
for (offs = 8; offs < 256; offs++ )
|
||||
{
|
||||
if(cvs_bullet_ram[offs] != 0)
|
||||
if(state->bullet_ram[offs] != 0)
|
||||
{
|
||||
int ct;
|
||||
for(ct=0;ct<1;ct++)
|
||||
for (ct = 0; ct < 1; ct++)
|
||||
{
|
||||
int bx=255-9-cvs_bullet_ram[offs]-ct;
|
||||
int bx = 255 - 9 - state->bullet_ram[offs] - ct;
|
||||
|
||||
/* bullet/object Collision */
|
||||
if (*BITMAP_ADDR16(s2636_0_bitmap, offs, bx) != 0) cvs_collision_register |= 0x04;
|
||||
if (*BITMAP_ADDR16(s2636_2_bitmap, offs, bx) != 0) cvs_collision_register |= 0x08;
|
||||
if (*BITMAP_ADDR16(s2636_0_bitmap, offs, bx) != 0) state->collision_register |= 0x04;
|
||||
if (*BITMAP_ADDR16(s2636_2_bitmap, offs, bx) != 0) state->collision_register |= 0x08;
|
||||
|
||||
*BITMAP_ADDR16(bitmap, offs, bx) = 7;
|
||||
}
|
||||
@ -197,10 +191,10 @@ VIDEO_UPDATE( quasar )
|
||||
*BITMAP_ADDR16(bitmap, y, x) = S2636_PIXEL_COLOR(pixel);
|
||||
|
||||
/* S2636 vs. background collision detection */
|
||||
if (colortable_entry_get_value(screen->machine->colortable, *BITMAP_ADDR16(cvs_collision_background, y, x)))
|
||||
if (colortable_entry_get_value(screen->machine->colortable, *BITMAP_ADDR16(state->collision_background, y, x)))
|
||||
{
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0)) cvs_collision_register |= 0x01;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2)) cvs_collision_register |= 0x02;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0)) state->collision_register |= 0x01;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2)) state->collision_register |= 0x02;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ static void calculate_star_field( running_machine *machine )
|
||||
{
|
||||
int color = (~(generator >> 8)) & 0x3f;
|
||||
|
||||
if (color && state->total_stars < MAX_STARS)
|
||||
if (color && state->total_stars < JUNGLER_MAX_STARS)
|
||||
{
|
||||
state->stars[state->total_stars].x = x;
|
||||
state->stars[state->total_stars].y = y;
|
||||
|
Loading…
Reference in New Issue
Block a user