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

📄 toaplan1.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
📖 第 1 页 / 共 5 页
字号:
   {   "o17_03.bin", 0x00020000, 0x68723dc9, REGION_GFX2, 0x040000, LOAD_NORMAL, },   {   "o17_04.bin", 0x00020000, 0xfe0ecb13, REGION_GFX2, 0x060000, LOAD_NORMAL, },   {           NULL,          0,          0, 0, 0, 0, },};static struct DSW_DATA dsw_data_same_same_same_2[] ={   { "Language",              0x0F, 0x10 },   { "0",                     0x00, 0x00 },   { "1",                     0x01, 0x00 },   { "2",                     0x02, 0x00 },   { "3",                     0x03, 0x00 },   { "4",                     0x04, 0x00 },   { "5",                     0x05, 0x00 },   { "6",                     0x06, 0x00 },   { "7",                     0x07, 0x00 },   { "8",                     0x08, 0x00 },   { "9",                     0x09, 0x00 },   { "A",                     0x0A, 0x00 },   { "B",                     0x0B, 0x00 },   { "C",                     0x0C, 0x00 },   { "D",                     0x0D, 0x00 },   { "E",                     0x0E, 0x00 },   { "F",                     0x0F, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_INFO same_same_same_dsw[] ={   { 0x023000, 0x00, dsw_data_default_0 },   { 0x023001, 0x00, dsw_data_default_1 },   { 0x023002, 0x00, dsw_data_same_same_same_2 },   { 0,        0,    NULL,      },};struct GAME_MAIN game_same_same_same ={   same_same_same_dirs,   same_same_same_roms,   vimana_inputs,   same_same_same_dsw,   NULL,   load_fire_shark,   clear_fire_shark,   &toaplan1_r270_video,   ExecuteToaplan1Frame,   "samesame",   "Same Same Same",   NULL,   COMPANY_ID_TOAPLAN,   "TP017",   1989,   NULL,   GAME_SHOOT | GAME_NOT_WORKING,};static struct DIR_INFO hell_fire_dirs[] ={   { "hell_fire", },   { "hellfire", },   { NULL, },};static struct ROM_INFO hell_fire_roms[] ={   {   "b90-14.bin", 0x00020000, 0x101df9f5, REGION_ROM1, 0x000000, LOAD_8_16,   },   {   "b90-15.bin", 0x00020000, 0xe67fd452, REGION_ROM1, 0x000001, LOAD_8_16,   },   {   "b90-04.bin", 0x00020000, 0xea6150fc, REGION_GFX1, 0x000000, LOAD_NORMAL, },   {   "b90-05.bin", 0x00020000, 0xbb52c507, REGION_GFX1, 0x020000, LOAD_NORMAL, },   {   "b90-06.bin", 0x00020000, 0xcf5b0252, REGION_GFX1, 0x040000, LOAD_NORMAL, },   {   "b90-07.bin", 0x00020000, 0xb98af263, REGION_GFX1, 0x060000, LOAD_NORMAL, },   {   "b90-11.bin", 0x00020000, 0xc33e543c, REGION_GFX2, 0x000000, LOAD_NORMAL, },   {   "b90-10.bin", 0x00020000, 0x35fd1092, REGION_GFX2, 0x020000, LOAD_NORMAL, },   {   "b90-09.bin", 0x00020000, 0xcf01009e, REGION_GFX2, 0x040000, LOAD_NORMAL, },   {   "b90-08.bin", 0x00020000, 0x3404a5e3, REGION_GFX2, 0x060000, LOAD_NORMAL, },   {   "b90-03.bin", 0x00008000, 0x4058fa67, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};static struct DSW_DATA dsw_data_hell_fire_2[] ={   { "Language",              0x0F, 0x10 },   { "0",                     0x00, 0x00 },   { "1",                     0x01, 0x00 },   { "2",                     0x02, 0x00 },   { "3",                     0x03, 0x00 },   { "4",                     0x04, 0x00 },   { "5",                     0x05, 0x00 },   { "6",                     0x06, 0x00 },   { "7",                     0x07, 0x00 },   { "8",                     0x08, 0x00 },   { "9",                     0x09, 0x00 },   { "A",                     0x0A, 0x00 },   { "B",                     0x0B, 0x00 },   { "C",                     0x0C, 0x00 },   { "D",                     0x0D, 0x00 },   { "E",                     0x0E, 0x00 },   { "F",                     0x0F, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_INFO hell_fire_dsw[] ={   { 0x023000, 0x00, dsw_data_hellfire_0 },   { 0x023001, 0x00, dsw_data_hellfire_1 },   { 0x023002, 0x00, dsw_data_hell_fire_2 },   { 0,        0,    NULL,      },};struct GAME_MAIN game_hell_fire ={   hell_fire_dirs,   hell_fire_roms,   vimana_inputs,   hell_fire_dsw,   NULL,   load_hell_fire,   clear_hell_fire,   &toaplan1_video,   ExecuteToaplan1Frame_Sound,   "hellfire",   "Hell Fire",   NULL,   COMPANY_ID_TOAPLAN,   "B90",   1989,   toaplan1_sound,   GAME_SHOOT,};static struct DIR_INFO truxton_dirs[] ={   { "truxton", },   { NULL, },};static struct ROM_INFO truxton_roms[] ={   {   "b65_11.bin", 0x00020000, 0x1a62379a, REGION_ROM1, 0x000000, LOAD_8_16,   },   {   "b65_10.bin", 0x00020000, 0xaff5195d, REGION_ROM1, 0x000001, LOAD_8_16,   },   {   "b65_08.bin", 0x00020000, 0xd2315b37, REGION_GFX1, 0x000000, LOAD_NORMAL, },   {   "b65_07.bin", 0x00020000, 0xfb83252a, REGION_GFX1, 0x020000, LOAD_NORMAL, },   {   "b65_06.bin", 0x00020000, 0x36cedcbe, REGION_GFX1, 0x040000, LOAD_NORMAL, },   {   "b65_05.bin", 0x00020000, 0x81cd95f1, REGION_GFX1, 0x060000, LOAD_NORMAL, },   {   "b65_04.bin", 0x00020000, 0x8c6ff461, REGION_GFX2, 0x000000, LOAD_NORMAL, },   {   "b65_03.bin", 0x00020000, 0x58b1350b, REGION_GFX2, 0x020000, LOAD_NORMAL, },   {   "b65_02.bin", 0x00020000, 0x1dd55161, REGION_GFX2, 0x040000, LOAD_NORMAL, },   {   "b65_01.bin", 0x00020000, 0xe974937f, REGION_GFX2, 0x060000, LOAD_NORMAL, },   {   "b65_09.bin", 0x00008000, 0xf1c0f410, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};static struct DSW_DATA dsw_data_truxton_2[] ={   { "Language",              0x0F, 0x10 },   { "0",                     0x00, 0x00 },   { "1",                     0x01, 0x00 },   { "2",                     0x02, 0x00 },   { "3",                     0x03, 0x00 },   { "4",                     0x04, 0x00 },   { "5",                     0x05, 0x00 },   { "6",                     0x06, 0x00 },   { "7",                     0x07, 0x00 },   { "8",                     0x08, 0x00 },   { "9",                     0x09, 0x00 },   { "A",                     0x0A, 0x00 },   { "B",                     0x0B, 0x00 },   { "C",                     0x0C, 0x00 },   { "D",                     0x0D, 0x00 },   { "E",                     0x0E, 0x00 },   { "F",                     0x0F, 0x00 },   { NULL,                    0,    0,   },};   static struct DSW_INFO truxton_dsw[] ={   { 0x023003, 0x00, dsw_data_rally_bike_0 },   { 0x023004, 0x00, dsw_data_truxton_1 },   { 0x023005, 0x00, dsw_data_truxton_2 },   { 0,        0,    NULL,      },};struct GAME_MAIN game_truxton ={   truxton_dirs,   truxton_roms,   vimana_inputs,   truxton_dsw,   NULL,   load_truxton,   clear_truxton,   &toaplan1_r270_video,   ExecuteToaplan1Frame_Sound,   "truxton",   "Tatsujin",   NULL,   COMPANY_ID_TOAPLAN,   "B65",   1988,   toaplan1_sound,   GAME_SHOOT,};// Store Tiles in priority lists (good idea from Shark!).#define MAX_PRI         32              // 32 levels of priority#define MAX_TILES       0x8000          // 0x4000*0x14=0x60000static struct TILE_Q{   UINT32 tile;                          // Tile number   UINT32 x,y;                           // X,Y position   UINT8 *map;                          // Colour map data   struct TILE_Q *next;                 // Next item with equal priority} TILE_Q;static struct TILE_Q *TileQueue;               // full liststatic struct TILE_Q *last_tile;               // last tile in usestatic struct TILE_Q *prilist[MAX_PRI];        // start node for each priority list#define ROM_COUNT       10/* Supported romsets:  0 - Vimana              - 1991 - TOAPLAN  1 - Vimana alt set      - 1991 - TOAPLAN  2 - Outzone             - 1990 - TOAPLAN  3 - Rally Bike          - 1988 - TOAPLAN  4 - Zero Wing           - 1990 - TOAPLAN  5 - Demon's World       - 1990 - TOAPLAN  6 - Fire Shark          - 19.. - TOAPLAN  7 - Same Same Same      - 19.. - TOAPLAN  8 - Hell Fire           - 19.. - TOAPLAN  9 - Truxton             - 1988 - TOAPLAN Todo: - LotsVimana: - Sound Z80 is not dumpedRally Bike: - Object ram is directly accessed (no port) bootleg?Fire Shark: - Sound Z80 is not dumpedSame Same Same: - Sound Z80 is not dumped*/static int romset;static UINT8 *GFX_BG0;static UINT8 *GFX_BG0_SOLID;static UINT8 *GFX_SPR;static UINT8 *GFX_SPR_SOLID;/******************************************************************************//*  VCU CHIP                                                                  *//******************************************************************************/typedef struct TP1VCU				// information about 1 chip{   UINT8 *VRAM;					// layer ram (0x10000 bytes)   UINT8 *RAM_OBJ;				// object ram (0x800 + 0x80 bytes)   UINT8 *SCROLL;				// scroll ram (0x10 bytes)   UINT32 obj_pos;				// current offset in object ram   UINT32 bg_pos;				// current offset in layer ram   UINT32 scroll_pos;				// current offset in SCROLL   UINT32 status;				// some status read   UINT8 *GFX_BG;				// GFX data   UINT8 *MASK_BG;				// MASK data   UINT32 tile_mask_bg;				// tile count   UINT32 tile_mask_obj;				// tile count   UINT32 tile_ofs_obj;				// tile offset} TP1VCU;struct TP1VCU tp1vcu[1];			// max 1 chipsstatic void init_tp1vcu(UINT32 num){   tp1vcu[num].obj_pos    = 0x0000;   tp1vcu[num].bg_pos     = 0x0000;   tp1vcu[num].scroll_pos = 0x0000;   tp1vcu[num].status     = 0x0000;}static void tp1vcu_obj_ww(UINT32 offset, UINT16 data){   switch(offset&0x0E){      case 0x02:                        // Port Address         tp1vcu[0].obj_pos = (data<<1) & 0x7FE;      break;      case 0x04:                        // Port Data         WriteWord(&tp1vcu[0].RAM_OBJ[tp1vcu[0].obj_pos], data);         tp1vcu[0].obj_pos += 0x002;         tp1vcu[0].obj_pos &= 0x7FE;      break;      case 0x06:                        // Port Data         WriteWord(&tp1vcu[0].RAM_OBJ[tp1vcu[0].obj_pos+0x800], data);         tp1vcu[0].obj_pos += 0x002;         tp1vcu[0].obj_pos &= 0x7FE;      break;      default:         #ifdef RAINE_DEBUG         print_debug("tp1vcu[0] ww(%04x,%04x)\n", offset&0x0E, data);         #endif      break;   }}static UINT16 tp1vcu_obj_rw(UINT32 offset){   UINT16 ret;   switch(offset&0x0E){      case 0x00:                        // Status         ret = tp1vcu[0].status;         tp1vcu[0].status ^= 1;      break;      case 0x04:                        // Port Data         ret = ReadWord(&tp1vcu[0].RAM_OBJ[tp1vcu[0].obj_pos]);         tp1vcu[0].obj_pos += 0x002;         tp1vcu[0].obj_pos &= 0x7FE;      break;      case 0x06:                        // Port Data         ret = ReadWord(&tp1vcu[0].RAM_OBJ[tp1vcu[0].obj_pos+0x800]);         tp1vcu[0].obj_pos += 0x002;         tp1vcu[0].obj_pos &= 0x7FE;      break;      default:         ret = 0x0000;         #ifdef RAINE_DEBUG         print_debug("tp1vcu[0] rw(%04x)\n", offset&0x0E);         #endif      break;   }   return ret;}static UINT8 tp1vcu_obj_rb(UINT32 offset){   UINT16 ret;   ret = tp1vcu_obj_rw(offset);   if((offset&1)==0)      return (UINT8) ((ret>>8)&0xFF);   else      return (UINT8) ((ret>>0)&0xFF);}static void tp1vcu_bg_ww(UINT32 offset, UINT16 data){   switch(offset&0x1E){      case 0x02:                        // Port Address         tp1vcu[0].bg_pos = (data<<2) & 0xFFFE;      break;   case 0x04:                        // Port Data     WriteWord(&tp1vcu[0].VRAM[tp1vcu[0].bg_pos], data);     break;   case 0x06:                        // Port Data     WriteWord(&tp1vcu[0].VRAM[tp1vcu[0].bg_pos+2], data);     tp1vcu[0].bg_pos += 0x0002;     tp1vcu[0].bg_pos &= 0xFFFE;     break;   case 0x10:                        // Scroll      case 0x12:                        // Scroll      case 0x14:                        // Scroll      case 0x16:                        // Scroll      case 0x18:                        // Scroll      case 0x1A:                        // Scroll      case 0x1C:                        // Scroll      case 0x1E:                        // Scroll         WriteWord(&tp1vcu[0].SCROLL[offset&0x0E], data);      break;      default:         #ifdef RAINE_DEBUG         print_debug("tp1vcu[0] ww(%04x,%04x)\n", offset&0x1E, data);         #endif      break;   }}static UINT16 tp1vcu_bg_rw(UINT32 offset){   UINT16 ret;   switch(offset&0x1E){   case 0x00:                        // Status     ret = tp1vcu[0].status;     tp1vcu[0].status ^= 1;     break;   case 2:     return tp1vcu[0].bg_pos>>2;   case 0x04:                        // Port Data     ret = ReadWord(&tp1vcu[0].VRAM[tp1vcu[0].bg_pos]);     break;   case 0x06:                        // Port Data     ret = ReadWord(&tp1vcu[0].VRAM[tp1vcu[0].bg_pos+2]);     break;        case 0x10:                        // Scroll   case 0x12:                        // Scroll   case 0x14:                        // Scroll   case 0x16:                        // Scroll   case 0x18:                        // Scroll   case 0x1A:                        // Scroll   case 0x1C:                        // Scroll   case 0x1E:                        // Scroll

⌨️ 快捷键说明

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