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

📄 thundfox.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************//*                                                                            *//*                  THUNDER FOX (C) 1990 TAITO CORPORATION                    *//*                                                                            *//******************************************************************************/#include "gameinc.h"#include "thundfox.h"#include "tc100scn.h"#include "tc200obj.h"#include "tc220ioc.h"#include "sasound.h"		// sample support routines#include "taitosnd.h"#ifdef RAINE_DEBUG#include "debug.h"#endifstatic struct DIR_INFO thunder_fox_dirs[] ={   { "thunder_fox", },   { "thundfox", },   { NULL, },};static struct ROM_INFO thunder_fox_roms[] ={   {   "c28scr1.01", 0x00080000, 0x6230a09d, 0, 0, 0, },   {     "c28lo.07", 0x00020000, 0x24419abb, 0, 0, 0, },   {  "c28mainh.13", 0x00020000, 0xacb07013, 0, 0, 0, },   {  "c28mainl.12", 0x00020000, 0xf04db477, 0, 0, 0, },   {   "c28objh.04", 0x00080000, 0xba7ed535, 0, 0, 0, },   {   "c28objl.03", 0x00080000, 0x51bdc7af, 0, 0, 0, },   {     "c28hi.08", 0x00020000, 0x38e038f1, 0, 0, 0, },   {   "c28scr2.01", 0x00080000, 0x44552b25, 0, 0, 0, },   {    "c28snd.14", 0x00010000, 0x45ef3616, 0, 0, 0, },   {   "c28snda.06", 0x00080000, 0xdb6983db, 0, 0, 0, },   {   "c28sndb.05", 0x00080000, 0xd3b238fa, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};static struct INPUT_INFO thunder_fox_inputs[] ={   { KB_DEF_COIN1,        MSG_COIN1,               0x02E20E, 0x04, BIT_ACTIVE_0 },   { KB_DEF_COIN2,        MSG_COIN2,               0x02E20E, 0x08, BIT_ACTIVE_0 },   { KB_DEF_TILT,         MSG_TILT,                0x02E20E, 0x01, BIT_ACTIVE_0 },   { KB_DEF_SERVICE,      MSG_SERVICE,             0x02E20E, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P1_START,     MSG_P1_START,            0x02E204, 0x80, BIT_ACTIVE_0 },   { KB_DEF_P1_UP,        MSG_P1_UP,               0x02E204, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P1_DOWN,      MSG_P1_DOWN,             0x02E204, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P1_LEFT,      MSG_P1_LEFT,             0x02E204, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P1_RIGHT,     MSG_P1_RIGHT,            0x02E204, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P1_B1,        MSG_P1_B1,               0x02E204, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P1_B2,        MSG_P1_B2,               0x02E204, 0x20, BIT_ACTIVE_0 },   { KB_DEF_P1_B3,        MSG_P1_B3,               0x02E204, 0x40, BIT_ACTIVE_0 },   { KB_DEF_P2_START,     MSG_P2_START,            0x02E206, 0x80, BIT_ACTIVE_0 },   { KB_DEF_P2_UP,        MSG_P2_UP,               0x02E206, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P2_DOWN,      MSG_P2_DOWN,             0x02E206, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P2_LEFT,      MSG_P2_LEFT,             0x02E206, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P2_RIGHT,     MSG_P2_RIGHT,            0x02E206, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P2_B1,        MSG_P2_B1,               0x02E206, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P2_B2,        MSG_P2_B2,               0x02E206, 0x20, BIT_ACTIVE_0 },   { KB_DEF_P2_B3,        MSG_P2_B3,               0x02E206, 0x40, BIT_ACTIVE_0 },   { 0,                   NULL,                    0,        0,    0            },};static struct DSW_DATA dsw_data_thunder_fox_0[] ={   { MSG_DSWA_BIT1,           0x01, 0x02 },   { MSG_OFF,                 0x01, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { 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_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_thunder_fox_1[] ={   { MSG_DIFFICULTY,          0x03, 0x04 },   { MSG_NORMAL,              0x03, 0x00 },   { MSG_EASY,                0x02, 0x00 },   { MSG_HARD,                0x01, 0x00 },   { MSG_HARDEST,             0x00, 0x00 },   { "Time Limit",            0x04, 0x02 },   { MSG_ON,                  0x04, 0x00 },   { MSG_OFF,                 0x00, 0x00 },   { "Lives",                 0x30, 0x04 },   { "3",                     0x30, 0x00 },   { "2",                     0x20, 0x00 },   { "4",                     0x10, 0x00 },   { "5",                     0x00, 0x00 },   { "Continue Play",         0x40, 0x02 },   { MSG_ON,                  0x40, 0x00 },   { MSG_OFF,                 0x00, 0x00 },   { "Controls",              0x80, 0x02 },   { "Dual",                  0x80, 0x00 },   { "Single",                0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_INFO thunder_fox_dsw[] ={   { 0x02E200, 0xFF, dsw_data_thunder_fox_0 },   { 0x02E202, 0xFF, dsw_data_thunder_fox_1 },   { 0,        0,    NULL,      },};static struct ROMSW_DATA romsw_data_thunder_fox_0[] ={   { "Taito Japan",           0x00 },   { "Taito America",         0x01 },   { "Taito",                 0x02 },   { NULL,                    0    },};static struct ROMSW_INFO thunder_fox_romsw[] ={   { 0x03FFFF, 0x00, romsw_data_thunder_fox_0 },   { 0,        0,    NULL },};static struct VIDEO_INFO thunder_fox_video ={   DrawThunderFox,   320,   224,   32,   VIDEO_ROTATE_NORMAL| VIDEO_ROTATABLE,};struct GAME_MAIN game_thunder_fox ={   thunder_fox_dirs,   thunder_fox_roms,   thunder_fox_inputs,   thunder_fox_dsw,   thunder_fox_romsw,   LoadThunderFox,   ClearThunderFox,   &thunder_fox_video,   ExecuteThunderFoxFrame,   "thundfox",   "Thunder Fox",   "僒儞僟乕僼僅僢僋僗",   COMPANY_ID_TAITO,   "C28",   1990,   taito_ym2610_sound,   GAME_SHOOT,};static UINT8 *RAM_INPUT;static UINT8 *RAM_VIDEO;static UINT8 *RAM_SCROLL;static UINT8 *RAM_VIDEO2;static UINT8 *RAM_SCROLL2;static UINT8 *GFX_BG0_SOLID;static UINT8 *GFX_BG2_SOLID;static UINT8 *GFX_BG0;static UINT8 *GFX_BG2;static UINT8 *RAM_OBJECT;static UINT8 *GFX_SPR;static UINT8 *GFX_SPR_SOLID;static int SoundBad;static void BadWriteByte(UINT32 address, UINT8 data){#ifdef RAINE_DEBUG      if(address!=0x800002)print_debug("Wb(%06x,%02x) [%06x]\n",address,data,s68000context.pc);#endif}static void BadWriteWord(UINT32 address, UINT16 data){   #ifdef RAINE_DEBUG      if(address!=0x200000)print_debug("Ww(%06x,%04x) [%06x]\n",address,data,s68000context.pc);   #endif}void LoadThunderFox(void){   int ta,tb;   if(!(RAM=AllocateMem(0x80000))) return;   if(!(GFX=AllocateMem(0x200000+0x200000))) return;   GFX_BG0=GFX+0x000000;   GFX_BG2=GFX+0x100000;   GFX_SPR=GFX+0x200000;   tb=0;   if(!load_rom("c28scr1.01", RAM, 0x100000)) return;		// 8x8 TILES   for(ta=0;ta<0x80000;ta+=2,tb+=4){      GFX[tb+3]=RAM[ta]&15;      GFX[tb+2]=RAM[ta]>>4;      GFX[tb+1]=RAM[ta+1]&15;      GFX[tb+0]=RAM[ta+1]>>4;   }   if(!load_rom("c28scr2.01", RAM, 0x80000)) return;		// 8x8 TILES   for(ta=0;ta<0x80000;ta+=2,tb+=4){      GFX[tb+3]=RAM[ta]&15;      GFX[tb+2]=RAM[ta]>>4;      GFX[tb+1]=RAM[ta+1]&15;      GFX[tb+0]=RAM[ta+1]>>4;   }   tb=0;   if(!load_rom("c28objl.03", RAM, 0x100000)) return;		// 16x16 SPRITES ($2000)   for(ta=0;ta<0x80000;ta++,tb+=4){      GFX_SPR[tb+0]=RAM[ta]&15;      GFX_SPR[tb+1]=RAM[ta]>>4;   }   tb=2;   if(!load_rom("c28objh.04", RAM, 0x100000)) return;		// 16x16 SPRITES ($2000)   for(ta=0;ta<0x80000;ta++,tb+=4){      GFX_SPR[tb+0]=RAM[ta]&15;      GFX_SPR[tb+1]=RAM[ta]>>4;   }   if(!(RAM=AllocateMem(0x40000+0x10000))) return;   if(!(ROM=AllocateMem(0x80000))) return;   if(!load_rom("c28mainh.13", RAM, 0x20000)) return;		// 68000 ROM   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta]=RAM[ta];   }   if(!load_rom("c28mainl.12", RAM, 0x20000)) return;   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta+1]=RAM[ta];   }   if(!load_rom("c28hi.08", RAM, 0x20000)) return;   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta+0x40000]=RAM[ta];   }   if(!load_rom("c28lo.07", RAM, 0x20000)) return;   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta+0x40001]=RAM[ta];   }   /*-----[Sound Setup]-----*/   Z80ROM=RAM+0x40000;   if(!load_rom("c28snd.14", Z80ROM, 0x10000)) return;	// Z80 SOUND ROM   if(Z80ROM[0x001F]==0x00){      SoundBad=0;			// ROM is good   }   else{      SoundBad=1;			// ROM is corrupt   }   if(SoundBad==0){   if(!(PCMROM=AllocateMem(0x100000))) return;   if(!load_rom("c28snda.06",PCMROM+0x00000,0x80000)) return;		// ADPCM A rom   if(!load_rom("c28sndb.05",PCMROM+0x80000,0x80000)) return;		// ADPCM B rom   YM2610SetBuffers(PCMROM, PCMROM, 0x100000, 0x100000);   AddTaitoYM2610(0x023A, 0x01BA, 0x10000);   }   /*-----------------------*/

⌨️ 快捷键说明

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