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

📄 wgp.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
📖 第 1 页 / 共 3 页
字号:
/******************************************************************************//*                                                                            *//*               WORLD GRAND PRIX (C) 1988 TAITO CORPORATION                  *//*                                                                            *//******************************************************************************/#include "gameinc.h"#include "wgp.h"#include "tc100scn.h"#include "tc220ioc.h"#include "taitosnd.h"#ifdef RAINE_DEBUG#include "debug.h"#endif#include "sasound.h"		// sample support routines/** This board uses following custom chips:    TC0100SCN - OK    TC0140SYT - OK    TC0170ABT    TC0220IOC - OK    TC0240PBJ    TC0250SCR    TC0260DAR    TC0330CHL* This game has LAN interface board, it uses uPD72105C.*/static struct DIR_INFO world_grand_prix_dirs[] ={   { "world_grand_prix", },   { "wgp", },   { NULL, },};static struct ROM_INFO world_grand_prix_roms[] ={   {       "c32-01", 0x00080000, 0xd27d7d93, 0, 0, 0, },   {       "c32-02", 0x00080000, 0xc5721f3a, 0, 0, 0, },   {       "c32-03", 0x00080000, 0x9ec3e134, 0, 0, 0, },   {       "c32-04", 0x00080000, 0x473a19c9, 0, 0, 0, },   {       "c32-05", 0x00080000, 0x3698d47a, 0, 0, 0, },   {       "c32-06", 0x00080000, 0xf0267203, 0, 0, 0, },   {       "c32-07", 0x00080000, 0x743d46bd, 0, 0, 0, },   {       "c32-08", 0x00080000, 0xfaab63b0, 0, 0, 0, },   {       "c32-09", 0x00080000, 0x96495f35, 0, 0, 0, },   {       "c32-10", 0x00080000, 0xa44c66e9, 0, 0, 0, },   {       "c32-11", 0x00080000, 0x2b326ff0, 0, 0, 0, },   {       "c32-12", 0x00080000, 0xdf48a37b, 0, 0, 0, },   {       "c32-24", 0x00010000, 0xe9adb447, 0, 0, 0, },   {       "c32-25", 0x00020000, 0x0cc81e77, 0, 0, 0, },   {       "c32-27", 0x00020000, 0xbe2397fb, 0, 0, 0, },   {       "c32-28", 0x00020000, 0x38f3c7bf, 0, 0, 0, },   {       "c32-29", 0x00020000, 0xfab47cf0, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};static struct INPUT_INFO world_grand_prix_inputs[] ={   { KB_DEF_COIN1,        MSG_COIN1,               0x06220E, 0x04, BIT_ACTIVE_0 },   { KB_DEF_COIN2,        MSG_COIN2,               0x06220E, 0x08, BIT_ACTIVE_0 },   { KB_DEF_TILT,         MSG_TILT,                0x06220E, 0x01, BIT_ACTIVE_0 },   { KB_DEF_SERVICE,      MSG_SERVICE,             0x06220E, 0x02, BIT_ACTIVE_0 }, // Vibration?!   { KB_DEF_P1_START,     MSG_P1_START,            0x062204, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P1_B1,        "Shift Up",              0x062204, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P1_B2,        "Shift Down",            0x062204, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P1_B3,        "Start Lump (Lamp?)",    0x062206, 0x01, BIT_ACTIVE_1 },   { KB_DEF_P1_B4,        "Brake Lump (Lamp?)",    0x062206, 0x02, BIT_ACTIVE_1 },   { 0,                   NULL,                    0,        0,    0            },};static struct DSW_DATA dsw_data_world_grand_prix_0[] ={   { "Motor",                 0x01, 0x02 },   { MSG_OFF,                 0x01, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT2,           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_DSWA_BIT5,           0x10, 0x02 },   { MSG_OFF,                 0x10, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT6,           0x20, 0x02 },   { MSG_OFF,                 0x20, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT7,           0x40, 0x02 },   { MSG_OFF,                 0x40, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT8,           0x80, 0x02 },   { MSG_OFF,                 0x80, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_INFO world_grand_prix_dsw[] ={   { 0x062200, 0xFF, dsw_data_world_grand_prix_0 },   { 0x062202, 0xFF, dsw_data_default_1 },   { 0,        0,    NULL,      },};static struct VIDEO_INFO world_grand_prix_video ={   DrawWorldGrandPrix,   320,   240,   32,   VIDEO_ROTATE_NORMAL| VIDEO_ROTATABLE,};struct GAME_MAIN game_world_grand_prix ={   world_grand_prix_dirs,   world_grand_prix_roms,   world_grand_prix_inputs,   world_grand_prix_dsw,   NULL,   load_world_grand_prix,   ClearWorldGrandPrix,   &world_grand_prix_video,   ExecuteWorldGrandPrixFrame,   "wgp",   "World Grand Prix",   NULL,   COMPANY_ID_TAITO,   "C32",   1989,   taito_ym2610_sound,   GAME_RACE | GAME_NOT_WORKING,};static struct DIR_INFO world_grand_prix_japanese_dirs[] ={   { "world_grand_prix_japanese", },   { "wgpj", },   { ROMOF("wgp"), },   { CLONEOF("wgp"), },   { NULL, },};static struct ROM_INFO world_grand_prix_japanese_roms[] ={   {       "c32-01", 0x00080000, 0xd27d7d93, 0, 0, 0, },   {       "c32-02", 0x00080000, 0xc5721f3a, 0, 0, 0, },   {       "c32-03", 0x00080000, 0x9ec3e134, 0, 0, 0, },   {       "c32-04", 0x00080000, 0x473a19c9, 0, 0, 0, },   {       "c32-05", 0x00080000, 0x3698d47a, 0, 0, 0, },   {       "c32-06", 0x00080000, 0xf0267203, 0, 0, 0, },   {       "c32-07", 0x00080000, 0x743d46bd, 0, 0, 0, },   {       "c32-08", 0x00080000, 0xfaab63b0, 0, 0, 0, },   {       "c32-09", 0x00080000, 0x96495f35, 0, 0, 0, },   {       "c32-10", 0x00080000, 0xa44c66e9, 0, 0, 0, },   {       "c32-11", 0x00080000, 0x2b326ff0, 0, 0, 0, },   {       "c32-12", 0x00080000, 0xdf48a37b, 0, 0, 0, },   {       "c32-24", 0x00010000, 0xe9adb447, 0, 0, 0, },   {   "c32-48.bin", 0x00020000, 0x819cc134, 0, 0, 0, },   {       "c32-27", 0x00020000, 0xbe2397fb, 0, 0, 0, },   {       "c32-28", 0x00020000, 0x38f3c7bf, 0, 0, 0, },   {   "c32-49.bin", 0x00020000, 0x4a515f02, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};struct GAME_MAIN game_world_grand_prix_japanese ={   world_grand_prix_japanese_dirs,   world_grand_prix_japanese_roms,   world_grand_prix_inputs,   world_grand_prix_dsw,   NULL,   load_world_grand_prix_japanese,   ClearWorldGrandPrix,   &world_grand_prix_video,   ExecuteWorldGrandPrixFrame,   "wgpj",   "World Grand Prix (Japan)",   NULL,   COMPANY_ID_TAITO,   "C32",   1989,   taito_ym2610_sound,   GAME_RACE | GAME_NOT_WORKING,};#define PIV_COUNT	(0x4000)#define OBJ_B_COUNT	(0x4000)static int obj_id,rod_id;//static int romset;// OBJECT TILE MAPSstatic UINT8 *OBJECT_MAP;// 16x16 OBJECT TILES BANK A//static UINT8 *GFX_OBJ_A;//static UINT8 *GFX_OBJ_A_SOLID;// 16x16 OBJECT TILES BANK Bstatic UINT8 *GFX_OBJ_B; static UINT8 *GFX_OBJ_B_SOLID;// 16x16 PIVOT TILESstatic UINT8 *GFX_PIV; static UINT8 *GFX_PIV_SOLID;static UINT8 *zoom16_ofs;static UINT8 *RAM_MAIN;static UINT8 *RAM_MAIN_2;static UINT8 *RAM_COMMON;static UINT8 *RAM_VIDEO;static UINT8 *RAM_VIDEO_2;static UINT8 *RAM_OBJECT;static UINT8 *RAM_COLOUR;static UINT8 *RAM_SCROLL;static UINT8 *RAM_SCROLL_2;static UINT8 *RAM_INPUT;static UINT8 *RAM_INPUT_2;static UINT8 *RAM_INPUT_3;static UINT8 *GFX_BG0_SOLID;static UINT8 *GFX_LINES;/******************************************************************************//* WGP colour banking                                                         *//******************************************************************************/static void set_col_bank(UINT32 bank){   bank &= 3;   silly_wgp_colour_ram(RAM_COLOUR + (bank * 0x800));   memset(bank_status, 0x00, 0x100 * 2);}static void load_actual(int romset){   int ta,tb,tc;   UINT8 *TMP;   romset=0;   if(!(GFX=AllocateMem(0x100000))) return;   if(!(GFX_LINES=AllocateMem(0x200000))) return;   if(!(GFX_PIV=AllocateMem(PIV_COUNT*0x100))) return;   if(!(GFX_OBJ_B=AllocateMem(OBJ_B_COUNT*0x100))) return;   if(!(OBJECT_MAP=AllocateMem(0x80000))) return;   if(!(TMP=AllocateMem(0x80000))) return;   if(!load_rom_index(4, TMP, OBJ_B_COUNT*0x20)) return;	// 16x16 OBJ A   tb=0;   for(ta=0;ta<OBJ_B_COUNT*0x20;ta+=2){      tc=ReadWord(&TMP[ta]);      GFX_OBJ_B[tb+0] = ((tc&0x000F)>> 0);      GFX_OBJ_B[tb+1] = ((tc&0x00F0)>> 4);      GFX_OBJ_B[tb+2] = ((tc&0x0F00)>> 8);      GFX_OBJ_B[tb+3] = ((tc&0xF000)>>12);      tb+=8;   }   if(!load_rom_index(5, TMP, OBJ_B_COUNT*0x20)) return;	// 16x16 OBJ A   tb=4;   for(ta=0;ta<OBJ_B_COUNT*0x20;ta+=2){      tc=ReadWord(&TMP[ta]);      GFX_OBJ_B[tb+0] = ((tc&0x000F)>> 0);      GFX_OBJ_B[tb+1] = ((tc&0x00F0)>> 4);      GFX_OBJ_B[tb+2] = ((tc&0x0F00)>> 8);      GFX_OBJ_B[tb+3] = ((tc&0xF000)>>12);      tb+=8;   }   if(!load_rom_index(6, TMP, OBJ_B_COUNT*0x20)) return;	// 16x16 OBJ A   tb=0x200000;   for(ta=0;ta<OBJ_B_COUNT*0x20;ta+=2){      tc=ReadWord(&TMP[ta]);      GFX_OBJ_B[tb+0] = ((tc&0x000F)>> 0);      GFX_OBJ_B[tb+1] = ((tc&0x00F0)>> 4);      GFX_OBJ_B[tb+2] = ((tc&0x0F00)>> 8);      GFX_OBJ_B[tb+3] = ((tc&0xF000)>>12);      tb+=8;   }   if(!load_rom_index(7, TMP, OBJ_B_COUNT*0x20)) return;	// 16x16 OBJ A   tb=0x200004;   for(ta=0;ta<OBJ_B_COUNT*0x20;ta+=2){      tc=ReadWord(&TMP[ta]);      GFX_OBJ_B[tb+0] = ((tc&0x000F)>> 0);      GFX_OBJ_B[tb+1] = ((tc&0x00F0)>> 4);      GFX_OBJ_B[tb+2] = ((tc&0x0F00)>> 8);      GFX_OBJ_B[tb+3] = ((tc&0xF000)>>12);      tb+=8;   }   if(!load_rom_index(0, TMP, PIV_COUNT*0x20)) return;	// 16x16 OBJ A   tb=0;   for(ta=0;ta<PIV_COUNT*0x20;ta+=2){      tc=ReadWord(&TMP[ta]);      GFX_PIV[tb+0] = ((tc&0x000F)>> 0);      GFX_PIV[tb+1] = ((tc&0x00F0)>> 4);      GFX_PIV[tb+2] = ((tc&0x0F00)>> 8);      GFX_PIV[tb+3] = ((tc&0xF000)>>12);      tb+=16;   }   if(!load_rom_index(1, TMP, PIV_COUNT*0x20)) return;	// 16x16 OBJ A   tb=4;   for(ta=0;ta<PIV_COUNT*0x20;ta+=2){      tc=ReadWord(&TMP[ta]);      GFX_PIV[tb+0] = ((tc&0x000F)>> 0);      GFX_PIV[tb+1] = ((tc&0x00F0)>> 4);      GFX_PIV[tb+2] = ((tc&0x0F00)>> 8);      GFX_PIV[tb+3] = ((tc&0xF000)>>12);      tb+=16;   }   if(!load_rom_index(2, TMP, PIV_COUNT*0x20)) return;	// 16x16 OBJ A   tb=8;   for(ta=0;ta<PIV_COUNT*0x20;ta+=2){      tc=ReadWord(&TMP[ta]);      GFX_PIV[tb+0] = ((tc&0x000F)>> 0);      GFX_PIV[tb+1] = ((tc&0x00F0)>> 4);      GFX_PIV[tb+2] = ((tc&0x0F00)>> 8);      GFX_PIV[tb+3] = ((tc&0xF000)>>12);      tb+=16;   }   if(!load_rom_index(3, TMP, PIV_COUNT*0x20)) return;	// 16x16 OBJ A   tb=12;   for(ta=0;ta<PIV_COUNT*0x20;ta+=2){      tc=ReadWord(&TMP[ta]);      GFX_PIV[tb+0] = ((tc&0x000F)>> 0);      GFX_PIV[tb+1] = ((tc&0x00F0)>> 4);      GFX_PIV[tb+2] = ((tc&0x0F00)>> 8);      GFX_PIV[tb+3] = ((tc&0xF000)>>12);      tb+=16;   }   if(!load_rom_index(8, TMP, 0x80000)) return;   tb=0;   for(ta=0;ta<0x80000;ta+=2){      tc=ReadWord(&TMP[ta]);      GFX[tb+0] = ((tc&0xF000)>>12);      GFX[tb+1] = ((tc&0x0F00)>> 8);      GFX[tb+2] = ((tc&0x00F0)>> 4);      GFX[tb+3] = ((tc&0x000F)>> 0);      tb+=4;   }   FreeMem(TMP);   GFX_PIV_SOLID   = make_solid_mask_16x16(GFX_PIV,   PIV_COUNT);   GFX_OBJ_B_SOLID = make_solid_mask_16x16(GFX_OBJ_B, OBJ_B_COUNT);   GFX_BG0_SOLID   = make_solid_mask_8x8  (GFX,       0x4000);   RAMSize=0x80000;   if(!(RAM=AllocateMem(0x80000))) return;   if(!(ROM=AllocateMem(0x100000))) return;   if(!load_rom_index(13, RAM, 0x20000)) return;	// 68000 MAIN ROM   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta]=RAM[ta];   }   if(!load_rom_index(16, RAM, 0x20000)) return;   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta+1]=RAM[ta];   }   if(!load_rom_index(15, RAM, 0x20000)) return;	// 68000 SUB ROM   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta+0x40000]=RAM[ta];   }   if(!load_rom_index(14, RAM, 0x20000)) return;   for(ta=0;ta<0x20000;ta++){      ROM[ta+ta+0x40001]=RAM[ta];   }   if(!load_rom_index(9, ROM+0x80000, 0x80000)) return; // 68000 MAIN DATA ROM   /*-----[Sound Setup]-----*/   Z80ROM=RAM+0x70000;   if(!load_rom_index(12, Z80ROM, 0x10000)) return;	// Z80 SOUND ROM   if(!(PCMROM=AllocateMem(0x100000))) return;   if(!load_rom_index(10, PCMROM+0x000000, 0x80000)) return;	// Delta-T   if(!load_rom_index(11, PCMROM+0x080000, 0x80000)) return;	// Main   YM2610SetBuffers(PCMROM+0x80000, PCMROM+0x00000, 0x80000, 0x80000);   AddTaitoYM2610(0x020B, 0x01BA, 0x10000);   /*-----------------------*/   memset(RAM+0x00000,0x00,0x70000);   //memset(RAM+0x62200,0xFF,0x00200);   RAM_MAIN    = RAM+0x00000;   RAM_VIDEO   = RAM+0x10000;   RAM_VIDEO_2 = RAM+0x20000;   RAM_OBJECT  = RAM+0x40000;   GFX_FG0     = RAM+0x50000;   RAM_MAIN_2  = RAM+0x54000;   RAM_COMMON  = RAM+0x5C000;   RAM_COLOUR  = RAM+0x60000;   RAM_SCROLL  = RAM+0x62000;   RAM_SCROLL_2= RAM+0x62100;   RAM_INPUT   = RAM+0x62200;   RAM_INPUT_2 = RAM+0x62300;   RAM_INPUT_3 = RAM+0x62400;   set_colour_mapper(&col_map_rrrr_gggg_bbbb_xxxx);   InitPaletteMap(RAM_COLOUR, 0x100, 0x10, 0x1000);

⌨️ 快捷键说明

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