📄 8080bw.c
字号:
/****************************************************************************/
/* */
/* 8080bw.c */
/* */
/* Michael Strutts, Nicola Salmoria, Tormod Tjaberg, Mirko Buffoni */
/* Lee Taylor, Valerio Verrando, Marco Cassili and others */
/* */
/* */
/* Exidy */
/* ----- */
/* Bandido (bandido) */
/* */
/* Midway */
/* ------ */
/* 596 - Sea Wolf (seawolf) */
/* 597 - Gunfight (gunfight) */
/* 605 - Tornado Baseball (tornbase) */
/* 610 - 280-ZZZAP (zzzap) */
/* 611 - Amazing Maze (maze) */
/* 612 - Boot Hill (boothill) */
/* 615 - Checkmate (checkmat) */
/* 618 - Desert Gun NO DRIVER */
/* 619 - Double Play (dplay) */
/* 622 - Laguna Racer (lracer) */
/* 623 - Guided Missile (gmissile) */
/* 626 - M-4 (m4) */
/* 630 - Clowns (clowns) */
/* 640 - Space Walk NO DRIVER */
/* 642 - Extra Innings (einnings) */
/* 643 - Shuffleboard NO DRIVER */
/* 644 - Dog Patch (dogpatch) */
/* 645 - Space Encounters (spcenctr) */
/* 652 - Phantom II (phantom2) */
/* 730 - 4 Player Bowling (midwbowl) */
/* 739 - Space Invaders (invaders) */
/* 742 - Blue Shark (blueshrk) */
/* 851 - Space Invaders Part II (Midway) (invdelux) */
/* 852 - Space Invaders Deluxe NO DRIVER */
/* */
/* Taito */
/* ----- */
/* Space Invaders Part II (Taito) (invadpt2) */
/* Space Laser "GPI Intruder" (intruder) */
/* Galaxy Wars (galxwars) */
/* Lunar Rescue (lrescue) */
/* Galaxy Rescue (bootleg?) (grescue) */
/* Lupin III (lupin3) */
/* Ozma Wars (ozmawars) */
/* Space Chaser (schaser) */
/* */
/* Nichibutsu */
/* ---------- */
/* Rolling Crash - Moon Base (rollingc) */
/* */
/* Nintendo */
/* -------- */
/* Heli Fire (helifire) */
/* Space Fever (color) (sfever) */
/* Space Fever (B&W) (sfeverbw) */
/* */
/* Universal */
/* --------- */
/* Cosmic Monsters (cosmicmo) */
/* */
/* Zeltec */
/* ------ */
/* Space Attack II (spaceatt) */
/* Invaders Revenge (invrvnge) */
/* */
/* Super Earth Invasion (earthinv) */
/* Destination Earth (desterth) */
/* Space Phantoms (spaceph) */
/* */
/* */
/* Notes: */
/* Space Chaser writes to $c400-$df9f. Color? */
/* */
/* */
/* Known problems: */
/* -------------- */
/* Space Encounter, Sea Wolf need their movement controls fixed. */
/* The accelerator in 280 Zzzap could be handled better. */
/* */
/* List of Changes */
/* --------------- */
/* MJC - 22.01.98 - Boot hill controls/memory mappings */
/* LBO - 5 May 98 - Cleaned up the code, added Al's extra drivers, */
/* rotation support */
/* */
/****************************************************************************/
#include <math.h>
#include "driver.h"
#include "vidhrdw/generic.h"
/* in machine/8080bw.c */
int invaders_shift_data_r(int offset);
int midbowl_shift_data_r(int offset);
int midbowl_shift_data_rev_r(int offset);
int blueshrk_shift_data_r(int offset);
int blueshrk_shift_data_rev_r(int offset);
void invaders_shift_amount_w(int offset,int data);
void invaders_shift_data_w(int offset,int data);
int invaders_interrupt(void);
int boothill_shift_data_r(int offset); /* MJC 310198 */
int boothill_port_0_r(int offset); /* MJC 310198 */
int boothill_port_1_r(int offset); /* MJC 310198 */
void boothill_sh_port3_w(int offset, int data); /* HSC 4/14/98 */
void boothill_sh_port5_w(int offset, int data); /* HSC 4/14/98 */
int gray6bit_controller0_r(int offset);
int gray6bit_controller1_r(int offset);
int seawolf_shift_data_r(int offset);
int seawolf_port_0_r(int offset);
/* in video/8080bw.c */
extern unsigned char *invaders_videoram;
void boothill_videoram_w(int offset,int data); /* MAB */
void invaders_videoram_w(int offset,int data);
void invdelux_videoram_w(int offset,int data); /* V.V */
void invrvnge_videoram_w(int offset,int data); /* V.V */
void lrescue_videoram_w(int offset,int data); /* V.V */
void rollingc_videoram_w(int offset,int data); /* L.T */
void astinvad_videoram_w(int offset,int data); /* HSC used for astinv (z80bw.c)*/
int invaders_vh_start(void);
void invaders_vh_stop(void);
void invaders_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void invaders_sh_port3_w(int offset,int data);
void invaders_sh_port4_w(int offset,int data);
void invadpt2_sh_port3_w(int offset,int data);
void invaders_sh_port5_w(int offset,int data);
void invaders_sh_update(void);
void seawolf_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
void blueshrk_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
static unsigned char palette[] = /* V.V */ /* Smoothed pure colors, overlays are not so contrasted */
{
0x00,0x00,0x00, /* BLACK */
0xff,0x20,0x20, /* RED */
0x20,0xff,0x20, /* GREEN */
0xff,0xff,0x20, /* YELLOW */
0xff,0xff,0xff, /* WHITE */
0x20,0xff,0xff, /* CYAN */
0xff,0x20,0xff /* PURPLE */
};
enum { BLACK,RED,GREEN,YELLOW,WHITE,CYAN,PURPLE }; /* V.V */
/****************************************************************************/
/* mix_hiscoreprint: special thanks to: Mirko , John B., Frank, and Mike B */
/* x = x position */
/* y = y Position */
/* value = value to display */
/* width = number of characters */
/* size = size of a character in the character rom */
/* adjust = number of rows to adjust the display (line characters up) */
/* romarea = where into memory the character rom is loaded */
/* offset = where in the character rom the 1st number starts */
/* type = to make this as flexible as possible i've added code for all */
/* the types of character drawing the current drivers need */
/* to add a new one just add a new case to the case statement */
/* case 0 : plain horizontal */
/* case 1 : horizontal using colors from lrescue */
/* case 2 : plain vertical */
/* case 3 : inverted vertical */
/* case 4 : astinvad horizontal (z80bw.c) */
/* HSC 11/16/98 */
void mix_hiscoreprint(int x, int y, int value, int width,int size, int adjust,int romarea, int offset, int type)
{
int i,j;
j = x+width-1;
while (j >= x)
{
int disp = (value % 10) * size;
for (i=0; i < size; i++)
switch (type)
{
case 0:
invaders_videoram_w((31-y) + (i+adjust)*32 + j*256,
Machine->memory_region[0][romarea+offset+disp+i]);
break;
case 1:
lrescue_videoram_w((31-y) + (i+adjust)*32 + j*256,
Machine->memory_region[0][romarea+offset+disp+i]);
break;
case 2:
boothill_videoram_w((31-j) + (i+adjust)*32 + y*256,
Machine->memory_region[0][romarea+offset+disp+i]);
break;
case 3:
boothill_videoram_w((31-j) + (i+adjust)*32 + y*256,
~(Machine->memory_region[0][romarea+offset+disp+i]));
break;
case 4:
astinvad_videoram_w((31-y) + (i+adjust)*32 + j*256,
Machine->memory_region[0][romarea+offset+disp+i]);
break;
}
value /= 10;
j--;
}
}
/*******************************************************/
/* */
/* Midway "Space Invaders" */
/* */
/*******************************************************/
ROM_START( invaders_rom )
ROM_REGION(0x10000) /* 64k for code */
ROM_LOAD( "invaders.h", 0x0000, 0x0800, 0x734f5ad8 )
ROM_LOAD( "invaders.g", 0x0800, 0x0800, 0x6bfaca4a )
ROM_LOAD( "invaders.f", 0x1000, 0x0800, 0x0ccead96 )
ROM_LOAD( "invaders.e", 0x1800, 0x0800, 0x14e538b0 )
ROM_END
/* invaders, earthinv, spaceatt, invrvnge, invdelux, invadpt2, galxwars, lrescue, */
/* desterth, cosmicmo, spaceph */
static struct MemoryReadAddress readmem[] =
{
{ 0x0000, 0x1fff, MRA_ROM },
{ 0x2000, 0x3fff, MRA_RAM },
{ 0x4000, 0x57ff, MRA_ROM },
{ -1 } /* end of table */
};
/* invaders, earthinv, spaceatt, invdelux, galxwars, desterth, cosmicmo */
static struct MemoryWriteAddress writemem[] =
{
{ 0x0000, 0x1fff, MWA_ROM },
{ 0x2000, 0x23ff, MWA_RAM },
{ 0x2400, 0x3fff, invaders_videoram_w, &invaders_videoram },
{ 0x4000, 0x57ff, MWA_ROM },
{ -1 } /* end of table */
};
static struct IOReadPort readport[] =
{
{ 0x01, 0x01, input_port_0_r },
{ 0x02, 0x02, input_port_1_r },
{ 0x03, 0x03, invaders_shift_data_r },
{ -1 } /* end of table */
};
/* Catch the write to unmapped I/O port 6 */
void invaders_dummy_write(int offset,int data)
{
}
static struct IOWritePort writeport[] =
{
{ 0x02, 0x02, invaders_shift_amount_w },
{ 0x03, 0x03, invaders_sh_port3_w },
{ 0x04, 0x04, invaders_shift_data_w },
{ 0x05, 0x05, invaders_sh_port5_w },
{ 0x06, 0x06, invaders_dummy_write },
{ -1 } /* end of table */
};
INPUT_PORTS_START( invaders_input_ports )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START /* DSW0 */
PORT_DIPNAME( 0x03, 0x00, "Lives", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x01, "4" )
PORT_DIPSETTING( 0x02, "5" )
PORT_DIPSETTING( 0x03, "6" )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_DIPNAME( 0x08, 0x00, "Bonus", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "1500" )
PORT_DIPSETTING( 0x08, "1000" )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL)
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
PORT_DIPNAME( 0x80, 0x00, "Coin Info", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "On" )
PORT_DIPSETTING( 0x80, "Off" )
PORT_START /* BSR */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, 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 /* Dummy port for cocktail mode */
PORT_DIPNAME( 0x01, 0x00, "Cabinet", IP_KEY_NONE )
PORT_DIPSETTING( 0x00, "Upright" )
PORT_DIPSETTING( 0x01, "Cocktail" )
INPUT_PORTS_END
static struct Samplesinterface samples_interface =
{
9 /* 9 channels */
};
static struct MachineDriver machine_driver =
{
/* basic machine hardware */
{
{
CPU_8080,
2000000, /* 2 Mhz? */
0,
readmem,writemem,readport,writeport,
invaders_interrupt,2 /* two interrupts per frame */
}
},
60, DEFAULT_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
1, /* single CPU, no need for interleaving */
0,
/* video hardware */
32*8, 32*8, { 0*8, 32*8-1, 0*8, 28*8-1 },
0, /* no gfxdecodeinfo - bitmapped display */
sizeof(palette)/3, 0,
0,
VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
0,
invaders_vh_start,
invaders_vh_stop,
invaders_vh_screenrefresh,
/* sound hardware */
0, 0, 0, 0,
{
{
SOUND_SAMPLES,
&samples_interface
}
}
};
static int invaders_hiload(void)
{
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
/* check if the hi score table has already been initialized */
if (memcmp(&RAM[0x2008],"\x02\x78\x38",3) == 0)
{
void *f;
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
{
osd_fread(f,&RAM[0x20f4],2);
osd_fclose(f);
}
return 1;
}
else return 0; /* we can't load the hi scores yet */
}
static void invaders_hisave(void)
{
void *f;
unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];
if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,1)) != 0)
{
osd_fwrite(f,&RAM[0x20f4],2);
osd_fclose(f);
RAM[0x2008] = 0;
}
}
static const char *invaders_sample_names[] =
{
"*invaders",
"0.SAM",
"1.SAM",
"2.SAM",
"3.SAM",
"4.SAM",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -