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

📄 driftout.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************//*                                                                            *//*                    DRIFT OUT (C) 1991 VISCO CORPORATION                    *//*                                                                            *//******************************************************************************/#include "gameinc.h"#include "driftout.h"#include "tc005rot.h"#include "tc100scn.h"#include "tc200obj.h"#include "tc220ioc.h"#include "sasound.h"		// sample support routines#include "taitosnd.h"static struct DIR_INFO drift_out_dirs[] ={   { "drift_out", },   { "driftout", },   { NULL, },};static struct ROM_INFO drift_out_roms[] ={   {    "do_50.rom", 0x00010000, 0xffe10124, 0, 0, 0, },   {    "do_46.rom", 0x00080000, 0xf960363e, 0, 0, 0, },   {    "do_45.rom", 0x00080000, 0xe3fe66b9, 0, 0, 0, },   {   "do_obj.rom", 0x00080000, 0x5491f1c4, 0, 0, 0, },   {   "do_piv.rom", 0x00080000, 0xc4f012f7, 0, 0, 0, },   {   "do_snd.rom", 0x00080000, 0xf2deb82b, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};static struct INPUT_INFO drift_out_inputs[] ={   { KB_DEF_COIN1,        MSG_COIN1,               0x02000E, 0x04, BIT_ACTIVE_0 },   { KB_DEF_COIN2,        MSG_COIN2,               0x02000E, 0x08, BIT_ACTIVE_0 },   { KB_DEF_TILT,         MSG_TILT,                0x02000E, 0x01, BIT_ACTIVE_0 },   { KB_DEF_SERVICE,      MSG_SERVICE,             0x02000E, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P1_START,     MSG_P1_START,            0x020004, 0x80, BIT_ACTIVE_0 },   { KB_DEF_P1_UP,        MSG_P1_UP,               0x020004, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P1_DOWN,      MSG_P1_DOWN,             0x020004, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P1_LEFT,      MSG_P1_LEFT,             0x020004, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P1_RIGHT,     MSG_P1_RIGHT,            0x020004, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P1_B1,        MSG_P1_B1,               0x020004, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P1_B2,        MSG_P1_B2,               0x020004, 0x20, BIT_ACTIVE_0 },   { 0,                   NULL,                    0,        0,    0            },};static struct DSW_DATA dsw_data_drift_out_0[] ={   { MSG_SCREEN,              0x02, 0x02 },   { MSG_NORMAL,              0x02, 0x00 },   { MSG_INVERT,              0x00, 0x00 },   { MSG_TEST_MODE,           0x04, 0x02 },   { MSG_OFF,                 0x04, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DEMO_SOUND,          0x08, 0x02 },   { MSG_ON,                  0x08, 0x00 },   { MSG_OFF,                 0x00, 0x00 },   { MSG_COIN1,               0x30, 0x04 },   { MSG_1COIN_1PLAY,         0x30, 0x00 },   { MSG_2COIN_1PLAY,         0x20, 0x00 },   { MSG_1COIN_2PLAY,         0x10, 0x00 },   { MSG_2COIN_3PLAY,         0x00, 0x00 },   { MSG_COIN2,               0xC0, 0x04 },   { MSG_1COIN_1PLAY,         0xC0, 0x00 },   { MSG_2COIN_1PLAY,         0x80, 0x00 },   { MSG_1COIN_2PLAY,         0x40, 0x00 },   { MSG_2COIN_3PLAY,         0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_DATA dsw_data_drift_out_1[] ={   { MSG_DIFFICULTY,          0x03, 0x04 },   { MSG_NORMAL,              0x03, 0x00 },   { MSG_EASY,                0x02, 0x00 },   { MSG_HARD,                0x01, 0x00 },   { MSG_HARDEST,             0x00, 0x00 },   { "Control",               0x0C, 0x04 },   { "Lever",                 0x0C, 0x00 },   { "Paddle A",              0x08, 0x00 },   { "Lever",                 0x04, 0x00 },   { "Paddle B",              0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_INFO drift_out_dsw[] ={   { 0x020000, 0xFF, dsw_data_drift_out_0 },   { 0x020002, 0xFF, dsw_data_drift_out_1 },   { 0,        0,    NULL,      },};static struct VIDEO_INFO drift_out_video ={   DrawDriftOut,   224,   320,   32,   VIDEO_ROTATE_NORMAL| VIDEO_ROTATABLE,};struct GAME_MAIN game_drift_out ={   drift_out_dirs,   drift_out_roms,   drift_out_inputs,   drift_out_dsw,   NULL,   LoadDriftOut,   ClearDriftOut,   &drift_out_video,   ExecuteDriftOutFrame,   "driftout",   "Drift Out",   "僪儕僼僩傾僂僩",   COMPANY_ID_VISCO,   NULL,   1991,   taito_ym2610_sound,   GAME_RACE,};static struct DIR_INFO drive_out_dirs[] ={   { "drive_out", },   { "driveout", },   { ROMOF("driftout"), },   { CLONEOF("driftout"), },   { NULL, },};static struct ROM_INFO drive_out_roms[] ={   { "driveout.028", 0x00080000, 0xcbde0b66, 0, 0, 0, },   { "driveout.003", 0x00080000, 0xdc431e4e, 0, 0, 0, },   { "driveout.020", 0x00008000, 0x99aaeb2e, 0, 0, 0, },   { "driveout.002", 0x00080000, 0x6f9063f4, 0, 0, 0, },   { "driveout.029", 0x00020000, 0x0aba2026, 0, 0, 0, },   { "do_piv.rom",   0x00080000, 0xc4f012f7, 0, 0, 0, },   { "driveout.081", 0x00040000, 0x0e9a3e9e, 0, 0, 0, },   { "driveout.084", 0x00040000, 0x530ac420, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};struct GAME_MAIN game_drive_out ={   drive_out_dirs,   drive_out_roms,   drift_out_inputs,   drift_out_dsw,   NULL,   LoadDriveOut,   ClearDriveOut,   &drift_out_video,   ExecuteDriftOutFrame,   "driveout",   "Drive Out",   NULL,   COMPANY_ID_BOOTLEG,   NULL,   1991,   taito_ym2610_sound,   GAME_RACE,};static UINT8 *RAM_VIDEO;static UINT8 *RAM_SCROLL;static UINT8 *RAM_ROTATE;static UINT8 *RAM_INPUT;static UINT8 *RAM_OBJECT;static UINT8 *GFX_SPR;static UINT8 *GFX_SPR_SOLID;static UINT8 *GFX_ROT;void LoadDriftOut(void){   int ta,tb;   RAMSize=0x40000+0x10000;   if(!(ROM=AllocateMem(0x80000))) return;   if(!(RAM=AllocateMem(RAMSize))) return;   if(!(GFX=AllocateMem(0x200000))) return;   GFX_ROT = GFX+0x000000;   GFX_SPR = GFX+0x100000;   tb=0;   if(!load_rom("do_piv.rom", ROM, 0x80000)) return;		// 8x8 TILES   ROM[0]=0;								// Bad Byte?   for(ta=0;ta<0x80000;ta++,tb+=2){      GFX[tb+0]=ROM[ta]>>4;      GFX[tb+1]=ROM[ta]&15;   }   tb=0;   if(!load_rom("do_obj.rom", ROM, 0x80000)) return;		// 16x16 SPRITES   for(ta=0;ta<0x80000;ta++,tb+=2){      GFX_SPR[tb+0]=ROM[ta]&15;      GFX_SPR[tb+1]=ROM[ta]>>4;   }   Rotate16x16(GFX_SPR,0x1000);   Flip16x16_X(GFX_SPR,0x1000);   if(!load_rom("do_46.rom", RAM, 0x40000)) return;		// 68000 ROM   for(ta=0;ta<0x40000;ta++){      ROM[ta+ta]=RAM[ta];   }   if(!load_rom("do_45.rom", RAM, 0x40000)) return;   for(ta=0;ta<0x40000;ta++){      ROM[ta+ta+1]=RAM[ta];   }   /*-----[Sound Setup]-----*/   Z80ROM=RAM+0x40000;   if(!load_rom("do_50.rom", Z80ROM, 0x10000)) return;	// Z80 SOUND ROM   if(!(PCMROM=AllocateMem(0x80000))) return;   if(!load_rom("do_snd.rom",PCMROM,0x80000)) return;	// ADPCM A rom   YM2610SetBuffers(PCMROM, PCMROM, 0x80000, 0x80000);   AddTaitoYM2610(0x023A, 0x01BA, 0x10000);   /*-----------------------*/   memset(RAM+0x00000,0x00,0x40000);   RAM_INPUT  = RAM+0x20000;   RAM_OBJECT = RAM+0x1C000;   RAM_VIDEO  = RAM+0x16000-0x4000;   RAM_SCROLL = RAM+0x20020;   RAM_ROTATE = RAM+0x10000;   GFX_FG0    = RAM+0x21000;   GFX_SPR_SOLID = make_solid_mask_16x16(GFX_SPR, 0x1000);   set_colour_mapper(&col_map_xrrr_rrgg_gggb_bbbb);   InitPaletteMap(RAM+0x14000, 0x100, 0x10, 0x8000);   // 68000 Speed Hack   // ----------------   WriteLong68k(&ROM[0x0724],0x13FC0000);	//	move.b	#$00,$AA0000   WriteLong68k(&ROM[0x0728],0x00AA0000);	//   WriteWord68k(&ROM[0x072C],0x6100-14);	//	bra.s	<loop>   // Init tc0200obj emulation   // ------------------------   tc0200obj.RAM	= RAM_OBJECT;   tc0200obj.RAM_B	= NULL;   tc0200obj.GFX	= GFX_SPR;   tc0200obj.MASK	= GFX_SPR_SOLID;   tc0200obj.bmp_x	= 32;   tc0200obj.bmp_y	= 32;   tc0200obj.bmp_w	= 224;   tc0200obj.bmp_h	= 320;// Mapper disabled   tc0200obj.tile_mask	= 0x0FFF;   tc0200obj.ofs_x	= -8;   tc0200obj.ofs_y	= 8;   init_tc0200obj();   // Init tc0220ioc emulation   // ------------------------   tc0220ioc.RAM  = RAM_INPUT;   tc0220ioc.ctrl = 0;		//TC0220_STOPCPU;   reset_tc0220ioc();   // Init tc0100scn emulation   // ------------------------   tc0100scn[0].layer[2].RAM	=RAM_VIDEO+0x4000;   tc0100scn[0].layer[2].GFX	=GFX_FG0;   tc0100scn[0].layer[2].SCR	=RAM_SCROLL+4;   tc0100scn[0].layer[2].type	=1;   tc0100scn[0].layer[2].bmp_x	=32;   tc0100scn[0].layer[2].bmp_y	=32;   tc0100scn[0].layer[2].bmp_w	=224;   tc0100scn[0].layer[2].bmp_h	=320;// Mapper disabled   tc0100scn[0].layer[2].scr_x	=24;   tc0100scn[0].layer[2].scr_y	=8;   tc0100scn[0].RAM     = RAM_VIDEO;   tc0100scn[0].GFX_FG0 = GFX_FG0;

⌨️ 快捷键说明

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