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

📄 ksystem.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
📖 第 1 页 / 共 4 页
字号:
/******************************************************************************//*                                                                            *//*                 TAITO K-SYSTEM (C) 1986 TAITO CORPORATION                  *//*                                                                            *//*                           Z80+Z80+YM2203+M68705                            */ /*                  NOTE: K-SYSTEM is not the official name.                  *//*                                                                            *//******************************************************************************/#include "gameinc.h"#include "ksystem.h"#include "tc220ioc.h"#include "taitosnd.h"#include "2203intf.h"#include "decode.h"#include "sasound.h"		// sample support routines#include "emumain.h"#ifdef RAINE_DEBUG#include "debug.h"#endif/*Z80 x 2M68705 x 1YM2203 x 1TC0010VCU x 1*//*changes/kayamon:15/2/00:   - fixed Kick&Run at last, now it works properly =)   - undid antiriad's amazing F018 bullshit ;-)     now it works again, assuming MZ80 has been fixed.     NOTE: it's what we in the trade technically call a 'WATCHDOG'... :P   - renamed kickrun to kicknrun for general MAME compatibilty30/8/99:   - added Knight Boy, dunno if it was worth it though.   - NOTE: MCU is tested for KKK, seems to be 100%, so any problems are           most likely due to the rest of the hardware instead.   - rewrote video h/w, based on Bubble Bobble.   - *** KICK&RUN not tested at all!!!!!!!!!!!         Not one bit. DIPs are wrong, etc         (probably doesn't work at all) ***   - MEXICO86 needs adding here too...   - had a go at that SOLID_MASK type stuff, hope it's right.   - added some more DIPs and stuff.   - overclocked main CPU, to avoid MZ80 IFF1 bug.     NOTE: I think the latest MZ80 fixes this itself.   - renamed driver to K-SYSTEM.   - added proper MCU emulation (hah, yeah right).   - fiddled DIPs/inputs about to work.changes/antiriad: - redid the speed hack, so they actually work ;). also hooked up F018 as   an interrupt request. it's probably some kind of vsync/waitvbl request. - increased the cpu slices, because the main cpu was spending a lot of   time waiting for the sub cpu. i also put the main cpu back to 8mhz, I   can't see any problem yet, probably the use of F018 now prevents the   bug showing up (mz80 3.0 will fix iff1 bugs anyway). - bank switching without memcpy :). - fiddle with the gfx but didn't fix anything (monster priority is wrong,   if you render everything in reverse, the monsters are right, but not   much else).*/static struct DIR_INFO kick_and_run_dirs[] ={   { "kick_and_run", },   { "kicknrun", },   { NULL, },};static struct ROM_INFO kick_and_run_roms[] ={   {   "a87-02.bin", 0x00008000, 0x64f1a85f, 0, 0, 0, },   {   "a87-03.bin", 0x00010000, 0xf42e8a88, 0, 0, 0, },   {   "a87-04.bin", 0x00008000, 0x8b438d20, 0, 0, 0, },   {   "a87-05.bin", 0x00010000, 0x4eee3a8a, 0, 0, 0, },   {   "a87-06.bin", 0x00008000, 0x1625b587, 0, 0, 0, },   {   "a87-07.bin", 0x00010000, 0x6cb6ebfe, 0, 0, 0, },   {   "a87-08.bin", 0x00010000, 0x715e1b04, 0, 0, 0, },   {   "a87-10.bin", 0x00000100, 0xbe6eb1f0, 0, 0, 0, },   {   "a87-11.bin", 0x00000100, 0x14f6c28d, 0, 0, 0, },   {   "a87-12.bin", 0x00000100, 0x3e953444, 0, 0, 0, },   {     "68_h.bin", 0x00000800, 0xff92f816, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};static struct INPUT_INFO kick_and_run_inputs[] ={   { KB_DEF_COIN1,        MSG_COIN1,               0x020005, 0x01, BIT_ACTIVE_0 },   { KB_DEF_COIN2,        MSG_COIN2,               0x020005, 0x02, BIT_ACTIVE_0 },   { KB_DEF_TILT,         MSG_TILT,                0x020000, 0x04, BIT_ACTIVE_0 },   { KB_DEF_SERVICE,      MSG_SERVICE,             0x020000, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P1_START,     MSG_P1_START,            0x020000, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P1_UP,        MSG_P1_UP,               0x020001, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P1_DOWN,      MSG_P1_DOWN,             0x020001, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P1_LEFT,      MSG_P1_LEFT,             0x020001, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P1_RIGHT,     MSG_P1_RIGHT,            0x020001, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P1_B1,        MSG_P1_B1,               0x020001, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P1_B2,        MSG_P1_B2,               0x020001, 0x20, BIT_ACTIVE_0 },   { KB_DEF_P2_START,     MSG_P2_START,            0x020000, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P2_UP,        MSG_P2_UP,               0x020002, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P2_DOWN,      MSG_P2_DOWN,             0x020002, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P2_LEFT,      MSG_P2_LEFT,             0x020002, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P2_RIGHT,     MSG_P2_RIGHT,            0x020002, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P2_B1,        MSG_P2_B1,               0x020002, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P2_B2,        MSG_P2_B2,               0x020002, 0x20, BIT_ACTIVE_0 },   { 0,                   NULL,                    0,        0,    0            },};static struct DSW_DATA dsw_data_kick_and_run_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_DSWA_BIT3,           0x04, 0x02 },   { MSG_OFF,                 0x04, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT4,           0x08, 0x02 },   { MSG_OFF,                 0x08, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT5,           0x10, 0x02 },   { MSG_OFF,                 0x10, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT6,           0x20, 0x02 },   { MSG_OFF,                 0x20, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT7,           0x40, 0x02 },   { MSG_OFF,                 0x40, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { MSG_DSWA_BIT8,           0x80, 0x02 },   { MSG_OFF,                 0x80, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_INFO kick_and_run_dsw[] ={   { 0x020003, 0xFF, dsw_data_kick_and_run_0 },   { 0x020004, 0xFF, dsw_data_default_1 },   { 0,        0,    NULL,      },};static struct VIDEO_INFO kiki_kai_kai_video ={   DrawKikiKaiKai,   256,   224,   8,   VIDEO_ROTATE_90 |   VIDEO_ROTATABLE,};static struct VIDEO_INFO kick_and_run_video ={   DrawKickRun,   256,   224,   8,   VIDEO_ROTATABLE,};static struct YM2203interface ym2203_interface ={   1,   4000000,   { 0x00ff20c0 },   {0},   {0},   {0},   {0},   {NULL}};static struct SOUND_INFO kiki_kai_kai_sound[] ={   { SOUND_YM2203,  &ym2203_interface,    },   { 0,             NULL,                 },};struct GAME_MAIN game_kick_and_run ={   kick_and_run_dirs,   kick_and_run_roms,   kick_and_run_inputs,   kick_and_run_dsw,   NULL,   LoadKickRun,   ClearKSystem,   &kick_and_run_video,   ExecuteKSystemFrame,   "kicknrun",   "Kick and Run",   NULL,   COMPANY_ID_TAITO,   "A87",   1986,   kiki_kai_kai_sound,   GAME_SPORTS,};static struct DIR_INFO kiki_kai_kai_dirs[] ={   { "kiki_kai_kai", },   { "kikikai", },   { "kikikaik", },   { NULL, },};static struct ROM_INFO kiki_kai_kai_roms[] ={   {   "a85-08.rom", 0x00000100, 0xd15f61a8, 0, 0, 0, },   {   "a85-09.rom", 0x00000100, 0xb931c94d, 0, 0, 0, },   {   "a85-10.rom", 0x00000100, 0x8fc3fa86, 0, 0, 0, },   {   "a85-11.rom", 0x00008000, 0xcc3539db, 0, 0, 0, },   {   "a85-12.rom", 0x00010000, 0x91e58067, 0, 0, 0, },   {   "a85-13.rom", 0x00010000, 0x3eeaf878, 0, 0, 0, },   {   "a85-14.rom", 0x00010000, 0xa9df0453, 0, 0, 0, },   {   "a85-15.rom", 0x00010000, 0xaebc8c32, 0, 0, 0, },   {   "a85-16.rom", 0x00010000, 0x4094d750, 0, 0, 0, },   {   "a85-17.rom", 0x00010000, 0xc141d5ab, 0, 0, 0, },   {   "knightb.uc", 0x00000800, 0x3cc2bbe4, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};static struct INPUT_INFO kiki_kai_kai_inputs[] ={   { KB_DEF_COIN1,        MSG_COIN1,               0x020005, 0x01, BIT_ACTIVE_0 },   { KB_DEF_COIN2,        MSG_COIN2,               0x020005, 0x02, BIT_ACTIVE_0 },   { KB_DEF_TILT,         MSG_TILT,                0x020000, 0x04, BIT_ACTIVE_0 },   { KB_DEF_SERVICE,      MSG_SERVICE,             0x020000, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P1_START,     MSG_P1_START,            0x020000, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P1_UP,        MSG_P1_UP,               0x020001, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P1_DOWN,      MSG_P1_DOWN,             0x020001, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P1_LEFT,      MSG_P1_LEFT,             0x020001, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P1_RIGHT,     MSG_P1_RIGHT,            0x020001, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P1_B1,        MSG_P1_B1,               0x020001, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P1_B2,        MSG_P1_B2,               0x020001, 0x20, BIT_ACTIVE_0 },   { KB_DEF_P2_START,     MSG_P2_START,            0x020000, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P2_UP,        MSG_P2_UP,               0x020002, 0x01, BIT_ACTIVE_0 },   { KB_DEF_P2_DOWN,      MSG_P2_DOWN,             0x020002, 0x02, BIT_ACTIVE_0 },   { KB_DEF_P2_LEFT,      MSG_P2_LEFT,             0x020002, 0x04, BIT_ACTIVE_0 },   { KB_DEF_P2_RIGHT,     MSG_P2_RIGHT,            0x020002, 0x08, BIT_ACTIVE_0 },   { KB_DEF_P2_B1,        MSG_P2_B1,               0x020002, 0x10, BIT_ACTIVE_0 },   { KB_DEF_P2_B2,        MSG_P2_B2,               0x020002, 0x20, BIT_ACTIVE_0 },   { 0,                   NULL,                    0,        0,    0            },};static struct DSW_DATA dsw_data_kiki_kai_kai_0[] ={   { "Cabinet",               0x01, 0x02 },   { "Upright",               0x01, 0x00 },   { "Table",                 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_2COIN_3PLAY,         0x00, 0x00 },   { MSG_COIN2,               0xC0, 0x04 },   { MSG_1COIN_1PLAY,         0xC0, 0x00 },   { MSG_1COIN_2PLAY,         0x80, 0x00 },   { MSG_2COIN_1PLAY,         0x40, 0x00 },   { MSG_2COIN_3PLAY,         0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_DATA dsw_data_kiki_kai_kai_1[] ={   { MSG_DIFFICULTY,          0x03, 0x04 },   { MSG_NORMAL,              0x03, 0x00 },   { MSG_EASY,                0x02, 0x00 },   { MSG_HARD,                0x01, 0x00 },   { MSG_HARDEST,             0x00, 0x00 },   { "Extra Life",            0x0C, 0x04 },   { "70k 150k",              0x0C, 0x00 },   { "70k 200k",              0x08, 0x00 },   { "100k 300k",             0x04, 0x00 },   { "50k 100k",              0x00, 0x00 },   { "Lives",                 0x30, 0x04 },   { "3",                     0x30, 0x00 },   { "4",                     0x20, 0x00 },   { "5",                     0x10, 0x00 },   { "2",                     0x00, 0x00 },   { "Unknown",		      0x40, 0x02 },   { MSG_OFF,                 0x40, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { "Number Match",          0x80, 0x02 },   { MSG_OFF,                 0x80, 0x00 },   { MSG_ON,                  0x00, 0x00 },   { NULL,                    0,    0,   },};static struct DSW_INFO kiki_kai_kai_dsw[] ={   { 0x020003, 0xFF, dsw_data_kiki_kai_kai_0 },   { 0x020004, 0xFF, dsw_data_kiki_kai_kai_1 },   { 0,        0,    NULL,      },};struct GAME_MAIN game_kiki_kai_kai ={   kiki_kai_kai_dirs,   kiki_kai_kai_roms,   kiki_kai_kai_inputs,   kiki_kai_kai_dsw,   NULL,   LoadKikiKaiKai,   ClearKSystem,   &kiki_kai_kai_video,   ExecuteKSystemFrame,   "kikikai",   "Kiki Kai Kai",   NULL,   COMPANY_ID_TAITO,   "A85",   1986,   kiki_kai_kai_sound,   GAME_PLATFORM,};static struct DIR_INFO knight_boy_dirs[] ={   { "knight_boy", },   { "knightb", },   { ROMOF("kikikai"), },   { CLONEOF("kikikai"), },   { NULL, },};static struct ROM_INFO knight_boy_roms[] ={   {  "a85-10.rom", 0x00000100, 0x8fc3fa86, 0, 0, 0, },   {  "a85-09.rom", 0x00000100, 0xb931c94d, 0, 0, 0, },   {  "a85-08.rom", 0x00000100, 0xd15f61a8, 0, 0, 0, },   {  "a85-11.rom", 0x00008000, 0xcc3539db, 0, 0, 0, },   {  "a85-12.rom", 0x00010000, 0x91e58067, 0, 0, 0, },   {   "knightb.b", 0x00010000, 0x63ad7df3, 0, 0, 0, },   {  "a85-14.rom", 0x00010000, 0xa9df0453, 0, 0, 0, },   {   "knightb.d", 0x00010000, 0x53ecdb3f, 0, 0, 0, },   {  "a85-16.rom", 0x00010000, 0x4094d750, 0, 0, 0, },   {  "a85-17.rom", 0x00010000, 0xc141d5ab, 0, 0, 0, },   {  "knightb.uc", 0x00000800, 0x3cc2bbe4, 0, 0, 0, },   {           NULL,          0,          0, 0, 0, 0, },};

⌨️ 快捷键说明

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