📄 blktiger.c
字号:
/***************************************************************************
Black Tiger
Driver provided by Paul Leaman
Thanks to Ishmair for providing information about the screen
layout on level 3.
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
#include "Z80/Z80.h"
extern unsigned char *blktiger_backgroundram;
extern unsigned char *blktiger_backgroundattribram;
extern int blktiger_backgroundram_size;
extern unsigned char *blktiger_palette_bank;
extern unsigned char *blktiger_screen_layout;
void blktiger_palette_bank_w(int offset,int data);
void blktiger_screen_layout_w(int offset,int data);
int blktiger_background_r(int offset);
void blktiger_background_w(int offset,int data);
void blktiger_video_control_w(int offset,int data);
void blktiger_video_enable_w(int offset,int data);
void blktiger_scrollbank_w(int offset,int data);
void blktiger_scrollx_w(int offset,int data);
void blktiger_scrolly_w(int offset,int data);
int blktiger_interrupt(void);
int blktiger_vh_start(void);
void blktiger_vh_stop(void);
void blktiger_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
/* this is a protection check. The game crashes (thru a jump to 0x8000) */
/* if a read from this address doesn't return the value it expects. */
static int blktiger_protection_r(int offset)
{
Z80_Regs regs;
Z80_GetRegs(®s);
#ifndef USE_DRZ80 /* FRANXIS 01-09-2005 */
return regs.DE.B.h;
#else
return (regs.regs.Z80DE>>24)&0x0F;
#endif
}
static void blktiger_bankswitch_w(int offset,int data)
{
int bankaddress;
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
bankaddress = 0x10000 + (data & 0x0f) * 0x4000;
cpu_setbank(1,&RAM[bankaddress]);
}
static struct MemoryReadAddress readmem[] =
{
{ 0x0000, 0x7fff, MRA_ROM },
{ 0x8000, 0xbfff, MRA_BANK1 },
{ 0xc000, 0xcfff, blktiger_background_r },
{ 0xd000, 0xffff, MRA_RAM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem[] =
{
{ 0x0000, 0xbfff, MWA_ROM },
{ 0xc000, 0xcfff, blktiger_background_w, &blktiger_backgroundram, &blktiger_backgroundram_size },
{ 0xd000, 0xd3ff, videoram_w, &videoram, &videoram_size },
{ 0xd400, 0xd7ff, colorram_w, &colorram },
{ 0xd800, 0xdbff, paletteram_xxxxBBBBRRRRGGGG_split1_w, &paletteram },
{ 0xdc00, 0xdfff, paletteram_xxxxBBBBRRRRGGGG_split2_w, &paletteram_2 },
{ 0xe000, 0xfdff, MWA_RAM },
{ 0xfe00, 0xffff, MWA_RAM, &spriteram, &spriteram_size },
{ -1 } /* end of table */
};
static struct IOReadPort readport[] =
{
{ 0x00, 0x00, input_port_0_r },
{ 0x01, 0x01, input_port_1_r },
{ 0x02, 0x02, input_port_2_r },
{ 0x03, 0x03, input_port_3_r },
{ 0x04, 0x04, input_port_4_r },
{ 0x05, 0x05, input_port_5_r },
{ 0x07, 0x07, blktiger_protection_r }, /*DPS 980118*/
{ -1 } /* end of table */
};
static struct IOWritePort writeport[] =
{
{ 0x00, 0x00, soundlatch_w },
{ 0x01, 0x01, blktiger_bankswitch_w },
{ 0x04, 0x04, blktiger_video_control_w },
{ 0x06, 0x06, watchdog_reset_w },
{ 0x07, 0x07, IOWP_NOP }, /* Software protection (7) */
{ 0x08, 0x09, blktiger_scrollx_w },
{ 0x0a, 0x0b, blktiger_scrolly_w },
{ 0x0c, 0x0c, blktiger_video_enable_w },
{ 0x0d, 0x0d, blktiger_scrollbank_w }, /* Scroll ram bank register */
{ 0x0e, 0x0e, blktiger_screen_layout_w },/* Video scrolling layout */
#if 0
{ 0x03, 0x03, IOWP_NOP }, /* Unknown port 3 */
#endif
{ -1 } /* end of table */
};
static struct MemoryReadAddress sound_readmem[] =
{
{ 0x0000, 0x7fff, MRA_ROM },
{ 0xc000, 0xc7ff, MRA_RAM },
{ 0xc800, 0xc800, soundlatch_r },
{ 0xe000, 0xe000, YM2203_status_port_0_r },
{ 0xe001, 0xe001, YM2203_read_port_0_r },
{ 0xe002, 0xe002, YM2203_status_port_1_r },
{ 0xe003, 0xe003, YM2203_read_port_1_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress sound_writemem[] =
{
{ 0x0000, 0x7fff, MWA_ROM },
{ 0xc000, 0xc7ff, MWA_RAM },
{ 0xe000, 0xe000, YM2203_control_port_0_w },
{ 0xe001, 0xe001, YM2203_write_port_0_w },
{ 0xe002, 0xe002, YM2203_control_port_1_w },
{ 0xe003, 0xe003, YM2203_write_port_1_w },
{ -1 } /* end of table */
};
INPUT_PORTS_START( input_ports )
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_UNKNOWN ) /* probably unused */
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | 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 ) /* probably unused */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_START /* IN2 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | 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_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_START /* DSW0 */
PORT_DIPNAME( 0x07, 0x07, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x01, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x02, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x07, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x06, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x05, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x04, "1 Coin/4 Credits" )
PORT_DIPSETTING( 0x03, "1 Coin/5 Credits" )
PORT_DIPNAME( 0x38, 0x38, "Coin B", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x08, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x10, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x38, "1 Coin/1 Credit" )
PORT_DIPSETTING( 0x30, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x28, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x20, "1 Coin/4 Credits" )
PORT_DIPSETTING( 0x18, "1 Coin/5 Credits" )
PORT_DIPNAME( 0x40, 0x40, "Flip Screen", IP_KEY_NONE )
PORT_DIPSETTING( 0x40, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_BITX( 0x80, 0x80, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Service Mode", OSD_KEY_F2, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x80, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_START /* DSW1 */
PORT_DIPNAME( 0x03, 0x03, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x02, "2" )
PORT_DIPSETTING( 0x03, "3" )
PORT_DIPSETTING( 0x01, "5" )
PORT_DIPSETTING( 0x00, "7")
PORT_DIPNAME( 0x1c, 0x1c, "Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0x1c, "1 (Easiest)")
PORT_DIPSETTING( 0x18, "2" )
PORT_DIPSETTING( 0x14, "3" )
PORT_DIPSETTING( 0x10, "4" )
PORT_DIPSETTING( 0x0c, "5 (Normal)" )
PORT_DIPSETTING( 0x08, "6" )
PORT_DIPSETTING( 0x04, "7" )
PORT_DIPSETTING( 0x00, "8 (Hardest)" )
PORT_DIPNAME( 0x20, 0x20, "Demo Sounds", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x20, "On" )
PORT_DIPNAME( 0x40, 0x40, "Allow Continue", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "No" )
PORT_DIPSETTING( 0x40, "Yes" )
PORT_DIPNAME( 0x80, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x80, "Cocktail" )
PORT_START
PORT_DIPNAME( 0x01, 0x01, "Freeze", IP_KEY_NONE ) /* could be VBLANK */
PORT_DIPSETTING( 0x01, "Off" )
PORT_DIPSETTING( 0x00, "On" )
INPUT_PORTS_END
static struct GfxLayout charlayout =
{
8,8, /* 8*8 characters */
2048, /* 2048 characters */
2, /* 2 bits per pixel */
{ 4, 0 },
{ 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3 },
{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
16*8 /* every char takes 16 consecutive bytes */
};
static struct GfxLayout spritelayout =
{
16,16, /* 16*16 sprites */
2048, /* 2048 sprites */
4, /* 4 bits per pixel */
{ 0x20000*8+4, 0x20000*8+0, 4, 0 },
{ 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3,
32*8+0, 32*8+1, 32*8+2, 32*8+3, 33*8+0, 33*8+1, 33*8+2, 33*8+3 },
{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
64*8 /* every sprite takes 64 consecutive bytes */
};
static struct GfxDecodeInfo gfxdecodeinfo[] =
{
/* start pointer colour start number of colours */
{ 1, 0x00000, &charlayout, 768, 32 }, /* colors 768 - 895 */
{ 1, 0x10000, &spritelayout, 0, 16 }, /* colors 0 - 255 */
{ 1, 0x50000, &spritelayout, 512, 8 }, /* colors 512 - 639 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -