⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blockade.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
static unsigned char palette[] =
{
        0x00,0x00,0x00, /* BLACK */
        0x00,0xff,0x00, /* GREEN */     /* overlay (Blockade/Hustle) */
        0xff,0xff,0xff, /* WHITE */     /* Comotion/Blasto */
        0xff,0x00,0x00, /* RED */       /* for the disclaimer text */
};

static unsigned short colortable[] =
{
        0x00, 0x01,         /* green on black (Blockade/Hustle) */
        0x00, 0x02,         /* white on black (Comotion/Blasto) */
};

static struct GfxLayout blockade_layout =
{
    8,8,    /* 8*8 characters */
    32, /* 32 characters */
    1,  /* 1 bit per pixel */
    { 0 },  /* no separation in 1 bpp */
    { 4,5,6,7,256*8+4,256*8+5,256*8+6,256*8+7 },    /* Merge nibble-wide roms */
    { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
    8*8 /* every char takes 8 consecutive bytes */
};

static struct GfxLayout blasto_layout =
{
    8,8,    /* 8*8 characters */
    64, /* 64 characters */
    1,  /* 1 bit per pixel */
    { 0 },  /* no separation in 1 bpp */
    { 4,5,6,7,512*8+4,512*8+5,512*8+6,512*8+7 },    /* Merge nibble-wide roms */
    { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
    8*8 /* every char takes 8 consecutive bytes */
};

static struct GfxDecodeInfo gfxdecodeinfo[] =
{
    { 1, 0x0000, &blockade_layout,   0, 2 },
    { 1, 0x0000, &blasto_layout,     0, 2 },
    { -1 } /* end of array */
};

static struct Samplesinterface samples_interface =
{
    1   /* 1 channel */
};

static struct MachineDriver blockade_machine_driver =
{
    /* basic machine hardware */
    {
        {
            CPU_8080,
            2079000,
            0,
            readmem,writemem,readport,writeport,
            blockade_interrupt,1
        },
    },
        60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
        1,
    0,

    /* video hardware */
    32*8, 28*8, { 0*8, 32*8-1, 0*8, 28*8-1 },
    gfxdecodeinfo,
    sizeof(palette)/3,sizeof(colortable)/sizeof(unsigned short),
    0,

    VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
    0,
    generic_vh_start,
    generic_vh_stop,
    blockade_vh_screenrefresh,

    /* sound hardware */
    0,0,0,0,
    {
        {
            SOUND_SAMPLES,
            &samples_interface
        }
    }
};

static struct MachineDriver comotion_machine_driver =
{
    /* basic machine hardware */
    {
        {
            CPU_8080,
            2079000,
            0,
            readmem,writemem,readport,writeport,
            blockade_interrupt,1
        },
    },
        60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
        1,
    0,

    /* video hardware */
    32*8, 28*8, { 0*8, 32*8-1, 0*8, 28*8-1 },
    gfxdecodeinfo,
    sizeof(palette)/3,sizeof(colortable)/sizeof(unsigned short),
    0,

    VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
    0,
    generic_vh_start,
    generic_vh_stop,
    comotion_vh_screenrefresh,

    /* sound hardware */
    0,0,0,0,
    {
        {
            SOUND_SAMPLES,
            &samples_interface
        }
    }
};

static struct MachineDriver blasto_machine_driver =
{
    /* basic machine hardware */
    {
        {
            CPU_8080,
            2079000,
            0,
            readmem,writemem,readport,writeport,
            blockade_interrupt,1
        },
    },
        60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
        1,
    0,

    /* video hardware */
    32*8, 28*8, { 0*8, 32*8-1, 0*8, 28*8-1 },
    gfxdecodeinfo,
    sizeof(palette)/3,sizeof(colortable)/sizeof(unsigned short),
    0,

    VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
    0,
    generic_vh_start,
    generic_vh_stop,
    blasto_vh_screenrefresh,

    /* sound hardware */
    0,0,0,0,
    {
        {
            SOUND_SAMPLES,
            &samples_interface
        }
    }
};

static struct MachineDriver hustle_machine_driver =
{
    /* basic machine hardware */
    {
        {
            CPU_8080,
            2079000,
            0,
            readmem,writemem,readport,writeport,
            blockade_interrupt,1
        },
    },
        60, DEFAULT_REAL_60HZ_VBLANK_DURATION,
        1,
    0,

    /* video hardware */
    32*8, 28*8, { 0*8, 32*8-1, 0*8, 28*8-1 },
    gfxdecodeinfo,
    sizeof(palette)/3,sizeof(colortable)/sizeof(unsigned short),
    0,

    VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
    0,
    generic_vh_start,
    generic_vh_stop,
    hustle_vh_screenrefresh,

    /* sound hardware */
    0,0,0,0,
    {
        {
            SOUND_SAMPLES,
            &samples_interface
        }
    }
};

/***************************************************************************

  Game driver(s)

***************************************************************************/

ROM_START( blockade_rom )
    ROM_REGION(0x10000) /* 64k for code */
    /* Note: These are being loaded into a bogus location, */
    /*       They are nibble wide rom images which will be */
    /*       merged and loaded into the proper place by    */
    /*       blockade_rom_init()                           */
    ROM_LOAD( "316-04.u2", 0x1000, 0x0400, 0xa93833e9 )
    ROM_LOAD( "316-03.u3", 0x1400, 0x0400, 0x85960d3b )

    ROM_REGION_DISPOSE(0x200)  /* temporary space for graphics (disposed after conversion) */
    ROM_LOAD( "316-02.u29", 0x0000, 0x0100, 0x409f610f )
    ROM_LOAD( "316-01.u43", 0x0100, 0x0100, 0x41a00b28 )
ROM_END

ROM_START( comotion_rom )
    ROM_REGION(0x10000) /* 64k for code */
    /* Note: These are being loaded into a bogus location, */
    /*       They are nibble wide rom images which will be */
    /*       merged and loaded into the proper place by    */
    /*       comotion_rom_init()                           */
    ROM_LOAD( "316-07.u2", 0x1000, 0x0400, 0x5b9bd054 )
    ROM_LOAD( "316-08.u3", 0x1400, 0x0400, 0x1a856042 )
    ROM_LOAD( "316-09.u4", 0x1800, 0x0400, 0x2590f87c )
    ROM_LOAD( "316-10.u5", 0x1c00, 0x0400, 0xfb49a69b )

    ROM_REGION_DISPOSE(0x200)  /* temporary space for graphics (disposed after conversion) */
    ROM_LOAD( "316-06.u43", 0x0000, 0x0100, 0x8f071297 )  /* Note: these are reversed */
    ROM_LOAD( "316-05.u29", 0x0100, 0x0100, 0x53fb8821 )
ROM_END

ROM_START( blasto_rom )
    ROM_REGION(0x10000) /* 64k for code */
    /* Note: These are being loaded into a bogus location, */
    /*       They are nibble wide rom images which will be */
    /*       merged and loaded into the proper place by    */
    /*       comotion_rom_init()                           */
    ROM_LOAD( "blasto.u2", 0x1000, 0x0400, 0xec99d043 )
    ROM_LOAD( "blasto.u3", 0x1400, 0x0400, 0xbe333415 )
    ROM_LOAD( "blasto.u4", 0x1800, 0x0400, 0x1c889993 )
    ROM_LOAD( "blasto.u5", 0x1c00, 0x0400, 0xefb640cb )

    ROM_REGION_DISPOSE(0x400)  /* temporary space for graphics (disposed after conversion) */
    ROM_LOAD( "blasto.u29", 0x0000, 0x0200, 0x4dd69499 )
    ROM_LOAD( "blasto.u43", 0x0200, 0x0200, 0x104051a4 )
ROM_END

ROM_START( hustle_rom )
    ROM_REGION(0x10000) /* 64k for code */
    /* Note: These are being loaded into a bogus location, */
    /*       They are nibble wide rom images which will be */
    /*       merged and loaded into the proper place by    */
    /*       comotion_rom_init()                           */
    ROM_LOAD( "3160016.u2", 0x1000, 0x0400, 0xd983de7c )
    ROM_LOAD( "3160017.u3", 0x1400, 0x0400, 0xedec9cb9 )
    ROM_LOAD( "3160018.u4", 0x1800, 0x0400, 0xf599b9c0 )
    ROM_LOAD( "3160019.u5", 0x1c00, 0x0400, 0x7794bc7e )

    ROM_REGION_DISPOSE(0x400)  /* temporary space for graphics (disposed after conversion) */
    ROM_LOAD( "3160020.u29", 0x0000, 0x0200, 0x541d2c67 )
    ROM_LOAD( "3160021.u43", 0x0200, 0x0200, 0xb5083128 )
ROM_END

static const char *blockade_sample_name[] =
{
    "*blockade",
    "BOOM.SAM",
    0   /* end of array */
};

static int hiload(void)
{
	unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];

	/* check if the hi score has already been initialized */
    if (memcmp(&RAM[0xff3a],"\x30\x30\x30",3) == 0)
    {
        void *f;

        if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
        {
            osd_fread(f,&RAM[0xff3a],5);
			osd_fclose(f);

        }

        return 1;
    }
    else
        return 0;  /* we can't load the hi scores yet */
}

static void 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[0xff3a],5);
        osd_fclose(f);
	}
}


struct GameDriver blockade_driver =
{
	__FILE__,
	0,
    "blockade",
    "Blockade",
	"1976",
	"Gremlin",
    "Frank Palazzolo",
	0,
    &blockade_machine_driver,
	0,

    blockade_rom,
    blockade_init,
    0,
    blockade_sample_name,
    0,  /* sound_prom */

    blockade_input_ports,

    0, palette, colortable,

    ORIENTATION_DEFAULT,
    0, 0
};

struct GameDriver comotion_driver =
{
	__FILE__,
	0,
    "comotion",
    "Comotion",
	"1976",
	"Gremlin",
    "Frank Palazzolo",
	0,
    &comotion_machine_driver,
	0,

    comotion_rom,
    comotion_init,
    0,
    blockade_sample_name,
    0,  /* sound_prom */

    comotion_input_ports,

    0, palette, colortable,

    ORIENTATION_DEFAULT,
    0, 0
};

struct GameDriver blasto_driver =
{
	__FILE__,
	0,
    "blasto",
    "Blasto",
	"1978",
	"Gremlin",
    "Frank Palazzolo\nJuergen Buchmueller",
	0,
    &blasto_machine_driver,
	0,

    blasto_rom,
    comotion_init,
    0,
    blockade_sample_name,
    0,  /* sound_prom */

    blasto_input_ports,

    0, palette, colortable,

    ORIENTATION_DEFAULT,
	hiload, hisave
};

struct GameDriver hustle_driver =
{
	__FILE__,
	0,
    "hustle",
    "Hustle",
	"1977",
	"Gremlin",
    "Frank Palazzolo",
	0,
    &hustle_machine_driver,
	0,

    hustle_rom,
    comotion_init,
    0,
    blockade_sample_name,
    0,  /* sound_prom */

    hustle_input_ports,

    0, palette, colortable,

    ORIENTATION_DEFAULT,
    0, 0
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -