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

📄 cave.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
📖 第 1 页 / 共 5 页
字号:
    64*4,65*4,66*4,67*4,68*4,69*4,70*4,71*4},   {0*32,1*32,2*32,3*32,4*32,5*32,6*32,7*32,    16*32,17*32,18*32,19*32,20*32,21*32,22*32,23*32},   16*16*4};/* 16x16x8 tiles */static struct GFX_LAYOUT layout_16x16x8 ={   16,16,   RGN_FRAC(1,1),   8,   {8,9,10,11, 0,1,2,3},   {0*4,1*4,4*4,5*4,8*4,9*4,12*4,13*4,    128*4,129*4,132*4,133*4,136*4,137*4,140*4,141*4},   {0*64,1*64,2*64,3*64,4*64,5*64,6*64,7*64,    16*64,17*64,18*64,19*64,20*64,21*64,22*64,23*64},   16*16*8};/* 16x16x4 objects */static struct GFX_LAYOUT cave_gfx_object ={   16,16,   RGN_FRAC(1,1),   4,   {0,1,2,3},   {  1*4,  0*4,  3*4,  2*4,  5*4,  4*4,  7*4,  6*4,      9*4,  8*4, 11*4, 10*4, 13*4, 12*4, 15*4, 14*4 },   {STEP16(0,16*4)},   16*16*4};/* 16x16x4 objects */static struct GFX_LAYOUT ddonpach_gfx_object ={   16,16,   RGN_FRAC(1,1),   4,   {0,1,2,3},   {STEP16(0,4)},   {STEP16(0,16*4)},   16*16*4};static struct GFX_LIST cave_gfx[] = // feveron only ???{   { REGION_GFX1, &layout_16x16x4,  },   { REGION_GFX2, &layout_16x16x4,  },   { REGION_GFX3, &layout_16x16x4,  },   { REGION_GFX4, &cave_gfx_object, },   { 0,           NULL,             },};static struct GFX_LIST donpachi_gfx[] ={   { REGION_GFX1, &layout_16x16x4,  },   { REGION_GFX2, &layout_16x16x4,  },   { REGION_GFX3, &layout_8x8x4,  },   { REGION_GFX4, &ddonpach_gfx_object, },   { 0,           NULL,             },};static struct GFX_LIST esprade_gfx[] ={   { REGION_GFX1, NULL,  },   { REGION_GFX2, NULL,  },   { REGION_GFX3, NULL,  },   { REGION_GFX4, NULL, },   { 0,           NULL,             },};static struct GFX_LIST ddonpach_gfx[] ={   { REGION_GFX1, &layout_16x16x4,      },   { REGION_GFX2, &layout_16x16x4,      },   { REGION_GFX3, &layout_8x8x8,        },   { REGION_GFX4, &ddonpach_gfx_object, },   { 0,           NULL,                 },};static struct GFX_LIST uopoko_gfx[] ={   { REGION_GFX1, &layout_16x16x8,  },   { REGION_GFX2, &layout_16x16x8,  },   { REGION_GFX3, &layout_16x16x8,  },   { REGION_GFX4, &cave_gfx_object, },   { 0,           NULL,             },};static struct VIDEO_INFO cave_68k_video_r270 ={   draw_cave_68k,   320,   240,   32,   VIDEO_ROTATE_270 |   VIDEO_ROTATABLE | VIDEO_NEEDS_16BPP,   cave_gfx,};static struct VIDEO_INFO esprade_video_r270 ={   draw_cave_68k,   320,   240,   32,   VIDEO_ROTATE_270 |   VIDEO_ROTATABLE | VIDEO_NEEDS_16BPP,   esprade_gfx,};static struct VIDEO_INFO donpachi_video_r270 ={   draw_cave_68k,   320,   240,   32,   VIDEO_ROTATE_270 |   VIDEO_ROTATABLE | VIDEO_NEEDS_16BPP,   donpachi_gfx,};static struct VIDEO_INFO hotdogst_video_r270 ={   draw_cave_68k,   384,   240,   32,   VIDEO_ROTATE_270 |   VIDEO_ROTATABLE | VIDEO_NEEDS_16BPP,   cave_gfx,};static struct VIDEO_INFO ddonpach_video ={   draw_cave_68k,   320,   240,   32,   VIDEO_ROTATE_270 |   VIDEO_ROTATABLE | VIDEO_NEEDS_16BPP,   ddonpach_gfx,};static struct VIDEO_INFO uopoko_video ={   draw_cave_68k,   320,   240,   32,   VIDEO_ROTATE_NORMAL |   VIDEO_ROTATABLE | VIDEO_NEEDS_16BPP,   uopoko_gfx,};struct GAME_MAIN game_esprade ={   esprade_dirs,   esprade_roms,   cave_68k_inputs,   NULL,   NULL,   load_esprade,   clear_cave_68k,   &esprade_video_r270,   execute_cave_68k_frame,   "esprade",   "Esprade",   "CV-04",   COMPANY_ID_CAVE,   NULL,   1998,   cave_sound,   GAME_SHOOT,};struct GAME_MAIN game_guwange ={   guwange_dirs,   guwange_roms,   guwange_inputs,   guwange_dsw,   NULL,   load_guwange,   clear_cave_68k,   &esprade_video_r270,   execute_cave_68k_frame,   "guwange",   "Guwange",   "CV-04",   COMPANY_ID_CAVE,   NULL,   1999,   cave_sound,   GAME_SHOOT,};struct GAME_MAIN game_ddonpach ={   ddonpach_dirs,   ddonpach_roms,   cave_68k_inputs,   NULL,   NULL,   load_ddonpach,   clear_cave_68k,   &ddonpach_video,   execute_cave_68k_frame,   "ddonpach",   "Dodonpachi (Japan)",   "CV-04",   COMPANY_ID_CAVE,   NULL,   1997,   cave_sound,   GAME_SHOOT,};struct GAME_MAIN game_donpachi ={   donpachi_dirs,   donpachi_roms,   cave_68k_inputs,   NULL,   NULL,   load_donpachi,   clear_cave_68k,   &donpachi_video_r270,   execute_cave_68k_frame,   "donpachi",   "DonPachi (Japan)",   "CV-04",   COMPANY_ID_CAVE,   NULL,   1995,   donpachi_sound,   GAME_SHOOT,};static struct DIR_INFO uo_poko_dirs[] ={   { "uo_poko", },   { "uopoko", },   { NULL, },};static struct ROM_INFO uo_poko_roms[] ={   {     "u26j.bin", 0x00080000, 0xe7eec050, REGION_ROM1, 0x000000, LOAD_8_16,   },   {     "u25j.bin", 0x00080000, 0x68cb6211, REGION_ROM1, 0x000001, LOAD_8_16,   },   {      "u49.bin", 0x00400000, 0x12fb11bb, REGION_GFX1, 0x000000, LOAD_NORMAL, },   {      "u33.bin", 0x00400000, 0x5d142ad2, REGION_GFX4, 0x000000, LOAD_NORMAL, },   {       "u4.bin", 0x00200000, 0xa2d0d755, REGION_SMP1, 0x000000, LOAD_NORMAL, },   {           NULL,          0,          0, 0, 0, 0, },};struct GAME_MAIN game_uo_poko ={   uo_poko_dirs,   uo_poko_roms,   cave_68k_inputs,   NULL,   NULL,   load_uo_poko,   clear_cave_68k,   &uopoko_video,   execute_cave_68k_frame,   "uopoko",   "Uo Poko",   NULL,   COMPANY_ID_CAVE,   "CV-02",   1998,   cave_sound,   GAME_PUZZLE,};static struct DIR_INFO feveron_dirs[] ={   { "feveron", },   { "dfeveron", },   { "dangun_feveron", },   { NULL, },};static struct ROM_INFO feveron_roms[] ={   {      "u34.bin", 0x00080000, 0xbe87f19d, REGION_ROM1, 0x000000, LOAD_8_16,   },   {      "u33.bin", 0x00080000, 0xe53a7db3, REGION_ROM1, 0x000001, LOAD_8_16,   },   {      "u50.bin", 0x00200000, 0x7a344417, REGION_GFX1, 0x000000, LOAD_NORMAL, },   {      "u49.bin", 0x00200000, 0xd21cdda7, REGION_GFX2, 0x000000, LOAD_NORMAL, },   {      "u25.bin", 0x00400000, 0xa6f6a95d, REGION_GFX4, 0x000000, LOAD_NORMAL, },   {      "u26.bin", 0x00400000, 0x32edb62a, REGION_GFX4, 0x400000, LOAD_NORMAL, },   {      "u19.bin", 0x00400000, 0x5f5514da, REGION_SMP1,        0, LOAD_NORMAL, },   {           NULL,          0,          0,           0,        0,           0, },};struct GAME_MAIN game_feveron ={   feveron_dirs,   feveron_roms,   cave_68k_inputs,   NULL,   NULL,   load_feveron,   clear_cave_68k,   &cave_68k_video_r270,   execute_cave_68k_frame,   "dfeveron",   "Dangun Feveron",   NULL,   COMPANY_ID_CAVE,   "CV-05",   1998,   cave_sound,   GAME_SHOOT,};static UINT8 *GFX_BG0;static UINT8 *GFX_BG1;static UINT8 *GFX_BG2;static UINT8 *GFX_OBJ_A;static UINT8 *GFX_OBJ_B;static UINT8 *GFX_OBJ_SIZE;static UINT8 *GFX_BG0_SOLID;static UINT8 *GFX_BG1_SOLID;static UINT8 *GFX_BG2_SOLID;static UINT8 *GFX_OBJ_SOLID;static UINT8 *RAM_BG0;static UINT8 *RAM_BG1;static UINT8 *RAM_BG2;static UINT8 *RAM_BG0_CTRL;static UINT8 *RAM_BG1_CTRL;static UINT8 *RAM_BG2_CTRL;static UINT8 *RAM_CTRL;static UINT32 gfx_colours;static struct EEPROM_interface eeprom_interface ={   6,            /* address bits */   16,            /* data bits */   "0110",         /* read command */   "0101",         /* write command */   0,            /* erase command */   0,            /* lock command */   "0100110000"    /* unlock command */};static struct EEPROM_interface hotdogst_eeprom_interface ={	6,				// address bits	16,				// data bits	"0110",			// read command	"0101",			// write command	0,				// erase command	0,				// lock command	"10100110000" 	// unlock command,};//WRITE_HANDLER( cave_eeprom_w )static void cave_eeprom_w(UINT32 offset, UINT16 data){	(void)(offset);   if ( (data & 0xFF000000) == 0 )  /* even address */   {      /* latch the bit */     //     print_ingame(60,"%d\n",data);      EEPROM_write_bit(data & 0x0800);     /* reset line asserted: reset. */     EEPROM_set_cs_line((data & 0x0200) ? CLEAR_LINE : ASSERT_LINE );          /* clock line asserted: write latch or select next bit to read */     EEPROM_set_clock_line((data & 0x0400) ? ASSERT_LINE : CLEAR_LINE );   }}//WRITE16_HANDLER( guwange_eeprom_w )static void guwange_eeprom_w(UINT32 offset, UINT16 data){	(void)(offset);  //  print_ingame(60,"gu %d %x\n",offset,data);  if ( (data & 0x00FF0000) == 0 )  /* odd address */   {     //     print_ingame(60,"eepr ok\n");     // latch the bit     EEPROM_write_bit(data & 0x80);      // reset line asserted: reset.     EEPROM_set_cs_line((data & 0x20) ? CLEAR_LINE : ASSERT_LINE );     // clock line asserted: write latch or select next bit to read     EEPROM_set_clock_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE );   }}/* Handles writes to the YMZ280B */static WRITE16_HANDLER( cave_sound_w ){  if (offset & 2)    YMZ280B_data_0_w(offset, data & 0xff);  else    YMZ280B_register_0_w(offset, data & 0xff);  //   }}/* Handles reads from the YMZ280B */static READ16_HANDLER( cave_sound_r ){  int r =YMZ280B_status_0_r(offset);  //fprintf(stderr,"cave_sound_r %x -> %x\n",offset,r);  return r;}static UINT8 esp_input_rb(UINT32 offset){  short val;  offset &= 3;  switch(offset){  case 0x00:    val = (input_buffer[0] & 0x03) | 0xFC;

⌨️ 快捷键说明

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