📄 kiki_mcu.c
字号:
/* Auto-generated from kiki.asm! Do not modify! *//* [spindizzy] - hacked, see L0x162 */#include "raine.h"#include "debug.h"#include "ingame.h"extern UINT8 KSystem_MCU_RDMEM(int a);extern void KSystem_MCU_WRMEM(int a, UINT8 v);#define MCU_RDMEM(a) KSystem_MCU_RDMEM(a)#define MCU_WRMEM(a,v) KSystem_MCU_WRMEM(a,v)#include "m68705.h"static int unpacked;void KikiKaiKai_mcu_reset(void){ m68705.pc = MCU_RDMEM(0x7ff) | (MCU_RDMEM(0x7fe) << 8); m68705.sp = 0x7f; m68705.a = m68705.x = 0x00; m68705.flag_i = 0; m68705.flag_n = m68705.flag_h = m68705.flag_z = m68705.flag_c = 0; unpacked = 0;}/*arghh, fucking msvc, goto jumptables not supported!!! :((*/#if defined(RAINE_DOS) || defined(RAINE_UNIX)#define LABEL(addr) \L0x##addr \#else#define LABEL(addr) \case 0x##addr \#undef JUMP#define JUMP(addr) \break; \#undef JUMP_IMM#define JUMP_IMM(adr) \{ m68705.pc = adr; \break; } \#endifvoid KikiKaiKai_mcu(int bih_count){ UINT8 temp, dummy; UINT16 addr; UINT8 x = m68705.x; UINT8 a = m68705.a; UINT16 sp = m68705.sp; UINT8 flag_c = m68705.flag_c; UINT8 flag_h = m68705.flag_h; UINT8 flag_n = m68705.flag_n; UINT8 flag_z = m68705.flag_z;#if defined(RAINE_DOS) || defined(RAINE_UNIX) static const M68705_JumpTable jump_table[] = { { 0x080, &&L0x080 }, { 0x09f, &&L0x09f }, { 0x0b4, &&L0x0b4 }, { 0x0e2, &&L0x0e2 }, { 0x0e4, &&L0x0e4 }, { 0x0f0, &&L0x0f0 }, { 0x0f6, &&L0x0f6 }, { 0x0f8, &&L0x0f8 }, { 0x0fe, &&L0x0fe }, { 0x100, &&L0x100 }, { 0x10c, &&L0x10c }, { 0x110, &&L0x110 }, { 0x118, &&L0x118 }, { 0x11c, &&L0x11c }, { 0x122, &&L0x122 }, { 0x12a, &&L0x12a }, { 0x132, &&L0x132 }, { 0x138, &&L0x138 }, { 0x13e, &&L0x13e }, { 0x144, &&L0x144 }, { 0x14a, &&L0x14a }, { 0x14c, &&L0x14c }, { 0x14f, &&L0x14f }, { 0x152, &&L0x152 }, { 0x153, &&L0x153 }, { 0x164, &&L0x164 }, { 0x17c, &&L0x17c }, { 0x17e, &&L0x17e }, { 0x182, &&L0x182 }, { 0x188, &&L0x188 }, { 0x18e, &&L0x18e }, { 0x19a, &&L0x19a }, { 0x1ac, &&L0x1ac }, { 0x1b4, &&L0x1b4 }, { 0x1c6, &&L0x1c6 }, { 0x1d0, &&L0x1d0 }, { 0x1d8, &&L0x1d8 }, { 0x1db, &&L0x1db }, { 0x1e3, &&L0x1e3 }, { 0x1f8, &&L0x1f8 }, { 0x1fd, &&L0x1fd }, { 0x213, &&L0x213 }, { 0x223, &&L0x223 }, { 0x227, &&L0x227 }, { 0x22f, &&L0x22f }, { 0x233, &&L0x233 }, { 0x24c, &&L0x24c }, { 0x254, &&L0x254 }, { 0x25a, &&L0x25a }, { 0x263, &&L0x263 }, { 0x265, &&L0x265 }, { 0x267, &&L0x267 }, { 0x27c, &&L0x27c }, { 0x27e, &&L0x27e }, { 0x281, &&L0x281 }, { 0x292, &&L0x292 }, { 0x2a1, &&L0x2a1 }, { 0x2aa, &&L0x2aa }, { 0x2b2, &&L0x2b2 }, { 0x2bb, &&L0x2bb }, { 0x2ca, &&L0x2ca }, { 0x2cf, &&L0x2cf }, { 0x2e0, &&L0x2e0 }, { 0x2e9, &&L0x2e9 }, { 0x2f9, &&L0x2f9 }, { 0x2ff, &&L0x2ff }, { 0x305, &&L0x305 }, { 0x309, &&L0x309 }, { 0x30f, &&L0x30f }, { 0x311, &&L0x311 }, { 0x31c, &&L0x31c }, { 0x31e, &&L0x31e }, { 0, NULL } }; if (!unpacked) { M68705_Unpack(&jump_table[0], &&invalid_pc); unpacked=1; }/* code starts here */ JUMP(m68705.pc);#elseLOOP: switch(m68705.pc){#endifLABEL(080): /* lda */ addr = 0x010; a = MCU_RDMEM(0x010); SET_NZ(a);//LABEL(082): /* sta */ SET_NZ(a); MCU_WRMEM(0x000, a);//LABEL(084): /* bclr1 */ BCLR(0x001, 1);//LABEL(086): /* bset1 */ BSET(0x001, 1);//LABEL(088): /* clr */ addr = 0x004; temp = 0; SET_NZ(temp); MCU_WRMEM(addr, temp);//LABEL(08a): /* bset4 */ BSET(0x001, 4);//LABEL(08c): /* bclr3 */ BCLR(0x001, 3);//LABEL(08e): /* bclr0 */ BCLR(0x001, 0);//LABEL(090): /* lda */ addr = 0x000; a = MCU_RDMEM(0x000); SET_NZ(a);//LABEL(092): /* bset3 */ BSET(0x001, 3);//LABEL(094): /* bset0 */ BSET(0x001, 0);//LABEL(096): /* sta */ SET_NZ(a); MCU_WRMEM(0x015, a);//LABEL(098): /* lda */ a = 0x0ff; SET_NZ(a);//LABEL(09a): /* sta */ SET_NZ(a); MCU_WRMEM(0x004, a);//LABEL(09c): /* lda */ addr = 0x015; a = MCU_RDMEM(0x015); SET_NZ(a);//LABEL(09e): /* rts */ PULLWORD(m68705.pc); JUMP(m68705.pc);LABEL(09f): /* sta */ SET_NZ(a); MCU_WRMEM(0x015, a);//LABEL(0a1): /* lda */ addr = 0x011; a = MCU_RDMEM(0x011); SET_NZ(a);//LABEL(0a3): /* sta */ SET_NZ(a); MCU_WRMEM(0x000, a);//LABEL(0a5): /* bclr1 */ BCLR(0x001, 1);//LABEL(0a7): /* bset1 */ BSET(0x001, 1);//LABEL(0a9): /* lda */ addr = 0x015; a = MCU_RDMEM(0x015); SET_NZ(a);//LABEL(0ab): /* sta */ SET_NZ(a); MCU_WRMEM(0x000, a);//LABEL(0ad): /* bclr4 */ BCLR(0x001, 4);//LABEL(0af): /* bclr3 */ BCLR(0x001, 3);//LABEL(0b1): /* bset3 */ BSET(0x001, 3);//LABEL(0b3): /* rts */ PULLWORD(m68705.pc); JUMP(m68705.pc);LABEL(0b4): /* sei *///INIT_PC m68705.flag_i = 1;//LABEL(0b5): /* rsp */ sp = 0x7f;//LABEL(0b6): /* lda */ a = 0x0ff; SET_NZ(a);//LABEL(0b8): /* sta */ SET_NZ(a); MCU_WRMEM(0x004, a);//LABEL(0ba): /* lda */ a = 0x000; SET_NZ(a);//LABEL(0bc): /* sta */ SET_NZ(a); MCU_WRMEM(0x006, a);//LABEL(0be): /* lda */ a = 0x0df; SET_NZ(a);//LABEL(0c0): /* sta */ SET_NZ(a); MCU_WRMEM(0x001, a);//LABEL(0c2): /* lda */ a = 0x0ff; SET_NZ(a);//LABEL(0c4): /* sta */ SET_NZ(a); MCU_WRMEM(0x005, a);//LABEL(0c6): /* lda */ a = 0x0df; SET_NZ(a);//LABEL(0c8): /* sta */ SET_NZ(a); MCU_WRMEM(0x001, a);//LABEL(0ca): /* clr */ addr = 0x01a; temp = 0; SET_NZ(temp); MCU_WRMEM(addr, temp);//LABEL(0cc): /* clr */ addr = 0x01b; temp = 0; SET_NZ(temp); MCU_WRMEM(addr, temp);//LABEL(0ce): /* clr */ addr = 0x01c; temp = 0; SET_NZ(temp); MCU_WRMEM(addr, temp);//LABEL(0d0): /* clr */ addr = 0x01d; temp = 0; SET_NZ(temp); MCU_WRMEM(addr, temp);//LABEL(0d2): /* lda */ addr = 0x002; a = MCU_RDMEM(0x002); SET_NZ(a);//LABEL(0d4): /* anda */ AND(a, a, 0x03f); SET_NZ(a);//LABEL(0d6): /* eora */ EOR(a, a, 0x003); SET_NZ(a);//LABEL(0d8): /* sta */ SET_NZ(a); MCU_WRMEM(0x012, a);//LABEL(0da): /* sta */ SET_NZ(a); MCU_WRMEM(0x014, a);//LABEL(0dc): /* lda */ a = 0x001; SET_NZ(a);//LABEL(0de): /* sta */ SET_NZ(a); MCU_WRMEM(0x010, a);//LABEL(0e0): /* bset2 */ BSET(0x001, 2);LABEL(0e2): /* jsr */ PUSHWORD(0x0e4); JUMP_IMM(0x080);LABEL(0e4): /* cmpa */ SUB(temp, a, 0x000);//LABEL(0e6): /* bne */ IF_CC_NZ() JUMP_IMM(0x0e2);//LABEL(0e8): /* lda */ a = 0x004; SET_NZ(a);//LABEL(0ea): /* sta */ SET_NZ(a); MCU_WRMEM(0x011, a);//LABEL(0ec): /* lda */ a = 0x0fc; SET_NZ(a);//LABEL(0ee): /* jsr */ PUSHWORD(0x0f0); JUMP_IMM(0x09f);LABEL(0f0): /* lda */ a = 0x00b; SET_NZ(a);//LABEL(0f2): /* sta */ SET_NZ(a); MCU_WRMEM(0x010, a);//LABEL(0f4): /* jsr */ PUSHWORD(0x0f6); JUMP_IMM(0x080);LABEL(0f6): /* jsr */ PUSHWORD(0x0f8); JUMP_IMM(0x080);LABEL(0f8): /* sta */ SET_NZ(a); MCU_WRMEM(0x01f, a);//LABEL(0fa): /* inc */ addr = 0x010; INC(temp, MCU_RDMEM(0x010)); MCU_WRMEM(addr, temp);//LABEL(0fc): /* jsr */ PUSHWORD(0x0fe); JUMP_IMM(0x080);LABEL(0fe): /* jsr */ PUSHWORD(0x100); JUMP_IMM(0x080);LABEL(100): /* sta */ SET_NZ(a); MCU_WRMEM(0x020, a);//LABEL(102): /* clr */ addr = 0x010; temp = 0; SET_NZ(temp); MCU_WRMEM(addr, temp);//LABEL(104): /* lda */ a = 0x002; SET_NZ(a);//LABEL(106): /* sta */ SET_NZ(a); MCU_WRMEM(0x011, a);//LABEL(108): /* bclr2 */ BCLR(0x001, 2);//LABEL(10a): /* jsr */ PUSHWORD(0x10c); JUMP_IMM(0x080);LABEL(10c): /* bset2 */ BSET(0x001, 2);//LABEL(10e): /* jsr */ PUSHWORD(0x110); JUMP_IMM(0x09f);LABEL(110): /* inc */ addr = 0x010; INC(temp, MCU_RDMEM(0x010)); MCU_WRMEM(addr, temp);//LABEL(112): /* inc */ addr = 0x011; INC(temp, MCU_RDMEM(0x011)); MCU_WRMEM(addr, temp);//LABEL(114): /* bclr2 */ BCLR(0x001, 2);//LABEL(116): /* jsr */ PUSHWORD(0x118); JUMP_IMM(0x080);LABEL(118): /* bset2 */ BSET(0x001, 2);//LABEL(11a): /* jsr */ PUSHWORD(0x11c); JUMP_IMM(0x09f);LABEL(11c): /* lda */ a = 0x019; SET_NZ(a);//LABEL(11e): /* sta */ SET_NZ(a); MCU_WRMEM(0x010, a);//LABEL(120): /* jsr */ PUSHWORD(0x122); JUMP_IMM(0x080);LABEL(122): /* lda */ a = 0x01b; SET_NZ(a);//LABEL(124): /* sta */ SET_NZ(a); MCU_WRMEM(0x011, a);//LABEL(126): /* lda */ a = 0x0ff; SET_NZ(a);//LABEL(128): /* jsr */ PUSHWORD(0x12a); JUMP_IMM(0x09f);LABEL(12a): /* lda */ a = 0x007; SET_NZ(a);//LABEL(12c): /* sta */ SET_NZ(a); MCU_WRMEM(0x011, a);//LABEL(12e): /* lda */ a = 0x003; SET_NZ(a);//LABEL(130): /* jsr */ PUSHWORD(0x132); JUMP_IMM(0x09f);LABEL(132): /* dec */ addr = 0x011; DEC(temp, MCU_RDMEM(0x011)); MCU_WRMEM(addr, temp);//LABEL(134): /* lda */ a = 0x0ff; SET_NZ(a);//LABEL(136): /* jsr */ PUSHWORD(0x138); JUMP_IMM(0x09f);LABEL(138): /* clr */ addr = 0x011; temp = 0; SET_NZ(temp); MCU_WRMEM(addr, temp);//LABEL(13a): /* lda */ a = 0x000; SET_NZ(a);//LABEL(13c): /* jsr */ PUSHWORD(0x13e); JUMP_IMM(0x09f);LABEL(13e): /* clr */ addr = 0x011; temp = 0; SET_NZ(temp); MCU_WRMEM(addr, temp);//LABEL(140): /* lda */ a = 0x000; SET_NZ(a);//LABEL(142): /* jsr */ PUSHWORD(0x144); JUMP_IMM(0x09f);LABEL(144): /* lda */ a = 0x00d; SET_NZ(a);//LABEL(146): /* sta */ SET_NZ(a); MCU_WRMEM(0x010, a);//LABEL(148): /* jsr */ PUSHWORD(0x14a); JUMP_IMM(0x080);LABEL(14a): /* jsr */ PUSHWORD(0x14c); JUMP_IMM(0x080);LABEL(14c): /* jsr */ PUSHWORD(0x14f); JUMP_IMM(0x164);LABEL(14f): /* jsr */ PUSHWORD(0x152); JUMP_IMM(0x24c);LABEL(152): /* cli */ m68705.flag_i = 0;LABEL(153): /* lda */ addr = 0x01f; a = MCU_RDMEM(0x01f); SET_NZ(a);//LABEL(155): /* lsra */ flag_c = a & 0x01; a >>= 1; SET_NZ(a);//LABEL(156): /* lsra */ flag_c = a & 0x01; a >>= 1; SET_NZ(a);//LABEL(157): /* lsra */ flag_c = a & 0x01; a >>= 1; SET_NZ(a);//LABEL(158): /* lsra */ flag_c = a & 0x01; a >>= 1; SET_NZ(a);//LABEL(159): /* tax */ x = a;//LABEL(15a): /* anda */ AND(a, a, 0x003); SET_NZ(a);//LABEL(15c): /* sta */ SET_NZ(a); MCU_WRMEM(0x016, a);//LABEL(15e): /* lsrx */ flag_c = x & 0x01; x >>= 1; SET_NZ(x);//LABEL(15f): /* lsrx */ flag_c = x & 0x01; x >>= 1; SET_NZ(x);//LABEL(160): /* stx */ SET_NZ(x); MCU_WRMEM(0x017, x);//LABEL(162): /* bra */ //JUMP_IMM(0x153); /* Hack to make it (a) only do the main loop once then return, * and (b) call the interrupt code from the main loop instead. */ m68705.pc = 0x14c; m68705.x = x; m68705.a = a; m68705.sp = sp; m68705.flag_c = flag_c; m68705.flag_h = flag_h; m68705.flag_n = flag_n; m68705.flag_z = flag_z; return; LABEL(164): /* lda */ a = 0x004; SET_NZ(a);//LABEL(166): /* sta */ SET_NZ(a); MCU_WRMEM(0x011, a);//LABEL(168): /* lda */ addr = 0x002; a = MCU_RDMEM(0x002); SET_NZ(a);//LABEL(16a): /* anda */ AND(a, a, 0x03f); SET_NZ(a);//LABEL(16c): /* eora */ EOR(a, a, 0x003); SET_NZ(a);//LABEL(16e): /* sta */ SET_NZ(a); MCU_WRMEM(0x012, a);//LABEL(170): /* lda */ addr = 0x01a; a = MCU_RDMEM(0x01a); SET_NZ(a);//LABEL(172): /* beq */ IF_CC_Z() JUMP_IMM(0x17c);//LABEL(174): /* dec */ addr = 0x01a; DEC(temp, MCU_RDMEM(0x01a)); MCU_WRMEM(addr, temp);//LABEL(176): /* beq */ IF_CC_Z() JUMP_IMM(0x17c);//LABEL(178): /* lda */ addr = 0x01e; a = MCU_RDMEM(0x01e); SET_NZ(a);//LABEL(17a): /* bra */ JUMP_IMM(0x17e);LABEL(17c): /* lda */ addr = 0x012; a = MCU_RDMEM(0x012); SET_NZ(a);LABEL(17e): /* bset2 */ BSET(0x001, 2);//LABEL(180): /* jsr */ PUSHWORD(0x182); JUMP_IMM(0x09f);LABEL(182): /* lda */ a = 0x00b; SET_NZ(a);//LABEL(184): /* sta */ SET_NZ(a); MCU_WRMEM(0x010, a);//LABEL(186): /* jsr */ PUSHWORD(0x188); JUMP_IMM(0x080);LABEL(188): /* sta */ SET_NZ(a); MCU_WRMEM(0x01f, a);//LABEL(18a): /* inc */ addr = 0x010; INC(temp, MCU_RDMEM(0x010)); MCU_WRMEM(addr, temp);//LABEL(18c): /* jsr */ PUSHWORD(0x18e); JUMP_IMM(0x080);LABEL(18e): /* sta */ SET_NZ(a); MCU_WRMEM(0x020, a);//LABEL(190): /* clr */ addr = 0x010; temp = 0; SET_NZ(temp); MCU_WRMEM(addr, temp);//LABEL(192): /* lda */ a = 0x002; SET_NZ(a);//LABEL(194): /* sta */ SET_NZ(a); MCU_WRMEM(0x011, a);//LABEL(196): /* bclr2 */ BCLR(0x001, 2);//LABEL(198): /* jsr */ PUSHWORD(0x19a); JUMP_IMM(0x080);LABEL(19a): /* lsra */ flag_c = a & 0x01; a >>= 1; SET_NZ(a);//LABEL(19b): /* lsra */ flag_c = a & 0x01; a >>= 1; SET_NZ(a);//LABEL(19c): /* anda */ AND(a, a, 0x003); SET_NZ(a);//LABEL(19e): /* tax */ x = a;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -