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

📄 opwolf.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************//*                                                                            *//*                  OPERATION WOLF (C) 1987 TAITO CORPORATION                 *//*                                                                            *//******************************************************************************/#include "gameinc.h"#include "opwolf.h"#include "tc100scn.h"#include "tc002obj.h"#include "sasound.h"		// sample support routines#include "taitosnd.h"#include "msm5205.h"#ifdef RAINE_DEBUG#include "debug.h"#endifstatic struct DIR_INFO operation_wolf_dirs[] ={   { "operation_wolf", },   { "opwolf", },   { NULL, },};static struct ROM_INFO operation_wolf_roms[] ={   {     "opwlf.13", 0x00080000, 0xf6acdab1, 0, 0, 0, },   {     "opwlf.29", 0x00010000, 0xb71bc44c, 0, 0, 0, },   {     "opwlf.30", 0x00010000, 0xfdabd8a5, 0, 0, 0, },   {     "opwlf.39", 0x00010000, 0x216b4838, 0, 0, 0, },   {     "opwlf.40", 0x00010000, 0x3ffbfe3a, 0, 0, 0, },   {     "opwlf.72", 0x00080000, 0x89f889e5, 0, 0, 0, },   {   "opwlf_s.10", 0x00010000, 0x45c7ace3, 0, 0, 0, },   {   "opwlf_s.21", 0x00080000, 0xf3e19c64, 0, 0, 0, },   {  "operwolf.09", 0x00008000, 0xab27a3dd, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};static struct INPUT_INFO operation_wolf_inputs[] ={   { KB_DEF_COIN1,        MSG_COIN1,               0x05C580, 0x04, BIT_ACTIVE_1 },   { KB_DEF_COIN2,        MSG_COIN2,               0x05C581, 0x04, BIT_ACTIVE_1 },   { KB_DEF_TILT,         MSG_TILT,                0x02B10A, 0x08, BIT_ACTIVE_0 },   { KB_DEF_SERVICE,      MSG_SERVICE,             0x02B10A, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P1_START,     MSG_P1_START,            0x02B10A, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P1_UP,        MSG_P1_UP,               0x02B408, 0x01, BIT_ACTIVE_1 },   { KB_DEF_P1_DOWN,      MSG_P1_DOWN,             0x02B408, 0x02, BIT_ACTIVE_1 },   { KB_DEF_P1_LEFT,      MSG_P1_LEFT,             0x02B408, 0x04, BIT_ACTIVE_1 },   { KB_DEF_P1_RIGHT,     MSG_P1_RIGHT,            0x02B408, 0x08, BIT_ACTIVE_1 },   { KB_DEF_P1_B1,        MSG_P1_B1,               0x02B10A, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P1_B2,        MSG_P1_B2,               0x02B10A, 0x01, BIT_ACTIVE_0 },   { 0,                   NULL,                    0,        0,    0            },};static struct DSW_DATA dsw_data_operation_wolf_0[] ={   { MSG_DSWA_BIT1,           0x01, 0x02 },   { MSG_OFF,                 0x01, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { "Continue Play",         0x02, 0x02 },   { MSG_OFF,                 0x02, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_TEST_MODE,           0x04, 0x02 },   { MSG_OFF,                 0x04, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { "Attract Mode",          0x08, 0x02 },   { "Sound",                 0x08, 0x00 },   { "Silence",               0x00, 0x00 },   { "Coin Slot A",           0x30, 0x04 },   { MSG_1COIN_1PLAY,         0x30, 0x00 },   { MSG_1COIN_2PLAY,         0x20, 0x00 },   { MSG_2COIN_1PLAY,         0x10, 0x00 },   { MSG_2COIN_3PLAY,         0x00, 0x00 },   { "Coin Slot B",           0xC0, 0x04 },   { MSG_1COIN_1PLAY,         0xC0, 0x00 },   { MSG_1COIN_2PLAY,         0x80, 0x00 },   { MSG_2COIN_1PLAY,         0x40, 0x00 },   { MSG_2COIN_3PLAY,         0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_DATA dsw_data_operation_wolf_1[] ={   { MSG_DIFFICULTY,          0x03, 0x04 },   { MSG_NORMAL,              0x03, 0x00 },   { MSG_EASY,                0x02, 0x00 },   { MSG_HARD,                0x01, 0x00 },   { MSG_HARDEST,             0x00, 0x00 },   { "Start Ammo",            0x0C, 0x04 },   { "6 Clips",               0x0C, 0x00 },   { "7 Clips",               0x08, 0x00 },   { "5 Clips",               0x04, 0x00 },   { "4 Clips",               0x00, 0x00 },   { MSG_DSWB_BIT6,           0x10, 0x02 },   { MSG_OFF,                 0x10, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWB_BIT7,           0x20, 0x02 },   { MSG_OFF,                 0x20, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { "Cont Discount",         0x40, 0x02 },   { MSG_OFF,                 0x40, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { "Language",              0x80, 0x02 },   { "Japanese",              0x80, 0x00 },   { "English",               0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_INFO operation_wolf_dsw[] ={   { 0x02B000, 0xBF, dsw_data_operation_wolf_0 },   { 0x02B002, 0xFF, dsw_data_operation_wolf_1 },   { 0,        0,    NULL,      },};static struct ROMSW_DATA romsw_data_operation_wolf_0[] ={   { "Taito Japan (Notice)",  0x01 },   { "Taito America",         0x02 },   { "Taito Japan",           0x03 },   { NULL,                    0    },};static struct ROMSW_INFO operation_wolf_romsw[] ={   { 0x03FFFF, 0x02, romsw_data_operation_wolf_0 },   { 0,        0,    NULL },};static struct VIDEO_INFO operation_wolf_video ={   DrawOperationWolf,   320,   240,   32,   VIDEO_ROTATE_NORMAL| VIDEO_ROTATABLE,};static struct YM2151interface ym2151_interface ={  1,			// 1 chip  4000000,		// 4 MHz  { YM3012_VOL(160,OSD_PAN_LEFT,160,OSD_PAN_RIGHT) },  { NULL },  { NULL }};static struct msm5205_adpcm_list opwolf_adpcm[] ={   { 0x000000,0x001B20-1 },	// 0xA0   { 0x001B20,0x003520-1 },	// 0xB0   { 0x003520,0x005520-1 },	// 0xB4   { 0x005520,0x007F40-1 },	// 0xB0   { 0x007F40,0x009F10-1 },	// 0xB0   { 0x009F10,0x00E5D0-1 },	// 0xB0   { 0x00E5D0,0x0135B0-1 },	// 0xB0   { 0x0135B0,0x014BC0-1 },	// 0xB0   { 0x014BC0,0x015FC0-1 },	// 0xB8   { 0x015FC0,0x019450-1 },	// 0xB0   { 0x019450,0x01A8E0-1 },	// 0xA4   { 0x01A8E0,0x01D6F0-1 },	// 0xAC   { 0x01D6F0,0x024500-1 },	// 0xAC   { 0x024500,0x029FA0-1 },	// 0xAC   { 0x029FA0,0x02D8C0-1 },	// 0xAC   { 0x02D8C0,0x032BB0-1 },	// 0xA8   { 0x032BB0,0x037FB0-1 },	// 0xA8   { 0x037FB0,0x03CAA0-1 },	// 0xB0   { 0x03CAA0,0x03D020-1 },	// 0xAC   { 0x03D020,0x03DAF0-1 },	// 0xA8   { 0x03DAF0,0x03E220-1 },	// 0xA4   { 0x03E220,0x03EC30-1 },	// 0x80   { 0x03EC30,0x03F380-1 },	// 0xA8   { 0x040AD0,0x0415E0-1 },	// 0xAC   { 0x0415E0,0x042380-1 },	// 0xAC   { 0x042380,0x043880-1 },	// 0x88   { 0x043880,0x044B70-1 },	// 0x88   { 0x044B70,0x045F50-1 },	// 0x84   { 0x045F50,0x046660-1 },	// 0xB8   { 0x046660,0x046C00-1 },	// 0xB4   { 0x046C00,0x0475F0-1 },	// 0xA0   { 0x0475F0,0x0483F0-1 },	// 0xB0   { 0x0483F0,0x04CE30-1 },	// 0xA4   { 0x04CE30,0x04F9E0-1 },	// 0xA4   { 0x04F9E0,0x0516E0-1 },	// 0xC0   { 0x0516E0,0x0537B0-1 },	// 0xC0   { 0x0537B0,0x054010-1 },	// 0xD0   { 0x054010,0x058750-1 },	// 0xFC   { 0x058750,0x059AB0-1 },	// 0xA8   { 0x059AB0,0x05D990-1 },	// 0xC8   { 0x05D990,0x061300-1 },	// 0xB0   { 0x061300,0x068E40-1 },	// 0xE8   { 0x068E40,0x069E30-1 },	// 0xEC   { 0x069E30,0x06B960-1 },	// 0xB4   { 0x06B960,0x06CBE0-1 },	// 0xB4   { 0x06CBE0,0x06DC90-1 },	// 0xCC   { 0x06F0A0,0x06FE10-1 },	// 0xFC   { 0x06FE10,0x070E60-1 },	// 0xC8   { 0x070E60,0x072010-1 },	// 0xC0   { 0x072C10,0x074F50-1 },	// 0xB4   { 0x074F50,0x0777C0-1 },	// 0xE4   { 0x03F380,0x03FF80-1 },	// 0xAC   { 0x03FF80,0x040AD0-1 },	// 0xA2   { 0x06DC90,0x06F0A0-1 },	// 0xD4   { 0x058750,0x059AB0-1 },	// 0x84   { 0x058750,0x059AB0-1 },	// 0x98   { 0x045F50,0x046660-1 },	// 0xF8   { 0x045F50,0x046660-1 },	// 0x90   { 0x072C10,0x074F50-1 },	// 0xE8   { 0x045F50,0x046660-1 },	// 0xB0};static struct MSM5205buffer_interface msm5205_interface ={   2,   { 8000, 8000 },   { 223,  223  },   { opwolf_adpcm, opwolf_adpcm},   { sizeof(opwolf_adpcm) / sizeof(struct msm5205_adpcm_list), sizeof(opwolf_adpcm) / sizeof(struct msm5205_adpcm_list)},   { NULL, NULL },   { 0,    0    },   MSM5205_MONO,};static struct SOUND_INFO opwolf_sound[] ={   { SOUND_YM2151J, &ym2151_interface,  },   { SOUND_MSM5205, &msm5205_interface, },   { 0,             NULL,               },};struct GAME_MAIN game_operation_wolf ={   operation_wolf_dirs,   operation_wolf_roms,   operation_wolf_inputs,   operation_wolf_dsw,   operation_wolf_romsw,   LoadOperationWolf,   ClearOperationWolf,   &operation_wolf_video,   ExecuteOperationWolfFrame,   "opwolf",   "Operation Wolf",   "僆儁儗乕僔儑儞僂儖僼",   COMPANY_ID_TAITO,   "B20",   1987,   opwolf_sound,   GAME_SHOOT,};static struct DIR_INFO operation_wolf_bootleg_dirs[] ={   { "operation_wolf_bootleg", },   { "opwolfbl", },   { "opwolfb", },   { ROMOF("opwolf"), },   { CLONEOF("opwolf"), },   { NULL, },};static struct ROM_INFO operation_wolf_bootleg_roms[] ={   {  "operwolf.01", 0x00010000, 0x0a65f256, 0, 0, 0, },   {  "operwolf.02", 0x00010000, 0x6231fdd0, 0, 0, 0, },   {  "operwolf.03", 0x00010000, 0xccf8ba80, 0, 0, 0, },   {  "operwolf.04", 0x00010000, 0xde0ca98d, 0, 0, 0, },   {  "operwolf.05", 0x00010000, 0xfd9e72c8, 0, 0, 0, },   {  "operwolf.06", 0x00010000, 0x317d0e66, 0, 0, 0, },   {  "operwolf.07", 0x00010000, 0xe1c4095e, 0, 0, 0, },   {  "operwolf.08", 0x00010000, 0x134d294e, 0, 0, 0, },   {  "operwolf.09", 0x00008000, 0xab27a3dd, 0, 0, 0, },   {  "operwolf.10", 0x00010000, 0x9ab6f75c, 0, 0, 0, },   {  "operwolf.11", 0x00010000, 0x342e318d, 0, 0, 0, },   {  "operwolf.12", 0x00010000, 0xd87e4405, 0, 0, 0, },   {  "operwolf.13", 0x00010000, 0x61230c6e, 0, 0, 0, },   {  "operwolf.14", 0x00010000, 0x663786eb, 0, 0, 0, },   {  "operwolf.15", 0x00010000, 0x315b8aa9, 0, 0, 0, },   {  "operwolf.16", 0x00010000, 0xe01099e3, 0, 0, 0, },   {  "operwolf.17", 0x00010000, 0x56fbe61d, 0, 0, 0, },   {  "operwolf.18", 0x00010000, 0xde9ab08e, 0, 0, 0, },   {  "operwolf.19", 0x00010000, 0x645cf85e, 0, 0, 0, },   {  "operwolf.20", 0x00010000, 0xd80b9cc6, 0, 0, 0, },   {  "operwolf.21", 0x00010000, 0x97d25157, 0, 0, 0, },   {  "operwolf.22", 0x00010000, 0x9228481f, 0, 0, 0, },   {  "operwolf.23", 0x00010000, 0xa874c703, 0, 0, 0, },   {  "operwolf.24", 0x00010000, 0x8efc5d4d, 0, 0, 0, },   {  "operwolf.25", 0x00010000, 0x85b87f58, 0, 0, 0, },   {  "operwolf.26", 0x00010000, 0x86d1d42d, 0, 0, 0, },   {  "operwolf.27", 0x00010000, 0x441211a6, 0, 0, 0, },   {  "operwolf.28", 0x00010000, 0x281b2175, 0, 0, 0, },   {  "operwolf.29", 0x00010000, 0x05a9eac0, 0, 0, 0, },   {  "operwolf.30", 0x00008000, 0x0669b94c, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};struct GAME_MAIN game_operation_wolf_bootleg ={   operation_wolf_bootleg_dirs,   operation_wolf_bootleg_roms,   operation_wolf_inputs,   operation_wolf_dsw,   NULL,   LoadOperationWolfB,   ClearOperationWolf,   &operation_wolf_video,   ExecuteOperationWolfFrame,   "opwolfb",   "Operation Bear",   "僆儁儗乕僔儑儞僂儖僼 (bootleg)",   COMPANY_ID_BOOTLEG,   NULL,   1987,   opwolf_sound,   GAME_SHOOT,};static UINT8 *RAM_VIDEO;static UINT8 *RAM_SCROLL;static UINT8 *GFX_BG0_SOLID;static UINT8 *RAM_OBJECT;static UINT8 *GFX_SPR;static UINT8 *GFX_SPR_SOLID;static UINT8 *Z80ROM2;void OpWolfWriteADPCMA(UINT16 offset, UINT8 data);void OpWolfWriteADPCMB(UINT16 offset, UINT8 data);static int romset;	// 0=ORIGINAL; 1=BOOTLEGstatic int x1,myy1,x11,myy11;static int CChipReadB(UINT32 address){   int i;   i=address&0x0FFE;   return(Z80ROM2[0xC000+(i>>1)]);}static int CChipReadW(UINT32 address){   return(CChipReadB(address+1));}static void CChipWriteB(UINT32 address, int data){   int i;   i=address&0x0FFE;   Z80ROM2[0xC000+(i>>1)]=data;}static void CChipWriteW(UINT32 address, int data){   CChipWriteB(address+1,data&0xFF);}static int BadReadByte(UINT32 address){   return(0);}static int BadReadWord(UINT32 address){   return(0);}static void BadWriteByte(UINT32 address, UINT8 data){}static void BadWriteWord(UINT32 address, UINT16 data){}static void LoadActual(void){   UINT8 *TMP;   int ta,tb;   RAMSize=0x60000;   if(!(RAM=AllocateMem(0x80000))) return;   if(!(ROM=AllocateMem(0x40000))) return;   if(!(GFX=AllocateMem(0x200000))) return;   GFX_SPR	= GFX+0x100000;   Z80ROM2=RAM+0x50000;			// C-CHIP ROM/RAM   if(romset==1){			// BOOTLEG   tb=0;   if(!load_rom("operwolf.08", RAM+0x00000, 0x10000)) return;	// 8x8 TILES   if(!load_rom("operwolf.06", RAM+0x10000, 0x10000)) return;	// 8x8 TILES   if(!load_rom("operwolf.07", RAM+0x20000, 0x10000)) return;	// 8x8 TILES   if(!load_rom("operwolf.05", RAM+0x30000, 0x10000)) return;	// 8x8 TILES   if(!load_rom("operwolf.04", RAM+0x40000, 0x10000)) return;	// 8x8 TILES   if(!load_rom("operwolf.02", RAM+0x50000, 0x10000)) return;	// 8x8 TILES   if(!load_rom("operwolf.03", RAM+0x60000, 0x10000)) return;	// 8x8 TILES   if(!load_rom("operwolf.01", RAM+0x70000, 0x10000)) return;	// 8x8 TILES   for(ta=0;ta<0x40000;ta++,tb+=4){      GFX[tb+0]=RAM[ta+0x00000]>>4;      GFX[tb+1]=RAM[ta+0x00000]&15;      GFX[tb+2]=RAM[ta+0x40000]>>4;      GFX[tb+3]=RAM[ta+0x40000]&15;   }   if(!load_rom("operwolf.14", RAM+0x00000, 0x10000)) return;	// 16x16 TILES   if(!load_rom("operwolf.15", RAM+0x10000, 0x10000)) return;	// 16x16 TILES   if(!load_rom("operwolf.16", RAM+0x20000, 0x10000)) return;	// 16x16 TILES   if(!load_rom("operwolf.17", RAM+0x30000, 0x10000)) return;	// 16x16 TILES   if(!load_rom("operwolf.18", RAM+0x40000, 0x10000)) return;	// 16x16 TILES   if(!load_rom("operwolf.19", RAM+0x50000, 0x10000)) return;	// 16x16 TILES   if(!load_rom("operwolf.20", RAM+0x60000, 0x10000)) return;	// 16x16 TILES   if(!load_rom("operwolf.21", RAM+0x70000, 0x10000)) return;	// 16x16 TILES   for(ta=0;ta<0x40000;ta++,tb+=4){      GFX[tb+0]=RAM[ta+0x00000]>>4;      GFX[tb+1]=RAM[ta+0x00000]&15;      GFX[tb+2]=RAM[ta+0x40000]>>4;      GFX[tb+3]=RAM[ta+0x40000]&15;   }   if(!load_rom("operwolf.12", RAM, 0x10000)) return;		// 68000 ROM   for(ta=0;ta<0x10000;ta++){      ROM[ta+ta]=RAM[ta];   }   if(!load_rom("operwolf.10", RAM, 0x10000)) return;   for(ta=0;ta<0x10000;ta++){      ROM[ta+ta+1]=RAM[ta];   }   if(!load_rom("operwolf.13", RAM, 0x10000)) return;   for(ta=0;ta<0x10000;ta++){      ROM[ta+ta+0x20000]=RAM[ta];   }   if(!load_rom("operwolf.11", RAM, 0x10000)) return;   for(ta=0;ta<0x10000;ta++){

⌨️ 快捷键说明

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