📄 aerofgt.c
字号:
/***************************************************************************
Notes:
- Sprite zoom is probably not 100% accurate (check the table in vidhrdw).
In pspikes, the zooming text during attract mode is horrible.
- Aero Fighters has graphics for different tiles (Sonic Wings, The Final War)
but I haven't found a way to display them - different program, maybe.
- Turbo Force bg1 tile maps are screwed. I have to offset the char code by
0x9c to get the title screen right...
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
#include "Z80/z80.h"
extern unsigned char *aerofgt_rasterram;
extern unsigned char *aerofgt_bg1videoram,*aerofgt_bg2videoram;
extern int aerofgt_bg1videoram_size,aerofgt_bg2videoram_size;
int aerofgt_rasterram_r(int offset);
void aerofgt_rasterram_w(int offset,int data);
int aerofgt_spriteram_2_r(int offset);
void aerofgt_spriteram_2_w(int offset,int data);
int aerofgt_bg1videoram_r(int offset);
int aerofgt_bg2videoram_r(int offset);
void aerofgt_bg1videoram_w(int offset,int data);
void aerofgt_bg2videoram_w(int offset,int data);
void pspikes_gfxbank_w(int offset,int data);
void turbofrc_gfxbank_w(int offset,int data);
void aerofgt_gfxbank_w(int offset,int data);
void aerofgt_bg1scrolly_w(int offset,int data);
void aerofgt_bg2scrolly_w(int offset,int data);
void turbofrc_bg2scrollx_w(int offset,int data);
void pspikes_palette_bank_w(int offset,int data);
int pspikes_vh_start(void);
int turbofrc_vh_start(void);
int aerofgt_vh_start(void);
void aerofgt_vh_stop(void);
void pspikes_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void turbofrc_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void aerofgt_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
static unsigned char *aerofgt_workram;
static int aerofgt_workram_r(int offset)
{
return READ_WORD(&aerofgt_workram[offset]);
}
static void aerofgt_workram_w(int offset,int data)
{
COMBINE_WORD_MEM(&aerofgt_workram[offset],data);
}
static int pending_command;
static void sound_command_w(int offset,int data)
{
pending_command = 1;
soundlatch_w(offset,data & 0xff);
cpu_cause_interrupt(1,Z80_NMI_INT);
}
static void turbofrc_sound_command_w(int offset,int data)
{
pending_command = 1;
soundlatch_w(offset,(data >> 8) & 0xff);
cpu_cause_interrupt(1,Z80_NMI_INT);
}
static int pending_command_r(int offset)
{
return pending_command;
}
static void pending_command_clear_w(int offset,int data)
{
pending_command = 0;
}
static void aerofgt_sh_bankswitch_w(int offset,int data)
{
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[1].memory_region];
int bankaddress;
bankaddress = 0x10000 + (data & 0x03) * 0x8000;
cpu_setbank(1,&RAM[bankaddress]);
}
static struct MemoryReadAddress pspikes_readmem[] =
{
{ 0x000000, 0x03ffff, MRA_ROM },
{ 0x100000, 0x10ffff, MRA_BANK6 },
{ 0xff8000, 0xff8fff, aerofgt_bg1videoram_r },
{ 0xffd000, 0xffdfff, aerofgt_rasterram_r }, /* different from aero */
{ 0xffe000, 0xffefff, paletteram_word_r },
{ 0xfff000, 0xfff001, input_port_0_r },
{ 0xfff002, 0xfff003, input_port_1_r },
{ 0xfff004, 0xfff005, input_port_2_r },
{ 0xfff006, 0xfff007, pending_command_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress pspikes_writemem[] =
{
{ 0x000000, 0x03ffff, MWA_ROM },
{ 0x100000, 0x10ffff, MWA_BANK6 }, /* work RAM */
{ 0x200000, 0x203fff, MWA_BANK4, &spriteram },
{ 0xff8000, 0xff8fff, aerofgt_bg1videoram_w, &aerofgt_bg1videoram, &aerofgt_bg1videoram_size },
{ 0xffc000, 0xffc3ff, aerofgt_spriteram_2_w, &spriteram_2, &spriteram_2_size }, /* different from aero */
{ 0xffd000, 0xffdfff, aerofgt_rasterram_w, &aerofgt_rasterram }, /* bg1 scroll registers */
{ 0xffe000, 0xffefff, paletteram_xRRRRRGGGGGBBBBB_word_w, &paletteram },
{ 0xfff000, 0xfff001, pspikes_palette_bank_w },
{ 0xfff002, 0xfff003, pspikes_gfxbank_w }, /* different from aero */
{ 0xfff004, 0xfff005, aerofgt_bg1scrolly_w },
{ 0xfff006, 0xfff007, sound_command_w },
{ -1 } /* end of table */
};
static struct MemoryReadAddress turbofrc_readmem[] =
{
{ 0x000000, 0x0bffff, MRA_ROM },
{ 0x0c0000, 0x0cffff, MRA_BANK6 },
{ 0x0d0000, 0x0d1fff, aerofgt_bg1videoram_r },
{ 0x0d2000, 0x0d3fff, aerofgt_bg2videoram_r },
{ 0x0e0000, 0x0e7fff, MRA_BANK4 },
{ 0x0f8000, 0x0fbfff, aerofgt_workram_r }, /* work RAM */
{ 0xff8000, 0xffbfff, aerofgt_workram_r }, /* mirror */
{ 0x0fc000, 0x0fc7ff, aerofgt_spriteram_2_r }, /* different from aero */
{ 0xffc000, 0xffc7ff, aerofgt_spriteram_2_r }, /* mirror */
{ 0x0fd000, 0x0fdfff, aerofgt_rasterram_r }, /* different from aero */
{ 0xffd000, 0xffdfff, aerofgt_rasterram_r }, /* mirror */
{ 0x0fe000, 0x0fe7ff, paletteram_word_r },
{ 0xfff000, 0xfff001, input_port_0_r },
{ 0xfff002, 0xfff003, input_port_1_r },
{ 0xfff004, 0xfff005, input_port_2_r },
{ 0xfff006, 0xfff007, pending_command_r },
{ 0xfff008, 0xfff009, input_port_3_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress turbofrc_writemem[] =
{
{ 0x000000, 0x0bffff, MWA_ROM },
{ 0x0c0000, 0x0cffff, MWA_BANK6 }, /* work RAM */
{ 0x0d0000, 0x0d1fff, aerofgt_bg1videoram_w, &aerofgt_bg1videoram, &aerofgt_bg1videoram_size },
{ 0x0d2000, 0x0d3fff, aerofgt_bg2videoram_w, &aerofgt_bg2videoram, &aerofgt_bg2videoram_size },
{ 0x0e0000, 0x0e7fff, MWA_BANK4, &spriteram },
{ 0x0f8000, 0x0fbfff, aerofgt_workram_w, &aerofgt_workram }, /* work RAM */
{ 0xff8000, 0xffbfff, aerofgt_workram_w }, /* mirror */
{ 0x0fc000, 0x0fc7ff, aerofgt_spriteram_2_w, &spriteram_2, &spriteram_2_size }, /* different from aero */
{ 0xffc000, 0xffc7ff, aerofgt_spriteram_2_w }, /* mirror */
{ 0x0fd000, 0x0fdfff, aerofgt_rasterram_w, &aerofgt_rasterram }, /* bg1 scroll registers */
{ 0xffd000, 0xffdfff, aerofgt_rasterram_w }, /* mirror */
{ 0x0fe000, 0x0fe7ff, paletteram_xRRRRRGGGGGBBBBB_word_w, &paletteram },
{ 0xfff002, 0xfff003, aerofgt_bg1scrolly_w },
{ 0xfff004, 0xfff005, turbofrc_bg2scrollx_w },
{ 0xfff006, 0xfff007, aerofgt_bg2scrolly_w },
{ 0xfff008, 0xfff00b, turbofrc_gfxbank_w }, /* different from aero */
{ 0xfff00c, 0xfff00d, MWA_NOP }, /* related to bg2 (written together with the scroll registers) */
{ 0xfff00e, 0xfff00f, turbofrc_sound_command_w },
{ -1 } /* end of table */
};
static struct MemoryReadAddress aerofgt_readmem[] =
{
{ 0x000000, 0x07ffff, MRA_ROM },
{ 0x1a0000, 0x1a07ff, paletteram_word_r },
{ 0x1b0000, 0x1b07ff, aerofgt_rasterram_r },
{ 0x1b0800, 0x1b0801, MRA_NOP }, /* ??? */
{ 0x1b0ff0, 0x1b0fff, MRA_BANK7 }, /* stack area during boot */
{ 0x1b2000, 0x1b3fff, aerofgt_bg1videoram_r },
{ 0x1b4000, 0x1b5fff, aerofgt_bg2videoram_r },
{ 0x1c0000, 0x1c7fff, MRA_BANK4 },
{ 0x1d0000, 0x1d1fff, aerofgt_spriteram_2_r },
{ 0xfef000, 0xffefff, aerofgt_workram_r }, /* work RAM */
{ 0xffffa0, 0xffffa1, input_port_0_r },
{ 0xffffa2, 0xffffa3, input_port_1_r },
{ 0xffffa4, 0xffffa5, input_port_2_r },
{ 0xffffa6, 0xffffa7, input_port_3_r },
{ 0xffffa8, 0xffffa9, input_port_4_r },
{ 0xffffac, 0xffffad, pending_command_r },
{ 0xffffae, 0xffffaf, input_port_5_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress aerofgt_writemem[] =
{
{ 0x000000, 0x07ffff, MWA_ROM },
{ 0x1a0000, 0x1a07ff, paletteram_xRRRRRGGGGGBBBBB_word_w, &paletteram },
{ 0x1b0000, 0x1b07ff, aerofgt_rasterram_w, &aerofgt_rasterram }, /* used only for the scroll registers */
{ 0x1b0800, 0x1b0801, MWA_NOP }, /* ??? */
{ 0x1b0ff0, 0x1b0fff, MWA_BANK7 }, /* stack area during boot */
{ 0x1b2000, 0x1b3fff, aerofgt_bg1videoram_w, &aerofgt_bg1videoram, &aerofgt_bg1videoram_size },
{ 0x1b4000, 0x1b5fff, aerofgt_bg2videoram_w, &aerofgt_bg2videoram, &aerofgt_bg2videoram_size },
{ 0x1c0000, 0x1c7fff, MWA_BANK4, &spriteram },
{ 0x1d0000, 0x1d1fff, aerofgt_spriteram_2_w, &spriteram_2, &spriteram_2_size },
{ 0xfef000, 0xffefff, aerofgt_workram_w, &aerofgt_workram }, /* work RAM */
{ 0xffff80, 0xffff87, aerofgt_gfxbank_w },
{ 0xffff88, 0xffff89, aerofgt_bg1scrolly_w }, /* + something else in the top byte */
{ 0xffff90, 0xffff91, aerofgt_bg2scrolly_w }, /* + something else in the top byte */
{ 0xffffac, 0xffffad, MWA_NOP }, /* ??? */
{ 0xffffc0, 0xffffc1, sound_command_w },
{ -1 } /* end of table */
};
static struct MemoryReadAddress sound_readmem[] =
{
{ 0x0000, 0x77ff, MRA_ROM },
{ 0x7800, 0x7fff, MRA_RAM },
{ 0x8000, 0xffff, MRA_BANK1 },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress sound_writemem[] =
{
{ 0x0000, 0x77ff, MWA_ROM },
{ 0x7800, 0x7fff, MWA_RAM },
{ 0x8000, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
static struct IOReadPort turbofrc_sound_readport[] =
{
{ 0x14, 0x14, soundlatch_r },
{ 0x18, 0x18, YM2610_status_port_0_A_r },
{ 0x1a, 0x1a, YM2610_status_port_0_B_r },
{ -1 } /* end of table */
};
static struct IOWritePort turbofrc_sound_writeport[] =
{
{ 0x00, 0x00, aerofgt_sh_bankswitch_w },
{ 0x14, 0x14, pending_command_clear_w },
{ 0x18, 0x18, YM2610_control_port_0_A_w },
{ 0x19, 0x19, YM2610_data_port_0_A_w },
{ 0x1a, 0x1a, YM2610_control_port_0_B_w },
{ 0x1b, 0x1b, YM2610_data_port_0_B_w },
{ -1 } /* end of table */
};
static struct IOReadPort aerofgt_sound_readport[] =
{
{ 0x00, 0x00, YM2610_status_port_0_A_r },
{ 0x02, 0x02, YM2610_status_port_0_B_r },
{ 0x0c, 0x0c, soundlatch_r },
{ -1 } /* end of table */
};
static struct IOWritePort aerofgt_sound_writeport[] =
{
{ 0x00, 0x00, YM2610_control_port_0_A_w },
{ 0x01, 0x01, YM2610_data_port_0_A_w },
{ 0x02, 0x02, YM2610_control_port_0_B_w },
{ 0x03, 0x03, YM2610_data_port_0_B_w },
{ 0x04, 0x04, aerofgt_sh_bankswitch_w },
{ 0x08, 0x08, pending_command_clear_w },
{ -1 } /* end of table */
};
INPUT_PORTS_START( pspikes_input_ports )
PORT_START
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START
PORT_DIPNAME( 0x0003, 0x0003, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x0001, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x0002, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x0003, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x0000, "1 Coin/2 Credits" )
PORT_DIPNAME( 0x000c, 0x000c, "Coin B", IP_KEY_NONE )
PORT_DIPSETTING( 0x0004, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x0008, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x000c, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x0000, "1 Coin/2 Credits" )
PORT_DIPNAME( 0x0010, 0x0010, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x0010, "Off" )
PORT_DIPSETTING( 0x0000, "On" )
PORT_DIPNAME( 0x0020, 0x0020, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x0020, "Off" )
PORT_DIPSETTING( 0x0000, "On" )
PORT_DIPNAME( 0x0040, 0x0000, "Demo Sound", IP_KEY_NONE )
PORT_DIPSETTING( 0x0040, "Off" )
PORT_DIPSETTING( 0x0000, "On" )
PORT_DIPNAME( 0x0080, 0x0080, "Flip Screen", IP_KEY_NONE )
PORT_DIPSETTING( 0x0080, "Off" )
PORT_DIPSETTING( 0x0000, "On" )
PORT_BITX( 0x0100, 0x0100, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Service Mode", OSD_KEY_F2, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x0100, "Off" )
PORT_DIPSETTING( 0x0000, "On" )
PORT_DIPNAME( 0x0600, 0x0600, "Initial Score", IP_KEY_NONE )
PORT_DIPSETTING( 0x0600, "12-12" )
PORT_DIPSETTING( 0x0400, "11-11" )
PORT_DIPSETTING( 0x0200, "11-12" )
PORT_DIPSETTING( 0x0000, "10-12" )
PORT_DIPNAME( 0x0800, 0x0800, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x0800, "Off" )
PORT_DIPSETTING( 0x0000, "On" )
PORT_DIPNAME( 0x1000, 0x1000, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x1000, "Off" )
PORT_DIPSETTING( 0x0000, "On" )
PORT_DIPNAME( 0x2000, 0x2000, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x2000, "Off" )
PORT_DIPSETTING( 0x0000, "On" )
PORT_DIPNAME( 0x4000, 0x4000, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x4000, "Off" )
PORT_DIPSETTING( 0x0000, "On" )
PORT_DIPNAME( 0x8000, 0x8000, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x8000, "Off" )
PORT_DIPSETTING( 0x0000, "On" )
INPUT_PORTS_END
INPUT_PORTS_START( turbofrc_input_ports )
PORT_START
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_SERVICE ) /* "TEST" */
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_TILT )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN4 )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_START
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -