📄 cabal.c
字号:
/******************************************************************************//* *//* CABAL (C) 1988 TAD CORPORATION *//* *//******************************************************************************/#include "gameinc.h"#include "cabal.h"#include "taitosnd.h"#include "2151intf.h"#include "smp16bit.h"#ifdef RAINE_DEBUG#include "debug.h"#endif#include "sasound.h" // sample support routines#include "savegame.h"static struct DIR_INFO cabal_dirs[] ={ { "cabal", }, { "cabalbl", }, { NULL, },};static struct ROM_INFO cabal_roms[] ={ { "cabal_01.bin", 0x00010000, 0x55c44764, 0, 0, 0, }, { "cabal_02.bin", 0x00010000, 0x0e1ec30e, 0, 0, 0, }, { "cabal_03.bin", 0x00010000, 0x7065e840, 0, 0, 0, }, { "cabal_04.bin", 0x00010000, 0x34d3cac8, 0, 0, 0, }, { "cabal_05.bin", 0x00010000, 0x4e49c28e, 0, 0, 0, }, { "cabal_08.bin", 0x00010000, 0x702735c9, 0, 0, 0, }, { "cabal_07.bin", 0x00010000, 0x581a50c1, 0, 0, 0, }, { "cabal_06.bin", 0x00010000, 0x6a0e739d, 0, 0, 0, }, { "cabal_09.bin", 0x00010000, 0x4ffa7fe3, 0, 0, 0, }, { "cabal_10.bin", 0x00010000, 0x958789b6, 0, 0, 0, }, { "cabal_11.bin", 0x00010000, 0xd308a543, 0, 0, 0, }, { "cabal_12.bin", 0x00010000, 0x543fcb37, 0, 0, 0, }, { "cabal_13.bin", 0x00010000, 0xd28d921e, 0, 0, 0, }, { "cabal_14.bin", 0x00010000, 0x420b0801, 0, 0, 0, }, { "cabal_15.bin", 0x00010000, 0x1023319b, 0, 0, 0, }, { "cabal_16.bin", 0x00010000, 0x77bc7a60, 0, 0, 0, }, { "cabal_17.bin", 0x00010000, 0x3b6d2b09, 0, 0, 0, }, { "cabal_18.bin", 0x00010000, 0x0bc50075, 0, 0, 0, }, { "cabal_19.bin", 0x00010000, 0x67e4fe47, 0, 0, 0, }, { "cabal_21.bin", 0x00010000, 0x96d5e8af, 0, 0, 0, }, { "cabal_22.bin", 0x00010000, 0x78c4af27, 0, 0, 0, }, { "cabal_23.bin", 0x00010000, 0xd763a47c, 0, 0, 0, }, { "cabal_24.bin", 0x00010000, 0x00abbe0c, 0, 0, 0, }, { "5-6s", 0x00004000, 0x6a76955a, 0, 0, 0, }, { NULL, 0, 0, 0, 0, 0, },};static struct INPUT_INFO cabal_inputs[] ={ { KB_DEF_COIN1, MSG_COIN1, 0x005404, 0x06, BIT_ACTIVE_0 }, { KB_DEF_P1_START, MSG_P1_START, 0x005421, 0x80, BIT_ACTIVE_0 }, { KB_DEF_P1_UP, MSG_P1_UP, 0x005419, 0x01, BIT_ACTIVE_0 }, { KB_DEF_P1_DOWN, MSG_P1_DOWN, 0x005419, 0x02, BIT_ACTIVE_0 }, { KB_DEF_P1_LEFT, MSG_P1_LEFT, 0x005419, 0x04, BIT_ACTIVE_0 }, { KB_DEF_P1_RIGHT, MSG_P1_RIGHT, 0x005419, 0x08, BIT_ACTIVE_0 }, { KB_DEF_P1_B1, MSG_P1_B1, 0x005420, 0x01, BIT_ACTIVE_0 }, { KB_DEF_P1_B2, MSG_P1_B2, 0x005420, 0x02, BIT_ACTIVE_0 }, { KB_DEF_P1_B3, MSG_P1_B3, 0x005421, 0x20, BIT_ACTIVE_0 }, { KB_DEF_P2_START, MSG_P2_START, 0x005421, 0x40, BIT_ACTIVE_0 }, { KB_DEF_P2_UP, MSG_P2_UP, 0x005419, 0x10, BIT_ACTIVE_0 }, { KB_DEF_P2_DOWN, MSG_P2_DOWN, 0x005419, 0x20, BIT_ACTIVE_0 }, { KB_DEF_P2_LEFT, MSG_P2_LEFT, 0x005419, 0x40, BIT_ACTIVE_0 }, { KB_DEF_P2_RIGHT, MSG_P2_RIGHT, 0x005419, 0x80, BIT_ACTIVE_0 }, { KB_DEF_P2_B1, MSG_P2_B1, 0x005420, 0x04, BIT_ACTIVE_0 }, { KB_DEF_P2_B2, MSG_P2_B2, 0x005420, 0x08, BIT_ACTIVE_0 }, { KB_DEF_P2_B3, MSG_P2_B3, 0x005421, 0x10, BIT_ACTIVE_0 }, { 0, NULL, 0, 0, 0 },};static struct DSW_DATA dsw_data_cabal_0[] ={ { MSG_COIN_SLOTS, 0x0F, 0x07 }, { MSG_1COIN_1PLAY, 0x0F, 0x00 }, { MSG_2COIN_1PLAY, 0x0E, 0x00 }, { MSG_3COIN_1PLAY, 0x0D, 0x00 }, { MSG_4COIN_1PLAY, 0x0C, 0x00 }, { MSG_5COIN_1PLAY, 0x0B, 0x00 }, { MSG_6COIN_1PLAY, 0x0A, 0x00 }, { MSG_1COIN_2PLAY, 0x09, 0x00 }, { MSG_FREE_PLAY, 0x00, 0x00 }, { "Coin Mode", 0x10, 0x02 }, { "Type 1", 0x10, 0x00 }, { "Type 2", 0x00, 0x00 }, { "Buttons", 0x20, 0x02 }, { MSG_NORMAL, 0x20, 0x00 }, { MSG_INVERT, 0x00, 0x00 }, { "Trackball", 0x80, 0x02 }, { "Small", 0x80, 0x00 }, { "Large", 0x00, 0x00 }, { NULL, 0, 0, },};static struct DSW_DATA dsw_data_cabal_1[] ={ { MSG_LIVES, 0x03, 0x04 }, { "3", 0x03, 0x00 }, { "2", 0x02, 0x00 }, { "5", 0x01, 0x00 }, { "Infinite", 0x00, 0x00 }, { MSG_EXTRA_LIFE, 0x0C, 0x04 }, { "20k and 50k", 0x0C, 0x00 }, { "30k and 100k", 0x08, 0x00 }, { "50k and 150k", 0x04, 0x00 }, { "70k", 0x00, 0x00 }, { MSG_DIFFICULTY, 0x30, 0x04 }, { MSG_EASY, 0x30, 0x00 }, { MSG_NORMAL, 0x20, 0x00 }, { MSG_HARD, 0x10, 0x00 }, { MSG_HARDEST, 0x00, 0x00 }, { MSG_DEMO_SOUND, 0x80, 0x02 }, { MSG_ON, 0x80, 0x00 }, { MSG_OFF, 0x00, 0x00 }, { NULL, 0, 0, },};static struct DSW_INFO cabal_dsw[] ={ { 0x005410, 0xFF, dsw_data_cabal_0 }, { 0x005411, 0xFF, dsw_data_cabal_1 }, { 0, 0, NULL, },};static struct VIDEO_INFO cabal_video ={ DrawCabal, 256, 224, 32, VIDEO_ROTATE_NORMAL| VIDEO_ROTATABLE,};static struct SMP16_ROM smp16_romlist_chip_a[16]; // Fill in laterstatic struct SMP16_ROM smp16_romlist_chip_b[16]; // Fill in laterstatic struct SMP16buffer_interface smp16_interface ={ 2, // 2 chips { 22000, 22000 }, // rate { smp16_romlist_chip_a, smp16_romlist_chip_b }, // rom list};static struct YM2151interface ym2151_interface ={ 1, // 1 chip 3579580, // 4000000, // 4 MHz { YM3012_VOL(255,OSD_PAN_LEFT,255,OSD_PAN_RIGHT) }, { NULL }};static struct SOUND_INFO cabal_sound[] ={ { SOUND_YM2151S, &ym2151_interface, }, { SOUND_SMP16, &smp16_interface, }, { 0, NULL, },};struct GAME_MAIN game_cabal ={ cabal_dirs, cabal_roms, cabal_inputs, cabal_dsw, NULL, LoadCabal, ClearCabal, &cabal_video, ExecuteCabalFrame, "cabalbl", "Cabal (bootleg)", "僇僶乕儖", COMPANY_ID_TAD, NULL, 1988, cabal_sound, GAME_SHOOT,};static int sport=0;static int sp_status=0xFF;static void CabalSoundWrite68k(UINT32 offset, UINT8 data){ switch(offset&15){ case 0x01: sport=data; sp_status=1;#ifdef RAINE_DEBUG print_debug("68000 Sends:%02x\n",sport);#endif break; }}static UINT8 CabalSoundRead68k(UINT32 offset){ int ret; switch(offset&15){ case 0x05: ret = RAM[0x5404]; break; default: ret = 0xFF; break; } return ret;}UINT8 CabalSoundReadZ80(UINT16 offset){ UINT8 ta; switch(offset&15){ case 0x08: ta=sp_status; break; case 0x0A: sp_status=0xFF; ta=sport; #ifdef RAINE_DEBUG print_debug("Z80 Receives:%02x\n",sport); #endif break; default: ta=0xFF; break; } #ifdef RAINE_DEBUG print_debug("Z80Read:%04x,%02x [%04x]\n",offset,ta,z80pc); #endif return(ta);}void CabalSoundWriteZ80(UINT16 offset, UINT8 data){ switch(offset&15){ case 0x00: data&=0x7F; if((data>0)&&(data<16)) SMP16buffer_request(0,data-1); break; case 0x02: data&=0x7F; if((data>0)&&(data<16)) SMP16buffer_request(1,data-1); break; default: #ifdef RAINE_DEBUG print_debug("Z80Write:%04x,%02x [%04x]\n",offset,data,z80pc); #endif break; }}void LoadCabal(void){ int ta,tb,tc; if(!(ROM=AllocateMem(0x40000))) return; if(!(RAM=AllocateMem(0x80000))) return; if(!(GFX=AllocateMem(0x210000))) return; if(!load_rom("5-6s", RAM, 0x4000)) return; // FG0 GFX (2 bitplanes) tb=0; for(ta=0;ta<0x4000;ta++){ tc=RAM[ta]; GFX[tb+3]=((tc&0x80)>>7)<<1; GFX[tb+2]=((tc&0x40)>>6)<<1; GFX[tb+1]=((tc&0x20)>>5)<<1; GFX[tb+0]=((tc&0x10)>>4)<<1; GFX[tb+3]|=((tc&0x08)>>3)<<0; GFX[tb+2]|=((tc&0x04)>>2)<<0; GFX[tb+1]|=((tc&0x02)>>1)<<0; GFX[tb+0]|=((tc&0x01)>>0)<<0; GFX[tb+3]|=0x0C; GFX[tb+2]|=0x0C; GFX[tb+1]|=0x0C; GFX[tb+0]|=0x0C; tb+=4; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -