📄 matmania.c
字号:
/***************************************************************************
Mat Mania
Memetron, 1985
(copyright Taito, licensed by Technos, distributed by Memetron)
MAIN BOARD:
0000-0fff RAM
1000-13ff Video RAM
1400-17ff Attribute RAM
1800-1fff ?? Only used in self-test ??
2000-21ff Background video RAM #1
2200-23ff Background attribute RAM #1
2400-25ff Background video RAM #2
2600-27ff Background attribute RAM #2
4000-ffff ROM
Changes:
25 Jan 98 LBO
* Split off from mystston.c
* Added Mania Challenge driver
TODO:
* Mania Challenge needs the audio CPU working. However, it's not clear how
it's set up. There is some extra 6502 code, but it appears to be for the main CPU.
I also understood that it was somehow using a 6809 for the audio CPU but I
can find no program ROMs that are 6809 code.
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
#include "M6502/m6502.h"
extern unsigned char *matmania_videoram2,*matmania_colorram2;
extern int matmania_videoram2_size;
extern unsigned char *matmania_videoram3,*matmania_colorram3;
extern int matmania_videoram3_size;
extern unsigned char *matmania_scroll;
extern unsigned char *matmania_pageselect;
void matmania_paletteram_w(int offset,int data);
void matmania_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
void matmania_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void maniach_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void matmania_videoram3_w(int offset,int data);
void matmania_colorram3_w(int offset,int data);
int matmania_vh_start(void);
void matmania_vh_stop(void);
void matmania_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void matmania_sh_command_w (int offset, int data)
{
soundlatch_w(offset,data);
cpu_cause_interrupt(1,M6502_INT_IRQ);
}
void matmania_dac_w(int offset,int data)
{
DAC_data_w(0,data);
}
static int maniach_3040;
void maniach_3040_w (int offset, int data)
{
maniach_3040 = data + 4;
}
int maniach_3040_r (int offset)
{
return maniach_3040;
}
int maniach_3041_r (int offset)
{
return 0x02;
}
static struct MemoryReadAddress matmania_readmem[] =
{
{ 0x0000, 0x077f, MRA_RAM },
{ 0x1000, 0x17ff, MRA_RAM },
{ 0x2000, 0x27ff, MRA_RAM },
{ 0x3000, 0x3000, input_port_0_r },
{ 0x3010, 0x3010, input_port_1_r },
{ 0x3020, 0x3020, input_port_2_r },
{ 0x3030, 0x3030, input_port_3_r },
{ 0x3040, 0x3040, maniach_3040_r },
{ 0x3041, 0x3041, maniach_3041_r },
{ 0x4000, 0xffff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress matmania_writemem[] =
{
{ 0x0000, 0x077f, MWA_RAM },
{ 0x0780, 0x07df, MWA_RAM, &spriteram, &spriteram_size },
{ 0x1000, 0x13ff, MWA_RAM, &matmania_videoram2, &matmania_videoram2_size },
{ 0x1400, 0x17ff, MWA_RAM, &matmania_colorram2 },
{ 0x2000, 0x21ff, videoram_w, &videoram, &videoram_size },
{ 0x2200, 0x23ff, colorram_w, &colorram },
{ 0x2400, 0x25ff, matmania_videoram3_w, &matmania_videoram3, &matmania_videoram3_size },
{ 0x2600, 0x27ff, matmania_colorram3_w, &matmania_colorram3 },
{ 0x3000, 0x3000, MWA_RAM, &matmania_pageselect },
{ 0x3010, 0x3010, matmania_sh_command_w },
{ 0x3020, 0x3020, MWA_RAM, &matmania_scroll },
{ 0x3030, 0x3030, MWA_NOP }, /* ?? */
{ 0x3050, 0x307f, matmania_paletteram_w, &paletteram },
{ 0x4000, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress maniach_writemem[] =
{
{ 0x0000, 0x077f, MWA_RAM },
{ 0x0780, 0x07df, MWA_RAM, &spriteram, &spriteram_size },
{ 0x1000, 0x13ff, MWA_RAM, &matmania_videoram2, &matmania_videoram2_size },
{ 0x1400, 0x17ff, MWA_RAM, &matmania_colorram2 },
{ 0x2000, 0x21ff, videoram_w, &videoram, &videoram_size },
{ 0x2200, 0x23ff, colorram_w, &colorram },
{ 0x2400, 0x25ff, matmania_videoram3_w, &matmania_videoram3, &matmania_videoram3_size },
{ 0x2600, 0x27ff, matmania_colorram3_w, &matmania_colorram3 },
{ 0x3000, 0x3000, MWA_RAM, &matmania_pageselect },
{ 0x3010, 0x3010, matmania_sh_command_w },
{ 0x3020, 0x3020, MWA_RAM, &matmania_scroll },
{ 0x3030, 0x3030, MWA_NOP }, /* ?? */
{ 0x3040, 0x3040, maniach_3040_w }, /* ??? */
{ 0x3050, 0x307f, matmania_paletteram_w, &paletteram },
{ 0x4000, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
static struct MemoryReadAddress sound_readmem[] =
{
{ 0x0000, 0x01ff, MRA_RAM },
{ 0x2007, 0x2007, soundlatch_r },
{ 0x8000, 0xffff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress sound_writemem[] =
{
{ 0x0000, 0x01ff, MWA_RAM },
{ 0x2000, 0x2000, AY8910_write_port_0_w },
{ 0x2001, 0x2001, AY8910_control_port_0_w },
{ 0x2002, 0x2002, AY8910_write_port_1_w },
{ 0x2003, 0x2003, AY8910_control_port_1_w },
{ 0x2004, 0x2004, matmania_dac_w },
{ 0x8000, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
static struct MemoryReadAddress maniach_sound_readmem[] =
{
{ 0x0000, 0x01ff, MRA_RAM },
{ 0x4000, 0xffff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress maniach_sound_writemem[] =
{
{ 0x0000, 0x01ff, MWA_RAM },
{ 0x4000, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
INPUT_PORTS_START( matmania_input_ports )
PORT_START /* IN0 */
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_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_BITX(0x40, IP_ACTIVE_LOW, IPT_COIN2 | IPF_IMPULSE, IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_COIN1 | IPF_IMPULSE, IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
PORT_START /* DSW1 */
PORT_DIPNAME (0x03, 0x03, "Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0x03, "Easy" )
PORT_DIPSETTING( 0x02, "Medium" )
PORT_DIPSETTING( 0x01, "Hard" )
PORT_DIPSETTING( 0x00, "Hardest" )
PORT_DIPNAME (0x04, 0x04, "Unknown 1", IP_KEY_NONE )
PORT_DIPSETTING( 0x04, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME (0x08, 0x08, "Unknown 2", IP_KEY_NONE )
PORT_DIPSETTING( 0x08, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME (0x10, 0x10, "Unknown 3", IP_KEY_NONE )
PORT_DIPSETTING( 0x10, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME (0x20, 0x20, "Unknown 4", IP_KEY_NONE )
PORT_DIPSETTING( 0x20, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME (0x40, 0x40, "Unknown 5", IP_KEY_NONE )
PORT_DIPSETTING( 0x40, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME (0x80, 0x80, "Unknown 6", IP_KEY_NONE )
PORT_DIPSETTING( 0x80, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_START /* DSW2 */
PORT_DIPNAME (0x03, 0x03, "Coin A", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x03, "1 Coin/1 Credits" )
PORT_DIPSETTING( 0x02, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x01, "1 Coin/3 Credits" )
PORT_DIPNAME (0x0c, 0x0c, "Coin B", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x0c, "1 Coin/1 Credits" )
PORT_DIPSETTING( 0x08, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x04, "1 Coin/3 Credits" )
PORT_DIPNAME (0x10, 0x10, "Demo Sounds", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Off" )
PORT_DIPSETTING( 0x10, "On" )
PORT_DIPNAME (0x20, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x20, "Cocktail" )
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_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
INPUT_PORTS_END
static struct GfxLayout charlayout =
{
8,8, /* 8*8 characters */
1024, /* 1024 characters */
3, /* 3 bits per pixel */
{ 2*1024*8*8, 1024*8*8, 0 }, /* the bitplanes are separated */
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
{ 7, 6, 5, 4, 3, 2, 1, 0 },
8*8 /* every char takes 8 consecutive bytes */
};
static struct GfxLayout tilelayout =
{
16,16, /* 16*16 tiles */
512, /* 512 tiles */
3, /* 3 bits per pixel */
{ 2*512*16*16, 512*16*16, 0 }, /* the bitplanes are separated */
{ 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 },
{ 7, 6, 5, 4, 3, 2, 1, 0,
16*8+7, 16*8+6, 16*8+5, 16*8+4, 16*8+3, 16*8+2, 16*8+1, 16*8+0 },
32*8 /* every tile takes 16 consecutive bytes */
};
static struct GfxLayout matmania_spritelayout =
{
16,16, /* 16*16 sprites */
3584, /* 3584 sprites */
3, /* 3 bits per pixel */
{ 2*3584*16*16, 3584*16*16, 0 }, /* the bitplanes are separated */
{ 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 },
{ 7, 6, 5, 4, 3, 2, 1, 0,
16*8+7, 16*8+6, 16*8+5, 16*8+4, 16*8+3, 16*8+2, 16*8+1, 16*8+0 },
32*8 /* every sprite takes 16 consecutive bytes */
};
static struct GfxLayout maniach_spritelayout =
{
16,16, /* 16*16 sprites */
3584, /* 3584 sprites */
3, /* 3 bits per pixel */
{ 0, 3584*16*16, 2*3584*16*16 }, /* the bitplanes are separated */
{ 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 },
{ 7, 6, 5, 4, 3, 2, 1, 0,
16*8+7, 16*8+6, 16*8+5, 16*8+4, 16*8+3, 16*8+2, 16*8+1, 16*8+0 },
32*8 /* every sprite takes 16 consecutive bytes */
};
static struct GfxLayout maniach_tilelayout =
{
16,16, /* 16*16 tiles */
1024, /* 1024 tiles */
3, /* 3 bits per pixel */
{ 2*1024*16*16, 1024*16*16, 0 }, /* the bitplanes are separated */
{ 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 },
{ 7, 6, 5, 4, 3, 2, 1, 0,
16*8+7, 16*8+6, 16*8+5, 16*8+4, 16*8+3, 16*8+2, 16*8+1, 16*8+0 },
32*8 /* every tile takes 16 consecutive bytes */
};
static struct GfxDecodeInfo matmania_gfxdecodeinfo[] =
{
{ 1, 0x00000, &charlayout, 0, 4 },
{ 1, 0x06000, &tilelayout, 4*8, 4 },
{ 1, 0x12000, &matmania_spritelayout, 8*8, 2 },
{ -1 } /* end of array */
};
static struct GfxDecodeInfo maniach_gfxdecodeinfo[] =
{
{ 1, 0x00000, &charlayout, 0, 4 },
{ 1, 0x06000, &maniach_tilelayout, 4*8, 4 },
{ 1, 0x1e000, &maniach_spritelayout, 8*8, 2 },
{ -1 } /* end of array */
};
static struct AY8910interface ay8910_interface =
{
2, /* 2 chips */
1500000, /* 1.5 MHz?????? */
{ 50, 50 },
{ 0 },
{ 0 },
{ 0 },
{ 0 }
};
static struct DACinterface dac_interface =
{
1,
{ 100 }
};
static struct MachineDriver matmania_machine_driver =
{
/* basic machine hardware */
{
{
CPU_M6502,
1500000, /* 1.5 Mhz ???? */
0,
matmania_readmem,matmania_writemem,0,0,
interrupt,1
},
{
CPU_M6502 | CPU_AUDIO_CPU,
1200000, /* 1.2 Mhz ???? */
3,
sound_readmem,sound_writemem,0,0,
nmi_interrupt,15 /* ???? */
},
},
60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
10, /* enough time for the audio CPU to get all commands */
0,
/* video hardware */
32*8, 32*8, { 1*8, 31*8-1, 0*8, 32*8-1 },
matmania_gfxdecodeinfo,
64+16, 64+16,
matmania_vh_convert_color_prom,
VIDEO_TYPE_RASTER|VIDEO_MODIFIES_PALETTE,
0,
matmania_vh_start,
matmania_vh_stop,
matmania_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_AY8910,
&ay8910_interface
},
{
SOUND_DAC,
&dac_interface
}
}
};
static struct MachineDriver maniach_machine_driver =
{
/* basic machine hardware */
{
{
CPU_M6502,
1500000, /* 1.5 Mhz ???? */
0,
matmania_readmem,maniach_writemem,0,0,
interrupt,1
},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -