?? heavyunt.c
字號:
/******************************************************************************//* *//* HEAVY UNIT (C) 1988 KANEKO (TAITO LICENSE) *//* *//******************************************************************************/#include "gameinc.h"#include "heavyunt.h"#include "tc220ioc.h"#include "taitosnd.h"#include "2203intf.h"#include "decode.h"#include "sasound.h" // sample support routines#ifdef RAINE_DEBUG#include "debug.h"#endif#include "savegame.h"/*b73-12.bin - sound cpu----------------------nmi is triggered when sound command is written?int is triggered by ym2203 timers or 60fps?memory:0000-7FFF = base rom8000-BFFF = bank romport:00-00 = bank switch02-03 = ym220304-04 = sound command?*/static struct DIR_INFO heavy_unit_dirs[] ={ { "heavy_unit", }, { "heavyunt", }, { NULL, },};static struct ROM_INFO heavy_unit_roms[] ={ { "b73.01", 0x00010000, 0x3a8a4489, 0, 0, 0, }, { "b73.02", 0x00010000, 0x025c536c, 0, 0, 0, }, { "b73.03", 0x00010000, 0xec6020cf, 0, 0, 0, }, { "b73.04", 0x00010000, 0xf7badbb2, 0, 0, 0, }, { "b73.05", 0x00010000, 0xb8e829d2, 0, 0, 0, }, { "b73.06", 0x00010000, 0xa98e4aea, 0, 0, 0, }, { "b73.07", 0x00010000, 0x5cffa42c, 0, 0, 0, }, { "b73.08", 0x00080000, 0xf83dd808, 0, 0, 0, }, { "b73.09", 0x00080000, 0x537c647f, 0, 0, 0, }, { "b73.12", 0x00010000, 0xd1d24fab, 0, 0, 0, }, { "b73.13", 0x00020000, 0xe2874601, 0, 0, 0, }, { "b73.14", 0x00010000, 0x0dfb51d4, 0, 0, 0, }, { NULL, 0, 0, 0, 0, 0, },};#if 0static struct INPUT_INFO heavy_unit_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_heavy_unit_0[] ={ { MSG_DSWA_BIT1, 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_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_INFO heavy_unit_dsw[] ={ { 0x020004, 0xFF, dsw_data_heavy_unit_0 }, { 0x020005, 0xFF, dsw_data_default_1 }, { 0, 0, NULL, },};#endifstatic struct VIDEO_INFO heavy_unit_video ={ draw_heavy_unit, 256, 224, 32, VIDEO_ROTATE_NORMAL,};#if 0static struct ROMSW_DATA romsw_data_heavy_unit_0[] ={ { "Taito Japan (notice)", 0x01 }, { "Taito America", 0x02 }, { "Taito Japan", 0x03 }, { "Tad Corporation", 0x04 }, { NULL, 0 },};#endifstatic struct YM2203interface ym2203_interface ={ 1, // 1 chip 4000000, // rate { 0x00ff20c0 }, // volume { 0 }, { 0 }, { 0 }, { 0 }, { NULL }};static struct SOUND_INFO heavy_unit_sound[] ={ { SOUND_YM2203, &ym2203_interface, }, { 0, NULL, },};#if 0static struct ROMSW_INFO heavy_unit_romsw[] ={ { 0x007FFF, 0x01, romsw_data_heavy_unit_0 }, { 0, 0, NULL },};#endifstruct GAME_MAIN game_heavy_unit ={ heavy_unit_dirs, heavy_unit_roms, NULL, //heavy_unit_inputs, NULL, //heavy_unit_dsw, NULL, //heavy_unit_romsw, load_heavy_unit, clear_heavy_unit, &heavy_unit_video, execute_heavy_unit_frame, "heavyunt", "Heavy Unit", NULL, COMPANY_ID_KANEKO, "B73", 1988, heavy_unit_sound, GAME_NOT_WORKING,};#if 0static UINT8 *GFX_BG0;static UINT8 *GFX_BG0_SOLID;static UINT8 *GFX_BG1;static UINT8 *GFX_BG1_SOLID;#endifstatic UINT8 *RAM2;static UINT8 *RAM3;static UINT8 *ROM2;static UINT8 *ROM3;static UINT8 *RAM_INPUT;static UINT8 *RAM_COLOUR;/******************************************************************************//* MAIN Z80 ROM BANKING *//******************************************************************************/static UINT8 z80_bank;static UINT8 *ROM_BANK[0x08];void heavy_unit_bank_w(UINT16 offset, UINT8 data){ offset &= 15; if(offset==0){ if((data&0x07) != z80_bank){ z80_bank = data & 0x07; 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<0x08; 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[8];void heavy_unit_sub_bank_w(UINT16 offset, UINT8 data){ offset &= 15; switch(offset){ case 0x00: if((data&0x07) != z80_bank_1){ z80_bank_1 = data & 0x07; 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<0x04; 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); }}/******************************************************************************//* SUB Z80 ROM BANKING *//******************************************************************************/static UINT8 z80_bank_2;static UINT8 *ROM_BANK_2[4];void heavy_unit_sub2_bank_w(UINT16 offset, UINT8 data){ offset &= 15; switch(offset){ case 0x00: if((data&0x07) != z80_bank_1){ z80_bank_1 = data & 0x07; 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_2(UINT8 *src, UINT8 *dst){ int ta; for(ta=0; ta<0x04; ta++){ ROM_BANK_2[ta] = dst+(ta*0xC000); memcpy(ROM_BANK_2[ta]+0x0000,src+0x0000,0x8000); memcpy(ROM_BANK_2[ta]+0x8000,src+(ta*0x4000),0x4000); }}/******************************************************************************//* INPUT + DSW *//******************************************************************************/static UINT32 port_unk;static UINT32 sound_command;static UINT32 sound_nmi;static UINT8 heavy_unit_main_port_rb(UINT16 offset){ UINT8 ret; offset &= 0xFF; switch(offset){ default:#ifdef RAINE_DEBUG print_debug("main_port_rb(%02x) [%04x]\n",offset, z80pc);#endif ret = 0xFF; break; } return ret;}static void heavy_unit_main_port_wb(UINT16 offset, UINT8 data){ offset &= 0xFF; switch(offset){ case 0x01: if((data & 7) != z80_bank){ z80_bank = data & 7; Z80BSetBank( ROM_BANK[z80_bank] ); } break; default: #ifdef RAINE_DEBUG print_debug("main_port_wb(%02x,%02x) [%04x]\n", offset, data, z80pc); #endif break; }}static UINT8 heavy_unit_sub_port_rb(UINT16 offset){ UINT8 ret; offset &= 0xFF; switch(offset){ case 0x0C: port_unk ++; ret = port_unk; break; default: #ifdef RAINE_DEBUG print_debug("sub_port_rb(%02x) [%04x]\n",offset, z80pc); #endif ret = 0xFF; break; } return ret;}static void heavy_unit_sub_port_wb(UINT16 offset, UINT8 data){ offset &= 0xFF; switch(offset){ case 0x00: if((data & 3) != z80_bank_1){ z80_bank_1 = data & 3; Z80CSetBank( ROM_BANK_1[z80_bank_1] ); } break; case 0x02: sound_command = data; sound_nmi = 1; break; default: #ifdef RAINE_DEBUG print_debug("sub_port_wb(%02x,%02x) [%04x]\n", offset, data, z80pc); #endif break; }}static UINT8 heavy_unit_sound_port_rb(UINT16 offset){ UINT8 ret; offset &= 0xFF; switch(offset){ case 0x02: case 0x03: ret = YM2203AReadZ80(offset & 1); break; case 0x04: ret = sound_command; break; default: #ifdef RAINE_DEBUG print_debug("sound_port_rb(%02x) [%04x]\n", offset, z80pc); #endif ret = 0xFF; break; } return ret;}static void heavy_unit_sound_port_wb(UINT16 offset, UINT8 data){ offset &= 0xFF; switch(offset){ case 0x00: if((data & 3) != z80_bank_2){ z80_bank_2 = data & 3; Z80DSetBank( ROM_BANK_2[z80_bank_2] ); } break; case 0x02: case 0x03: YM2203AWriteZ80(offset & 1, data);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -