📄 bosco.c
字号:
/***************************************************************************
bosco memory map (preliminary)
CPU #1:
0000-3fff ROM
CPU #2:
0000-1fff ROM
CPU #3:
0000-1fff ROM
ALL CPUS:
8000-83ff Video RAM
8400-87ff Color RAM
8b80-8bff sprite code/color
9380-93ff sprite position
9b80-9bff sprite control
8800-9fff RAM
read:
6800-6807 dip switches (only bits 0 and 1 are used - bit 0 is DSW1, bit 1 is DSW2)
dsw1:
bit 6-7 lives
bit 3-5 bonus
bit 0-2 coins per play
dsw2: (bootleg version, the original version is slightly different)
bit 7 cocktail/upright (1 = upright)
bit 6 ?
bit 5 RACK TEST
bit 4 pause (0 = paused, 1 = not paused)
bit 3 ?
bit 2 ?
bit 0-1 difficulty
7000- custom IO chip return values
7100 custom IO chip status ($10 = command executed)
write:
6805 sound voice 1 waveform (nibble)
6811-6813 sound voice 1 frequency (nibble)
6815 sound voice 1 volume (nibble)
680a sound voice 2 waveform (nibble)
6816-6818 sound voice 2 frequency (nibble)
681a sound voice 2 volume (nibble)
680f sound voice 3 waveform (nibble)
681b-681d sound voice 3 frequency (nibble)
681f sound voice 3 volume (nibble)
6820 cpu #1 irq acknowledge/enable
6821 cpu #2 irq acknowledge/enable
6822 cpu #3 nmi acknowledge/enable
6823 if 0, halt CPU #2 and #3
6830 Watchdog reset?
7000- custom IO chip parameters
7100 custom IO chip command (see machine/bosco.c for more details)
a000-a002 starfield scroll direction/speed (only bit 0 is significant)
a003-a005 starfield blink?
a007 flip screen
Interrupts:
CPU #1 IRQ mode 1
NMI is triggered by the custom IO chip to signal the CPU to read/write
parameters
CPU #2 IRQ mode 1
CPU #3 NMI (@120Hz)
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
extern unsigned char *bosco_sharedram;
int bosco_reset_r(int offset);
int bosco_hiscore_print_r(int offset);
int bosco_sharedram_r(int offset);
void bosco_sharedram_w(int offset,int data);
int bosco_dsw_r(int offset);
void bosco_interrupt_enable_1_w(int offset,int data);
void bosco_interrupt_enable_2_w(int offset,int data);
void bosco_interrupt_enable_3_w(int offset,int data);
void bosco_halt_w(int offset,int data);
int bosco_customio_r_1(int offset);
int bosco_customio_r_2(int offset);
void bosco_customio_w_1(int offset,int data);
void bosco_customio_w_2(int offset,int data);
int bosco_customio_data_r_1(int offset);
int bosco_customio_data_r_2(int offset);
void bosco_customio_data_w_1(int offset,int data);
void bosco_customio_data_w_2(int offset,int data);
int bosco_interrupt_1(void);
int bosco_interrupt_2(void);
int bosco_interrupt_3(void);
void bosco_init_machine(void);
void bosco_cpu_reset_w(int offset, int data);
int bosco_vh_start(void);
void bosco_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void bosco_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
extern unsigned char *bosco_videoram2,*bosco_colorram2;
extern unsigned char *bosco_radarx,*bosco_radary,*bosco_radarattr;
extern int bosco_radarram_size;
extern unsigned char *bosco_staronoff;
extern unsigned char *bosco_starblink;
void bosco_videoram2_w(int offset,int data);
void bosco_colorram2_w(int offset,int data);
void bosco_flipscreen_w(int offset,int data);
void bosco_scrollx_w(int offset,int data);
void bosco_scrolly_w(int offset,int data);
void bosco_starcontrol_w(int offset,int data);
int bosco_vh_start(void);
void bosco_vh_stop(void);
void bosco_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void pengo_sound_w(int offset,int data);
int bosco_sh_start(void);
void bosco_sh_stop(void);
extern unsigned char *pengo_soundregs;
extern unsigned char bosco_hiscoreloaded;
extern int HiScore;
static struct MemoryReadAddress readmem_cpu1[] =
{
{ 0x0000, 0x3fff, MRA_ROM },
{ 0x6800, 0x6807, bosco_dsw_r },
{ 0x7000, 0x700f, bosco_customio_data_r_1 },
{ 0x7100, 0x7100, bosco_customio_r_1 },
{ 0x7800, 0x97ff, bosco_sharedram_r, &bosco_sharedram },
{ -1 } /* end of table */
};
static struct MemoryReadAddress readmem_cpu2[] =
{
{ 0x0000, 0x1fff, MRA_ROM },
{ 0x6800, 0x6807, bosco_dsw_r },
{ 0x9000, 0x900f, bosco_customio_data_r_2 },
{ 0x9100, 0x9100, bosco_customio_r_2 },
{ 0x7800, 0x97ff, bosco_sharedram_r },
{ -1 } /* end of table */
};
static struct MemoryReadAddress readmem_cpu3[] =
{
{ 0x0000, 0x1fff, MRA_ROM },
{ 0x6800, 0x6807, bosco_dsw_r },
{ 0x7800, 0x97ff, bosco_sharedram_r },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem_cpu1[] =
{
{ 0x0000, 0x3fff, MWA_ROM },
{ 0x6800, 0x681f, pengo_sound_w, &pengo_soundregs },
{ 0x6820, 0x6820, bosco_interrupt_enable_1_w },
{ 0x6822, 0x6822, bosco_interrupt_enable_3_w },
{ 0x6823, 0x6823, bosco_halt_w },
{ 0x6830, 0x6830, watchdog_reset_w },
{ 0x7000, 0x700f, bosco_customio_data_w_1 },
{ 0x7100, 0x7100, bosco_customio_w_1 },
{ 0x8000, 0x83ff, videoram_w, &videoram, &videoram_size },
{ 0x8400, 0x87ff, bosco_videoram2_w, &bosco_videoram2 },
{ 0x8800, 0x8bff, colorram_w, &colorram },
{ 0x8c00, 0x8fff, bosco_colorram2_w, &bosco_colorram2 },
{ 0x7800, 0x97ff, bosco_sharedram_w },
{ 0x83d4, 0x83df, MWA_RAM, &spriteram, &spriteram_size }, /* these are here just to initialize */
{ 0x8bd4, 0x8bdf, MWA_RAM, &spriteram_2 }, /* the pointers. */
{ 0x83f4, 0x83ff, MWA_RAM, &bosco_radarx, &bosco_radarram_size }, /* ditto */
{ 0x8bf4, 0x8bff, MWA_RAM, &bosco_radary },
{ 0x9810, 0x9810, bosco_scrollx_w },
{ 0x9820, 0x9820, bosco_scrolly_w },
{ 0x9830, 0x9830, bosco_starcontrol_w },
{ 0x9840, 0x9840, MWA_RAM, &bosco_staronoff },
{ 0x9870, 0x9870, bosco_flipscreen_w },
{ 0x9804, 0x980f, MWA_RAM, &bosco_radarattr },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem_cpu2[] =
{
{ 0x0000, 0x1fff, MWA_ROM },
{ 0x6821, 0x6821, bosco_interrupt_enable_2_w },
{ 0x8000, 0x83ff, videoram_w },
{ 0x8400, 0x87ff, bosco_videoram2_w },
{ 0x8800, 0x8bff, colorram_w },
{ 0x8c00, 0x8fff, bosco_colorram2_w },
{ 0x9000, 0x900f, bosco_customio_data_w_2 },
{ 0x9100, 0x9100, bosco_customio_w_2 },
{ 0x7800, 0x97ff, bosco_sharedram_w },
{ 0x9810, 0x9810, bosco_scrollx_w },
{ 0x9820, 0x9820, bosco_scrolly_w },
{ 0x9830, 0x9830, bosco_starcontrol_w },
{ 0x9874, 0x9875, MWA_RAM, &bosco_starblink },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem_cpu3[] =
{
{ 0x0000, 0x1fff, MWA_ROM },
{ 0x6800, 0x681f, pengo_sound_w },
{ 0x6822, 0x6822, bosco_interrupt_enable_3_w },
{ 0x8000, 0x83ff, videoram_w },
{ 0x8400, 0x87ff, bosco_videoram2_w },
{ 0x8800, 0x8bff, colorram_w },
{ 0x8c00, 0x8fff, bosco_colorram2_w },
{ 0x7800, 0x97ff, bosco_sharedram_w },
{ -1 } /* end of table */
};
INPUT_PORTS_START( bosco_input_ports )
PORT_START /* DSW0 */
PORT_DIPNAME( 0x07, 0x07, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Free Play" )
PORT_DIPSETTING( 0x01, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x02, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x03, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x04, "2 Coins/3 Credits" )
PORT_DIPSETTING( 0x05, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x06, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x07, "1 Coin/1 Credit" )
/* TODO: bonus scores are different for 5 lives */
PORT_DIPNAME( 0x38, 0x08, "Bonus Fighter", IP_KEY_NONE )
PORT_DIPSETTING( 0x30, "15K 50K" )
PORT_DIPSETTING( 0x38, "20K 70K" )
PORT_DIPSETTING( 0x08, "10K 50K 50K" )
PORT_DIPSETTING( 0x10, "15K 50K 50K" )
PORT_DIPSETTING( 0x18, "15K 70K 70K" )
PORT_DIPSETTING( 0x20, "20K 70K 70K" )
PORT_DIPSETTING( 0x28, "40K 100K 100K" )
PORT_DIPSETTING( 0x00, "None" )
PORT_DIPNAME( 0xc0, 0x80, "Fighters", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "1" )
PORT_DIPSETTING( 0x40, "2" )
PORT_DIPSETTING( 0x80, "3" )
PORT_DIPSETTING( 0xc0, "5" )
PORT_START /* DSW1 */
PORT_DIPNAME( 0x01, 0x01, "2 Credits Game", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "1 Player" )
PORT_DIPSETTING( 0x01, "2 Players" )
PORT_DIPNAME( 0x06, 0x06, "Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0x02, "Easy" )
PORT_DIPSETTING( 0x06, "Medium" )
PORT_DIPSETTING( 0x04, "Hardest" )
PORT_DIPSETTING( 0x00, "Auto" )
PORT_DIPNAME( 0x08, 0x08, "Allow Continue", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "No" )
PORT_DIPSETTING( 0x08, "Yes" )
PORT_DIPNAME( 0x10, 0x00, "Demo Sounds", IP_KEY_NONE )
PORT_DIPSETTING( 0x10, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x20, 0x20, "Freeze", IP_KEY_NONE )
PORT_DIPSETTING( 0x20, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x40, 0x40, "Test ????", IP_KEY_NONE )
PORT_DIPSETTING( 0x40, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x80, 0x80, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x80, "Upright" )
PORT_DIPSETTING( 0x00, "Cocktail" )
PORT_START /* FAKE */
/* The player inputs are not memory mapped, they are handled by an I/O chip. */
/* These fake input ports are read by galaga_customio_data_r() */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_IMPULSE,
IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS, 0 )
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* FAKE */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | 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_LEFT | IPF_8WAY | IPF_COCKTAIL)
PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_IMPULSE | IPF_COCKTAIL,
IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS, 0 )
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START /* FAKE */
/* the button here is used to trigger the sound in the test screen */
PORT_BITX(0x03, IP_ACTIVE_LOW, IPT_BUTTON1, 0, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 0 )
PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_START1 | IPF_IMPULSE,
IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_START2 | IPF_IMPULSE,
IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_COIN1 | IPF_IMPULSE,
IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_COIN2 | IPF_IMPULSE,
IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_COIN3 | IPF_IMPULSE,
IP_NAME_DEFAULT, IP_KEY_DEFAULT, IP_JOY_DEFAULT, 1 )
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" )
INPUT_PORTS_END
INPUT_PORTS_START( bosconm_input_ports )
PORT_START /* DSW0 */
PORT_DIPNAME( 0x07, 0x07, "Coinage", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Free Play" )
PORT_DIPSETTING( 0x01, "4 Coins/1 Credit" )
PORT_DIPSETTING( 0x02, "3 Coins/1 Credit" )
PORT_DIPSETTING( 0x03, "2 Coins/1 Credit" )
PORT_DIPSETTING( 0x04, "2 Coins/3 Credits" )
PORT_DIPSETTING( 0x05, "1 Coin/3 Credits" )
PORT_DIPSETTING( 0x06, "1 Coin/2 Credits" )
PORT_DIPSETTING( 0x07, "1 Coin/1 Credit" )
/* TODO: bonus scores are different for 5 lives */
PORT_DIPNAME( 0x38, 0x08, "Bonus Fighter", IP_KEY_NONE )
PORT_DIPSETTING( 0x30, "15K 50K" )
PORT_DIPSETTING( 0x38, "20K 70K" )
PORT_DIPSETTING( 0x08, "10K 50K 50K" )
PORT_DIPSETTING( 0x10, "15K 50K 50K" )
PORT_DIPSETTING( 0x18, "15K 70K 70K" )
PORT_DIPSETTING( 0x20, "20K 70K 70K" )
PORT_DIPSETTING( 0x28, "40K 100K 100K" )
PORT_DIPSETTING( 0x00, "None" )
PORT_DIPNAME( 0xc0, 0x80, "Fighters", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "1" )
PORT_DIPSETTING( 0x40, "2" )
PORT_DIPSETTING( 0x80, "3" )
PORT_DIPSETTING( 0xc0, "5" )
PORT_START /* DSW1 */
PORT_DIPNAME( 0x01, 0x01, "2 Credits Game", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "1 Player" )
PORT_DIPSETTING( 0x01, "2 Players" )
PORT_DIPNAME( 0x06, 0x06, "Difficulty", IP_KEY_NONE )
PORT_DIPSETTING( 0x02, "Easy" )
PORT_DIPSETTING( 0x06, "Medium" )
PORT_DIPSETTING( 0x04, "Hardest" )
PORT_DIPSETTING( 0x00, "Auto" )
PORT_DIPNAME( 0x08, 0x00, "Demo Sounds", IP_KEY_NONE )
PORT_DIPSETTING( 0x08, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x10, 0x10, "Freeze", IP_KEY_NONE )
PORT_DIPSETTING( 0x10, "Off" )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPNAME( 0x20, 0x20, "Allow Continue", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "No" )
PORT_DIPSETTING( 0x20, "Yes" )
PORT_DIPNAME( 0x40, 0x40, "Test ????", IP_KEY_NONE )
PORT_DIPSETTING( 0x40, "Off" )
PORT_DIPSETTING( 0x00, "On" )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -