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

📄 othunder.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************//*                                                                            *//*              OPERATION THUNDERBOLT (C) 1988 TAITO CORPORATION              *//*                                                                            *//******************************************************************************/#include "gameinc.h"#include "othunder.h"#include "tc100scn.h"#include "tc110pcr.h"#include "tc220ioc.h"#include "sasound.h"		// sample support routines#include "taitosnd.h"#include "savegame.h"static struct DIR_INFO operation_thunderbolt_dirs[] ={   { "operation_thunderbolt", },   { "othunder", },   { NULL, },};static struct ROM_INFO operation_thunderbolt_roms[] ={   {       "b67-02", 0x00080000, 0xc20cd2fb, 0, 0, 0, },   {       "b67-03", 0x00080000, 0xbc9019ed, 0, 0, 0, },   {       "b67-04", 0x00080000, 0x2af4c8af, 0, 0, 0, },   {       "b67-05", 0x00080000, 0x9593e42b, 0, 0, 0, },   {       "b67-06", 0x00080000, 0xb9a38d64, 0, 0, 0, },   {       "b67-07", 0x00080000, 0x4f834357, 0, 0, 0, },   {       "b67-08", 0x00080000, 0x458f41fb, 0, 0, 0, },   {       "b67-01", 0x00080000, 0x81ad9acb, 0, 0, 0, },   {       "b67-13", 0x00010000, 0x2936b4b1, 0, 0, 0, },   {       "b67-14", 0x00020000, 0x7f3dd724, 0, 0, 0, },   {       "b67-15", 0x00020000, 0xe84f62d0, 0, 0, 0, },   {       "b67-20", 0x00020000, 0x21439ea2, 0, 0, 0, },   {       "b67-23", 0x00020000, 0x789e9daa, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};static struct INPUT_INFO operation_thunderbolt_inputs[] ={   { KB_DEF_COIN1,        MSG_COIN1,               0x028004, 0x08, BIT_ACTIVE_0 },   { KB_DEF_COIN2,        MSG_COIN2,               0x028004, 0x04, BIT_ACTIVE_0 },   { KB_DEF_TILT,         MSG_TILT,                0x028004, 0x20, BIT_ACTIVE_0 },   { KB_DEF_SERVICE,      MSG_SERVICE,             0x028004, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P1_START,     MSG_P1_START,            0x028004, 0x40, BIT_ACTIVE_0 },   { KB_DEF_P1_UP,        MSG_P1_UP,               0x028010, 0x01, BIT_ACTIVE_1 },   { KB_DEF_P1_DOWN,      MSG_P1_DOWN,             0x028010, 0x02, BIT_ACTIVE_1 },   { KB_DEF_P1_LEFT,      MSG_P1_LEFT,             0x028010, 0x04, BIT_ACTIVE_1 },   { KB_DEF_P1_RIGHT,     MSG_P1_RIGHT,            0x028010, 0x08, BIT_ACTIVE_1 },   { KB_DEF_P1_B1,        MSG_P1_B1,               0x02800E, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P1_B2,        MSG_P1_B2,               0x02800E, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P2_START,     MSG_P2_START,            0x028004, 0x80, BIT_ACTIVE_0 },   { KB_DEF_P2_UP,        MSG_P2_UP,               0x028020, 0x01, BIT_ACTIVE_1 },   { KB_DEF_P2_DOWN,      MSG_P2_DOWN,             0x028020, 0x02, BIT_ACTIVE_1 },   { KB_DEF_P2_LEFT,      MSG_P2_LEFT,             0x028020, 0x04, BIT_ACTIVE_1 },   { KB_DEF_P2_RIGHT,     MSG_P2_RIGHT,            0x028020, 0x08, BIT_ACTIVE_1 },   { KB_DEF_P2_B1,        MSG_P2_B1,               0x02800E, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P2_B2,        MSG_P2_B2,               0x02800E, 0x08, BIT_ACTIVE_0 },   { 0,                   NULL,                    0,        0,    0            },};static struct DSW_DATA dsw_data_operation_thunderbolt_0[] ={   { "Continue Mode",         0x02, 0x02 },   { MSG_OFF,                 0x02, 0x00 },   { MSG_ON,                  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_3COIN_1PLAY,         0x10, 0x00 },   { MSG_4COIN_1PLAY,         0x00, 0x00 },   { MSG_COIN2,               0xC0, 0x04 },   { MSG_1COIN_2PLAY,         0xC0, 0x00 },   { MSG_1COIN_3PLAY,         0x80, 0x00 },   { MSG_1COIN_4PLAY,         0x40, 0x00 },   { MSG_1COIN_6PLAY,         0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_DATA dsw_data_operation_thunderbolt_1[] ={   { MSG_DIFFICULTY,          0x03, 0x04 },   { MSG_NORMAL,              0x03, 0x00 },   { MSG_EASY,                0x02, 0x00 },   { MSG_HARD,                0x01, 0x00 },   { MSG_HARDEST,             0x00, 0x00 },   { "Bullet Mags / Rockets", 0x0c, 0x04 },   { "5 / 3",                 0x0c, 0x00 },   { "6 / 4",                 0x08, 0x00 },   { "7 / 5",                 0x04, 0x00 },   { "8 / 6",                 0x00, 0x00 },   { "Bullets per Magazine",  0x30, 0x04 },   { "40",                    0x30, 0x00 },   { "50",                    0x20, 0x00 },   { "35",                    0x10, 0x00 },   { "30",                    0x00, 0x00 },   { "Half Price Continue",   0x40, 0x02 },   { MSG_OFF,                 0x40, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { "Game Title Language",   0x80, 0x02 },   { "Japanese",              0x80, 0x00 },   { "English",               0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_INFO operation_thunderbolt_dsw[] ={   { 0x028000, 0xFF, dsw_data_operation_thunderbolt_0 },   { 0x028002, 0x7F, dsw_data_operation_thunderbolt_1 },   { 0,        0,    NULL,      },};static struct ROMSW_DATA romsw_data_operation_thunderbolt_0[] ={   { "Taito Japan (Notice)",  0x01 },   { "Taito America",         0x02 },   { "Taito Japan",           0x03 },   { NULL,                    0    },};static struct ROMSW_INFO operation_thunderbolt_romsw[] ={   { 0x03FFFF, 0x03, romsw_data_operation_thunderbolt_0 },   { 0,        0,    NULL },};static struct VIDEO_INFO operation_thunderbolt_video ={   DrawOpThunderbolt,   320,   240,   64,   VIDEO_ROTATE_NORMAL| VIDEO_ROTATABLE,};struct GAME_MAIN game_operation_thunderbolt ={   operation_thunderbolt_dirs,   operation_thunderbolt_roms,   operation_thunderbolt_inputs,   operation_thunderbolt_dsw,   operation_thunderbolt_romsw,   LoadOpThunderbolt,   ClearOpThunderbolt,   &operation_thunderbolt_video,   ExecuteOpThunderboltFrame,   "othunder",   "Operation Thunderbolt",   "僆儁儗乕僔儑儞僒儞僟乕儃儖僩",   COMPANY_ID_TAITO,   "B67",   1989,   taito_ym2610_sound,   GAME_SHOOT,};static UINT8 *RAM_VIDEO;static UINT8 *RAM_SCROLL;static UINT8 *RAM_INPUT;static UINT8 *GFX_SPR;static UINT8 *GFX_SPR_SOLID;static UINT8 *GFX_BG0;static UINT8 *GFX_BG0_SOLID;static int x1,myy1,x11,myy11,x2,y2;void LoadOpThunderbolt(void){   int ta,tb,tc,td,te,tf;   UINT8 *TMP;   if(!(TMP=AllocateMem(0x2CBA00))) return;   if(!(GFX=AllocateMem(0x100000+0x459000+0x2000+0x4000))) return;   tb=0x80000;   if(!load_rom("B67-04", TMP, 0x49740)) return;		// 16x8 SPRITES   for(ta=0;ta<0x49740;ta+=2){      tc=ReadWord(&TMP[ta]);      TMP[tb+0]=((tc&0x8000)>>(15-0));      TMP[tb+1]=((tc&0x4000)>>(14-0));      TMP[tb+2]=((tc&0x2000)>>(13-0));      TMP[tb+3]=((tc&0x1000)>>(12-0));      TMP[tb+4]=((tc&0x0800)>>(11-0));      TMP[tb+5]=((tc&0x0400)>>(10-0));      TMP[tb+6]=((tc&0x0200)>>(9-0));      TMP[tb+7]=((tc&0x0100)>>(8-0));      TMP[tb+8]=((tc&0x0080)>>(7-0));      TMP[tb+9]=((tc&0x0040)>>(6-0));      TMP[tb+10]=((tc&0x0020)>>(5-0));      TMP[tb+11]=((tc&0x0010)>>(4-0));      TMP[tb+12]=((tc&0x0008)>>(3-0));      TMP[tb+13]=((tc&0x0004)>>(2-0));      TMP[tb+14]=((tc&0x0002)>>(1-0));      TMP[tb+15]=((tc&0x0001)>>(0-0));      tb+=16;   }   tb=0x80000;   if(!load_rom("B67-03", TMP, 0x49740)) return;		// 16x8 SPRITES   for(ta=0;ta<0x49740;ta+=2){      tc=ReadWord(&TMP[ta]);      TMP[tb+0]|=((tc&0x8000)>>(15-1));      TMP[tb+1]|=((tc&0x4000)>>(14-1));      TMP[tb+2]|=((tc&0x2000)>>(13-1));      TMP[tb+3]|=((tc&0x1000)>>(12-1));      TMP[tb+4]|=((tc&0x0800)>>(11-1));      TMP[tb+5]|=((tc&0x0400)>>(10-1));      TMP[tb+6]|=((tc&0x0200)>>(9-1));      TMP[tb+7]|=((tc&0x0100)>>(8-1));      TMP[tb+8]|=((tc&0x0080)>>(7-1));      TMP[tb+9]|=((tc&0x0040)>>(6-1));      TMP[tb+10]|=((tc&0x0020)>>(5-1));      TMP[tb+11]|=((tc&0x0010)>>(4-1));      TMP[tb+12]|=((tc&0x0008)>>(3-1));      TMP[tb+13]|=((tc&0x0004)>>(2-1));      TMP[tb+14]|=((tc&0x0002)>>(0));      TMP[tb+15]|=((tc&0x0001)<<(1));      tb+=16;   }   tb=0x80000;   if(!load_rom("B67-02", TMP, 0x49740)) return;		// 16x8 SPRITES   for(ta=0;ta<0x49740;ta+=2){      tc=ReadWord(&TMP[ta]);      TMP[tb+0]|=((tc&0x8000)>>(15-2));      TMP[tb+1]|=((tc&0x4000)>>(14-2));      TMP[tb+2]|=((tc&0x2000)>>(13-2));      TMP[tb+3]|=((tc&0x1000)>>(12-2));      TMP[tb+4]|=((tc&0x0800)>>(11-2));      TMP[tb+5]|=((tc&0x0400)>>(10-2));      TMP[tb+6]|=((tc&0x0200)>>(9-2));      TMP[tb+7]|=((tc&0x0100)>>(8-2));      TMP[tb+8]|=((tc&0x0080)>>(7-2));      TMP[tb+9]|=((tc&0x0040)>>(6-2));      TMP[tb+10]|=((tc&0x0020)>>(5-2));      TMP[tb+11]|=((tc&0x0010)>>(4-2));      TMP[tb+12]|=((tc&0x0008)>>(3-2));      TMP[tb+13]|=((tc&0x0004)>>(0));      TMP[tb+14]|=((tc&0x0002)<<(1));      TMP[tb+15]|=((tc&0x0001)<<(2));      tb+=16;   }   tb=0x80000;   if(!load_rom("B67-01", TMP, 0x49740)) return;		// 16x8 SPRITES   for(ta=0;ta<0x49740;ta+=2){      tc=ReadWord(&TMP[ta]);      TMP[tb+0]|=((tc&0x8000)>>(15-3));      TMP[tb+1]|=((tc&0x4000)>>(14-3));      TMP[tb+2]|=((tc&0x2000)>>(13-3));      TMP[tb+3]|=((tc&0x1000)>>(12-3));      TMP[tb+4]|=((tc&0x0800)>>(11-3));      TMP[tb+5]|=((tc&0x0400)>>(10-3));      TMP[tb+6]|=((tc&0x0200)>>(9-3));      TMP[tb+7]|=((tc&0x0100)>>(8-3));      TMP[tb+8]|=((tc&0x0080)>>(7-3));      TMP[tb+9]|=((tc&0x0040)>>(6-3));      TMP[tb+10]|=((tc&0x0020)>>(5-3));      TMP[tb+11]|=((tc&0x0010)>>(4-3));      TMP[tb+12]|=((tc&0x0008)>>(0));      TMP[tb+13]|=((tc&0x0004)<<(1));      TMP[tb+14]|=((tc&0x0002)<<(2));      TMP[tb+15]|=((tc&0x0001)<<(3));      tb+=16;   }   te=0;   if(!load_rom("B67-05", TMP, 0x11640)) return;		// 64x64 SPRITES   for(ta=0x100000;ta<0x559000;ta+=0x1000){      for(tb=0;tb<8;tb++){      for(tc=0;tc<4;tc++){         td=((TMP[te+1]<<8)|(TMP[te+0]));         td=td<<7;         td+=0x80000;         te+=2;         for(tf=0;tf<8;tf++){            WriteLong(&GFX[(tb<<9)+(tc<<4)+(tf<<6)+ta+0],ReadLong(&TMP[td+0]));            WriteLong(&GFX[(tb<<9)+(tc<<4)+(tf<<6)+ta+4],ReadLong(&TMP[td+4]));            WriteLong(&GFX[(tb<<9)+(tc<<4)+(tf<<6)+ta+8],ReadLong(&TMP[td+8]));            WriteLong(&GFX[(tb<<9)+(tc<<4)+(tf<<6)+ta+12],ReadLong(&TMP[td+12]));            td+=16;         }      }      }   }   tb=0;   if(!load_rom("B67-06", TMP, 0x80000)) return;		// 8x8 BG TILES   for(ta=0;ta<0x80000;ta+=2){      GFX[tb+3]=TMP[ta+0]&15;      GFX[tb+2]=TMP[ta+0]>>4;      GFX[tb+1]=TMP[ta+1]&15;      GFX[tb+0]=TMP[ta+1]>>4;      tb+=4;   }   GFX_BG0=GFX+0x000000;   GFX_SPR=GFX+0x100000;   GFX_BG0_SOLID = make_solid_mask_8x8(GFX, 0x4000);   GFX_SPR_SOLID = MakeSolidTileMap64x64(GFX_SPR, 0x459);   Init64x64_Table(&GFX[0x559000]);	// $2000 bytes   RAMSize=0x48000+0x10000+0x80;   if(!(RAM=AllocateMem(RAMSize))) return;   if(!(ROM=AllocateMem(0x80000))) return;   if(!load_rom("B67-20", RAM, 0x20000)) return;   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta]=RAM[ta];   }   if(!load_rom("B67-23", RAM, 0x20000)) return;   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta+1]=RAM[ta];   }   if(!load_rom("B67-14", RAM, 0x20000)) return;   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta+0x40000]=RAM[ta];   }   if(!load_rom("B67-15", RAM, 0x20000)) return;   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta+0x40001]=RAM[ta];   }   /*-----[Sound Setup]-----*/   Z80ROM=RAM+0x48000;   if(!load_rom("B67-13", Z80ROM, 0x10000)) return;	// Z80 SOUND ROM   if(!(PCMROM=AllocateMem(0x100000))) return;   if(!load_rom("B67-07",PCMROM+0x00000,0x80000)) return;	// ADPCM A rom   if(!load_rom("B67-08",PCMROM+0x80000,0x80000)) return;	// ADPCM A rom   YM2610SetBuffers(PCMROM, PCMROM+0x80000, 0x80000, 0x80000);   AddTaitoYM2610(0x0338, 0x02A5, 0x10000);   /*-----------------------*/   memset(RAM+0x00000,0x00,0x40000);   RAM_VIDEO  = RAM+0x10000;   RAM_SCROLL = RAM+0x28100;   RAM_INPUT  = RAM+0x28000;   set_colour_mapper(&col_map_xrrr_rrgg_gggb_bbbb);   InitPaletteMap(RAM+0x38000, 0x100, 0x10, 0x8000);   GFX_FG0 = RAM+0x3C000;   tc0110pcr_init(RAM+0x38000, 1);   EEPROM=RAM+0x48000+0x10000;   add_eeprom(EEPROM, 0x80, EPR_INVALIDATE_ON_ROM_CHANGE);   load_eeprom();   WriteLong68k(&ROM[0x072C],0x4E714E71);	// FIX INTERRUPT   WriteLong68k(&ROM[0x1A2E],0x4E714E71);	// FIX MAIN CHECKSUM ERROR   WriteLong68k(&ROM[0x1A32],0x4E714E71);   ROM[0xCDBE]=0x60;	// FIX SOUND? ERROR   ROM[0x185C]=0x4E;	// FIX MAIN RAM CHECK   ROM[0x185D]=0x71;   ROM[0x185E]=0x4E;   ROM[0x185F]=0x71;   ROM[0x187A]=0x4E;	// FIX MAIN RAM CHECK   ROM[0x187B]=0x71;   ROM[0x187C]=0x4E;   ROM[0x187D]=0x71;   ROM[0x1898]=0x4E;	// FIX MAIN RAM CHECK   ROM[0x1899]=0x71;   ROM[0x189A]=0x4E;   ROM[0x189B]=0x71;   ROM[0x18B6]=0x4E;	// FIX MAIN RAM CHECK   ROM[0x18B7]=0x71;   ROM[0x18B8]=0x4E;   ROM[0x18B9]=0x71;   ROM[0x007A]=0xCD;   ROM[0x007B]=0x3E;   ROM[0xCD3E]=0x48;		// IMPROVE INT#6   ROM[0xCD3F]=0xE7;   ROM[0xCD40]=0xC0;   ROM[0xCD41]=0xC0;   ROM[0x0868]=0x4E;		// SKIP OLD CODE (NO ROOM FOR HACK)   ROM[0x0867]=0xF9;		// (JMP $7FF00)   ROM[0x0868]=0x00;   ROM[0x0869]=0x07;   ROM[0x086A]=0xFF;   ROM[0x086B]=0x00;   ROM[0x7FF00]=0x4E;		// (JSR $000400)   ROM[0x7FF01]=0xB9;   ROM[0x7FF02]=0x00;   ROM[0x7FF03]=0x00;   ROM[0x7FF04]=0x04;   ROM[0x7FF05]=0x00;

⌨️ 快捷键说明

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