📄 tnzs.c
字号:
/***************************************************************************
The New Zealand Story driver, used for tnzs & tnzs2.
TO-DO: - Find out how the hardware credit-counter works
- Fix problem with sprites and tiles being a few pixels out when the
screen is flipped.
13/6/1998: - Hi-score saving/loading for tnzs & tnzs2, by Santeri Saarimaa
****************************************************************************
The New Zealand Story memory map (preliminary)
CPU #1
0000-7fff ROM
8000-bfff banked - banks 0-1 RAM; banks 2-7 ROM
c000-dfff object RAM, including:
c000-c1ff sprites (code, low byte)
c200-c3ff sprites (x-coord, low byte)
c400-c5ff tiles (code, low byte)
d000-d1ff sprites (code, high byte)
d200-d3ff sprites (x-coord and colour, high byte)
d400-d5ff tiles (code, high byte)
d600-d7ff tiles (colour)
e000-efff RAM shared with CPU #2
f000-ffff VDC RAM, including:
f000-f1ff sprites (y-coord)
f200-f2ff scrolling info
f300-f301 vdc controller
f302-f303 scroll x-coords (high bits)
f600 bankswitch
f800-fbff palette
CPU #2
0000-7fff ROM
8000-9fff banked ROM
a000 bankswitch
b000-b001 YM2203 interface (with DIPs on YM2203 ports)
c000-c001 input ports (and coin counter)
e000-efff RAM shared with CPU #1
f000-f003 ???
****************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
#include "Z80/Z80.h"
/* prototypes for functions in ../machine/tnzs.c */
unsigned char *tnzs_objram, *tnzs_workram;
unsigned char *tnzs_vdcram, *tnzs_scrollram;
void tnzs_init_machine(void);
int tnzs_inputport_r(int offset);
int tnzs_workram_r(int offset);
void tnzs_inputport_w(int offset, int data);
void tnzs_workram_w(int offset, int data);
void tnzs_bankswitch_w(int offset, int data);
void tnzs_bankswitch1_w(int offset, int data);
void tnzs_sound_command_w(int offset, int data)
{
}
int tnzs_interrupt(void) { return 0; }
/* prototypes for functions in ../vidhrdw/tnzs.c */
int tnzs_vh_start(void);
void tnzs_vh_stop(void);
void tnzs_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
static struct MemoryReadAddress readmem[] =
{
{ 0x0000, 0x7fff, MRA_ROM },
{ 0x8000, 0xbfff, MRA_BANK1 }, /* BANK RAM */
{ 0xc000, 0xdfff, MRA_RAM },
{ 0xe000, 0xefff, MRA_RAM }, /* WORK RAM - shared with audio CPU */
{ 0xf000, 0xf1ff, MRA_RAM }, /* VDC RAM */
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem[] =
{
{ 0x0000, 0x7fff, MWA_ROM },
/* { 0xef10, 0xef10, tnzs_sound_command_w }, */
{ 0x8000, 0xbfff, MWA_BANK1 },
{ 0xc000, 0xdfff, MWA_RAM, &tnzs_objram },
{ 0xe000, 0xefff, MWA_RAM, &tnzs_workram }, /* WORK RAM - shared with audio CPU */
{ 0xf000, 0xf1ff, MWA_RAM, &tnzs_vdcram },
{ 0xf200, 0xf3ff, MWA_RAM, &tnzs_scrollram }, /* scrolling info */
{ 0xf600, 0xf600, tnzs_bankswitch_w },
{ 0xf800, 0xfbff, paletteram_xRRRRRGGGGGBBBBB_w, &paletteram },
{ -1 } /* end of table */
};
static struct MemoryReadAddress readmem1[] =
{
{ 0x0000, 0x7fff, MRA_ROM },
{ 0x8000, 0x9fff, MRA_BANK2 },
{ 0xb000, 0xb000, YM2203_status_port_0_r },
{ 0xb001, 0xb001, YM2203_read_port_0_r },
{ 0xc000, 0xc001, tnzs_inputport_r},
{ 0xd000, 0xdfff, MRA_RAM },
{ 0xe000, 0xefff, tnzs_workram_r },
{ 0xf000, 0xf003, MRA_RAM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem1[] =
{
{ 0x0000, 0x9fff, MWA_ROM },
{ 0xa000, 0xa000, tnzs_bankswitch1_w },
{ 0xb000, 0xb000, YM2203_control_port_0_w },
{ 0xb001, 0xb001, YM2203_write_port_0_w },
{ 0xc000, 0xc001, tnzs_inputport_w },
{ 0xd000, 0xdfff, MWA_RAM },
{ 0xe000, 0xefff, tnzs_workram_w },
{ -1 } /* end of table */
};
INPUT_PORTS_START( tnzs_input_ports )
PORT_START /* IN0 - number of credits??? */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_PLAYER2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START1 )
PORT_START /* IN2 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* IN3 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* IN4 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* IN5 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_PLAYER2 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_PLAYER2 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_PLAYER2 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
/* DIP switch settings supplied by Greg Best <gregbest98@hotmail.com> */
PORT_START /* DSW A - ef0e */
PORT_DIPNAME( 0x01, 0x01, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x01, "Cocktail" )
PORT_DIPNAME( 0x02, 0x02, "Flip Screen", IP_KEY_NONE )
PORT_DIPSETTING( 0x02, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_BITX( 0x04, 0x04, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Service Mode", OSD_KEY_F2, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x04, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) /* Always off */
PORT_DIPNAME( 0x30, 0x30, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x10, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x20, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x30, "1 Coin/1 Credit" )
PORT_DIPNAME( 0xc0, 0xc0, "Coin B", IP_KEY_NONE )
PORT_DIPSETTING( 0xc0, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x80, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x40, "1 Coin/4 Credits" )
PORT_DIPSETTING( 0x00, "1 Coin/6 Credits" )
PORT_START /* DSW B - ef0f */
PORT_DIPNAME( 0x03, 0x03, "Difficulty", IP_KEY_NONE)
PORT_DIPSETTING( 0x02, "Easy" )
PORT_DIPSETTING( 0x03, "Medium" )
PORT_DIPSETTING( 0x01, "Hard" )
PORT_DIPSETTING( 0x00, "Hardest" )
PORT_DIPNAME( 0x0c, 0x0c, "Bonus Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "50000 150000" )
PORT_DIPSETTING( 0x0c, "70000 200000" )
PORT_DIPSETTING( 0x04, "100000 250000" )
PORT_DIPSETTING( 0x08, "200000 300000" )
PORT_DIPNAME( 0x30, 0x30, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x20, "2" )
PORT_DIPSETTING( 0x30, "3" )
PORT_DIPSETTING( 0x00, "4" )
PORT_DIPSETTING( 0x10, "5" )
PORT_DIPNAME( 0x40, 0x40, "Allow Continue", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "No" )
PORT_DIPSETTING( 0x40, "Yes" )
PORT_DIPNAME( 0x80, 0x80, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x80, "Off" )
PORT_DIPSETTING( 0x00, "On" )
INPUT_PORTS_END
static struct GfxLayout charlayout =
{
16,16, /* the characters are 16x16 pixels */
0x100 * 32,
4, /* 4 bits per pixel */
{ 0xc0000*8, 0x80000*8, 0x40000*8, 0x00000*8 },
{ 0, 1, 2, 3, 4, 5, 6, 7, 64, 65, 66, 67, 68, 69, 70, 71 },
{ 0, 8, 16, 24, 32, 40, 48, 56, 128, 136, 144, 152, 160, 168, 176, 184},
32*8 /* every char takes 32 bytes in four ROMs */
};
static struct GfxDecodeInfo gfxdecodeinfo[] =
{
{ 1, 0x00000, &charlayout, 0, 32 },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -