📄 exzisus.c
字号:
/******************************************************************************//* *//* EXZISUS (C) 1987 TAITO CORPORATION *//* *//******************************************************************************/#include "gameinc.h"#include "exzisus.h"#include "tc220ioc.h"#include "taitosnd.h"#include "2203intf.h"#include "decode.h"#ifdef RAINE_DEBUG#include "debug.h"#endif#include "savegame.h"/*Z80 x 3TC0140SYTZ80 + YM2151TC0010VCU x 2B12 = Exzisus (2 screens) = original gameB23 = Exzisus (single screen) = romswap update*/static struct DIR_INFO exzisus_dirs[] ={ { "exzisus", }, { NULL, },};static struct ROM_INFO exzisus_roms[] ={ { "b12-12.bin", 0x00010000, 0xa662be67, 0, 0, 0, }, { "b12-13.bin", 0x00010000, 0x04a29633, 0, 0, 0, }, { "b12-15.bin", 0x00010000, 0xd81107c8, 0, 0, 0, }, { "b12-16.bin", 0x00010000, 0x6fec6acb, 0, 0, 0, }, { "b12-17.bin", 0x00010000, 0xdb1d5a6c, 0, 0, 0, }, { "b12-18.bin", 0x00010000, 0x64e358aa, 0, 0, 0, }, { "b12-19.bin", 0x00010000, 0x772b2641, 0, 0, 0, }, { "b12-20.bin", 0x00010000, 0x87f52e89, 0, 0, 0, }, { "b23-03.bin", 0x00000400, 0x9458fd45, 0, 0, 0, }, { "b23-04.bin", 0x00000400, 0x5042cffa, 0, 0, 0, }, { "b23-05.bin", 0x00000400, 0x87f0f69a, 0, 0, 0, }, { "b23-06.bin", 0x00010000, 0x44f8f661, 0, 0, 0, }, { "b23-07.bin", 0x00010000, 0xd7f6ec89, 0, 0, 0, }, { "b23-08.bin", 0x00010000, 0x1ce498c1, 0, 0, 0, }, { "b23-09.bin", 0x00010000, 0x6651617f, 0, 0, 0, }, { "b23-10.bin", 0x00010000, 0xc80216fc, 0, 0, 0, }, { "b23-11.bin", 0x00010000, 0xd6a79cef, 0, 0, 0, }, { "b23-12.bin", 0x00010000, 0x13637f54, 0, 0, 0, }, { "b23-13.bin", 0x00008000, 0x51110aa1, 0, 0, 0, }, { "b23-14.bin", 0x00008000, 0xf7ca7df2, 0, 0, 0, }, { NULL, 0, 0, 0, 0, 0, },};static struct INPUT_INFO exzisus_inputs[] ={ { KB_DEF_COIN1, MSG_COIN1, 0x020002, 0x10, BIT_ACTIVE_1 }, { KB_DEF_COIN2, MSG_COIN2, 0x020002, 0x20, BIT_ACTIVE_1 }, { KB_DEF_TILT, MSG_TILT, 0x020002, 0x02, BIT_ACTIVE_0 }, { KB_DEF_SERVICE, MSG_SERVICE, 0x020002, 0x01, BIT_ACTIVE_0 }, { KB_DEF_P1_START, MSG_P1_START, 0x020002, 0x04, BIT_ACTIVE_0 }, { KB_DEF_P1_UP, MSG_P1_UP, 0x020000, 0x01, BIT_ACTIVE_0 }, { KB_DEF_P1_DOWN, MSG_P1_DOWN, 0x020000, 0x02, BIT_ACTIVE_0 }, { KB_DEF_P1_LEFT, MSG_P1_LEFT, 0x020000, 0x08, BIT_ACTIVE_0 }, { KB_DEF_P1_RIGHT, MSG_P1_RIGHT, 0x020000, 0x04, BIT_ACTIVE_0 }, { KB_DEF_P1_B1, MSG_P1_B1, 0x020000, 0x10, BIT_ACTIVE_0 }, { KB_DEF_P1_B2, MSG_P1_B2, 0x020000, 0x20, BIT_ACTIVE_0 }, { KB_DEF_P2_START, MSG_P2_START, 0x020002, 0x08, BIT_ACTIVE_0 }, { KB_DEF_P2_UP, MSG_P2_UP, 0x020001, 0x01, BIT_ACTIVE_0 }, { KB_DEF_P2_DOWN, MSG_P2_DOWN, 0x020001, 0x02, BIT_ACTIVE_0 }, { KB_DEF_P2_LEFT, MSG_P2_LEFT, 0x020001, 0x08, BIT_ACTIVE_0 }, { KB_DEF_P2_RIGHT, MSG_P2_RIGHT, 0x020001, 0x04, BIT_ACTIVE_0 }, { KB_DEF_P2_B1, MSG_P2_B1, 0x020001, 0x10, BIT_ACTIVE_0 }, { KB_DEF_P2_B2, MSG_P2_B2, 0x020001, 0x20, BIT_ACTIVE_0 }, { 0, NULL, 0, 0, 0 },};static struct DSW_DATA dsw_data_exzisus_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_1COIN_2PLAY, 0x20, 0x00 }, { MSG_2COIN_1PLAY, 0x10, 0x00 }, { MSG_3COIN_1PLAY, 0x00, 0x00 }, { MSG_COIN2, 0xC0, 0x04 }, { MSG_1COIN_1PLAY, 0xC0, 0x00 }, { MSG_1COIN_2PLAY, 0x80, 0x00 }, { MSG_2COIN_1PLAY, 0x40, 0x00 }, { MSG_3COIN_1PLAY, 0x00, 0x00 }, { NULL, 0, 0, },};static struct DSW_DATA dsw_data_exzisus_1[] ={ { MSG_DIFFICULTY, 0x03, 0x04 }, { MSG_NORMAL, 0x03, 0x00 }, { MSG_EASY, 0x02, 0x00 }, { MSG_HARD, 0x01, 0x00 }, { MSG_HARDEST, 0x00, 0x00 }, { MSG_EXTRA_LIFE, 0x0c, 0x04 }, { "150k and every 200k", 0x0C, 0x00 }, { "100k and every 150k", 0x08, 0x00 }, { "150k", 0x04, 0x00 }, { "200k", 0x00, 0x00 }, { MSG_LIVES, 0x30, 0x04 }, { "3", 0x30, 0x00 }, { "4", 0x20, 0x00 }, { "5", 0x10, 0x00 }, { "2", 0x00, 0x00 }, { MSG_DSWB_BIT7, 0x40, 0x02 }, { MSG_OFF, 0x40, 0x00 }, { MSG_ON, 0x00, 0x00 }, { MSG_DSWB_BIT8, 0x80, 0x02 }, { MSG_OFF, 0x80, 0x00 }, { MSG_ON, 0x00, 0x00 }, { NULL, 0, 0, },};static struct DSW_INFO exzisus_dsw[] ={ { 0x020004, 0xFF, dsw_data_exzisus_0 }, { 0x020005, 0xFF, dsw_data_exzisus_1 }, { 0, 0, NULL, },};static struct VIDEO_INFO exzisus_video ={ draw_exzisus, 256, 224, 32, VIDEO_ROTATE_NORMAL | VIDEO_ROTATABLE,};static struct ROMSW_DATA romsw_data_exzisus_0[] ={ { "Taito Japan (notice)", 0x01 }, { "Taito America", 0x02 }, { "Taito Japan", 0x03 }, { "Tad Corporation", 0x04 }, { NULL, 0 },};static struct ROMSW_INFO exzisus_romsw[] ={ { 0x007FFF, 0x01, romsw_data_exzisus_0 }, { 0, 0, NULL },};struct GAME_MAIN game_exzisus ={ exzisus_dirs, exzisus_roms, exzisus_inputs, exzisus_dsw, exzisus_romsw, load_exzisus, clear_exzisus, &exzisus_video, execute_exzisus_frame, "exzisus", "Exzisus", "僀僌僕乕僓僗", COMPANY_ID_TAITO, "B23", 1987, taito_ym2151_sound, GAME_SHOOT,};static UINT8 *GFX_BG0;static UINT8 *GFX_BG0_SOLID;static UINT8 *GFX_BG1;static UINT8 *GFX_BG1_SOLID;static UINT8 *RAM2;static UINT8 *RAM3;static UINT8 *ROM2;static UINT8 *RAM_INPUT;static UINT8 *RAM_COLOUR;/******************************************************************************//* MAIN Z80 ROM BANKING *//******************************************************************************/static UINT8 z80_bank;static UINT8 *ROM_BANK[0x10];void exzisus_bank_w(UINT16 offset, UINT8 data){ offset &= 15; if(offset==0){ if((data&0x0F) != z80_bank){ z80_bank = data & 0x0F; Z80BSetBank( ROM_BANK[z80_bank] ); /*#ifdef RAINE_DEBUG print_debug("MAIN Bank: %02x [%04x]\n", data, z80pc); #endif*/ } }}static void init_bank_rom(UINT8 *src, UINT8 *dst){ int ta; for(ta=0; ta<0x10; ta++){ ROM_BANK[ta] = dst+(ta*0xC000); memcpy(ROM_BANK[ta]+0x0000,src+0x0000,0x8000); memcpy(ROM_BANK[ta]+0x8000,src+(ta*0x4000),0x4000); }}/******************************************************************************//* SUB Z80 ROM BANKING *//******************************************************************************/static UINT8 z80_bank_1;static UINT8 *ROM_BANK_1[0x10];void exzisus_sub_bank_w(UINT16 offset, UINT8 data){ offset &= 15; switch(offset){ case 0x00: if((data&0x0F) != z80_bank_1){ z80_bank_1 = data & 0x0F; Z80CSetBank( ROM_BANK_1[z80_bank_1] ); /*#ifdef RAINE_DEBUG print_debug("SUB Bank: %02x [%04x]\n", data, z80pc); #endif*/ } break; case 0x02: switch_led(0,(data>>2)&1); // Coin A [Coin Inserted] switch_led(1,(data>>3)&1); // Coin B [Coin Inserted] switch_led(2,(data>>0)&1); // Coin A [Ready for coins] //switch_led(3,(data>>1)&1); // Coin B [Ready for coins] break; }}static void init_bank_rom_1(UINT8 *src, UINT8 *dst){ int ta; for(ta=0; ta<0x10; ta++){ ROM_BANK_1[ta] = dst+(ta*0xC000); memcpy(ROM_BANK_1[ta]+0x0000,src+0x0000,0x8000); memcpy(ROM_BANK_1[ta]+0x8000,src+(ta*0x4000),0x4000); }}/******************************************************************************//* INPUT + DSW *//******************************************************************************/static UINT8 exzisus_ioc_rb(UINT16 offset){ return RAM_INPUT[offset & 0x0F];}/******************************************************************************//* LOAD SAVE DATA *//******************************************************************************/static void exzisus_load_update(void){ UINT8 ta; ta = z80_bank; z80_bank = 0xFF; exzisus_bank_w(0,ta); ta = z80_bank_1; z80_bank_1 = 0xFF; exzisus_sub_bank_w(0,ta);}static void exzisus_add_save_data(void){ AddLoadCallback(exzisus_load_update); AddSaveData(SAVE_USER_0, (UINT8 *)&z80_bank , sizeof(z80_bank)); AddSaveData(SAVE_USER_1, (UINT8 *)&z80_bank_1, sizeof(z80_bank_1));}static void DrawNibble0(UINT8 *out, UINT32 plane, UINT8 c){ int count, t; count = 4; do { t = c & 1; *out = t << plane; out++; c >>= 1; } while(--count);}static void DrawNibble(UINT8 *out, UINT32 plane, UINT8 c){ int count, t; count = 4; do { t = c & 1; *out |= t << plane; out++; c >>= 1; } while(--count);}void load_exzisus(void){ int ta,tb,tc; UINT8 *TMP; RAMSize=0x10000+0x10000+0x10+0x10000+0x10000+0x400; if(!(ROM =AllocateMem(0xC000*0x10))) return; if(!(ROM2=AllocateMem(0xC000*0x10))) return; if(!(RAM=AllocateMem(RAMSize))) return; if(!(TMP=AllocateMem(0x080000))) return; RAM2 = RAM+0x10000; RAM_INPUT = RAM+0x10000+0x10000; Z80ROM = RAM+0x10000+0x10000+0x10; RAM3 = RAM+0x10000+0x10000+0x10+0x10000; RAM_COLOUR = RAM+0x10000+0x10000+0x10+0x10000+0x10000; /*-----[Sound Setup]-----*/ if(!load_rom("b23-14.bin", Z80ROM, 0x8000)) return; // Z80 SOUND ROM memset(Z80ROM+0x8000,0x00,0x8000); AddTaitoYM2151(0x01C7, 0x01A0, 0x10000, NULL, NULL); /*-----------------------*/ if(!load_rom("b23-10.bin",TMP+0x00000,0x10000)) return; // Z80 MAIN ROM if(!load_rom("b23-12.bin",TMP+0x10000,0x10000)) return; // Z80 MAIN ROM memset(TMP+0x20000,0x00,0x10000); memset(TMP+0x30000,0x00,0x10000); // fix rom 1 error TMP[0x6829]=0x18; // fix work ram error TMP[0x67fd]=0x18; // Skip Idle Z80 TMP[0x0084]=0xD3; // OUTA (AAh) TMP[0x0085]=0xAA; // SetStopZ80BMode2(0x007E); init_bank_rom(TMP,ROM); memset(RAM, 0x00, 0x10000);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -