📄 hyperspt.c
字号:
/***************************************************************************
Based on drivers from Juno First emulator by Chris Hardy (chrish@kcbbs.gen.nz)
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
#include "M6809/M6809.h"
extern unsigned char *hyperspt_scroll;
void hyperspt_flipscreen_w(int offset,int data);
void hyperspt_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
int hyperspt_vh_start(void);
void hyperspt_vh_stop(void);
void hyperspt_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void roadf_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
extern unsigned char *konami_dac;
void konami_sh_irqtrigger_w(int offset,int data);
int hyperspt_sh_timer_r(int offset);
void hyperspt_sound_w(int offset , int data);
/* these routines lurk in sndhrdw/trackfld.c */
extern struct VLM5030interface konami_vlm5030_interface;
extern struct SN76496interface konami_sn76496_interface;
extern struct DACinterface konami_dac_interface;
void konami_dac_w(int offset,int data);
void konami_SN76496_latch_w(int offset,int data);
void konami_SN76496_0_w(int offset,int data);
/* in machine/konami.c */
unsigned char KonamiDecode( unsigned char opcode, unsigned short address );
void hyperspt_init_machine(void)
{
/* Set optimization flags for M6809 */
m6809_Flags = M6809_FAST_S | M6809_FAST_U;
}
/* handle fake button for speed cheat */
static int konami_IN1_r(int offset)
{
int res;
static int cheat = 0;
static int bits[] = { 0xee, 0xff, 0xbb, 0xaa };
res = readinputport(1);
if ((res & 0x80) == 0)
{
res |= 0x55;
res &= bits[cheat];
cheat = (++cheat)%4;
}
return res;
}
static struct MemoryReadAddress hyperspt_readmem[] =
{
{ 0x1000, 0x10ff, MRA_RAM },
{ 0x1600, 0x1600, input_port_4_r }, /* DIP 2 */
{ 0x1680, 0x1680, input_port_0_r }, /* IO Coin */
{ 0x1681, 0x1681, konami_IN1_r }, /* P1 IO and handle fake button for cheating */
{ 0x1682, 0x1682, input_port_2_r }, /* P2 IO */
{ 0x1683, 0x1683, input_port_3_r }, /* DIP 1 */
{ 0x2000, 0x3fff, MRA_RAM },
{ 0x4000, 0xffff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryReadAddress roadf_readmem[] =
{
{ 0x1000, 0x10ff, MRA_RAM },
{ 0x1600, 0x1600, input_port_4_r }, /* DIP 2 */
{ 0x1680, 0x1680, input_port_0_r }, /* IO Coin */
{ 0x1681, 0x1681, input_port_1_r }, /* P1 IO */
{ 0x1682, 0x1682, input_port_2_r }, /* P2 IO */
{ 0x1683, 0x1683, input_port_3_r }, /* DIP 1 */
{ 0x2000, 0x3fff, MRA_RAM },
{ 0x4000, 0xffff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem[] =
{
{ 0x1000, 0x10bf, MWA_RAM, &spriteram, &spriteram_size },
{ 0x10C0, 0x10ff, MWA_RAM, &hyperspt_scroll }, /* Scroll amount */
{ 0x1400, 0x1400, watchdog_reset_w },
{ 0x1480, 0x1480, hyperspt_flipscreen_w },
{ 0x1481, 0x1481, konami_sh_irqtrigger_w }, /* cause interrupt on audio CPU */
{ 0x1483, 0x1484, coin_counter_w },
{ 0x1487, 0x1487, interrupt_enable_w }, /* Interrupt enable */
{ 0x1500, 0x1500, soundlatch_w },
{ 0x2000, 0x27ff, videoram_w, &videoram, &videoram_size },
{ 0x2800, 0x2fff, colorram_w, &colorram },
{ 0x3000, 0x3fff, MWA_RAM },
{ 0x4000, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
static struct MemoryReadAddress sound_readmem[] =
{
{ 0x0000, 0x3fff, MRA_ROM },
{ 0x4000, 0x4fff, MRA_RAM },
{ 0x6000, 0x6000, soundlatch_r },
{ 0x8000, 0x8000, hyperspt_sh_timer_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress sound_writemem[] =
{
{ 0x0000, 0x3fff, MWA_ROM },
{ 0x4000, 0x4fff, MWA_RAM },
{ 0xa000, 0xa000, VLM5030_data_w }, /* speech data */
{ 0xc000, 0xdfff, hyperspt_sound_w }, /* speech and output controll */
{ 0xe000, 0xe000, konami_dac_w, &konami_dac },
{ 0xe001, 0xe001, konami_SN76496_latch_w }, /* Loads the snd command into the snd latch */
{ 0xe002, 0xe002, konami_SN76496_0_w }, /* This address triggers the SN chip to read the data port. */
{ -1 } /* end of table */
};
INPUT_PORTS_START( hyperspt_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN4 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
/* Fake button to press buttons 1 and 3 impossibly fast. Handle via konami_IN1_r */
PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_CHEAT | IPF_PLAYER1, "Run Like Hell Cheat", IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0 )
PORT_START /* IN2 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 /*| IPF_COCKTAIL*/ )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 /*| IPF_COCKTAIL*/ )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 /*| IPF_COCKTAIL*/ )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER4 /*| IPF_COCKTAIL*/ )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 /*| IPF_COCKTAIL*/ )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 /*| IPF_COCKTAIL*/ )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* DSW0 */
PORT_DIPNAME( 0x0f, 0x0f, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x02, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x05, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x08, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x04, "3 Coins/2 Credits" )
PORT_DIPSETTING( 0x01, "4 Coins/3 Credits" )
PORT_DIPSETTING( 0x0f, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x03, "3 Coins/4 Credits" )
PORT_DIPSETTING( 0x07, "2 Coins/3 Credits" )
PORT_DIPSETTING( 0x0e, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x06, "2 Coins/5 Credits" )
PORT_DIPSETTING( 0x0d, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x0c, "1 Coin/4 Credits" )
PORT_DIPSETTING( 0x0b, "1 Coin/5 Credits" )
PORT_DIPSETTING( 0x0a, "1 Coin/6 Credits" )
PORT_DIPSETTING( 0x09, "1 Coin/7 Credits" )
PORT_DIPSETTING( 0x00, "Free Play" )
PORT_DIPNAME( 0xf0, 0xf0, "Coin B", IP_KEY_NONE )
PORT_DIPSETTING( 0x20, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x50, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x80, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x40, "3 Coins/2 Credits" )
PORT_DIPSETTING( 0x10, "4 Coins/3 Credits" )
PORT_DIPSETTING( 0xf0, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x30, "3 Coins/4 Credits" )
PORT_DIPSETTING( 0x70, "2 Coins/3 Credits" )
PORT_DIPSETTING( 0xe0, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x60, "2 Coins/5 Credits" )
PORT_DIPSETTING( 0xd0, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0xc0, "1 Coin/4 Credits" )
PORT_DIPSETTING( 0xb0, "1 Coin/5 Credits" )
PORT_DIPSETTING( 0xa0, "1 Coin/6 Credits" )
PORT_DIPSETTING( 0x90, "1 Coin/7 Credits" )
PORT_DIPSETTING( 0x00, "Disabled" )
/* 0x00 disables Coin 2. It still accepts coins and makes the sound, but
it doesn't give you any credit */
PORT_START /* DSW1 */
PORT_DIPNAME( 0x01, 0x00, "After Last Event", IP_KEY_NONE )
PORT_DIPSETTING( 0x01, "Game Over" )
PORT_DIPSETTING( 0x00, "Game Continues" )
PORT_DIPNAME( 0x02, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x02, "Cocktail" )
PORT_DIPNAME( 0x04, 0x00, "Demo Sounds", IP_KEY_NONE )
PORT_DIPSETTING( 0x04, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x08, 0x08, "World Records", IP_KEY_NONE )
PORT_DIPSETTING( 0x08, "Don't Erase" )
PORT_DIPSETTING( 0x00, "Erase on Reset" )
PORT_DIPNAME( 0xf0, 0xf0, "Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0xf0, "Easy 1" )
PORT_DIPSETTING( 0xe0, "Easy 2" )
PORT_DIPSETTING( 0xd0, "Easy 3" )
PORT_DIPSETTING( 0xc0, "Easy 4" )
PORT_DIPSETTING( 0xb0, "Normal 1" )
PORT_DIPSETTING( 0xa0, "Normal 2" )
PORT_DIPSETTING( 0x90, "Normal 3" )
PORT_DIPSETTING( 0x80, "Normal 4" )
PORT_DIPSETTING( 0x70, "Normal 5" )
PORT_DIPSETTING( 0x60, "Normal 6" )
PORT_DIPSETTING( 0x50, "Normal 7" )
PORT_DIPSETTING( 0x40, "Normal 8" )
PORT_DIPSETTING( 0x30, "Difficult 1" )
PORT_DIPSETTING( 0x20, "Difficult 2" )
PORT_DIPSETTING( 0x10, "Difficult 3" )
PORT_DIPSETTING( 0x00, "Difficult 4" )
INPUT_PORTS_END
INPUT_PORTS_START( roadf_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN4 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* IN2 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* the game doesn't boot if this is 1 */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* DSW0 */
PORT_DIPNAME( 0x0f, 0x0f, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x02, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x05, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x08, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x04, "3 Coins/2 Credits" )
PORT_DIPSETTING( 0x01, "4 Coins/3 Credits" )
PORT_DIPSETTING( 0x0f, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x03, "3 Coins/4 Credits" )
PORT_DIPSETTING( 0x07, "2 Coins/3 Credits" )
PORT_DIPSETTING( 0x0e, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x06, "2 Coins/5 Credits" )
PORT_DIPSETTING( 0x0d, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x0c, "1 Coin/4 Credits" )
PORT_DIPSETTING( 0x0b, "1 Coin/5 Credits" )
PORT_DIPSETTING( 0x0a, "1 Coin/6 Credits" )
PORT_DIPSETTING( 0x09, "1 Coin/7 Credits" )
PORT_DIPSETTING( 0x00, "Free Play" )
PORT_DIPNAME( 0xf0, 0xf0, "Coin B", IP_KEY_NONE )
PORT_DIPSETTING( 0x20, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x50, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x80, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x40, "3 Coins/2 Credits" )
PORT_DIPSETTING( 0x10, "4 Coins/3 Credits" )
PORT_DIPSETTING( 0xf0, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x30, "3 Coins/4 Credits" )
PORT_DIPSETTING( 0x70, "2 Coins/3 Credits" )
PORT_DIPSETTING( 0xe0, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x60, "2 Coins/5 Credits" )
PORT_DIPSETTING( 0xd0, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0xc0, "1 Coin/4 Credits" )
PORT_DIPSETTING( 0xb0, "1 Coin/5 Credits" )
PORT_DIPSETTING( 0xa0, "1 Coin/6 Credits" )
PORT_DIPSETTING( 0x90, "1 Coin/7 Credits" )
PORT_DIPSETTING( 0x00, "Disabled" )
/* 0x00 disables Coin 2. It still accepts coins and makes the sound, but
it doesn't give you any credit */
PORT_START /* DSW1 */
PORT_DIPNAME( 0x01, 0x00, "Allow Continue", IP_KEY_NONE )
PORT_DIPSETTING( 0x01, "No" )
PORT_DIPSETTING( 0x00, "Yes" )
PORT_DIPNAME( 0x06, 0x06, "Number of Opponents", IP_KEY_NONE )
PORT_DIPSETTING( 0x06, "Easy" )
PORT_DIPSETTING( 0x04, "Medium" )
PORT_DIPSETTING( 0x02, "Hard" )
PORT_DIPSETTING( 0x00, "Hardest" )
PORT_DIPNAME( 0x08, 0x08, "Speed of Opponents", IP_KEY_NONE )
PORT_DIPSETTING( 0x08, "Easy" )
PORT_DIPSETTING( 0x00, "Difficult" )
PORT_DIPNAME( 0x30, 0x30, "Fuel Consumption", IP_KEY_NONE )
PORT_DIPSETTING( 0x30, "Easy" )
PORT_DIPSETTING( 0x20, "Medium" )
PORT_DIPSETTING( 0x10, "Hard" )
PORT_DIPSETTING( 0x00, "Hardest" )
PORT_DIPNAME( 0x40, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x40, "Cocktail" )
PORT_DIPNAME( 0x80, 0x00, "Demo Sounds", IP_KEY_NONE )
PORT_DIPSETTING( 0x80, "Off" )
PORT_DIPSETTING( 0x00, "On" )
INPUT_PORTS_END
static struct GfxLayout hyperspt_charlayout =
{
8,8, /* 8*8 sprites */
1024, /* 1024 characters */
4, /* 4 bits per pixel */
{ 0x4000*8+4, 0x4000*8+0, 4, 0 },
{ 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
16*8 /* every sprite takes 64 consecutive bytes */
};
static struct GfxLayout hyperspt_spritelayout =
{
16,16, /* 16*16 sprites */
512, /* 512 sprites */
4, /* 4 bits per pixel */
{ 0x8000*8+4, 0x8000*8+0, 4, 0 },
{ 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 ,
32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8, },
64*8 /* every sprite takes 64 consecutive bytes */
};
static struct GfxDecodeInfo hyperspt_gfxdecodeinfo[] =
{
{ 1, 0x0000, &hyperspt_charlayout, 0, 16 },
{ 1, 0x8000, &hyperspt_spritelayout, 16*16, 16 },
{ -1 } /* end of array */
};
static struct GfxLayout roadf_charlayout =
{
8,8, /* 8*8 sprites */
1536, /* 1536 characters */
4, /* 4 bits per pixel */
{ 0x6000*8+4, 0x6000*8+0, 4, 0 },
{ 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
16*8 /* every sprite takes 64 consecutive bytes */
};
static struct GfxLayout roadf_spritelayout =
{
16,16, /* 16*16 sprites */
256, /* 256 sprites */
4, /* 4 bits per pixel */
{ 0x4000*8+4, 0x4000*8+0, 4, 0 },
{ 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 ,
32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8, },
64*8 /* every sprite takes 64 consecutive bytes */
};
static struct GfxDecodeInfo roadf_gfxdecodeinfo[] =
{
{ 1, 0x0000, &roadf_charlayout, 0, 16 },
{ 1, 0xc000, &roadf_spritelayout, 16*16, 16 },
{ -1 } /* end of array */
};
/* filename for hyper sports sample files */
static const char *hyperspt_sample_names[] =
{
"00.sam","01.sam","02.sam","03.sam","04.sam","05.sam","06.sam","07.sam",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -