Created
January 4, 2024 04:48
-
-
Save ilyakurdyukov/a30b73ec44e0aec5162fb7b9f524a6a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static const uint8_t rom_01a[] = { | |
/* mode numbers */ | |
#if 1 | |
#define B1(x,n) (#x[7-n]!='.')<<n | |
#define X(x) B1(x,0)|B1(x,1)|B1(x,2)|B1(x,3)|B1(x,4)|B1(x,5)|B1(x,6)|B1(x,7), | |
X(.@@@@@..)X(........)X(.@....@.)X(.@...@..)X(...@@@..)X(@@@..@..)X(.@@@@@..)X(@.......)X(.@@.@@..)X(.@@..@..) | |
X(@.....@.)X(.@....@.)X(@....@@.)X(@..@..@.)X(..@..@..)X(@.@...@.)X(@..@..@.)X(@....@@.)X(@..@..@.)X(@..@..@.) | |
X(@.....@.)X(@@@@@@@.)X(@...@.@.)X(@..@..@.)X(.@...@..)X(@.@...@.)X(@..@..@.)X(@..@@...)X(@..@..@.)X(@..@..@.) | |
X(@.....@.)X(......@.)X(@..@..@.)X(@..@..@.)X(@@@@@@@.)X(@.@...@.)X(@..@..@.)X(@.@.....)X(@..@..@.)X(@..@..@.) | |
X(.@@@@@..)X(........)X(.@@...@.)X(.@@.@@..)X(.....@..)X(@..@@@..)X(.@..@@..)X(@@......)X(.@@.@@..)X(.@@@@@..) | |
#undef X | |
#undef B1 | |
#else | |
/* 0 1 2 3 4 5 6 7 8 9 */ | |
0x7c,0x00,0x42,0x44,0x1c,0xe4,0x7c,0x80,0x6c,0x64, | |
0x82,0x42,0x86,0x92,0x24,0xa2,0x92,0x86,0x92,0x92, | |
0x82,0xfe,0x8a,0x92,0x44,0xa2,0x92,0x98,0x92,0x92, | |
0x82,0x02,0x92,0x92,0xfe,0xa2,0x92,0xa0,0x92,0x92, | |
0x7c,0x00,0x62,0x6c,0x04,0x9c,0x4c,0xc0,0x6c,0x7c | |
#endif | |
}; | |
static const uint8_t rom_e80[] = { | |
#if 1 | |
#define B1(x,n) (#x[3-n]!='.')<<n | |
#define X(x) B1(x,0)|B1(x,1)|B1(x,2)|B1(x,3) | |
#define Y(a,b,c,d) (a)<<4|b,(c)<<4|d, | |
/* classic figures */ | |
Y(X(@@@.), /* 0 */ | |
X(.@..), | |
X(....), 3) | |
Y(X(@@@.), /* 1 */ | |
X(@...), | |
X(....), 3) | |
Y(X(@@@.), /* 2 */ | |
X(..@.), | |
X(....), 3) | |
Y(X(....), /* 3 */ | |
X(.@@.), | |
X(.@@.), 0) | |
Y(X(.@..), /* 4 */ | |
X(@@..), | |
X(@...), 1) | |
Y(X(@...), /* 5 */ | |
X(@@..), | |
X(.@..), 1) | |
Y(X(....), /* 6 */ | |
X(....), | |
X(@@@@), 1) | |
/* weird figures */ | |
Y(X(@@@.), /* 7 */ | |
X(.@..), | |
X(.@..), 3) | |
Y(X(.@..), /* 8 */ | |
X(@@@.), | |
X(.@..), 0) | |
Y(X(@@@.), /* 9 */ | |
X(@.@.), | |
X(....), 3) | |
Y(X(..@.), /* 10 */ | |
X(@@@.), | |
X(@...), 1) | |
Y(X(@...), /* 11 */ | |
X(@@@.), | |
X(..@.), 1) | |
Y(X(....), /* 12 */ | |
X(..@.), | |
X(.@@.), 3) | |
Y(X(....), /* 13 */ | |
X(.@..), | |
X(.@..), 1) | |
#undef Y | |
#undef X | |
#undef B1 | |
#else | |
/* classic figures */ | |
0xe4,0x03, 0xe8,0x03, 0xe2,0x03, 0x06,0x60 ,0x4c,0x81, 0x8c,0x41, 0x00,0xf1, | |
/* weird figures */ | |
0xe4,0x43, 0x4e,0x40, 0xea,0x03, 0x2e,0x81, 0x8e,0x21, 0x02,0x63, 0x04,0x41 | |
#endif | |
}; | |
static const uint8_t rom_f[256] = { | |
/* 0xf00 : bit << 6 | (off & 0x3f) */ | |
0xff,0xbf,0x7f,0x3f,0xfe,0xbe,0x7e,0x3e,0x97,0x95, | |
0xfd,0xbd,0x7d,0x3d,0xfc,0xbc,0x7c,0x3c,0xd7,0xd5, | |
0xfb,0xbb,0x7b,0x3b,0xfa,0xba,0x7a,0x3a,0x57,0x55, | |
0xf9,0xb9,0x79,0x39,0xf8,0xb8,0x78,0x38,0x17,0x15, | |
0xf7,0xb7,0x77,0x37,0xf6,0xb6,0x76,0x36,0xd6,0xd4, | |
0xf5,0xb5,0x75,0x35,0xf4,0xb4,0x74,0x34,0x56,0x54, | |
0xf3,0xb3,0x73,0x33,0xf2,0xb2,0x72,0x32,0x16,0x14, | |
0xf1,0xb1,0x71,0x31,0xf0,0xb0,0x70,0x30,0x96,0x94, | |
0xef,0xaf,0x6f,0x2f,0xee,0xae,0x6e,0x2e,0x12,0x52, | |
0xed,0xad,0x6d,0x2d,0xec,0xac,0x6c,0x2c,0x10,0x50, | |
0xeb,0xab,0x6b,0x2b,0xea,0xaa,0x6a,0x2a,0x0e,0x4e, | |
0xe9,0xa9,0x69,0x29,0xe8,0xa8,0x68,0x28,0x0c,0x4c, | |
0xe7,0xa7,0x67,0x27,0xe6,0xa6,0x66,0x26,0x0a,0x4a, | |
0xe5,0xa5,0x65,0x25,0xe4,0xa4,0x64,0x24,0x08,0x48, | |
0xe3,0xa3,0x63,0x23,0xe2,0xa2,0x62,0x22,0x06,0x46, | |
0xe1,0xa1,0x61,0x21,0xe0,0xa0,0x60,0x20,0x04,0x44, | |
0xdf,0x9f,0x5f,0x1f,0xde,0x9e,0x5e,0x1e,0x42,0x40, | |
0xdd,0x9d,0x5d,0x1d,0xdc,0x9c,0x5c,0x1c,0x82,0x80, | |
0xdb,0x9b,0x5b,0x1b,0xda,0x9a,0x5a,0x1a,0x02,0x00, | |
0xd9,0x99,0x59,0x19,0xd8,0x98,0x58,0x18,0xc2,0xc0, | |
// 0xfc8 : (bit << 6 | ((off + 0x10) & 0x3f)) */ | |
0xd4,0xd6,0xd8,0xda,0x98,0x94,0x96, // speed | |
0xdc,0xde,0xe0,0xe2,0xa0,0x9c,0x9e, // level | |
/* 0x40 .. 0x01: | |
c7_2 c7_3 c7_1 b3_0 b3_1 b3_2 b3_3 */ | |
0x97,0xd7,0x57,0x03,0x43,0x83,0xc3, // score xxxX | |
0x99,0xd9,0x59,0x09,0x49,0x89,0xc9, // score xxXx | |
0x8b,0xcb,0x4b,0x0d,0x4d,0x8d,0xcd, // score xXxx | |
0x9b,0xdb,0x5b,0x0f,0x4f,0x8f,0xcf, // score Xxxx | |
/* 0xff2 : digits | |
0x40 | |
0x02 0x20 | |
0x01 | |
0x04 0x10 | |
0x08 | |
*/ | |
/* 0 1 2 3 4 5| 6 7 8 9 10 */ | |
0x7e,0x30,0x6d,0x79,0x33,0x5b,0x5f,0x70,0x7f,0x7b,0x00, | |
// shooter table : 0xffd + game_type - 5 | |
0x22,0x16,0x47 | |
}; | |
#define RET_ENUM(X) \ | |
X(0x068) X(0x06e) \ | |
X(0x076) X(0x078) X(0x07a) \ | |
X(0x0ac) X(0x0c8) \ | |
X(0x0ca) X(0x0d0) X(0x0d2) X(0x116) \ | |
X(0x134) X(0x136) X(0x154) X(0x156) \ | |
X(0x15d) X(0x165) X(0x178) X(0x17a) \ | |
X(0x17e) \ | |
X(0x193) X(0x19b) X(0x1a2) \ | |
X(0x1a5) X(0x1a7) X(0x1a9) X(0x1ab) X(0x1b1) \ | |
X(0x1f3) X(0x225) \ | |
X(0x230) X(0x237) X(0x244) \ | |
X(0x270) \ | |
X(0x28f) X(0x295) X(0x297) \ | |
X(0x29d) X(0x29f) X(0x2a1) X(0x2a7) X(0x2ab) \ | |
X(0x2b3) X(0x2b7) X(0x2bd) X(0x2bf) X(0x2c1) \ | |
X(0x2c5) X(0x2d4) X(0x2d9) X(0x2e3) X(0x2ec) \ | |
X(0x304) X(0x309) X(0x30d) X(0x30f) \ | |
X(0x358) X(0x398) \ | |
X(0x39a) X(0x3ad) X(0x3c5) X(0x3d6) \ | |
X(0x416) X(0x41b) \ | |
X(0x41d) X(0x448) X(0x47d) X(0x47f) X(0x481) \ | |
X(0x486) X(0x488) X(0x490) X(0x4a4) X(0x4a9) \ | |
X(0x4b2) X(0x4b7) X(0x4bb) X(0x4bd) \ | |
X(0x4d1) X(0x4d5) X(0x4d7) X(0x4f1) X(0x4f3) \ | |
X(0x4f8) X(0x504) X(0x506) X(0x509) X(0x513) \ | |
X(0x51e) X(0x530) X(0x539) X(0x53b) \ | |
X(0x561) X(0x563) X(0x56b) \ | |
X(0x585) X(0x587) X(0x58f) X(0x591) X(0x596) \ | |
X(0x598) X(0x59a) X(0x5b7) X(0x5bb) \ | |
X(0x604) X(0x616) \ | |
X(0x629) X(0x631) X(0x633) X(0x640) X(0x642) \ | |
X(0x64d) X(0x64f) X(0x651) X(0x653) \ | |
X(0x655) X(0x65e) X(0x660) X(0x688) X(0x68e) \ | |
X(0x6a7) \ | |
X(0x6b1) X(0x6bb) X(0x6c1) X(0x6cd) X(0x6d4) \ | |
X(0x6df) X(0x6e3) X(0x6e8) X(0x6fb) X(0x708) \ | |
X(0x70a) X(0x70c) X(0x714) X(0x716) X(0x71e) \ | |
X(0x720) X(0x722) X(0x72b) X(0x72d) X(0x738) \ | |
X(0x746) X(0x752) X(0x756) \ | |
X(0x760) X(0x767) X(0x76c) \ | |
X(0x772) X(0x77d) \ | |
X(0x791) X(0xbe7) X(0xbe9) \ | |
X(0xbeb) X(0xbef) X(0xbf9) X(0xbff) \ | |
X(0xc0e) X(0xc12) X(0xc18) X(0xc21) \ | |
X(0xc25) X(0xc32) \ | |
X(0xc44) X(0xc4c) X(0xc50) X(0xc57) \ | |
X(0xc5b) X(0xc61) X(0xc65) X(0xc68) X(0xc79) \ | |
X(0xc7e) X(0xc83) X(0xc86) X(0xc8e) X(0xc93) \ | |
X(0xc98) X(0xc9a) X(0xc9f) X(0xca7) X(0xcab) \ | |
X(0xcb1) X(0xcb5) X(0xcb7) X(0xcbf) \ | |
X(0xcc3) X(0xce4) X(0xd80) X(0xd82) \ | |
X(0xd86) X(0xd88) X(0xe3d) | |
#define JTMR_ENUM(X) \ | |
X(l_db7, 0xdb7) | |
#define READ8(o) (m[o + 1] << 4 | m[o]) | |
#define WRITE8(o, v) do { int _val = v; \ | |
m[o] = _val & 15; m[o + 1] = _val >> 4 & 15; } while (0) | |
#define TEST16(a, b) \ | |
((*(uint32_t*)&m[a] & *(uint32_t*)&m[b]) != 0) | |
START | |
// 0x53 game_type2 | |
// select screen => 0 | |
// game_type 0,1 => 8 (8) | |
// game_type 2,3 => 9 (8+1) | |
// game_type 4 => 0xa (8+2) | |
// game_type 5,6,7 => 0xc (8+4) | |
// 0x52 shooter_type | |
// game_type 5 => 0 | |
// game_type 6 => 1 | |
// game_type 7 => 2 | |
TIMER_ON | |
#if 0 | |
for (;;) { | |
a = 0xe; | |
OUT_PA | |
IN_PP | |
if (a & 1) goto l_04c; // pp_0 Rotate | |
memset(m, 0xf, 0x100); | |
} | |
#else | |
goto l_04c; | |
#endif | |
f_00e: | |
m[0x0c] = GET_TMR & 15; | |
m[0x0d] = GET_TMR & 15; | |
m[0x0e] = GET_TMR & 15; | |
goto l_968; | |
l_04c: | |
memset(m, 0, 0x100); | |
m[0xbb] = 1; // 187_0 next sign | |
m[0xc3] = 1; // 195_0 sound sign | |
m[0xb6] = 0xc; // 182_2 level sign, 182_3 rotate sign | |
m[0xb7] = 2; // 183_1 rotate_2 | |
m[0xc5] = 2; // 197_1 speed sign | |
m[0x91] = 1; // 0x91 mode_low | |
l_061: | |
memset(m + 0x94, 0, 0xc); | |
m[0x83] = 0; | |
CALL(f_3bd, 0x068) // redraw pause | |
m[0xb1] |= 2; // 177_1 game over | |
CALL(f_7de, 0x06e) | |
l_06e: | |
memset(m, 0, 0x5e); | |
memset(m + 0x94, 0, 0xc); | |
CALL(f_e3f, 0x076) // update_next | |
CALL(f_0f2, 0x078) // redraw speed and level | |
CALL(f_ab3, 0x07a) // clear_field | |
l_07a: // redraw the mode numbers | |
// 0x92 mode_high | |
r3r2 = 0x92; a = 10; | |
do { // l_07d | |
m[0x33] = a; // 19 - y | |
m[0x34] = m[r3r2]; | |
m[0x35] = 1; | |
m[0x30] = 2; | |
// CALL(f_e76, 0x089) | |
do { // l_089 | |
m[0x31] = m[0x33]; | |
m[0x32] = 0; | |
//r1r0 = 0x34; | |
//CALL(f_dfa, 0x095) // add_8bit(a = 10) | |
WRITE8(0x34, READ8(0x34) + 10); | |
a = rom_01a[READ8(0x34) - 0x1a]; | |
m[0x36] = a & 15; | |
m[0x37] = a >> 4; | |
m[0x38] = 7; | |
do { // l_0a1 | |
a = m[0x37]; RRC m[0x37] = a; | |
a = m[0x36]; RRC m[0x36] = a; | |
// state = a & 1 | |
// col = m[0x30] | |
// row = m[0x32] << 4 | m[0x31] | |
CALL(f_9e5, 0x0ac) // draw_dot_30 | |
WRITE8(0x31, READ8(0x31) + 1); | |
// CALL(f_dfd, 0x0ae) // add_8bit(a = 1, r1r0 = 0x31) | |
} while (--m[0x38]); | |
m[0x30]++; | |
} while (m[0x30] != 7); | |
// 0x91 mode_low | |
r3r2 = 0x91; a = 2; | |
} while (m[0x33] != 2); | |
// select screen loop | |
for (;;) { // l_0c5 | |
a = 0; | |
CALL(f_b07, 0x0c8) // redraw score | |
CALL(f_cc5, 0x0ca) // check_input | |
if (r3r2 & 0xf0) { | |
a = 7; | |
CALL(f_7a3, 0x0d0) // sound(a) | |
CALL(f_0d4, 0x0d2) // process keys in r3 | |
} | |
} | |
f_0d4: | |
a = r3r2 >> 4; | |
if (a & 1) { // pp_0 Rotate | |
// l_0fe | |
m[0xb7] ^= 3; // 183_0 rotate_1, 183_1 rotate_2 | |
RET | |
} | |
cf = 0; | |
if (a & 2) goto l_103; // pp_1 Down | |
if (a & 8) goto l_0e6; // pp_3 Left | |
// fallback: pp_2 Right | |
f_0dc: // inc_speed | |
r1r0 = 0x80; | |
INC(m[0x80]) | |
if (m[0x80] != 10) goto l_0f2; | |
a = 9; // max speed | |
goto l_0ee; | |
l_0e6: | |
f_0e6: // inc_level | |
r1r0 = 0x81; | |
INC(m[0x81]) | |
if (m[0x81] != 13) goto l_0f2; | |
a = 12; // max level | |
l_0ee: | |
// wrap to zero if cf == 0 | |
m[r1r0] = cf ? a : 0; | |
l_0f2: | |
f_0f2: // redraw speed and level | |
WRITE8(0x02, 0xce); | |
r3r2 = 0x80; a = 2; // 0x80 speed, 0x81 level | |
goto l_b4d; | |
l_103: // increase mode | |
// 0x90 game_type | |
m[0x90] = (m[0x90] + 1) & 7; | |
#if 1 | |
// 0x91 mode_low | |
a = m[0x91] + 1; DAA m[0x91] = a; | |
// 0x92 mode_high | |
if (cf) { INC(m[0x92]) } | |
r1r0 = 0x91; | |
r3r2 = 0xa0; // bcd 100 | |
CALL(f_362, 0x116) // compare r3r2 and m[r1r0] | |
if (!r4) { | |
// reset on overflow | |
m[0x92] = 0; // mode_high | |
m[0x91] = 1; // mode_low | |
m[0x90] = 0; // game_type | |
} | |
#else | |
// 0x91 mode_low, 0x92 mode_high | |
WRITE8(0x91, READ8(0x91) + 1) | |
if (READ8(0x91) == 100) { // reset on overflow | |
WRITE8(0x91, 1); | |
m[0x90] = 0; // game_type | |
} | |
#endif | |
goto l_07a; | |
l_121: // start new game | |
m[0xb1] &= ~2; // 177_1 game over | |
memset(m, 0, 0x5e); | |
DEC(m[0x59]) | |
INC(m[0x50]) | |
m[0x51] = 5; | |
CALL(f_ab3, 0x134) // clear_field | |
CALL(f_af6, 0x136) | |
m[0x53] = 8; | |
// 0x90 game_type | |
if (m[0x90] >= 2) { | |
if (m[0x90] >= 4) goto l_520; | |
INC(m[0x53]) // 9 | |
} | |
memset(m + 0x94, 0, 0xc); | |
if (m[0xc3] & 1) { // 195_0 sound sign | |
INC(m[0x59]) | |
SOUND(0xe) | |
} | |
CALL(f_822, 0x154) // next_figure | |
l_154: | |
CALL(f_7f4, 0x156) | |
if ((m[0x53] & 1) == 0) { // game_type 0,1 | |
CALL(f_7f9, 0x15d) | |
} | |
a = m[0x81]; // 0x81 level | |
r3r2 = (r3r2 & 0xf0) | a; | |
while (r3r2 & 15) { | |
CALL(f_00e, 0x165) | |
DEC_R2 | |
} | |
l_169: | |
INC(m[0x42]) | |
m[0x85] &= ~1; | |
memcpy(m + 0x33, m + 0x3c, 2); | |
CALL(f_822, 0x178) // next_figure | |
CALL(f_e3f, 0x17a) // update_next | |
// CALL(f_e21, 0x17c) | |
memcpy(m + 0x36, m + 0x30, 5); | |
CALL(f_e9c, 0x17e) // read_figure | |
// r3r2 = 0x1c; | |
// CALL(f_e15, 0x182) | |
// CALL(f_e76, 0x185) | |
memcpy(m + 0x1c, m + 0x2c, 4); | |
m[0x30] = 3; | |
m[0x31] = 0; | |
m[0x32] = 1; | |
r3r2 = 0x1f; | |
while (!m[r3r2]) { // l_188 | |
DEC_R2 | |
INC(m[0x31]) | |
} | |
// CALL(f_e21, 0x191) | |
memcpy(m + 0x36, m + 0x30, 5); | |
CALL(f_874, 0x193) | |
//CALL(f_e2c, 0x195) // cf = (m[0x1f..0x1c] & m[0x2f..0x2c]) != 0 | |
cf = TEST16(0x1c, 0x2c); | |
// CALL(f_e13, 0x197) | |
memcpy(m + 0x44, m + 0x2c, 4); | |
if (!cf) goto l_22e; | |
CALL(f_90d, 0x19b) | |
l_19b: | |
m[0xb1] |= 2; // 177_1 game over | |
a = 0xa; | |
CALL(f_7bc, 0x1a2) | |
a = 0xd; | |
l_1a3: | |
CALL(f_7a9, 0x1a5) // some sound | |
l_1a5: | |
CALL(f_d98, 0x1a7) | |
CALL(f_7f9, 0x1a9) | |
l_1a9: | |
CALL(f_808, 0x1ab) | |
a = m[0x0a] ^ 0xf; | |
CALL(f_962, 0x1b1) | |
memcpy(m + 0x10, m + 0x00, 4); | |
INC(m[0x3f]) | |
cf = m[0x58] >= 13; // needed? | |
r3r2 = 0x1e; | |
if (m[0x58] == 13) goto l_1cb; | |
r3r2 = 0x08; | |
if (m[0x58] != 12) goto l_1cb; | |
goto l_2fe; // increase score by 1 | |
l_1c9: | |
r3r2 = 0x18; | |
l_1cb: | |
goto l_389; | |
l_1cd: | |
memcpy(m + 0x00, m + 0x10, 4); | |
cf = m[0x03] >= 13; | |
if (!cf) goto l_1a9; | |
DEC(m[0x03]) | |
m[0x02] = 7; | |
m[0x0a] ^= 0xf; | |
if (m[0x0a]) goto l_1f5; | |
if (m[0x58] == 0xd) goto l_06e; | |
if (m[0x53] & 2) goto l_68e; // snake | |
if (m[0x53] & 4) goto l_530; // shooter | |
CALL(f_da1, 0x1f3) // some sound | |
goto l_154; | |
l_1f5: | |
a = 0xe; | |
if (m[0x58] == 0xc) goto l_223; | |
a = 4; | |
if (m[0x58] != 0xd) goto l_223; | |
r3r2 = m[0x90] & 4 ? 0x7c : 0x8c; // hi-score | |
cf = 1; | |
// compare m[r3r2] and m[0x4f..0x4c] | |
for (r1r0 = 0x4c; r1r0 < 0x50; r1r0++) { // l_20c | |
a = m[r3r2]; | |
SBC(a, m[r1r0]) | |
INC_R2 | |
} | |
if (!cf) // m[r3r2] < m[0x4f..0x4c] | |
memcpy(m + (r3r2 & 0xf0) + 8, m + 0x48, 8); | |
a = !cf || m[0x4f] ? 0xe : 0xc; | |
l_223: | |
cf = 0; | |
CALL(f_7bc, 0x225) | |
goto l_1a9; | |
l_227: | |
// CALL(f_e13, 0x229) | |
memcpy(m + 0x44, m + 0x2c, 4); | |
// CALL(f_efa, 0x22b) | |
memcpy(m + 0x30, m + 0x36, 5); | |
INC(m[0x0b]) | |
l_22e: | |
CALL(f_90d, 0x230) | |
do { // l_230 | |
if (m[0x59] & 4) goto l_244; | |
CALL(f_cc5, 0x237) // check_input | |
a = 6; | |
ADD(a, m[0x9a]) | |
} while (!cf); // m[0x9a] < 10 | |
DEC(m[0x59]) | |
r3r2 = 0xf6; | |
CALL(f_793, 0x244) | |
l_244: | |
a = m[0x80] ^ 0xf; // 0x80 speed | |
// if (!a || (a & 2)) goto l_255; | |
if ((m[0x53] & 6) == 4) { // shooter | |
r3r2 = a << 4; | |
} else { // l_255 | |
r3r2 = (a - 5) << 3; | |
cf = 0; | |
} | |
goto l_389; | |
l_260: | |
if (m[0x53] & 2) goto l_6c3; // snake | |
if (m[0x53] & 4) goto l_56d; // shooter | |
// CALL(f_e21, 0x269) | |
memcpy(m + 0x36, m + 0x30, 5); | |
// CALL(f_e07, 0x26b) // sub_8bit(a = -1, r1r0 = 0x37) | |
WRITE8(0x37, READ8(0x37) - 1); | |
INC(m[0x0b]) | |
CALL(f_874, 0x270) | |
// r1r0 = 0x44; | |
// r3r2 = 0x2d; | |
// CALL(f_e17, 0x276) | |
// r3r2 = 0x10; | |
// CALL(f_e15, 0x27a) | |
memcpy(m + 0x2d, m + 0x44, 3); | |
m[0x20] = m[0x47]; // r2 overflow | |
memcpy(m + 0x10, m + 0x2c, 4); | |
// CALL(f_e2c, 0x27c) // cf = (m[0x1f..0x1c] & m[0x2f..0x2c]) != 0 | |
cf = TEST16(0x1c, 0x2c); | |
if (!cf) goto l_227; // the piece can fall down | |
// CALL(f_e21, 0x280) | |
memcpy(m + 0x36, m + 0x30, 5); | |
if (m[0x3f] & 8) goto l_28b; | |
m[0x3f] |= 8; | |
r3r2 = 0x32; | |
goto l_389; | |
l_28b: | |
m[0x3f] = 0; | |
a = 3; | |
CALL(f_7a9, 0x28f) // some sound | |
r1r0 = 0x15; | |
a = m[0x15]; | |
m[0x15] = 0; | |
l_293: | |
CALL(f_7f9, 0x295) | |
l_295: | |
CALL(f_9fa, 0x297) | |
DEC(r4) | |
if (r4) goto l_2d7; | |
a = 0xb; | |
CALL(f_7a9, 0x29d) // some sound | |
CALL(f_7f9, 0x29f) | |
l_29f: | |
CALL(f_9fa, 0x2a1) | |
DEC(r4) | |
a = r4; | |
if (!a) goto l_2a9; | |
CALL(f_968, 0x2a7) | |
goto l_29f; | |
l_2a9: | |
CALL(f_35a, 0x2ab) | |
m[0x14] = r4; | |
r3r2 = 0x1a; | |
do { // l_2b1 | |
CALL(f_961, 0x2b3) | |
r1r0 = 0x02; | |
CALL(f_e0c, 0x2b7) // sub_8bit(a = -10) | |
a = r3r2 & 15; | |
DEC_R2 | |
} while (a); | |
do { // l_2bb | |
CALL(f_9fa, 0x2bd) | |
CALL(f_968, 0x2bf) | |
CALL(f_35e, 0x2c1) // compare 199 and m[0x01..0x00] | |
} while (cf); | |
CALL(f_961, 0x2c5) | |
r1r0 = 0x15; | |
INC(m[0x15]) | |
DEC_R0 | |
a = m[0x14]; | |
if (a) goto l_293; | |
cf = m[0x53] & 1; // game_type 2,3 | |
if (!cf) goto l_293; | |
CALL(f_0e6, 0x2d4) | |
l_2d4: | |
a = 0xc; | |
goto l_1a3; | |
l_2d7: | |
CALL(f_35e, 0x2d9) // compare 199 and m[0x01..0x00] | |
if (cf) goto l_295; | |
// 0x15 number of completed horizontal lines | |
if (!m[0x15]) goto l_32a; | |
a = 0; | |
CALL(f_7bc, 0x2e3) | |
r3r2 = m[0x15]; // 1..4 | |
r1r0 = 0x48; // lines count | |
CALL(f_370, 0x2ec) // add bcd | |
r4 = m[0x15]; | |
// score increase: 1, 3, 7, 15 | |
r3r2 = r4 == 4 ? 0x15 : (1 << r4) - 1; | |
r1r0 = 0x4c + 1; // score * 10 | |
goto l_302; | |
l_2fe: // increase score by 1 | |
r3r2 = 0x01; | |
l_300: | |
r1r0 = 0x4c; // score | |
l_302: | |
CALL(f_370, 0x304) // add bcd | |
if (!r4) { // last digit changed | |
cf = 1; | |
CALL(f_0dc, 0x309) // increase speed | |
r3r2 = 0xc8; | |
CALL(f_793, 0x30d) | |
} | |
CALL(f_af6, 0x30f) | |
r1r0 = 0x3f; | |
a = m[0x3f]; | |
if (a & 1) goto l_1c9; | |
if (a) goto l_c38; | |
a = m[0x53] & 6; | |
if (!a) goto l_169; // game_type 0..3 | |
if (a & 2) goto l_6ff; // snake | |
// r1r0 = 0x3c; | |
// CALL(f_e09, 0x324) // sub_8bit(a = -1) | |
WRITE8(0x3c, READ8(0x3c) - 1); | |
m[0x0a] = 0; | |
goto l_4bd; | |
l_32a: | |
// r1r0 = 0x42; | |
// a = 0xc; | |
// CALL(f_7ec, 0x32f) | |
if (m[0x42] >= 4) { | |
m[0x42] = 0; | |
a = 4; | |
goto l_356; | |
} | |
if (m[0x32] != 0xf && 0xd < READ8(0x31)) { | |
a = 6; | |
goto l_356; | |
} | |
r1r0 = 0x10; | |
r3r2 = 0x1c; | |
do { // l_346 | |
a = m[r3r2]; | |
m[r1r0 + 1] |= a; | |
m[r1r0] &= a; | |
if (m[r1r0] != a) goto l_355; | |
r1r0++; | |
} while (++r3r2 < 0x20); | |
goto l_169; | |
l_355: | |
a = 8; | |
l_356: | |
CALL(f_7bc, 0x358) // some sound | |
goto l_169; | |
f_35a: // compare 10 and m[0x01..0x00] | |
r3r2 = 10; | |
goto l_360; | |
f_35e: // compare 199 and m[0x01..0x00] | |
r3r2 = 199; | |
l_360: | |
r1r0 = 0; | |
f_362: // compare r3r2 and m[r1r0] | |
r4 = 0; | |
a = r3r2 & 15; | |
SUB(a, m[r1r0]) | |
if (a) r4++; | |
INC_R0 | |
a = r3r2 >> 4; | |
SBC(a, m[r1r0]) | |
if (a) r4++; | |
// cf = 0 if r3r2 < m[r1r0] | |
// cf = 1 if r3r2 >= m[r1r0] | |
// r4 = 0 if r3r2 == m[r1r0] | |
RET // r1r0 => r1r0 + 1 | |
f_370: // add bcd | |
cf = 0; | |
r4 = 1; | |
l_373: | |
do { | |
a = r3r2 & 15; r3r2 >>= 4; | |
ADC(a, m[r1r0]) DAA m[r1r0] = a; | |
INC_R0 | |
// r4 = 0 if the last digit has changed | |
if ((r1r0 & 15) == 0xf && cf) r4 = 0; | |
} while (r1r0 & 3); | |
a = 0; | |
RET | |
l_389: | |
WRITE8(0x16, r3r2); | |
l_390: | |
// r1r0 = 0x16; | |
// CALL(f_e60, 0x394) | |
a = m[0x16] | m[0x17]; | |
if (!a) goto l_3b2; | |
l_396: | |
CALL(f_cc5, 0x398) // check_input | |
CALL(f_3bd, 0x39a) // redraw pause | |
if (m[0x3f] & 1) goto l_3d6; | |
r1r0 = 0x53; | |
a = m[0x53]; | |
if (a & 2) goto l_41f; // snake | |
if (a & 4) goto l_45d; // shooter | |
a = r3r2 >> 4; | |
if (a & 1) goto l_735; // pp_0 Rotate | |
if (!a) goto l_3c5; | |
CALL(f_7a8, 0x3ad) // sound(0) | |
a = r3r2 >> 4; | |
if (a & 4) goto l_75e; // pp_2 Right | |
if (a & 8) goto l_765; // pp_3 Left | |
// fallback: pp_1 Down | |
l_3b2: | |
r1r0 = 0x3f; | |
a = m[0x3f] & 7; | |
if (!a) goto l_260; | |
m[0x3f] ^= a; | |
if (a & 1) goto l_1cd; | |
goto l_c3c; | |
f_3bd: // redraw pause | |
// 183_3 pause sign | |
if ((m[0xb7] & 8) == 0) RET | |
a = 1; // any non-zero value | |
CALL(f_b07, 0x3c5) // redraw score | |
l_3c5: | |
if ((m[0x59] & 1) == 0) { | |
// a = m[0x5a]; | |
// r1r0 = 0x9a; | |
// CALL(f_7ec, 0x3d0) | |
if (m[0x9a] + m[0x5a] >= 16) { | |
m[0x9a] = 0; | |
m[0x59]++; | |
CALL(f_da1, 0x3d6) // some sound | |
} | |
} | |
l_3d6: | |
r3r2 = 0x5d; | |
if (m[0x5d]) { | |
// r1r0 = 0x98; a = 0xd; | |
// CALL(f_7ec, 0x3e0) | |
if (m[0x98] >= 3) { | |
m[0x98] = 0; | |
m[0x5d]--; | |
m[0xd3] ^= 0xf; | |
m[0xd1] ^= 0xf; | |
} | |
} | |
if (m[0x3f] & 1) goto l_401; | |
if (m[0x53] & 1) goto l_3f8; // game_type 2,3 | |
if (m[0x53] & 2) goto l_408; // snake | |
goto l_401; | |
l_3f8: // game_type 2 or 3 | |
// a = 0xa; | |
// CALL(f_7ea, 0x3fb) | |
if (m[0x97] >= 6) { | |
m[0x97] = 0; | |
m[0xfe] ^= 8; // x=4, y=19 | |
} | |
l_401: | |
// 183_3 pause sign | |
if (m[0xb7] & 8) goto l_396; | |
goto l_390; | |
l_408: | |
// a = 0xd; | |
// CALL(f_7ea, 0x40b) | |
// if (cf) | |
if (m[0x97] >= 3) { | |
m[0x97] = 0; | |
m[0x56] ^= 2; | |
if ((m[0x56] & 2) == 0) { | |
CALL(f_9e4, 0x416) // clear_dot_30 | |
a = 1; | |
} else { | |
CALL(f_9e1, 0x41b) // set_dot_30 | |
} | |
CALL(f_9d9, 0x41d) // draw_dot_36 | |
} | |
goto l_401; | |
l_41f: | |
a = r3r2 >> 4; | |
if (!a) goto l_3c5; | |
r4 = 0; | |
if (a & 4) goto l_42d; | |
r4++; | |
if (a & 1) goto l_42d; | |
r4++; | |
if (a & 2) goto l_42d; | |
r4++; // r3 == 8, r4 = 3 | |
l_42d: | |
a = r4; | |
ADD(a, m[0x20]) | |
if (a != 3) goto l_6c7; | |
// swap 0x30..0x32 with 0x33..0x35 | |
r1r0 = 0x32; r3r2 = 0x35; | |
do { // l_439 | |
r4 = m[r1r0]; m[r1r0] = m[r3r2]; m[r3r2] = r4; | |
r3r2--; | |
} while (r1r0-- != 0x30); | |
r3r2 = 0x20; | |
CALL(f_819, 0x448) | |
l_448: | |
r4 = m[r3r2] ^ 3; | |
m[r3r2] = m[r1r0] ^ 3; | |
INC_R2 | |
INC_R2 | |
m[r1r0] = r3r2 & 15; | |
a = r1r0 & 15; | |
SUB(a, m[r1r0]) | |
a = r4; | |
m[r1r0] = a; | |
if (!cf) goto l_3c5; | |
DEC_R2 | |
DEC_R0 | |
goto l_448; | |
l_45d: | |
a = r3r2 >> 4; | |
RRC | |
if (a & 1) goto l_46e; | |
if (a & 2) goto l_49c; | |
if (a & 4) goto l_4ab; | |
if (m[0x3f] & 2) goto l_3c5; | |
if (!cf) goto l_4bf; | |
goto l_ba2; | |
l_46e: | |
a = m[0x52]; // 0x52 shooter_type | |
if (!a || (a & 1)) goto l_3c5; // gametype 5,6 | |
if (!m[0x51]) goto l_3c5; | |
m[0x51]--; | |
a = 9; | |
CALL(f_7a9, 0x47d) // some sound | |
CALL(f_7f4, 0x47f) | |
do { // l_47f | |
CALL(f_9fa, 0x481) | |
INC(r4) | |
if (r4) goto l_48c; | |
CALL(f_968, 0x486) | |
CALL(f_35e, 0x488) // compare 199 and m[0x01..0x00] | |
} while (cf); // 199 >= READ8(0x00) | |
goto l_3c5; | |
l_48c: | |
r3r2 = (r3r2 & 0xf0) | 5; | |
do { // l_48e | |
CALL(f_961, 0x490) | |
if (m[0x03] == 0xd) break; | |
} while (--r3r2 & 15); | |
goto l_3c5; | |
l_49c: | |
r1r0 = 0x30; | |
a = 0x9; | |
a ^= m[r1r0]; | |
if (!a) goto l_4bf; | |
CALL(f_9e4, 0x4a4) // clear_dot_30 | |
r1r0 = 0x30; | |
INC(m[r1r0]) | |
CALL(f_9f3, 0x4a9) | |
goto l_4b7; | |
l_4ab: | |
if (!m[0x30]) goto l_4bf; | |
CALL(f_9e4, 0x4b2) // clear_dot_30 | |
DEC(m[0x30]) | |
CALL(f_9f3, 0x4b7) | |
l_4b7: | |
if (cf) goto l_4f5; | |
CALL(f_9e1, 0x4bb) // set_dot_30 | |
CALL(f_7a8, 0x4bd) // sound(0) | |
l_4bd: | |
m[0x31] = 0; | |
m[0x32] = 0; | |
l_4bf: | |
if (m[0x3f] & 2) goto l_3c5; | |
if (m[0x52]) goto l_3c5; // gametype 6,7 | |
if (!m[0x60]) goto l_3c5; | |
a = 4; | |
CALL(f_7ea, 0x4d1) | |
if (!cf) goto l_3c5; | |
CALL(f_9d9, 0x4d5) // draw_dot_36 | |
CALL(f_e07, 0x4d7) // sub_8bit(a = -1, r1r0 = 0x37) | |
r3r2 = 0x36; | |
r1r0 = 0x30; | |
a = m[0x36]; | |
SUB(a, m[0x30]) | |
if (!a) goto l_4e4; | |
DEC(m[0x36]) | |
if (cf) goto l_4e4; | |
INC(m[0x36]) | |
INC(m[0x36]) | |
l_4e4: | |
r3r2 = 0x38; | |
a = m[0x38]; | |
INC(a) | |
if (a) goto l_4ef; | |
m[0x60] = a; | |
goto l_3c5; | |
l_4ef: | |
CALL(f_9d8, 0x4f1) // set_dot_36 | |
CALL(f_858, 0x4f3) | |
if (!cf) goto l_3c5; | |
l_4f5: | |
a = 0xb; | |
CALL(f_7a9, 0x4f8) // some sound | |
m[0x14] = 10; | |
do { // l_4fc | |
r3r2 = 0x43; | |
if ((m[0x43] & 2) == 0) { | |
a = m[0x14]; | |
CALL(f_9e5, 0x504) // draw_dot_30 | |
} | |
do { // l_504 | |
CALL(f_0f2, 0x506) // redraw speed and level | |
a = 0x8; | |
CALL(f_7ea, 0x509) | |
} while (!cf); | |
INC(m[0x14]) | |
} while (m[0x14]); | |
CALL(f_86a, 0x513) // dec_lives | |
if (!a) goto l_19b; // no lives left | |
a = m[0x43]; | |
m[0x43] = 0; | |
if (a) goto l_1a5; | |
a = 4; | |
CALL(f_7bc, 0x51e) | |
goto l_55f; | |
l_520: | |
// 0x90 game_type | |
if (m[0x90] == 4) goto l_68a; // snake game | |
// shooter games (5,6,7) | |
m[0x53] = 0xc; | |
// m[0x52] = m[0x90] - 5; | |
if (m[0x90] != 5) { | |
INC(m[0x52]) // 1 | |
if (m[0x90] != 6) { INC(m[0x52]) } // 2 | |
} | |
CALL(f_86a, 0x530) // dec_lives | |
l_530: | |
// CALL(f_e64, 0x532) | |
memset(m, 0, 0x4c); | |
if (m[0x52]) { // gametype 6,7 | |
CALL(f_7f0, 0x539) | |
CALL(f_00e, 0x53b) | |
goto l_55f; | |
} | |
memset(m + 0xd8, 0xf, 8); | |
DEC(m[0xe0]) | |
m[0xe1] = 3; // col2, col3 | |
m[0xc0] = 9; // col8 | |
DEC(m[0xc2]) | |
m[0xdd] = 7; // col1, col2, col3 | |
m[0xdf] = 7; // col1, col2, col3 | |
DEC(m[0x34]) | |
m[0x3c] = 10; | |
m[0x3d] = 2; | |
l_55f: | |
CALL(f_7f9, 0x561) | |
CALL(f_961, 0x563) | |
// CALL(f_e76, 0x566) | |
m[0x30] = 4; | |
m[0x31] = 0; | |
m[0x32] = 0; | |
m[0x60] = 0; | |
CALL(f_9e1, 0x56b) // set_dot_30 | |
goto l_6a7; | |
l_56d: // game_type 5,6,7 | |
INC(m[0x54]) | |
r3r2 = 0x90; // 0x90 game_type | |
// 0xffd + game_type - 5 | |
m[0x55] = rom_f[0xf8 | m[0x90]] >> 4; | |
if (m[0x54] != m[0x55]) goto l_244; | |
m[0x54] = 0; | |
if (!m[0x52]) goto l_618; // gametype 5 | |
CALL(f_7f4, 0x585) | |
CALL(f_9fa, 0x587) | |
INC(r4) | |
if (r4) { | |
r1r0 = 0x02; | |
CALL(f_e0c, 0x58f) // sub_8bit(a = -10) | |
CALL(f_968, 0x591) | |
INC(m[0x43]) | |
} | |
do { // l_594 | |
CALL(f_9fa, 0x596) | |
CALL(f_968, 0x598) | |
CALL(f_35e, 0x59a) // compare 199 and m[0x01..0x00] | |
} while (cf); | |
if (m[0x43]) goto l_4f5; | |
if (m[0x52] & 1) goto l_5bd; // gametype 6 | |
r3r2 = 0x81; | |
INC(m[0x5c]) | |
a = (16 - m[0x81]) >> 1 & 7; // 0x81 level | |
if (a == m[0x5c]) { | |
m[0x5c] = 0; | |
CALL(f_961, 0x5b7) | |
goto l_244; | |
} | |
l_5b9: | |
CALL(f_00e, 0x5bb) | |
goto l_244; | |
l_5bd: | |
// r1r0 = 0x20; | |
// CALL(f_e60, 0x5c1) | |
a = m[0x20] | m[0x21]; | |
if (a) goto l_602; | |
a = GET_TMR & 7; | |
if (a) goto l_5b9; | |
m[0x21] = 4; | |
INC(m[0x20]) | |
memset(m + 0x60, 0, 16); | |
m[0x60] = 0xf; | |
m[0x64] = 9; | |
m[0x68] = 9; | |
m[0x6c] = 0xf; | |
r4 = GET_TMR & 7; | |
if (r4 == 7) r4 = 0; | |
m[0x36] = r4; | |
m[0x37] = 4; | |
m[0x38] = 1; | |
for (r4 = 6 - r4; r4; r4--) { | |
// m[0x6f..0x60] <<= 1 | |
r1r0 = 0x60; cf = 0; | |
do { // l_5f9 | |
a = m[r1r0]; RLC m[r1r0] = a; | |
} while (++r1r0 < 0x70); | |
} | |
l_602: | |
CALL(f_e07, 0x604) // sub_8bit(a = -1, r1r0 = 0x37) | |
a = m[0x21]; | |
if (!a) goto l_5b9; | |
DEC(m[0x21]) | |
a = m[0x21]; | |
a = (a << 2 | a >> 2) & 0xf; | |
// r1r0 = 0x60 | a; r3r2 = 0x0c; | |
// CALL(f_e17, 0x614) | |
memcpy(m + 0x0c, m + 0x60 + a, 4); | |
r3r2 = 0; | |
CALL(f_968, 0x616) | |
goto l_244; | |
l_618: | |
// r1r0 = 0x3c; | |
// CALL(f_e60, 0x61c) | |
a = m[0x3c] | m[0x3d]; | |
if (a) goto l_625; | |
r1r0 = 0x60; | |
a = m[0x60]; | |
if (a) goto l_688; | |
goto l_2d4; | |
l_625: | |
r1r0 = 0x34; | |
CALL(f_e09, 0x629) // sub_8bit(a = -1) | |
if (m[0x37] != 1) { | |
CALL(f_7f4, 0x631) | |
CALL(f_9fa, 0x633) | |
if (r4 != 0xf) { INC(m[0x43]) } | |
} | |
r3r2 = 0x33; | |
r4 = 0xe; | |
CALL(f_ba6, 0x640) | |
CALL(f_808, 0x642) | |
// r1r0 = 0x00; | |
// r3r2 = 0x02; | |
// CALL(f_e73, 0x648) | |
memcpy(m + 0x02, m + 0x00, 2); | |
r3r2 = 0x04; | |
r1r0 = 0x02; | |
a = 9; | |
CALL(f_e00, 0x64d) // add_8bit | |
CALL(f_9fa, 0x64f) | |
l_64f: | |
CALL(f_9fa, 0x651) | |
CALL(f_968, 0x653) | |
CALL(f_35e, 0x655) // compare 199 and m[0x01..0x00] | |
if (cf) goto l_64f; | |
r1r0 = 0x43; | |
a = m[0x43]; | |
if (a) goto l_4f5; | |
CALL(f_961, 0x65e) | |
CALL(f_9e1, 0x660) // set_dot_30 | |
if (m[0x60]) goto l_688; | |
if (m[0x35] == 0xf) goto l_688; | |
if (m[0x34] < 3) goto l_688; | |
INC(m[0x60]) | |
m[0x61] = 0; | |
a = GET_TMR & 15; | |
r4 = a < 10 ? a : a - 10; | |
m[0x36] = r4; | |
m[0x37] = m[0x34] - 1; | |
m[0x38] = 0; | |
CALL(f_9d8, 0x688) // set_dot_36 | |
l_688: | |
goto l_244; | |
l_68a: // snake game | |
m[0x53] = 0xa; | |
CALL(f_86a, 0x68e) // dec_lives | |
l_68e: | |
// CALL(f_e64, 0x690) | |
memset(m, 0, 0x4c); | |
memset(m + 0x20, 0xf, 16); | |
m[0x20] = 0; | |
m[0x21] = 0; | |
INC(m[0xff]) | |
m[0xfe] = 0xc; | |
m[0x30] = 5; | |
m[0x33] = 3; | |
CALL(f_acf, 0x6a7) | |
l_6a7: | |
memset(m + 0x94, 0, 0xc); | |
do { // l_6a9 | |
cf = m[0xc3] & 1; // 195_0 sound sign | |
if (!cf) goto l_6c1; | |
CALL(f_cc5, 0x6b1) // check_input | |
a = m[0x9a] ^ 2; | |
if (!a) { | |
m[0x9a] = 3; | |
a = 8; | |
CALL(f_7a9, 0x6bb) // some sound | |
} | |
} while (a != 4); | |
CALL(f_da1, 0x6c1) // some sound | |
l_6c1: | |
goto l_244; | |
l_6c3: | |
r1r0 = 0x20; | |
r4 = m[0x20]; | |
l_6c7: | |
m[0x3c] = r4; | |
CALL(f_9e1, 0x6cd) // set_dot_30 | |
r3r2 = 0x3c; | |
a = m[0x3c]; | |
r1r0 = 0x30; | |
CALL(f_dee, 0x6d4) | |
r1r0 = 0x30; | |
a = 0x6; | |
ADD(a, m[0x30]) | |
if (cf) goto l_72f; | |
INC_R0 | |
r3r2 = 0x13; | |
CALL(f_362, 0x6df) // compare r3r2 and m[r1r0] | |
if (!cf) goto l_72f; | |
CALL(f_858, 0x6e3) | |
if (!cf) goto l_70e; | |
r4 = a; | |
l_6e6: | |
CALL(f_819, 0x6e8) | |
INC_R0 | |
r3r2 = r1r0; | |
do { // l_6ed | |
DEC_R0 | |
m[r3r2] = m[r1r0]; | |
DEC_R2 | |
} while (r1r0 & 15); | |
r3r2 = 0x3c; | |
a = m[0x3c]; | |
m[r1r0] = a; | |
if (r4) goto l_71c; | |
CALL(f_9e1, 0x6fb) // set_dot_30 | |
r3r2 = 0x10; | |
goto l_300; | |
l_6ff: | |
r1r0 = 0x2e; | |
if (m[0x2e] != 0xf) goto l_2d4; | |
a = 0x5; | |
CALL(f_7a9, 0x708) | |
CALL(f_9e1, 0x70a) // set_dot_30 | |
CALL(f_acf, 0x70c) | |
goto l_6c1; | |
l_70e: | |
r3r2 = 0x30; | |
r4 = 0x3; | |
CALL(f_ba6, 0x714) | |
CALL(f_9fa, 0x716) | |
if (cf) goto l_72f; | |
r4 = 0x1; | |
goto l_6e6; | |
l_71c: | |
CALL(f_9e1, 0x71e) // set_dot_30 | |
CALL(f_9dd, 0x720) // draw_dot_33 | |
CALL(f_819, 0x722) | |
r4 = m[r1r0]; | |
m[r1r0] = 0xf; | |
r1r0 = 0x33; | |
a = r4; | |
CALL(f_dee, 0x72b) | |
CALL(f_7a8, 0x72d) // sound(0) | |
goto l_6c1; | |
l_72f: | |
m[0x43] = 2; | |
goto l_4f5; | |
l_735: | |
a = 0xa; | |
CALL(f_7a9, 0x738) // some sound | |
memcpy(m + 0x36, m + 0x30, 5); | |
if ((m[0xb7] & 2) == 0) { // 183_1 rotate_2 | |
DEC(m[0x3a]) | |
DEC(m[0x3a]) | |
} | |
INC(m[0x3a]) | |
CALL(f_e9c, 0x746) // read_figure | |
if (m[0x36] == 8) { | |
memcpy(m + 0x1c, m + 0x2c, 4); | |
CALL(f_90a, 0x752) | |
goto l_767; | |
} | |
CALL(f_e28, 0x756) // cf = (m[0x47..0x44] & m[0x2f..0x2c]) != 0 | |
if (cf) goto l_791; | |
// r3r2 = 0x1c; | |
// CALL(f_e15, 0x75c) | |
memcpy(m + 0x1c, m + 0x2c, 4); | |
goto l_78d; | |
l_75e: | |
CALL(f_90a, 0x760) | |
INC(m[0x36]) | |
goto l_76a; | |
l_765: | |
CALL(f_90a, 0x767) | |
l_767: | |
DEC(m[0x36]) | |
l_76a: | |
CALL(f_874, 0x76c) | |
// r3r2 = 0x28; | |
// CALL(f_e15, 0x770) | |
memcpy(m + 0x28, m + 0x2c, 4); | |
CALL(f_e2c, 0x772) // cf = (m[0x1f..0x1c] & m[0x2f..0x2c]) != 0 | |
if (!cf) goto l_787; | |
if (!m[0x58]) goto l_783; | |
// CALL(f_e21, 0x77b) | |
memcpy(m + 0x36, m + 0x30, 5); | |
CALL(f_e9c, 0x77d) // read_figure | |
// r3r2 = 0x1c; | |
// CALL(f_e15, 0x781) | |
memcpy(m + 0x1c, m + 0x2c, 4); | |
goto l_78d; | |
l_783: | |
// CALL(f_e21, 0x785) | |
memcpy(m + 0x36, m + 0x30, 5); | |
goto l_78f; | |
l_787: | |
// r1r0 = 0x28; | |
// r3r2 = 0x44; | |
// CALL(f_e17, 0x78d) | |
memcpy(m + 0x44, m + 0x28, 4); | |
l_78d: | |
// CALL(f_efa, 0x78f) | |
memcpy(m + 0x30, m + 0x36, 5); | |
l_78f: | |
CALL(f_90d, 0x791) | |
l_791: | |
goto l_3c5; | |
f_793: // some sound | |
memset(m + 0x94, 0, 0xc); | |
m[0x5a] = r3r2 & 15; | |
m[0x59] &= ~1; | |
a = r3r2 >> 4; | |
f_7a3: // sound(a) | |
m[0x58] = a; | |
goto l_7b1; | |
f_7a8: // sound(0) | |
a = 0; | |
f_7a9: // some sound | |
m[0x58] = a; | |
if (~m[0x59] & 1) RET | |
l_7b1: // repeat_sound | |
// 195_0 sound sign | |
if (~m[0xc3] & 1) RET | |
SOUND(m[0x58]) | |
RET | |
f_7bc: | |
r4 = a; | |
if (!a) m[0x42] = 0; | |
// 195_0 sound sign | |
if (m[0xc3] & 1) { | |
r3r2 = 0x5d; | |
m[0x5d] = 8; | |
a = 0xb; | |
do { // l_7cd | |
// a = 0xb, (0xf, 0xd), ... | |
r1r0 = 0x87; | |
a &= m[0x87]; | |
OUT_PA | |
// l_7d1 timeout? | |
do r1r0 = (r1r0 + 1) & 0xff; while (r1r0); | |
a = (r3r2 ^= 2) & 0xf; | |
DEC(r4) | |
} while (r4); | |
} | |
f_7de: | |
m[0xd1] = 0xf; | |
m[0xcf] = 0xf; | |
r1r0 = 0xd3; | |
m[0xd3] = a = 0; | |
RET | |
f_7ea: | |
r1r0 = 0x97; | |
f_7ec: | |
ADD(a, m[r1r0]) | |
if (cf) m[r1r0] = a = 0; | |
RET | |
f_7f0: | |
r3r2 = 199; | |
goto l_7fc; | |
f_7f4: | |
a = 10; r3r2 = 19; | |
goto l_7fc; | |
f_7f9: | |
a = 0; r3r2 = 9; | |
l_7fc: | |
m[0x00] = a; | |
m[0x01] = 0; | |
WRITE8(0x02, r3r2); | |
f_808: | |
m[0x05] = 10; | |
r1r0 = 0x57; a = 0x9; | |
m[0x57] = 9; | |
RET | |
f_813: // memset(m + r1r0, 0, (~r1r0 & 15) + 1) | |
a = 0x0; | |
do { m[r1r0] = a; INC_R0 } while (r1r0 & 15); | |
RET | |
f_819: | |
r1r0 = 0x2f; | |
do { INC_R0 } while (m[r1r0] != 0xf); | |
DEC_R0 | |
RET | |
f_822: | |
for (;;) { | |
r4 = m[0x82] = (m[0x82] + 1) ^ (GET_TMR & 15); | |
if (r4 < 7) break; | |
r4 -= 7; | |
if (r4 < 7) break; | |
} | |
// r4 = random 0..6 | |
// every fourth time | |
INC(m[0x50]) | |
if ((m[0x90] & 1) && m[0x50] == 4) { // 0x90 game_type | |
m[0x50] = 0; | |
r4 += 7; // use modified figures | |
} | |
a = GET_TMR & 15; | |
m[0x3a] = a; | |
m[0x3d] = a; | |
m[0x39] = r4; | |
m[0x3c] = r4; | |
goto l_e9c; // read_figure | |
f_852: | |
r3r2 = 0x31; r1r0 = 0x37; | |
goto l_85c; | |
f_858: | |
r3r2 = 0x30; r1r0 = 0x36; | |
l_85c: | |
cf = 0; | |
do { // l_85d | |
a = m[r3r2] ^ m[r1r0]; | |
if (a) goto l_869; | |
r1r0++; r3r2++; | |
} while (r1r0 != 0x39); | |
a = 0; | |
cf = 1; // if equals | |
l_869: | |
RET | |
f_86a: // dec_lives | |
DEC(m[0x50]) // 0fedc -> f7620 | |
a = rom_f[0xf0 | m[0x50]]; | |
// r4 = a >> 4; // ignored? | |
r3r2 = 0xbe; // next (x=0) | |
m[0xbe] = a &= 15; | |
goto l_d98; // returns A after call to sound | |
f_874: | |
memset(m + 0x2c, 0xf, 4); | |
a = 1; r4 = 0; | |
l_880: | |
m[0x41] = a; | |
m[0x06] = 4; | |
m[0x05] = 4; | |
a = m[0x36]; | |
if (a >= 7) { | |
// 0123456789abcdef | |
// xxxxxxx3210f0123 | |
a = (a < 12 ? 10 - a : a - 12) & 15; | |
m[0x05] = a; | |
} | |
a = m[0x38]; | |
if (a) { | |
if (a == 15) a = m[0x37] & 3; | |
else a = 4 - (m[0x37] & 3); | |
m[0x06] = a; | |
} | |
m[0x57] = 0; | |
m[0x07] = 0; | |
a = m[0x36]; | |
if (a >= 7 && a < 10) | |
m[0x07] = a - 6; | |
if (!r4) { | |
if (a >= 11) a = 0; | |
r1r0 = 0x00; | |
} else { // l_8cb | |
a = (a + 3) & 15; | |
// 0123456789abcdef | |
// 3456789999999999 | |
if (a >= 10) a = 9; | |
r1r0 = 0x02; | |
} | |
r3r2 = 0x36; r4 = 0xf; | |
goto l_ba9; | |
l_8dc: | |
r3r2 = 0x2c; | |
if (m[0x38] == 0xf) { | |
a = m[0x37] ^ 3; | |
INC(a) | |
r3r2 = (r3r2 & 0xf0) | a; | |
} | |
if (m[0x41] != 1) goto l_92a; | |
if (m[0x0b]) { | |
m[0x0b] = 0; | |
m[0x06] = 1; | |
} | |
l_8f9: | |
goto l_9fa; | |
l_8fb: | |
m[r3r2] = m[0x0c]; | |
INC_R2 | |
DEC(m[0x06]) | |
if (m[0x06]) goto l_8f9; | |
l_906: | |
r1r0 = 0x41; | |
m[0x41] = 0; | |
RET | |
f_90a: | |
cf = 0; | |
goto l_90e; | |
f_90d: | |
cf = 1; | |
l_90e: | |
memcpy(m + 0x2c, m + 0x44, 4); | |
if (cf) | |
for (a = 0; a < 4; a++) | |
m[0x2c + a] |= m[0x1c + a]; | |
f_924: | |
r4 = a = 2; | |
goto l_880; | |
l_92a: | |
if (m[0x0b]) { | |
m[0x0b] = 0; | |
if (m[0x38] != 1) { INC(m[0x06]) } | |
} | |
l_939: | |
m[0x0c] = m[r3r2]; | |
a = 1; | |
l_93e: | |
r4 = a; | |
#if 1 | |
// r4 => ror, !r4 => rol | |
a = m[0x07]; | |
a = (r4 ? a : -a) & 3; | |
{ | |
int t = m[0x0c]; | |
t = (t << 4 | t) >> a; | |
m[0x0c] = t & 15; | |
} | |
#else | |
r3r2 = m[0x07] << 4 | (r3r2 & 15); | |
a = m[0x0c]; | |
while (r3r2 & 0xf0) { | |
// r4 => RR, !r4 => RL | |
RR | |
if (!r4) { RL RL } | |
DEC_R3 | |
} | |
m[0x0c] = a; | |
#endif | |
a = 2; | |
r3r2 = a << 4 | (r3r2 & 15); | |
if (r4) goto l_968; | |
goto l_8fb; | |
l_958: | |
INC_R2 | |
r1r0 = 0x06; | |
DEC(m[r1r0]) | |
a = m[r1r0]; | |
if (a) goto l_939; | |
goto l_906; | |
f_961: | |
a = 0; | |
f_962: | |
r1r0 = 0x0c; | |
do { // l_964 | |
m[r1r0] = a; | |
INC_R0 | |
} while (r1r0 & 15); | |
l_968: | |
f_968: | |
m[0x5b] |= 4; | |
r4 = 4; | |
goto l_a07; | |
l_96f: | |
// cf:m[0x0f..0x0c] >>= 1 | |
for (r1r0 = 0x0f; r1r0 >= 0xc; r1r0--) { | |
a = m[r1r0]; RRC m[r1r0] = a; | |
} | |
r1r0 = 0x03; | |
goto l_a2a; | |
l_97c: | |
a = r4; | |
if (!cf) { | |
m[r1r0] &= ~a; | |
a = 0; | |
} | |
m[r1r0] |= a; | |
DEC(m[0x02]) | |
if (m[0x02] == 0xf) { DEC(m[0x03]) } | |
DEC(m[0x04]) | |
if (m[0x04]) goto l_96f; | |
if ((m[0x57] & 1) == 0) { | |
ADD(m[0x02], 10) | |
if (cf) { INC(m[0x03]) } | |
r4 = 1; | |
} else { | |
if ((m[0x57] & 2) == 0 && m[0x0a]) goto l_9bc; | |
r4 = 2; | |
} | |
do { // l_9ae | |
a = m[0x05]; | |
ADD(m[0x02], a) | |
if (cf) { INC(m[0x03]) } | |
} while (--r4); | |
l_9bc: | |
r3r2 = READ8(0x08); | |
r1r0 = 0x41; | |
a = m[0x41]; | |
if (!a) RET | |
DEC(a) | |
if (!a) goto l_93e; | |
DEC(a) | |
if (!a) goto l_958; | |
DEC(a) | |
if (!a) goto l_b99; | |
DEC(a) | |
if (!a) goto l_906; | |
m[0x41] = 0; | |
if (cf) goto l_acf; | |
// fallback | |
f_9d8: // set_dot_36 | |
a = 1; | |
f_9d9: // draw_dot_36 | |
r3r2 = 0x36; | |
goto l_9e7; | |
f_9dd: // draw_dot_33 | |
r3r2 = 0x33; | |
goto l_9e7; | |
f_9e1: // set_dot_30 | |
a = 1; | |
goto l_9e5; | |
f_9e4: // clear_dot_30 | |
a = 0; | |
l_9e5: | |
f_9e5: // draw_dot_30 | |
r3r2 = 0x30; | |
l_9e7: | |
m[0x0c] = a; | |
r1r0 = 0x02; | |
r4 = 1; // draw_dot | |
goto l_ba8; | |
l_9f0: | |
a = 0x4; | |
goto l_b94; | |
f_9f3: | |
m[0x00] = m[r1r0]; | |
m[0x01] = 0; | |
r3r2 = 0x01; | |
l_9fa: | |
f_9fa: | |
m[0x0c] = 0xf; | |
m[0x1b] = 0; | |
m[0x5b] &= ~4; | |
r4 = 0xb; | |
l_a07: | |
WRITE8(0x08, r3r2); | |
m[0x04] = m[0x05]; | |
if (r4 & 4) goto l_96f; | |
l_a16: | |
r1r0 = 0x01; | |
if (m[0x53] & 1) // game_type 2,3 | |
if (!m[0x01] && m[0x00] == 4) goto l_a58; | |
l_a2a: | |
a = 1; | |
JTMR(l_db7, 0xdb7) // saves r1r0 | |
l_a2d: | |
a = m[r1r0]; | |
DEC_R0 | |
r1r0 = rom_f[a << 4 | m[r1r0]]; | |
r4 = 1 << (r1r0 >> 6); // bit mask | |
r1r0 |= 0xc0; // addr | |
if (m[0x57] & 2) r1r0 -= 0x10; // digits | |
r3r2 = 0x5b; | |
if (m[0x5b] & 4) goto l_97c; | |
a = r4 & m[r1r0]; | |
cf = 0; | |
if (!a) goto l_a5c; | |
l_a58: | |
cf = 1; | |
INC(m[0x1b]) | |
l_a5c: | |
// cf = dot value | |
r1r0 = 0x0c; | |
// m[0x0f..0xc] << 1 | cf | |
do { // l_a5e | |
a = m[r1r0]; RLC m[r1r0] = a; | |
} while (++r1r0 < 0x10); | |
INC(m[0x00]) | |
if (!m[0x00]) { INC(m[0x01]) } | |
DEC(m[0x04]) | |
if (m[0x04]) goto l_a16; | |
if ((m[0x57] & 1) == 0) { | |
r4 = m[0x00]; | |
a = (10 - m[0x05]) & 0xf; | |
ADD(a, r4) | |
m[0x00] = a; | |
if (cf) { INC(m[0x01]) } | |
} | |
if (!m[0x57]) goto l_9bc; | |
if (m[0x57] & 4) { | |
// l_aad | |
a = m[0x0c]; | |
RRC | |
goto l_9bc; | |
} | |
a = m[0x1b]; | |
r4 = !a ? 0xf : a == 10 ? 1 : 0; | |
if (!m[0x0a]) goto l_9bc; | |
// 0xec = -20 | |
ADD(m[0x00], 0xc) | |
ADC(m[0x01], 0xe) | |
goto l_9bc; | |
f_ab3: // clear_field | |
// clear x=8..9, y=8..12 | |
m[0xc0] = m[0xc2] = 0; | |
// clear x=8..9, y=0..7 | |
for (a = 0; a < 8; a++) m[0xc4 + a * 2] &= ~3; | |
// clear remaining | |
memset(m + 0xd4, 0, 0x2c); | |
r1r0 = r4 = a = 0; | |
RET | |
l_acf: | |
f_acf: | |
a = GET_TMR & 15; | |
// random col: 0..9, but numbers 0..5 have double chance | |
m[0x36] = a < 10 ? a : a - 10; | |
// random row: 0..19, but numbers 4..15 have double chance | |
a = GET_TMR & 15; | |
m[0x37] = a; | |
m[0x38] = a < 4 ? GET_TMR & 1 : 0; // random 0..1 | |
r3r2 = 0x36; | |
r4 = 2; | |
goto l_ba6; | |
l_af0: | |
m[0x41] = 5; | |
goto l_9fa; | |
l_af6: | |
f_af6: | |
r3r2 = 0x4c; | |
cf = 0; // show score | |
goto l_b34; | |
f_b07: // redraw score | |
r4 = a; | |
if (m[0x9d] >= 2) goto l_cf1; // halt | |
if (m[0x9a] != 2) RET | |
m[0x9a] = 0; | |
m[0x56] ^= 1; // switch between lines and score | |
cf = m[0x56] & 1; | |
// 0x90 game_type | |
// m[0x90] & 4 is true for snake and shooters | |
if (!r4) { // hi-score | |
if (!cf || (m[0x90] & 4)) { // l_afb | |
r3r2 = m[0x90] & 4 ? 0x7c : 0x8c; | |
m[0xc3] |= 4; // 195_2 hi- sign | |
cf = 0; // show score | |
goto l_b38; | |
} | |
r3r2 = 0x88; | |
} else { // l_b28 | |
m[0xb7] ^= 4; // 183_2 tea sign | |
if (!cf || (m[0x90] & 4)) goto l_af6; | |
r3r2 = 0x48; | |
} | |
cf = 1; // show lines | |
l_b34: | |
// 195_2 hi- sign | |
m[0xc3] &= ~4; | |
l_b38: | |
// 193_0 lines sign, 193_2 score sign | |
m[0xc1] = (m[0xc1] & ~5) | (cf ? 1 : 4); | |
// 177_3 last zero, 177_2 prev zero | |
m[0xb1] &= ~(8 | 4); | |
WRITE8(0x02, 0xdc); | |
a = 4; | |
l_b4d: | |
m[0x1b] = r4 = a; | |
r1r0 = 0x78; | |
while (r1r0 < 0x7c) m[r1r0++] = m[r3r2++]; | |
if (r4 != 2) { | |
do { // l_b5f | |
DEC_R0 | |
if (m[r1r0]) goto l_b7a; | |
m[r1r0] = 10; // 10 means invisible | |
DEC(r4) | |
} while (r4); | |
m[r1r0] = 0; | |
} else { // l_b6c | |
cf = 0; | |
// 0x79 = 0x81 level | |
a = m[0x79]; DAA m[0x79] = a; | |
// 210_2 level 1x | |
m[0xd2] = (m[0xd2] & ~4) | (cf ? 4 : 0); | |
} | |
goto l_b80; | |
l_b7a: | |
// non-zero score | |
if (!cf) m[0xb1] |= 4; // 177_2 prev zero | |
l_b80: | |
m[0x05] = 7; | |
r3r2 = 0x78; | |
l_b86: | |
// 0xff2 digit segments | |
r4 = (m[r3r2] + 2) & 15; | |
a = rom_f[0xf0 | r4]; | |
WRITE8(0x0c, a); | |
m[0x57] = a = 3; | |
l_b94: | |
m[0x41] = a; | |
goto l_968; | |
l_b99: | |
INC_R2 | |
DEC(m[0x1b]) | |
a = m[0x1b]; | |
if (a) goto l_b86; | |
goto l_906; | |
l_ba2: | |
r3r2 = 0x30; | |
r4 = 0; | |
l_ba6: | |
f_ba6: | |
r1r0 = 0x00; | |
l_ba8: | |
a = m[r3r2]; // col | |
l_ba9: | |
m[r1r0] = a; // col | |
INC_R0 | |
m[r1r0] = 0; // tmp_high = 0 | |
INC_R2 | |
INC_R2 | |
if (m[r3r2]) { // row_high | |
if (m[r3r2] == 0xf) goto l_bc9; | |
m[r1r0] = 10; // tmp_high = 10 | |
} | |
DEC_R2 | |
r3r2 = m[r3r2]; // row_low | |
DEC_R0 | |
// tmp += 10 * row_low | |
WRITE8(r1r0, READ8(r1r0) + r3r2 * 10); | |
l_bc9: | |
a = 0; | |
if (r4 == 0xf) goto l_8dc; | |
if (r4 == 0xe) RET | |
m[0x05] = 1; | |
m[0x57] = 5; | |
if (r4 == 0) goto l_be2; | |
if (r4 == 1) goto l_9f0; // draw_dot | |
if (r4 == 2) goto l_af0; | |
a = r4 - 2; // is this used? | |
RET | |
l_be2: | |
DEC(m[0x57]) | |
r1r0 = 0x00; | |
CALL(f_dfa, 0xbe7) // add_8bit(a = 10) | |
do { // l_be7 | |
CALL(f_dfd, 0xbe9) // add_8bit(a = 1, r1r0 = 0x31) | |
CALL(f_9fa, 0xbeb) | |
if (cf) goto l_bfb; | |
CALL(f_35e, 0xbef) // compare 199 and m[0x01..0x00] | |
} while (cf); | |
if (m[0x52] & 2) goto l_bff; // gametype 7 | |
a = 4; | |
CALL(f_7a9, 0xbf9) // some sound | |
l_bf9: | |
goto l_4bd; | |
l_bfb: | |
r1r0 = 0x00; | |
CALL(f_e0c, 0xbff) // sub_8bit(a = -10) | |
l_bff: | |
// r1r0 = 0x00; | |
// r3r2 = 0x02; | |
// CALL(f_e73, 0xc05) | |
memcpy(m + 0x02, m + 0x00, 2); | |
r3r2 = 0x04; | |
if (m[0x52] & 2) goto l_c75; // gametype 7 | |
cf = m[0x52] & 1; // gametype 6 | |
a = 4; | |
CALL(f_7a9, 0xc0e) // some sound | |
if (!cf) goto l_c59; | |
CALL(f_852, 0xc12) | |
if (!cf) goto l_e3b; | |
r1r0 = 0x18; | |
CALL(f_c6a, 0xc18) | |
m[0x20] = a; | |
memset(m + 0x2c, 0, 4); | |
CALL(f_924, 0xc21) | |
r3r2 = 0x6c; | |
CALL(f_793, 0xc25) | |
// CALL(f_e21, 0xc27) | |
memcpy(m + 0x36, m + 0x30, 5); | |
memset(m + 0x60, 0, 16); | |
m[0x31] = 0; | |
m[0x32] = 0; | |
m[0x14] = 0; | |
a = 0; | |
l_c30: | |
CALL(f_9d9, 0xc32) // draw_dot_36 | |
m[0x3f] = 2; | |
goto l_2fe; // increase score by 1 | |
l_c38: | |
r3r2 = 0x14; | |
goto l_389; | |
l_c3c: | |
INC(m[0x14]) | |
a = m[0x14]; | |
if (a & 1) goto l_c30; | |
CALL(f_9d9, 0xc44) // draw_dot_36 | |
// r1r0 = 0x37; | |
// CALL(f_e60, 0xc48) | |
a = m[0x37] | m[0x38]; | |
if (!a) goto l_c4e; | |
CALL(f_e07, 0xc4c) // sub_8bit(a = -1, r1r0 = 0x37) | |
goto l_c30; | |
l_c4e: | |
CALL(f_858, 0xc50) | |
if (!cf) goto l_c54; | |
goto l_4f5; | |
l_c54: | |
a = 0xe; | |
CALL(f_7bc, 0xc57) | |
goto l_c68; | |
l_c59: | |
CALL(f_858, 0xc5b) | |
if (!cf) goto l_e3b; | |
r1r0 = 0x61; | |
CALL(f_c6a, 0xc61) | |
DEC_R0 | |
m[r1r0] = a; | |
CALL(f_9d9, 0xc65) // draw_dot_36 | |
a = 0x9; | |
CALL(f_7a9, 0xc68) // some sound | |
l_c68: | |
goto l_4bd; | |
f_c6a: | |
INC(m[r1r0]) | |
r3r2 = 0x81; | |
a = m[0x81]; // 0x81 level | |
ADD(a, 0x4) | |
a ^= m[r1r0]; | |
if (a) goto l_c68; | |
m[r1r0] = a; | |
RET | |
l_c75: | |
r1r0 = 0x02; | |
CALL(f_e0c, 0xc79) // sub_8bit(a = -10) | |
// WRITE8(0x02, READ8(0x02) - 10); | |
DEC_R0 | |
r1r0 = 0x02; | |
r3r2 = 0x09; | |
CALL(f_362, 0xc7e) // compare r3r2 and m[r1r0] | |
if (cf) goto l_bf9; // READ8(0x02) >= 9 | |
a = 0xf; | |
CALL(f_962, 0xc83) | |
a = 0x5; | |
CALL(f_7a9, 0xc86) // sound(5) | |
a = m[0x30] ^ 0xf; | |
r1r0 = 0x02; | |
CALL(f_e0d, 0xc8e) // sub_8bit | |
// WRITE8(0x02, READ8(0x02) + ~m[0x30]); | |
DEC_R0 | |
r1r0 = 0x02; | |
r3r2 = 0x00; | |
CALL(f_e73, 0xc93) // memcpy(m + 0x00, m + 0x02, 2); | |
r1r0 = 0x00; | |
a = 7; // -9 | |
CALL(f_e0d, 0xc98) // sub_8bit | |
// WRITE8(0x00, READ8(0x00) - 9); | |
CALL(f_808, 0xc9a) | |
INC(m[0x0a]) | |
CALL(f_9fa, 0xc9f) | |
if (r4 != 1) goto l_e3d; | |
r3r2 = r3r2 | 0xf; | |
l_ca5: | |
CALL(f_961, 0xca7) | |
r1r0 = 0x02; | |
CALL(f_dfa, 0xcab) // add_8bit(a = 10) | |
// WRITE8(0x02, READ8(0x02) + 10); | |
a = r3r2 & 15; | |
DEC_R2 | |
if (a) goto l_ca5; | |
CALL(f_7bc, 0xcb1) | |
while (m[0x00] | m[0x01]) { // l_cb3 | |
CALL(f_9fa, 0xcb5) | |
CALL(f_968, 0xcb7) | |
} | |
CALL(f_961, 0xcbf) | |
r3r2 = 0x2f; | |
CALL(f_793, 0xcc3) | |
goto l_e3d; | |
f_cc5: // check_input | |
a = 0; | |
JTMR(l_db7, 0xdb7) | |
l_cc8: | |
r3r2 = 0x00; | |
r1r0 = 0x93; | |
cf = m[0x93] >= 4; | |
if (!cf) RET | |
m[0x93] = 0; | |
DEC_R1 | |
a = m[0x83] ^ 0xf; | |
r3r2 = (r3r2 & 0xf0) | a; | |
IN_PS | |
m[0x83] = a; | |
a = ((r3r2 & 15) | m[0x83]) ^ 0xf; | |
if (!a) goto l_cf5; | |
// ps_0 Start | |
if (a & 1) goto l_d6a; | |
// ps_1 Mute | |
if (a & 2) goto l_d8a; | |
CALL(f_d98, 0xce4) | |
l_ce4: | |
r1r0 = 0x00; | |
l_ce6: | |
IN_PS | |
// ps_2 OnOff | |
if (~a & 4) goto l_ce4; | |
r1r0 = (r1r0 + 1) & 0xff; | |
if (r1r0) goto l_ce6; | |
l_cf1: | |
HALT | |
// NOP | |
goto l_061; | |
l_cf5: | |
r3r2 = m[0x84] << 4 | (r3r2 & 15); | |
IN_PP | |
m[0x84] = a; | |
r4 = (r3r2 >> 4 | m[0x84]) ^ 0xf; | |
// pp_2 Right, pp_3 Left | |
if ((r4 & 0xc) == 0) { | |
m[0x95] = 0; | |
m[0x85] &= 7; | |
} | |
// pp_0 Rotate | |
if ((r4 & 1) == 0) { | |
m[0x96] = 0; | |
m[0x86] &= ~1; | |
} | |
if (!m[0x53]) goto l_d60; // select screen | |
a = m[0x53] & 6; | |
if (a) { // game_type 4..7 | |
if (a & 2) goto l_d60; // snake | |
if (m[0x52] & 2) goto l_d43; // gametype 7 | |
a = m[0x86] & 1 ? 3 : 6; | |
if (m[0x96] < a) goto l_d43; | |
m[0x96] = 0; | |
m[0x86] |= 1; | |
r3r2 = 0x10 | (r3r2 & 15); | |
} | |
if ((m[0x85] & 1) == 0) { | |
IN_PP | |
if (~a & 2) goto l_d43; | |
m[0x85] |= 1; | |
} | |
r3r2 |= 0x20; | |
l_d43: | |
a = m[0x85] & 8 ? 0xa : 0xe; | |
ADD(a, m[0x95]) | |
if (cf) { | |
m[0x95] = 0; | |
m[0x85] |= 8; | |
r3r2 |= r4 & 4 ? 0x40 : 0x80; | |
} | |
l_d60: | |
r1r0 = 0x84; | |
r3r2 &= ~(m[0x84] << 4); | |
RET | |
l_d6a: // start/pause key handler | |
if (!m[0x53]) goto l_121; // start new game | |
m[0xb7] ^= 8; // 183_3 pause sign | |
m[0xb7] &= ~4; // 183_2 tea sign | |
if (m[0x3f] == 2) { | |
a = 1; | |
CALL(f_9d9, 0xd80) // draw_dot_36 | |
} | |
CALL(f_af6, 0xd82) | |
memset(m + 0x94, 0, 0xc); | |
CALL(f_d93, 0xd86) // sound off | |
CALL(f_da1, 0xd88) // some sound | |
goto l_396; | |
l_d8a: // sound on/off | |
r3r2 = 0x00; | |
m[0xc3] ^= 1; // 195_0 sound sign | |
if (m[0xc3] & 1) goto l_d9f; | |
f_d93: // sound off | |
SOUND_OFF | |
m[0x59] = 0xf; | |
l_d98: | |
f_d98: | |
a = 0xe; | |
l_d99: | |
r1r0 = 0x87; | |
m[0x87] = a; // sound mask | |
OUT_PA | |
a = m[r3r2]; | |
RET | |
l_d9f: | |
SOUND(0x7) | |
f_da1: // some sound | |
// 195_0 sound sign | |
a = (~m[0xc3] | m[0x3f]) & 1; | |
if (a) goto l_d98; | |
// 177_1 game over | |
// 183_3 pause sign | |
a = (m[0xb1] << 2 | m[0xb7]) & 8; | |
if (a) goto l_d98; | |
a = 0xf; | |
goto l_d99; | |
l_db7: // timer_handler | |
r4 = a; | |
do { | |
INC(m[0x93]) | |
INC(m[0x94]) | |
if (m[0x94] != 8) break; | |
m[0x94] = 0; | |
INC(m[0x95]) | |
INC(m[0x96]) | |
INC(m[0x97]) | |
INC(m[0x98]) | |
INC(m[0x99]) | |
if (m[0x99]) break; | |
INC(m[0x9a]) | |
INC(m[0x9b]) | |
if (m[0x9b]) break; | |
INC(m[0x9c]) | |
if (m[0x9c]) break; | |
INC(m[0x9d]) | |
} while (0); | |
r3r2 = 0x16; | |
a = m[r3r2]; | |
if (a) goto l_de9; | |
INC_R2 | |
a = m[r3r2]; | |
if (!a) goto l_dea; | |
DEC(m[r3r2]) | |
DEC_R2 | |
l_de9: | |
DEC(m[r3r2]) | |
l_dea: | |
if (r4) goto l_a2d; | |
goto l_cc8; | |
f_dee: | |
if (!a) goto l_e05; | |
DEC(a) | |
INC_R0 | |
if (!a) goto l_dff; | |
DEC(a) | |
if (!a) goto l_e09; | |
DEC_R0 | |
l_df8: | |
DEC(m[r1r0]) | |
l_df9: | |
RET | |
f_dfa: // add_8bit(a = 10) | |
a = 0xa; | |
goto l_e00; | |
f_dfd: // add_8bit(a = 1, r1r0 = 0x31) | |
r1r0 = 0x31; | |
l_dff: // add_8bit(a = 1) | |
a = 0x1; | |
l_e00: | |
f_e00: // add_8bit | |
ADD(a, m[r1r0]) | |
m[r1r0] = a; | |
INC_R0 | |
if (!cf) goto l_e06; | |
l_e05: | |
INC(m[r1r0]) | |
l_e06: | |
RET | |
f_e07: // sub_8bit(a = -1, r1r0 = 0x37) | |
r1r0 = 0x37; | |
l_e09: | |
f_e09: // sub_8bit(a = -1) | |
a = 0xf; | |
goto l_e0d; | |
f_e0c: // sub_8bit(a = -10) | |
a = 0x6; | |
l_e0d: | |
f_e0d: // sub_8bit | |
ADD(a, m[r1r0]) | |
m[r1r0] = a; | |
INC_R0 | |
if (!cf) { DEC(m[r1r0]) } | |
RET | |
f_e13: // memcpy(m + 0x44, m + 0x2c, 4) | |
r3r2 = 0x44; | |
f_e15: // memcpy(m + r3r2, m + 0x2c, 4) | |
r1r0 = 0x2c; | |
f_e17: // memcpy(m + r3r2, m + r1r0, 4) | |
a = 4; | |
l_e18: | |
f_e18: // memcpy(m + r3r2, m + r1r0, a) | |
r4 = a; | |
do { // l_e19 | |
a = m[r1r0]; | |
m[r3r2] = a; | |
INC_R0 | |
INC_R2 | |
DEC(r4) | |
} while (r4); | |
RET | |
f_e21: // memcpy(m + 0x36, m + 0x30, 5) | |
r1r0 = 0x30; | |
r3r2 = 0x36; | |
l_e25: // memcpy(m + r3r2, m + r1r0, 5) | |
a = 0x5; | |
goto l_e18; | |
f_e28: // cf = (m[0x47..0x44] & m[0x2f..0x2c]) != 0 | |
r3r2 = 0x44; | |
goto l_e2e; | |
f_e2c: // cf = (m[0x1f..0x1c] & m[0x2f..0x2c]) != 0 | |
r3r2 = 0x1c; | |
l_e2e: | |
cf = 1; | |
r1r0 = 0x2c; | |
do { // l_e31 | |
a = m[r3r2] & m[r1r0]; | |
if (a) goto l_e3a; | |
INC_R0 | |
INC_R2 | |
} while (r1r0 & 15); | |
cf = 0; | |
l_e3a: | |
RET | |
l_e3b: | |
CALL(f_961, 0xe3d) | |
l_e3d: | |
goto l_2fe; // increase score by 1 | |
f_e3f: // update_next | |
// m[2e:2d:2c] = m[2d:2c:2e] | |
r4 = m[0x2e]; m[0x2e] = m[0x2d]; m[0x2d] = m[0x2c]; m[0x2c] = r4; | |
for (r1r0 = 0x2c; r1r0 < 0x30; r1r0 += 1) // y=3..0 | |
for (r3r2 = 0xb8; r3r2 < 0xc0; r3r2 += 2) { // x=3..0 | |
a = m[r1r0]; RRC m[r1r0] = a; | |
a = m[r3r2]; RRC m[r3r2] = a; | |
} | |
RET | |
f_e60: | |
a = m[r1r0]; | |
INC_R0 | |
a |= m[r1r0]; | |
RET | |
f_e64: | |
r1r0 = 0x4b; | |
f_e66: // memset(m, 0, r1r0 + 1) | |
a = 0x0; | |
f_e67: // memset(m, a, r1r0 + 1) | |
r4 = a; | |
memset(m, r4, r1r0 + 1); | |
r1r0 = a = 0; | |
RET | |
f_e73: | |
a = 0x2; | |
goto l_e18; | |
f_e76: | |
m[0x30] = a; | |
m[0x31] = 0; | |
m[0x32] = 0; | |
r1r0 = 0x32; a = 0; | |
RET | |
l_e9c: | |
f_e9c: // read and rotate figure | |
// 0x0c..0x0f temp | |
// 0x39 figure index | |
// 0x3a rotation | |
r4 = m[0x39]; | |
a = rom_e80[r4 * 2]; | |
m[0x2c] = a >> 4; | |
m[0x2d] = a & 15; | |
a = rom_e80[r4 * 2 + 1]; | |
m[0x2e] = a >> 4; | |
m[0x2f] = 0; | |
m[0x3a] &= a; // rotation mask | |
a = 0; | |
// rotate the figure | |
for (r4 = m[0x3a]; r4; r4--) { | |
int i, j; | |
for (i = 0; i < 4; i++) { | |
a = 0; | |
for (j = 0; j < 4; j++) | |
a = a << 1 | (m[0x2c + j] >> i & 1); | |
m[0x0c + i] = a; | |
} | |
r1r0 = 0x0c; | |
if (m[0x39] < 12) while (!m[r1r0]) r1r0++; | |
r3r2 = 0x2c; | |
while (r1r0 < 0x10) m[r3r2++] = m[r1r0++]; | |
while (r3r2 < 0x30) m[r3r2++] = 0; | |
} | |
RET | |
f_efa: // memcpy(m + 0x30, m + 0x36, 5) | |
r1r0 = 0x36; | |
r3r2 = 0x30; | |
goto l_e25; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment