📄 srumbler.c
字号:
/***************************************************************************
Speed Rumbler
Driver provided by Paul Leaman
M6809 for game, Z80 and YM-2203 for sound.
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
#include "M6809/m6809.h"
extern unsigned char *srumbler_backgroundram;
extern int srumbler_backgroundram_size;
extern unsigned char *srumbler_scrollx;
extern unsigned char *srumbler_scrolly;
void srumbler_bankswitch_w(int offset,int data);
void srumbler_background_w(int offset,int data);
void srumbler_4009_w(int offset,int data);
int srumbler_interrupt(void);
int srumbler_vh_start(void);
void srumbler_vh_stop(void);
void srumbler_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void srumbler_bankswitch_w(int offset,int data)
{
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
cpu_setbank (1, &RAM[0x10000+(data&0x0f)*0x9000]);
}
int srumbler_interrupt(void)
{
if (cpu_getiloops()==0)
{
return interrupt();
}
else
{
return M6809_INT_FIRQ;
}
}
static struct MemoryReadAddress readmem[] =
{
{ 0x0000, 0x3fff, MRA_RAM }, /* RAM (of 1 sort or another) */
{ 0x4008, 0x4008, input_port_0_r },
{ 0x4009, 0x4009, input_port_1_r },
{ 0x400a, 0x400a, input_port_2_r },
{ 0x400b, 0x400b, input_port_3_r },
{ 0x400c, 0x400c, input_port_4_r },
{ 0x5000, 0xdfff, MRA_BANK1}, /* Banked ROM */
{ 0xe000, 0xffff, MRA_ROM }, /* ROM */
{ -1 } /* end of table */
};
/*
The "scroll test" routine on the test screen appears to overflow and write
over the control registers (0x4000-0x4080) when it clears the screen.
This doesn't affect anything since it happens to write the correct value
to the page register.
Ignore the warnings about writing to unmapped memory.
*/
static struct MemoryWriteAddress writemem[] =
{
{ 0x0000, 0x1dff, MWA_RAM },
{ 0x1e00, 0x1fff, MWA_RAM, &spriteram, &spriteram_size },
{ 0x2000, 0x3fff, srumbler_background_w, &srumbler_backgroundram, &srumbler_backgroundram_size },
{ 0x4008, 0x4008, srumbler_bankswitch_w},
{ 0x4009, 0x4009, srumbler_4009_w},
{ 0x400a, 0x400b, MWA_RAM, &srumbler_scrollx},
{ 0x400c, 0x400d, MWA_RAM, &srumbler_scrolly},
{ 0x400e, 0x400e, soundlatch_w},
{ 0x5000, 0x5fff, videoram_w, &videoram, &videoram_size },
{ 0x6000, 0x6fff, MWA_RAM }, /* Video RAM 2 ??? (not used) */
{ 0x7100, 0x73ff, paletteram_RRRRGGGGBBBBxxxx_swap_w, &paletteram },
{ 0x7400, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
static struct MemoryReadAddress sound_readmem[] =
{
{ 0xe000, 0xe000, soundlatch_r },
{ 0xc000, 0xc7ff, MRA_RAM },
{ 0x0000, 0x7fff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress sound_writemem[] =
{
{ 0xc000, 0xc7ff, MWA_RAM },
{ 0x8000, 0x8000, YM2203_control_port_0_w },
{ 0x8001, 0x8001, YM2203_write_port_0_w },
{ 0xa000, 0xa000, YM2203_control_port_1_w },
{ 0xa001, 0xa001, YM2203_write_port_1_w },
{ 0x0000, 0x7fff, MWA_ROM },
{ -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 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
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 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
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 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* DSW0 */
PORT_DIPNAME( 0x07, 0x07, "Coin B", 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/6 Credits" )
PORT_DIPNAME( 0x38, 0x38, "Coin A", 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/6 Credits" )
PORT_BITX( 0x40, 0x40, IPT_DIPSWITCH_NAME | IPF_TOGGLE, "Service Mode", OSD_KEY_F2, IP_JOY_NONE, 0 )
PORT_DIPSETTING( 0x40, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x80, 0x80, "Unknown", IP_KEY_NONE )
PORT_DIPSETTING( 0x80, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_START /* DSW1 */
PORT_DIPNAME( 0x03, 0x03, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x03, "3" )
PORT_DIPSETTING( 0x02, "4" )
PORT_DIPSETTING( 0x01, "5" )
PORT_DIPSETTING( 0x00, "7" )
PORT_DIPNAME( 0x04, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x04, "Cocktail" )
PORT_DIPNAME( 0x18, 0x18, "Bonus Life", IP_KEY_NONE )
PORT_DIPSETTING( 0x18, "20000, 70000 every 70000" )
PORT_DIPSETTING( 0x10, "30000, 80000 every 80000" )
PORT_DIPSETTING( 0x08, "20000, 80000" )
PORT_DIPSETTING( 0x00, "30000, 80000" )
PORT_DIPNAME( 0x60, 0x60, "Level", IP_KEY_NONE )
PORT_DIPSETTING( 0x40, "0" )
PORT_DIPSETTING( 0x60, "10" )
PORT_DIPSETTING( 0x20, "20" )
PORT_DIPSETTING( 0x00, "30" )
PORT_DIPNAME( 0x80, 0x80, "Music", IP_KEY_NONE )
PORT_DIPSETTING( 0x80, "Off" )
PORT_DIPSETTING( 0x00, "On" )
INPUT_PORTS_END
static struct GfxLayout charlayout =
{
8,8, /* 8*8 characters */
1024, /* 1024 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
};
static struct GfxLayout tilelayout =
{
16,16, /* 16*16 tiles */
2048, /* 2048 tiles */
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
};
static struct GfxLayout spritelayout =
{
16,16, /* 16*16 sprites */
2048, /* 2048 sprites */
4, /* 4 bits per pixel */
{ 0x30000*8, 0x20000*8, 0x10000*8, 0 },
{ 0, 1, 2, 3, 4, 5, 6, 7,
2*64+0, 2*64+1, 2*64+2, 2*64+3, 2*64+4, 2*64+5, 2*64+6, 2*64+7, 2*64+8 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
32*8 /* every sprite takes 32*8 consecutive bytes */
};
static struct GfxDecodeInfo gfxdecodeinfo[] =
{
/* start pointer colour start number of colours */
{ 1, 0x00000, &charlayout, 320, 16 }, /* colors 320 - 383 */
{ 1, 0x10000, &tilelayout, 0, 8 }, /* colors 0 - 127 */
{ 1, 0x50000, &spritelayout, 128, 8 }, /* colors 128 - 255 */
{ -1 } /* end of array */
};
/*
SPEED-RUMBLER Paging system.
===========================
This is quite complex.
The area from 0xe000-0xffff is resident all the time. The area from
0x5000-0xdfff is paged in and out.
The following map is derived from the ROM test routine. The routine
tests the ROM chips in the following order.
1=RC4
2=RC3
3=RC2
4=RC1
5=RC9
6=RC8
7=RC7
8=RC6
The numbers on the bars on the paging map refer to the ROM test
order. This is also the order that the ROM chips are loaded into MAME.
For example, page 0 consists of rom-test numbers 2 and 8.
This means it uses elements from RC3 and RC6.
All locations under the arrows correspond to the ROM test and should be
correct (since the ROMs pass their tests). It may be necessary to
swap two blocks of the same size and number.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -