📄 tecmo.c
字号:
/***************************************************************************
tecmo.c
M68000 based Tecmo games (Final Starforce) may fit in here as well
Silkworm memory map (preliminary)
0000-bfff ROM
c000-c1ff Background video RAM #2
c200-c3ff Background color RAM #2
c400-c5ff Background video RAM #1
c600-c7ff Background color RAM #1
c800-cbff Video RAM
cc00-cfff Color RAM
d000-dfff RAM
e000-e7ff Sprites
e800-efff Palette RAM, groups of 2 bytes, 4 bits per gun: xB RG
e800-e9ff sprites
ea00-ebff characters
ec00-edff bg #1
ee00-efff bg #2
f000-f7ff window for banked ROM
read:
f800 IN0 (heli) bit 0-3
f801 IN0 bit 4-7
f802 IN1 (jeep) bit 0-3
f803 IN1 bit 4-7
f806 DSWA bit 0-3
f807 DSWA bit 4-7
f808 DSWB bit 0-3
f809 DSWB bit 4-7
f80f COIN
write:
f800-f801 bg #1 x scroll
f802 bg #1 y scroll
f803-f804 bg #2 x scroll
f805 bg #2 y scroll
f806 ????
f808 ROM bank selector
f809 ????
f80b ????
***************************************************************************
Rygar memory map (preliminary)
read:
f800 player #1 joystick
f801 player #1 buttons; service
f802 player #2 joystick (mirror player#1 - since players take turns)
f803 player #2 buttons (cocktail mode reads these)
f804 start, coins
f806 DSWA
f807 DSWA cocktail
f808 DSWB
f809 DSWB
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
#include "Z80/Z80.h"
void tecmo_bankswitch_w(int offset,int data);
int tecmo_bankedrom_r(int offset);
void tecmo_bankswitch_w(int offset,int data)
{
int bankaddress;
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
bankaddress = 0x10000 + ((data & 0xf8) << 8);
cpu_setbank(1,&RAM[bankaddress]);
}
static void tecmo_sound_command_w(int offset,int data)
{
soundlatch_w(offset,data);
cpu_cause_interrupt(1,Z80_NMI_INT);
}
static int adpcm_start,adpcm_end;
static void tecmo_adpcm_start_w(int offset,int data)
{
adpcm_start = data << 8;
}
static void tecmo_adpcm_end_w(int offset,int data)
{
adpcm_end = (data + 1) << 8;
}
static void tecmo_adpcm_trigger_w(int offset,int data)
{
ADPCM_setvol(0,(data & 0x0f) * 100 / 0x0f);
if (data & 0x0f) /* maybe this selects the volume? */
ADPCM_play(0,adpcm_start,(adpcm_end - adpcm_start)*2);
}
extern unsigned char *tecmo_videoram,*tecmo_colorram;
extern unsigned char *tecmo_videoram2,*tecmo_colorram2;
extern unsigned char *tecmo_scroll;
extern int tecmo_videoram2_size;
void tecmo_videoram_w(int offset,int data);
void tecmo_colorram_w(int offset,int data);
int rygar_vh_start(void);
int silkworm_vh_start(void);
int gemini_vh_start(void);
void tecmo_vh_stop(void);
void tecmo_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
static struct MemoryReadAddress readmem[] =
{
{ 0x0000, 0xbfff, MRA_ROM },
{ 0xc000, 0xefff, MRA_RAM },
{ 0xf000, 0xf7ff, MRA_BANK1 },
{ 0xf800, 0xf800, input_port_0_r },
{ 0xf801, 0xf801, input_port_1_r },
{ 0xf802, 0xf802, input_port_2_r },
{ 0xf803, 0xf803, input_port_3_r },
{ 0xf804, 0xf804, input_port_4_r },
{ 0xf805, 0xf805, input_port_5_r },
{ 0xf806, 0xf806, input_port_6_r },
{ 0xf807, 0xf807, input_port_7_r },
{ 0xf808, 0xf808, input_port_8_r },
{ 0xf809, 0xf809, input_port_9_r },
{ 0xf80f, 0xf80f, input_port_10_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress silkworm_writemem[] =
{
{ 0x0000, 0xbfff, MWA_ROM },
{ 0xc000, 0xc1ff, videoram_w, &videoram, &videoram_size },
{ 0xc200, 0xc3ff, colorram_w, &colorram },
{ 0xc400, 0xc5ff, tecmo_videoram_w, &tecmo_videoram },
{ 0xc600, 0xc7ff, tecmo_colorram_w, &tecmo_colorram },
{ 0xc800, 0xcbff, MWA_RAM, &tecmo_videoram2, &tecmo_videoram2_size },
{ 0xcc00, 0xcfff, MWA_RAM, &tecmo_colorram2 },
{ 0xd000, 0xdfff, MWA_RAM },
{ 0xe000, 0xe7ff, MWA_RAM, &spriteram, &spriteram_size },
{ 0xe800, 0xefff, paletteram_xxxxBBBBRRRRGGGG_swap_w, &paletteram },
{ 0xf000, 0xf7ff, MWA_ROM },
{ 0xf800, 0xf805, MWA_RAM, &tecmo_scroll },
{ 0xf806, 0xf806, tecmo_sound_command_w },
{ 0xf807, 0xf807, MWA_NOP }, /* ???? */
{ 0xf808, 0xf808, tecmo_bankswitch_w },
{ 0xf809, 0xf809, MWA_NOP }, /* ???? */
{ 0xf80b, 0xf80b, MWA_NOP }, /* ???? */
{ -1 } /* end of table */
};
static struct MemoryWriteAddress rygar_writemem[] =
{
{ 0x0000, 0xbfff, MWA_ROM },
{ 0xc000, 0xcfff, MWA_RAM },
{ 0xd000, 0xd3ff, MWA_RAM, &tecmo_videoram2, &tecmo_videoram2_size },
{ 0xd400, 0xd7ff, MWA_RAM, &tecmo_colorram2 },
{ 0xd800, 0xd9ff, tecmo_videoram_w, &tecmo_videoram },
{ 0xda00, 0xdbff, tecmo_colorram_w, &tecmo_colorram },
{ 0xdc00, 0xddff, videoram_w, &videoram, &videoram_size },
{ 0xde00, 0xdfff, colorram_w, &colorram },
{ 0xe000, 0xe7ff, MWA_RAM, &spriteram, &spriteram_size },
{ 0xe800, 0xefff, paletteram_xxxxBBBBRRRRGGGG_swap_w, &paletteram },
{ 0xf000, 0xf7ff, MWA_ROM },
{ 0xf800, 0xf805, MWA_RAM, &tecmo_scroll },
{ 0xf806, 0xf806, tecmo_sound_command_w },
{ 0xf807, 0xf807, MWA_NOP }, /* ???? */
{ 0xf808, 0xf808, tecmo_bankswitch_w },
{ 0xf809, 0xf809, MWA_NOP }, /* ???? */
{ 0xf80b, 0xf80b, MWA_NOP }, /* ???? */
{ -1 } /* end of table */
};
static struct MemoryWriteAddress gemini_writemem[] =
{
{ 0x0000, 0xbfff, MWA_ROM },
{ 0xc000, 0xcfff, MWA_RAM },
{ 0xd000, 0xd3ff, MWA_RAM, &tecmo_videoram2, &tecmo_videoram2_size },
{ 0xd400, 0xd7ff, MWA_RAM, &tecmo_colorram2 },
{ 0xd800, 0xd9ff, tecmo_videoram_w, &tecmo_videoram },
{ 0xda00, 0xdbff, tecmo_colorram_w, &tecmo_colorram },
{ 0xdc00, 0xddff, videoram_w, &videoram, &videoram_size },
{ 0xde00, 0xdfff, colorram_w, &colorram },
{ 0xe000, 0xe7ff, paletteram_xxxxBBBBRRRRGGGG_swap_w, &paletteram },
{ 0xe800, 0xefff, MWA_RAM, &spriteram, &spriteram_size },
{ 0xf000, 0xf7ff, MWA_ROM },
{ 0xf800, 0xf805, MWA_RAM, &tecmo_scroll },
{ 0xf806, 0xf806, tecmo_sound_command_w },
{ 0xf807, 0xf807, MWA_NOP }, /* ???? */
{ 0xf808, 0xf808, tecmo_bankswitch_w },
{ 0xf809, 0xf809, MWA_NOP }, /* ???? */
{ 0xf80b, 0xf80b, MWA_NOP }, /* ???? */
{ -1 } /* end of table */
};
static struct MemoryReadAddress sound_readmem[] =
{
{ 0x0000, 0x7fff, MRA_ROM },
{ 0x8000, 0x87ff, MRA_RAM },
{ 0xc000, 0xc000, soundlatch_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress sound_writemem[] =
{
{ 0x2000, 0x207f, MWA_RAM }, /* Silkworm set #2 has a custom CPU which */
/* writes code to this area */
{ 0x0000, 0x7fff, MWA_ROM },
{ 0x8000, 0x87ff, MWA_RAM },
{ 0xa000, 0xa000, YM3812_control_port_0_w },
{ 0xa001, 0xa001, YM3812_write_port_0_w },
{ 0xc000, 0xc000, tecmo_adpcm_start_w },
{ 0xc400, 0xc400, tecmo_adpcm_end_w },
{ 0xc800, 0xc800, tecmo_adpcm_trigger_w },
{ 0xcc00, 0xcc00, MWA_NOP }, /* NMI acknowledge? */
{ -1 } /* end of table */
};
static struct MemoryReadAddress rygar_sound_readmem[] =
{
{ 0x0000, 0x3fff, MRA_ROM },
{ 0x4000, 0x47ff, MRA_RAM },
{ 0xc000, 0xc000, soundlatch_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress rygar_sound_writemem[] =
{
{ 0x0000, 0x3fff, MWA_ROM },
{ 0x4000, 0x47ff, MWA_RAM },
{ 0x8000, 0x8000, YM3812_control_port_0_w },
{ 0x8001, 0x8001, YM3812_write_port_0_w },
{ 0xc000, 0xc000, tecmo_adpcm_start_w },
{ 0xd000, 0xd000, tecmo_adpcm_end_w },
{ 0xe000, 0xe000, tecmo_adpcm_trigger_w },
{ 0xf000, 0xf000, MWA_NOP }, /* NMI acknowledge? */
{ -1 } /* end of table */
};
INPUT_PORTS_START( rygar_input_ports )
PORT_START /* IN0 bits 0-3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )
PORT_START /* IN1 bits 0-3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START /* IN2 bits 0-3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
PORT_START /* IN3 bits 0-3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START /* IN4 bits 0-3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_START /* unused? */
PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START /* DSWA bit 0-3 */
PORT_DIPNAME( 0x03, 0x00, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x01, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x00, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x02, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x03, "1 Coin/3 Credits" )
PORT_DIPNAME( 0x0C, 0x00, "Coin B", IP_KEY_NONE )
PORT_DIPSETTING( 0x04, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x00, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x08, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x0C, "1 Coin/3 Credits" )
PORT_START /* DSWA bit 4-7 */
PORT_DIPNAME( 0x03, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x03, "2" )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x01, "4" )
PORT_DIPSETTING( 0x02, "5" )
PORT_DIPNAME( 0x04, 0x04, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x04, "Upright" )
PORT_DIPSETTING( 0x00, "Cocktail" )
PORT_DIPNAME( 0x08, 0x00, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x08, "On" )
PORT_START /* DSWB bit 0-3 */
PORT_DIPNAME( 0x03, 0x00, "Bonus Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "50000 200000 500000" )
PORT_DIPSETTING( 0x01, "100000 300000 600000" )
PORT_DIPSETTING( 0x02, "200000 500000" )
PORT_DIPSETTING( 0x03, "100000" )
PORT_DIPNAME( 0x04, 0x00, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x04, "On" )
PORT_DIPNAME( 0x08, 0x00, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x08, "On" )
PORT_START /* DSWB bit 4-7 */
PORT_DIPNAME( 0x03, 0x00, "Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Easy" )
PORT_DIPSETTING( 0x01, "Normal" )
PORT_DIPSETTING( 0x02, "Hard" )
PORT_DIPSETTING( 0x03, "Hardest" )
PORT_DIPNAME( 0x04, 0x00, "2P Can Start Anytime", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "No" )
PORT_DIPSETTING( 0x04, "Yes" )
PORT_DIPNAME( 0x08, 0x08, "Allow Continue", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "No" )
PORT_DIPSETTING( 0x08, "Yes" )
PORT_START /* unused? */
PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNKNOWN )
INPUT_PORTS_END
INPUT_PORTS_START( gemini_input_ports )
PORT_START /* IN0 bits 0-3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )
PORT_START /* IN1 bits 0-3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START /* IN2 bits 0-3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
PORT_START /* IN3 bits 0-3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START /* unused? */
PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START /* IN4 bits 0-3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_START /* DSWA bit 0-3 */
PORT_DIPNAME( 0x07, 0x00, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x06, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x00, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x07, "2 Coins/3 Credits" )
PORT_DIPSETTING( 0x01, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x02, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x03, "1 Coin/4 Credits" )
PORT_DIPSETTING( 0x04, "1 Coin/5 Credits" )
PORT_DIPSETTING( 0x05, "1 Coin/6 Credits" )
PORT_DIPNAME( 0x08, 0x00, "Final Round Continuation", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Round 6" )
PORT_DIPSETTING( 0x08, "Round 7" )
PORT_START /* DSWA bit 4-7 */
PORT_DIPNAME( 0x07, 0x00, "Coin B", IP_KEY_NONE )
PORT_DIPSETTING( 0x06, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x00, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x07, "2 Coins/3 Credits" )
PORT_DIPSETTING( 0x01, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x02, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x03, "1 Coin/4 Credits" )
PORT_DIPSETTING( 0x04, "1 Coin/5 Credits" )
PORT_DIPSETTING( 0x05, "1 Coin/6 Credits" )
PORT_DIPNAME( 0x08, 0x00, "Buy in During Final Round", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "No" )
PORT_DIPSETTING( 0x08, "Yes" )
PORT_START /* DSWB bit 0-3 */
PORT_DIPNAME( 0x03, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x03, "2" )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x01, "4" )
PORT_DIPSETTING( 0x02, "5" )
PORT_DIPNAME( 0x0c, 0x00, "Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Easy" )
PORT_DIPSETTING( 0x04, "Normal" )
PORT_DIPSETTING( 0x08, "Hard" )
PORT_DIPSETTING( 0x0c, "Hardest" )
PORT_START /* DSWB bit 4-7 */
PORT_DIPNAME( 0x07, 0x00, "Bonus Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "50000 200000" )
PORT_DIPSETTING( 0x01, "50000 300000" )
PORT_DIPSETTING( 0x02, "100000 500000" )
PORT_DIPSETTING( 0x03, "50000" )
PORT_DIPSETTING( 0x04, "100000" )
PORT_DIPSETTING( 0x05, "200000" )
PORT_DIPSETTING( 0x06, "300000" )
PORT_DIPSETTING( 0x07, "None" )
PORT_DIPNAME( 0x08, 0x00, "Demo Sounds", IP_KEY_NONE )
PORT_DIPSETTING( 0x08, "Off" )
PORT_DIPSETTING( 0x00, "On" )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -