#include "types.h" #include "z80stub.h" #include "obj/mspacman.h" static INT32 sg_s32StartCount; static struct z80context sg_sZ80Context; // Total data size is 24576 bytes static UINT8 sg_u8mspacman_memory[0x10000]; void mspacman_init(void) { memset((void *) sg_u8mspacman_memory, 0, sizeof(sg_u8mspacman_memory)); memcpy((void *) &sg_u8mspacman_memory[0x0], sg_u8Region0, sizeof(sg_u8Region0)); memcpy((void *) &sg_u8mspacman_memory[0x8000], sg_u8Region1, sizeof(sg_u8Region1)); } void mspacmanIndirectWrite8(UINT32 u32Address, UINT8 u8Data) { if (u32Address >= 0x4000 && u32Address <= 0x47ff) { MSPacVideoWrite(u32Address, u8Data); return; } else if (u32Address >= 0x5000 && u32Address <= 0x505f) { MSStuffWrite(u32Address, u8Data); return; } else if (u32Address >= 0x507f && u32Address <= 0x50ff) { MSNothingWrite(u32Address, u8Data); return; } else if (u32Address >= 0xc000 && u32Address <= 0xc7ff) { MSPacVideoWrite(u32Address, u8Data); return; } else { sg_u8mspacman_memory[u32Address] = u8Data; } } void mspacmanIndirectIOWrite8(UINT32 u32Address, UINT8 u8Data) { if (0x0000 == u32Address) { MSIOWrite(u32Address, u8Data); return; } } UINT32 mspacman_GetElapsedTicks(BOOL bClear) { UINT32 u32Temp = sg_sZ80Context.z80clockticks; if (bClear) { sg_sZ80Context.z80clockticks = 0; } return(u32Temp); } void mspacman_reset(void) { sg_sZ80Context.z80AF = 0x0040; sg_sZ80Context.z80halted = 0; sg_sZ80Context.z80BC = 0; sg_sZ80Context.z80DE = 0; sg_sZ80Context.z80HL = 0; sg_sZ80Context.z80afprime = 0; sg_sZ80Context.z80bcprime = 0; sg_sZ80Context.z80deprime = 0; sg_sZ80Context.z80hlprime = 0; sg_sZ80Context.z80i = 0; sg_sZ80Context.z80r = 0; sg_sZ80Context.z80IX = 0xffff; sg_sZ80Context.z80IY = 0xffff; sg_sZ80Context.z80pc = 0; sg_sZ80Context.z80SP = 0xffff; sg_sZ80Context.z80interruptMode = 0; sg_sZ80Context.intAddr = 0x38; sg_sZ80Context.nmiAddr = 0x66; sg_sZ80Context.z80Base = sg_u8mspacman_memory; } void mspacman_SetCPUContext(struct z80context *psContext) { memcpy((void *)&sg_sZ80Context, psContext, sizeof(*psContext)); sg_sZ80Context.z80Base = sg_u8mspacman_memory; } UINT32 mspacman_int(UINT8 u8AddressLSB) { UINT8 *pu8SP; sg_sZ80Context.z80halted = 0; if (0 == (sg_sZ80Context.z80iff & Z80_FLAG_IFF1)) { return(0xffffffff); // Interrupt not taken } sg_sZ80Context.z80iff &= ~(Z80_FLAG_IFF1 | Z80_FLAG_IFF2); pu8SP = (sg_u8mspacman_memory + sg_sZ80Context.z80SP - 1); *pu8SP-- = (UINT8) (sg_sZ80Context.z80pc >> 8); *pu8SP = (UINT8) sg_sZ80Context.z80pc; sg_sZ80Context.z80SP -= 2; if (2 == sg_sZ80Context.z80interruptMode) { sg_sZ80Context.z80pc = ((UINT16) sg_sZ80Context.z80i << 8) | (u8AddressLSB); sg_sZ80Context.z80pc = ((UINT16) sg_u8mspacman_memory[sg_sZ80Context.z80pc + 1] << 8) | sg_u8mspacman_memory[sg_sZ80Context.z80pc]; } else { sg_sZ80Context.z80pc = sg_sZ80Context.intAddr; } sg_sZ80Context.z80clockticks += sg_u8INTTiming[sg_sZ80Context.z80interruptMode]; return(0); } void mspacman_nmi(void) { UINT8 *pu8SP; sg_sZ80Context.z80halted = 0; pu8SP = (sg_u8mspacman_memory + sg_sZ80Context.z80SP - 1); *pu8SP-- = (UINT8) (sg_sZ80Context.z80pc >> 8); *pu8SP = (UINT8) sg_sZ80Context.z80pc; sg_sZ80Context.z80SP -= 2; sg_sZ80Context.z80pc = sg_sZ80Context.nmiAddr; sg_sZ80Context.z80clockticks += 11; sg_sZ80Context.z80iff &= (~Z80_FLAG_IFF1); } void mspacman_SetNMIAddress(UINT32 u32Address) { sg_sZ80Context.nmiAddr = u32Address; } void mspacman_SetINTAddress(UINT32 u32Address) { sg_sZ80Context.intAddr = u32Address; } void mspacman_GetCPUContext(struct z80context *psContext) { memcpy((void *) psContext, (void *) &sg_sZ80Context, sizeof(*psContext)); } UINT32 mspacman_exec(register INT32 s32CyclesRemaining) { register UINT8 u8Flags = sg_sZ80Context.z80F; if (sg_sZ80Context.z80halted) { if (0 == s32CyclesRemaining) { s32CyclesRemaining = 4; } sg_sZ80Context.z80clockticks += s32CyclesRemaining; sg_sZ80Context.z80rCounter += s32CyclesRemaining; sg_s32StartCount = 0; return(0); } sg_s32StartCount = s32CyclesRemaining; goto goToPC; returnInstruction: sg_sZ80Context.z80pc = sg_u8mspacman_memory[sg_sZ80Context.z80SP++]; sg_sZ80Context.z80pc |= ((UINT16) sg_u8mspacman_memory[sg_sZ80Context.z80SP++] << 8); goToPC: switch (sg_sZ80Context.z80pc) { case 0x0000: // 0000: di ; Disable interrupts // rst 0 - initialization // init L0000: sg_sZ80Context.z80iff &= 0xfe; // 0001: ld a, 00h ; 0 -> a sg_sZ80Context.z80A = (UINT8) (0); // 0003: ld i, a ; Clear interrupt status register sg_sZ80Context.z80i = (UINT8) (sg_sZ80Context.z80A); // 0005: jp 230bh ; startup test goto L230b;; // 0008: ld (hl), a // rst 8 - memset() // Fill 'hl' to 'hl+b' with 'a' L0008: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 0009: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 000a: djnz 08h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L0008;; } case 0x000c: // 000c: ret goto returnInstruction;; case 0x000d: // 000d: jp 070eh ; junk goto L070e;; L0010: // Replaced code from 0x0010-0x0016 with the following: sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + sg_sZ80Context.z80A); sg_sZ80Context.z80A = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; // 0x0011 Replaced // 0x0012 Replaced // 0x0014 Replaced // 0x0015 Replaced // 0x0016 Replaced case 0x0017: // 0017: ret goto returnInstruction;; // 0018: ld a, b // rst 18 (for dereferencing pointers to words) // hl = hl + 2*b, (hl) -> e, (++hl) -> d, de -> hl // HL = base address of table // B = index // after the call, DE gets the data in HL+(2*B) // modified: DE, A L0018: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); { UINT16 u16Temp0; // 0019: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80A))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80A ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 001a: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1b; goto L0010; case 0x001b: // 001b: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 001c: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 001d: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 001e: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 001f: ret goto returnInstruction;; // 0020: pop hl // rst 20 (for dereferencing pointers to pointers to functions) L0020: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); { UINT16 u16Temp0; // 0021: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80A))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80A ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 0022: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; goto L0010; case 0x0023: // 0023: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 0024: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 0025: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 0026: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 0027: jp (hl) sg_sZ80Context.z80pc = (UINT16) (sg_sZ80Context.z80HL); goto goToPC;; // 0028: pop hl ; next byte after call // rst 28 // this is completely baffling me L0028: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 0029: ld b, (hl) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 002a: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 002b: ld c, (hl) sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 002c: inc hl ; bc gets the word after the call sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 002d: push hl ; adjust return value sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 002e: jr 42h goto L0042;; case 0x0030: // 0030: ld de, 4c90h // rst 30 L0030: sg_sZ80Context.z80DE = (UINT16) (0x4c90); // 0033: ld b, 10h sg_sZ80Context.z80B = (UINT8) (0x10); // 0035: jp 0051h goto L0051;; case 0x0038: // 0038: jp 1f9bh ; patched jump from pacman. // rst 38 (vblank) // Interrupt mode 1 handler L0038: goto L1f9b;; // 0042: ld hl, (4c80h) ; hl = (4c80) // continuation of rst 28 L0042: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4c80]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4c81]); // 0045: ld (hl), b mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80B); // 0046: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 0047: ld (hl), c mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80C); // 0048: inc l ; ((4c80), (4c81)) = bc sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80L & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80L & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 0049: jr nz, 4dh if (((u8Flags & 0x40) >> 6) != 1) { goto L004d;; } // 004b: ld L, 0c0h ; if( c==00 ) l = c0 (spins c0-ff) sg_sZ80Context.z80L = (UINT8) (0xc0); // 004d: ld (4c80h), hl ; (4c80, 4c81) = hl L004d: sg_u8mspacman_memory[0x4c80] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4c81] = sg_sZ80Context.z80H; // 0050: ret goto returnInstruction;; // 0051: ld a, (de) // rst 30 continuation L0051: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80DE]); // 0052: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0053: jr z, 5bh if (((u8Flags & 0x40) >> 6) == 1) { goto L005b;; } // 0055: inc e sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80E + 1); // 0056: inc e sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80E + 1); // 0057: inc e sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80E + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80E == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80E & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80E & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80E == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 0058: djnz 51h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L0051;; } // 005a: ret goto returnInstruction;; // 005b: pop hl L005b: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 005c: ld b, 03h sg_sZ80Context.z80B = (UINT8) (0x03); // 005e: ld a, (hl) L005e: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 005f: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 0060: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 0061: inc e sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80E + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80E == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80E & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80E & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80E == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 0062: djnz 5eh sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L005e;; } // 0064: jp (hl) sg_sZ80Context.z80pc = (UINT16) (sg_sZ80Context.z80HL); goto goToPC;; // 0065: jp 202dh // this is a common call L0065: goto L202d;; // 008d: push af // part of the interrupt routine (non-test) // continuation of RST 38 partially... (vblank) // (gets called from the 1f9b test subroutine) L008d: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80A; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = u8Flags; // 008e: ld (Wdog), a ; kick the dog MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 0091: xor a, a ; 0 -> a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0092: ld (IRQEn), a ; disable hardware interrupts MSStuffWrite(0x5000,sg_sZ80Context.z80A); // 0095: di ; disable cpu interrupts sg_sZ80Context.z80iff &= 0xfe; // 0096: push bc sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80B; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80C; // 0097: push de sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80D; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80E; // 0098: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 0099: push ix sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80XH; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80XL; // 009b: push iy sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80YH; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80YL; // 009d: ld hl, 4e8ch ; write freq/volume for sound regs // load the sound into the hardware sg_sZ80Context.z80HL = (UINT16) (0x4e8c); case 0x00a0: // 00a0: ld de, V1Frq ; sound voice frequency sg_sZ80Context.z80DE = (UINT16) (0x5050); // 00a3: ld bc, 0010h ; bc = 10 sg_sZ80Context.z80BC = (UINT16) (0x10); // 00a6: ldir UniqueLabel0: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel0;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 00a8: ld a, (4ecch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4ecc]); // 00ab: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 00ac: ld a, (4ecfh) // write sound waveforms sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4ecf]); // 00af: jr nz, 0b4h if (((u8Flags & 0x40) >> 6) != 1) { goto L00b4;; } // 00b1: ld a, (4e9fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e9f]); // 00b4: ld (V1Wav), a ; sound voice 1 waveform L00b4: MSStuffWrite(0x5045,sg_sZ80Context.z80A); // 00b7: ld a, (4edch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4edc]); // 00ba: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 00bb: ld a, (4edfh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4edf]); // 00be: jr nz, 0c3h if (((u8Flags & 0x40) >> 6) != 1) { goto L00c3;; } // 00c0: ld a, (4eafh) // jp here from table sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4eaf]); // 00c3: ld (V2Wav), a ; sound voice 2 waveform L00c3: MSStuffWrite(0x504a,sg_sZ80Context.z80A); // 00c6: ld a, (4eech) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4eec]); // 00c9: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 00ca: ld a, (4eefh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4eef]); // 00cd: jr nz, 0d2h if (((u8Flags & 0x40) >> 6) != 1) { goto L00d2;; } // 00cf: ld a, (4ebfh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4ebf]); // 00d2: ld (V3Wav), a ; sound voice 3 waveform L00d2: MSStuffWrite(0x504f,sg_sZ80Context.z80A); // 00d5: ld hl, 4c02h sg_sZ80Context.z80HL = (UINT16) (0x4c02); // 00d8: ld de, 4c22h sg_sZ80Context.z80DE = (UINT16) (0x4c22); // 00db: ld bc, 001ch sg_sZ80Context.z80BC = (UINT16) (0x1c); // 00de: ldir UniqueLabel1: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel1;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 00e0: ld ix, 4c20h sg_sZ80Context.z80IX = (UINT16) (0x4c20); // 00e4: ld a, (ix+02h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x02]); // 00e7: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 00e8: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 00e9: ld (ix+02h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, sg_sZ80Context.z80A); // 00ec: ld a, (ix+04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x04]); // 00ef: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 00f0: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 00f1: ld (ix+04h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x04, sg_sZ80Context.z80A); // 00f4: ld a, (ix+06h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x06]); // 00f7: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 00f8: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 00f9: ld (ix+06h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, sg_sZ80Context.z80A); // 00fc: ld a, (ix+08h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x08]); // 00ff: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 0100: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 0101: ld (ix+08h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x08, sg_sZ80Context.z80A); // 0104: ld a, (ix+0ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0a]); // 0107: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 0108: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 0109: ld (ix+0ah), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, sg_sZ80Context.z80A); // 010c: ld a, (ix+0ch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0c]); // 010f: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 0110: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 0111: ld (ix+0ch), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0c, sg_sZ80Context.z80A); // 0114: ld a, (4dd1h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd1]); { UINT16 u16Temp0; // 0117: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0119: jr nz, 0153h if (((u8Flags & 0x40) >> 6) != 1) { goto L0153;; } // 011b: ld ix, 4c20h sg_sZ80Context.z80IX = (UINT16) (0x4c20); // 011f: ld a, (4da4h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da4]); { UINT16 u16Temp0; // 0122: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 0123: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 0124: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); { UINT32 u32Temp0; // 0126: add ix, de u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); } // 0128: ld hl, (4c24h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4c24]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4c25]); // 012b: ld de, (4c34h) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[0x4c34]); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[0x4c35]); // 012f: ld a, (ix+00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 0132: ld (4c24h), a sg_u8mspacman_memory[0x4c24] = sg_sZ80Context.z80A; // 0135: ld a, (ix+01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); // 0138: ld (4c25h), a sg_u8mspacman_memory[0x4c25] = sg_sZ80Context.z80A; // 013b: ld a, (ix+10h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x10]); case 0x013e: // 013e: ld (4c34h), a sg_u8mspacman_memory[0x4c34] = sg_sZ80Context.z80A; // 0141: ld a, (ix+11h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x11]); // 0144: ld (4c35h), a sg_u8mspacman_memory[0x4c35] = sg_sZ80Context.z80A; // 0147: ld (ix+00h), l mspacmanIndirectWrite8(sg_sZ80Context.z80IX, sg_sZ80Context.z80L); // 014a: ld (ix+01h), h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 1, sg_sZ80Context.z80H); // 014d: ld (ix+10h), e mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x10, sg_sZ80Context.z80E); // 0150: ld (ix+11h), d mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x11, sg_sZ80Context.z80D); // 0153: ld a, (4da6h) L0153: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da6]); // 0156: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0157: jp z, 0176h if (((u8Flags & 0x40) >> 6) == 1) { goto L0176;; } // 015a: ld bc, (4c22h) sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[0x4c22]); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[0x4c23]); // 015e: ld de, (4c32h) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[0x4c32]); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[0x4c33]); // 0162: ld hl, (4c2ah) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4c2a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4c2b]); // 0165: ld (4c22h), hl sg_u8mspacman_memory[0x4c22] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4c23] = sg_sZ80Context.z80H; // 0168: ld hl, (4c3ah) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4c3a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4c3b]); // 016b: ld (4c32h), hl sg_u8mspacman_memory[0x4c32] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4c33] = sg_sZ80Context.z80H; // 016e: ld (4c2ah), bc sg_u8mspacman_memory[0x4c2a] = sg_sZ80Context.z80C; sg_u8mspacman_memory[0x4c2b] = sg_sZ80Context.z80B; // 0172: ld (4c3ah), de sg_u8mspacman_memory[0x4c3a] = sg_sZ80Context.z80E; sg_u8mspacman_memory[0x4c3b] = sg_sZ80Context.z80D; // 0176: ld hl, 4c22h L0176: sg_sZ80Context.z80HL = (UINT16) (0x4c22); // 0179: ld de, 4ff2h sg_sZ80Context.z80DE = (UINT16) (0x4ff2); // 017c: ld bc, 000ch sg_sZ80Context.z80BC = (UINT16) (0x0c); // 017f: ldir UniqueLabel2: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel2;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 0181: ld hl, 4c32h sg_sZ80Context.z80HL = (UINT16) (0x4c32); // 0184: ld de, 5062h sg_sZ80Context.z80DE = (UINT16) (0x5062); // 0187: ld bc, 000ch sg_sZ80Context.z80BC = (UINT16) (0x0c); // 018a: ldir UniqueLabel3: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel3;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 018c: call 01dch ; controls the game play - // core game loop sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8f; goto L01dc; case 0x018f: // 018f: call 0221h ; controls the moving sprites sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x92; goto L0221; case 0x0192: // 0192: call 03c8h ; enable sound out and other stuff - sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; goto L03c8; case 0x0195: // 0195: ld a, (4e00h) ; check game mode sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); // 0198: and a, a ; set flags u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0199: jr z, 01adh ; skip over next calls if no players if (((u8Flags & 0x40) >> 6) == 1) { goto L01ad;; } // 019b: call 039dh ; displays 'READY!' sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9e; goto L039d; case 0x019e: // 019e: call 1490h ; display sprites in intro and game sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa1; goto L1490; case 0x01a1: // 01a1: call 141fh ; ? sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa4; goto L141f; case 0x01a4: // 01a4: call 0267h ; debounce rack input / add credits sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa7; goto L0267; case 0x01a7: // 01a7: call 02adh ; debounce coin input / add credits sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xaa; goto L02ad; case 0x01aa: // 01aa: call 02fdh ; blink coin lights sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xad; goto L02fd; case 0x01ad: // 01ad: ld a, (4e00h) ; nplayers L01ad: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); // 01b0: dec a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 01b1: jr nz, 01b9h ; skip if intro mode if (((u8Flags & 0x40) >> 6) != 1) { goto L01b9;; } // 01b3: ld (4each), a sg_u8mspacman_memory[0x4eac] = sg_sZ80Context.z80A; // 01b6: ld (4ebch), a sg_u8mspacman_memory[0x4ebc] = sg_sZ80Context.z80A; // 01b9: call 2d0ch ; something with sound? L01b9: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbc; goto L2d0c; case 0x01bc: // 01bc: call 2cc1h ; something with sound? sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbf; goto L2cc1; case 0x01bf: // 01bf: pop iy sg_sZ80Context.z80YL = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80YH = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 01c1: pop ix sg_sZ80Context.z80XL = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80XH = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 01c3: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 01c4: pop de sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 01c5: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 01c6: ld a, (4e00h) ; check players sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); // 01c9: and a, a ; set flags u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 01ca: jr z, 01d4h if (((u8Flags & 0x40) >> 6) == 1) { goto L01d4;; } // 01cc: ld a, (V1Acc) ; IN1 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 01cf: and a, 10h ; rack TEST sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x10); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 01d1: jp z, Start ; reset if TEST is set if (((u8Flags & 0x40) >> 6) == 1) { goto L0000;; } // 01d4: ld a, 01h ; a=1 L01d4: sg_sZ80Context.z80A = (UINT8) (1); // 01d6: ld (IRQEn), a ; reenable hardware interrupts MSStuffWrite(0x5000,sg_sZ80Context.z80A); // 01d9: ei ; enable cpu interrupts sg_sZ80Context.z80iff |= 0x01; sg_sZ80Context.z80iff |= 0x02; s32CyclesRemaining = s32CyclesRemaining - 0x04; // 01da: pop af u8Flags = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 01db: ret ; end goto returnInstruction;; // 01dc: ld hl, 4c84h // controls the game play // (stops on game screen when disabled) L01dc: sg_sZ80Context.z80HL = (UINT16) (0x4c84); { UINT8 u8Temp0; // 01df: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 01e0: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); { UINT8 u8Temp0; // 01e1: dec (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 01e2: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 01e3: ld de, 0219h sg_sZ80Context.z80DE = (UINT16) (0x0219); // 01e6: ld bc, 0401h sg_sZ80Context.z80BC = (UINT16) (0x0401); { UINT8 u8Temp0; // 01e9: inc (hl) L01e9: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 01ea: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 01eb: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); { UINT16 u16Temp0; // 01ed: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } { UINT16 u16Temp0; UINT8 u8Temp0; // 01ee: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 01ef: jr nz, 0204h if (((u8Flags & 0x40) >> 6) != 1) { goto L0204;; } // 01f1: inc c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C + 1); // 01f2: ld a, (de) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80DE]); { UINT16 u16Temp0; // 01f3: add a, 10h u16Temp0 = sg_sZ80Context.z80A + 0x10; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 01f5: and a, 0f0h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0xf0); // 01f7: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 01f8: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); { UINT16 u16Temp0; UINT8 u8Temp0; // 01f9: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 01fa: jr nz, 0204h if (((u8Flags & 0x40) >> 6) != 1) { goto L0204;; } // 01fc: inc c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C + 1); if ((sg_sZ80Context.z80C & 0x0f) == 0) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } { UINT16 u16Temp0; // 01fd: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 01fe: ld (hl), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0); // 0200: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 0201: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 0202: djnz 01e9h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L01e9;; } // 0204: ld hl, 4c8ah L0204: sg_sZ80Context.z80HL = (UINT16) (0x4c8a); // 0207: ld (hl), c mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80C); // 0208: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 0209: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 020a: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 020b: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; UINT8 u8Temp0; // 020c: add a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A + u8Temp0; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 020d: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 020e: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 020f: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 0210: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 0211: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; UINT8 u8Temp0; // 0212: add a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A + u8Temp0; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 0213: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 0214: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; UINT8 u8Temp0; // 0215: add a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A + u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 0216: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 0217: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 0218: ret goto returnInstruction;; // 0221: ld hl, 4c90h // controls the moving sprites L0221: sg_sZ80Context.z80HL = (UINT16) (0x4c90); // 0224: ld a, (4c8ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c8a]); // 0227: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 0228: ld b, 10h sg_sZ80Context.z80B = (UINT8) (0x10); // 022a: ld a, (hl) L022a: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 022b: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 022c: jr z, 025dh if (((u8Flags & 0x40) >> 6) == 1) { goto L025d;; } // 022e: and a, 0c0h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0xc0); // 0230: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 0231: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); { UINT16 u16Temp0; // 0232: cp a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 0233: jr nc, 025dh if (((u8Flags & 0x01) >> 0) != 1) { goto L025d;; } { UINT8 u8Temp0; // 0235: dec (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0236: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 0237: and a, 3fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x3f); u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0239: jr nz, 025dh if (((u8Flags & 0x40) >> 6) != 1) { goto L025d;; } // 023b: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 023c: push bc sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80B; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80C; // 023d: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 023e: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 023f: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 0240: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 0241: ld b, (hl) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 0242: ld hl, 025bh sg_sZ80Context.z80HL = (UINT16) (0x025b); // 0245: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 0246: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x02; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x47; goto L0020; case 0x025b: // 025b: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 025c: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 025d: inc l L025d: sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 025e: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 025f: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80L & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80L & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 0260: djnz 022ah sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L022a;; } // 0262: ret goto returnInstruction;; case 0x0263: // 0263: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x02; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x64; goto L0028; case 0x0264: // 0264: inc e sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80E + 1); { UINT16 u16Temp0; UINT8 u8Temp0; // 0265: add a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A + u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A ^ 0x80) & (u8Temp0 ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } case 0x0266: // 0266: ret goto returnInstruction;; // 0267: ld a, (credits) ; number of current credits // debounce rack input / add credits (if 99 or over, return) L0267: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6e]); { UINT16 u16Temp0; // 026a: cp a, 99h ; max coins u16Temp0 = sg_sZ80Context.z80A - 0x99; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x99 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } { UINT8 u8Temp0; // 026c: rla ; then lockout u8Temp0 = ((u8Flags & 0x01) >> 0); u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 0x80) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | u8Temp0)); } // 026d: ld (coinlk), a ; coin lockout MSStuffWrite(0x5006,sg_sZ80Context.z80A); { UINT8 u8Temp0; // 0270: rra u8Temp0 = ((u8Flags & 0x01) >> 0) << 0x07; u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 1) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | u8Temp0)); u8Flags &= 0xfd; u8Flags &= 0xef; } // 0271: ret nc ; return if 99 credits if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 0272: ld a, (IRQEn) ; check IN0 input sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5000]); // 0275: ld b, a ; b=a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 0276: rlc b ; rotate left u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80B & 0x80) ? 0x01 : 0); sg_sZ80Context.z80B = (UINT8) (((sg_sZ80Context.z80B << 1) | (sg_sZ80Context.z80B >> 0x07))); // 0278: ld a, (4e66h) ; ? sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e66]); { UINT8 u8Temp0; // 027b: rla ; rotate left with carry u8Temp0 = ((u8Flags & 0x01) >> 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | u8Temp0)); } // 027c: and a, 0fh ; and it with 0f sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); // 027e: ld (4e66h), a ; put it back sg_u8mspacman_memory[0x4e66] = sg_sZ80Context.z80A; { UINT16 u16Temp0; // 0281: sub a, 0ch ; a=a-$C u16Temp0 = sg_sZ80Context.z80A - 0x0c; sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); } // 0283: call z, 02dfh ; call $2df if a==0 ; add coin if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x02; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x86; goto L02df; } case 0x0286: // 0286: rlc b u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80B & 0x80) ? 0x01 : 0); sg_sZ80Context.z80B = (UINT8) (((sg_sZ80Context.z80B << 1) | (sg_sZ80Context.z80B >> 0x07))); // 0288: ld a, (4e67h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e67]); { UINT8 u8Temp0; // 028b: rla u8Temp0 = ((u8Flags & 0x01) >> 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | u8Temp0)); } // 028c: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); // 028e: ld (4e67h), a sg_u8mspacman_memory[0x4e67] = sg_sZ80Context.z80A; { UINT16 u16Temp0; // 0291: sub a, 0ch u16Temp0 = sg_sZ80Context.z80A - 0x0c; sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); } // 0293: jp nz, 029ah if (((u8Flags & 0x40) >> 6) != 1) { goto L029a;; } // 0296: ld hl, 4e69h ; increment credits sg_sZ80Context.z80HL = (UINT16) (0x4e69); { UINT8 u8Temp0; // 0299: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 029a: rlc b L029a: u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80B & 0x80) ? 0x01 : 0); sg_sZ80Context.z80B = (UINT8) (((sg_sZ80Context.z80B << 1) | (sg_sZ80Context.z80B >> 0x07))); // 029c: ld a, (4e68h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e68]); { UINT8 u8Temp0; // 029f: rla u8Temp0 = ((u8Flags & 0x01) >> 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | u8Temp0)); } // 02a0: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); // 02a2: ld (4e68h), a sg_u8mspacman_memory[0x4e68] = sg_sZ80Context.z80A; { UINT16 u16Temp0; // 02a5: sub a, 0ch u16Temp0 = sg_sZ80Context.z80A - 0x0c; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x0c))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x0c ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 02a7: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 02a8: ld hl, 4e69h sg_sZ80Context.z80HL = (UINT16) (0x4e69); { UINT8 u8Temp0; // 02ab: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 02ac: ret goto returnInstruction;; // 02ad: ld a, (4e69h) ; increment credits // debounce coin input / add credits L02ad: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e69]); // 02b0: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 02b1: ret z ; if it's zero, return if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 02b2: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 02b3: ld a, (4e6ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6a]); // 02b6: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 02b7: cp a, 00h u16Temp0 = sg_sZ80Context.z80A; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 02b9: jp nz, 02c4h if (((u8Flags & 0x40) >> 6) != 1) { goto L02c4;; } // 02bc: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 02be: ld (coinct), a MSStuffWrite(0x5007,sg_sZ80Context.z80A); // 02c1: call 02dfh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x02; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc4; goto L02df; case 0x02c4: // 02c4: ld a, e L02c4: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80E); { UINT16 u16Temp0; // 02c5: cp a, 08h u16Temp0 = sg_sZ80Context.z80A - 0x08; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 02c7: jp nz, 02ceh if (((u8Flags & 0x40) >> 6) != 1) { goto L02ce;; } // 02ca: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 02cb: ld (coinct), a ; coin counter MSStuffWrite(0x5007,sg_sZ80Context.z80A); // 02ce: inc e L02ce: sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80E + 1); // 02cf: ld a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80E); // 02d0: ld (4e6ah), a ; credit memory = a sg_u8mspacman_memory[0x4e6a] = sg_sZ80Context.z80A; { UINT16 u16Temp0; // 02d3: sub a, 10h u16Temp0 = sg_sZ80Context.z80A - 0x10; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x10))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x10 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 02d5: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 02d6: ld (4e6ah), a sg_u8mspacman_memory[0x4e6a] = sg_sZ80Context.z80A; // 02d9: dec b sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80B == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80B & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80B & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80B == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 02da: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 02db: ld (4e69h), a sg_u8mspacman_memory[0x4e69] = sg_sZ80Context.z80A; // 02de: ret goto returnInstruction;; // 02df: ld a, (xcoin) ; #coins per #credits // coins -> credits routine L02df: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6b]); // 02e2: ld hl, 4e6ch ; leftover coins sg_sZ80Context.z80HL = (UINT16) (0x4e6c); { UINT8 u8Temp0; // 02e5: inc (hl) ; add 1 mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } { UINT16 u16Temp0; UINT8 u8Temp0; // 02e6: sub a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 02e7: ret nz ; not enough coins for credits if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 02e8: ld (hl), a ; store leftover coins mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 02e9: ld a, (xcred) ; #credits per #coins sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6d]); // 02ec: ld hl, credits ; #credits sg_sZ80Context.z80HL = (UINT16) (0x4e6e); { UINT16 u16Temp0; UINT8 u8Temp0; // 02ef: add a, (hl) ; add # credits u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A + u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; } { UINT16 u16Temp0; // 02f0: daa u16Temp0 = (sg_sZ80Context.z80A | (((u8Flags & 0x01) >> 0) << 0x08) | (((u8Flags & 0x10) >> 4) << 0x09) | (((u8Flags & 0x02) >> 1) << 0x0a)); u8Flags = (UINT8) (sg_u16DAATable[u16Temp0] >> 0x08); sg_sZ80Context.z80A = (UINT8) (sg_u16DAATable[u16Temp0] & 0xff); } // 02f1: jp nc, 02f6h if (((u8Flags & 0x01) >> 0) != 1) { goto L02f6;; } // 02f4: ld a, 99h sg_sZ80Context.z80A = (UINT8) (0x99); // 02f6: ld (hl), a ; store #credits, max 99 L02f6: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 02f7: ld hl, 4e9ch sg_sZ80Context.z80HL = (UINT16) (0x4e9c); // 02fa: set 1, (hl) ; set bit 1 of 4e9c (play a sound) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 0x02); // 02fc: ret goto returnInstruction;; // 02fd: ld hl, 4dceh // blink coin lights, print player 1 and player 2, check for mode 3 L02fd: sg_sZ80Context.z80HL = (UINT16) (0x4dce); { UINT8 u8Temp0; // 0300: inc (hl) ; increment whats in $4dce mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0301: ld a, (hl) ; a = alue in 4cf sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 0302: and a, 0fh ; and with $0f sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0304: jr nz, 0325h ; if not 0, jump if (((u8Flags & 0x40) >> 6) != 1) { goto L0325;; } // 0306: ld a, (hl) ; shift right sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 0307: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 0308: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 0309: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 030a: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 030b: ld b, a ; b=a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 030c: ld a, (4dd6h) // blink coin lights to pellets ; HACK11 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd6]); // 030f: cpl ; compliment sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); // 0310: or a, b ; or b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80B); // 0311: ld c, a ; c=a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 0312: ld a, (credits) ; a = number of credits sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6e]); { UINT16 u16Temp0; // 0315: sub a, 01h ; subtract one from it. u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); } // 0317: jr nc, 031bh ; if carry not 0 then jump if (((u8Flags & 0x01) >> 0) != 1) { goto L031b;; } // 0319: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 031a: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 031b: jr z, SetStartLamps L031b: if (((u8Flags & 0x40) >> 6) == 1) { goto L031e;; } // 031d: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 031e: ld (p2lamp), a ; player 2 start lamp L031e: MSStuffWrite(0x5005,sg_sZ80Context.z80A); // 0321: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 0322: ld (p1lamp), a ; player 1 start lamp MSStuffWrite(0x5004,sg_sZ80Context.z80A); // 0325: ld ix, 43d8h L0325: sg_sZ80Context.z80IX = (UINT16) (0x43d8); // 0329: ld iy, 43c5h sg_sZ80Context.z80IY = (UINT16) (0x43c5); // 032d: ld a, (4e00h) ; game mode? // determine 1p or 2p sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); { UINT16 u16Temp0; // 0330: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0332: jp z, 0344h ; Jump if 1 or 2 players if (((u8Flags & 0x40) >> 6) == 1) { goto L0344;; } // 0335: ld a, (4e03h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e03]); { UINT16 u16Temp0; // 0338: cp a, 02h u16Temp0 = sg_sZ80Context.z80A - 0x02; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x02))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x02 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 033a: jp nc, 0344h if (((u8Flags & 0x01) >> 0) != 1) { goto L0344;; } // 033d: call 0369h ; draw '1UP' sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x40; goto L0369; case 0x0340: // 0340: call 0376h ; draw '2UP' sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x43; goto L0376; case 0x0343: // 0343: ret goto returnInstruction;; // 0344: ld a, (4e09h) // display and blink 1UP/2UP depending on player up L0344: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 0347: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0348: ld a, (4dceh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dce]); // 034b: jp nz, 0359h if (((u8Flags & 0x40) >> 6) != 1) { goto L0359;; } // 034e: bit 4, a u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0x10) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 0350: call z, 0369h ; draw '1UP' if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x53; goto L0369; } case 0x0353: // 0353: call nz, 0383h ; clear '1UP' if (((u8Flags & 0x40) >> 6) != 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x56; goto L0383; } case 0x0356: // 0356: jp 0361h goto L0361;; // 0359: bit 4, a L0359: u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0x10) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 035b: call z, 0376h ; draw '1UP' if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x5e; goto L0376; } case 0x035e: // 035e: call nz, 0390h ; clear '2UP' if (((u8Flags & 0x40) >> 6) != 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x61; goto L0390; } case 0x0361: // 0361: ld a, (coincrd) ; players 0=1 1=2 L0361: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e70]); // 0364: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0365: call z, 0390h ; clear '2UP' if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x68; goto L0390; } case 0x0368: // 0368: ret goto returnInstruction;; // 0369: ld (ix+00h), 50h ; 'P' // draw '1UP' L0369: mspacmanIndirectWrite8(sg_sZ80Context.z80IX, 0x50); // 036d: ld (ix+01h), 55h ; 'U' mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 1, 0x55); // 0371: ld (ix+02h), 31h ; '1' mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, 0x31); // 0375: ret goto returnInstruction;; // 0376: ld (iy+00h), 50h ; 'P' // draw '2UP' L0376: mspacmanIndirectWrite8(sg_sZ80Context.z80IY, 0x50); // 037a: ld (iy+01h), 55h ; 'U' mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 1, 0x55); // 037e: ld (iy+02h), 32h ; '2' mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x02, 0x32); // 0382: ret goto returnInstruction;; // 0383: ld (ix+00h), 40h ; ' ' // clear '1UP' L0383: mspacmanIndirectWrite8(sg_sZ80Context.z80IX, 0x40); // 0387: ld (ix+01h), 40h ; ' ' mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 1, 0x40); // 038b: ld (ix+02h), 40h ; ' ' mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, 0x40); // 038f: ret goto returnInstruction;; // 0390: ld (iy+00h), 40h ; ' ' // clear '2UP' L0390: mspacmanIndirectWrite8(sg_sZ80Context.z80IY, 0x40); // 0394: ld (iy+01h), 40h ; ' ' mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 1, 0x40); // 0398: ld (iy+02h), 40h ; ' ' mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x02, 0x40); // 039c: ret goto returnInstruction;; // 039d: ld a, (4e06h) ; if 4e06 is <5, normal pac // draws big pacman in intermission L039d: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e06]); { UINT16 u16Temp0; // 03a0: sub a, 05h u16Temp0 = sg_sZ80Context.z80A - 0x05; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x05))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x05 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 03a2: ret c if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 03a3: ld hl, (4d08h) // draw big pac sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d08]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d09]); // 03a6: ld b, 08h sg_sZ80Context.z80B = (UINT8) (0x08); // 03a8: ld c, 10h sg_sZ80Context.z80C = (UINT8) (0x10); // 03aa: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); // 03ab: ld (4d06h), a sg_u8mspacman_memory[0x4d06] = sg_sZ80Context.z80A; // 03ae: ld (4dd2h), a sg_u8mspacman_memory[0x4dd2] = sg_sZ80Context.z80A; { UINT16 u16Temp0; // 03b1: sub a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 03b2: ld (4d02h), a sg_u8mspacman_memory[0x4d02] = sg_sZ80Context.z80A; // 03b5: ld (4d04h), a sg_u8mspacman_memory[0x4d04] = sg_sZ80Context.z80A; // 03b8: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); { UINT16 u16Temp0; // 03b9: add a, b u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80B; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 03ba: ld (4d03h), a sg_u8mspacman_memory[0x4d03] = sg_sZ80Context.z80A; // 03bd: ld (4d07h), a sg_u8mspacman_memory[0x4d07] = sg_sZ80Context.z80A; { UINT16 u16Temp0; // 03c0: sub a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80C))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80C ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 03c1: ld (4d05h), a sg_u8mspacman_memory[0x4d05] = sg_sZ80Context.z80A; // 03c4: ld (4dd3h), a sg_u8mspacman_memory[0x4dd3] = sg_sZ80Context.z80A; // 03c7: ret goto returnInstruction;; // 03c8: ld a, (4e00h) ; game mode // enable sound out and other stuff L03c8: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); // 03cb: rst 20h ; stack = program counter @ rst 20 sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xcc; goto L0020; case 0x03d4: // 03d4: ld a, (4e01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e01]); // 03d7: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd8; goto L0020; case 0x03dc: // 03dc: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xdd; goto L0028; case 0x03df: // 03df: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe0; goto L0028; case 0x03e2: // 03e2: rst 28h // this seems to execute oddly. sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe3; goto L0028; case 0x03e5: // 03e5: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe6; goto L0028; case 0x03e8: // 03e8: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe9; goto L0028; case 0x03eb: // 03eb: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xec; goto L0028; case 0x03ee: // 03ee: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xef; goto L0028; case 0x03f1: // 03f1: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf2; goto L0028; case 0x03f4: // 03f4: ld hl, 4e01h sg_sZ80Context.z80HL = (UINT16) (0x4e01); { UINT8 u8Temp0; // 03f7: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 03f8: ld hl, SndEn ; enable sound sg_sZ80Context.z80HL = (UINT16) (0x5001); // 03fb: ld (hl), 01h ; output mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 1); // 03fd: ret goto returnInstruction;; case 0x03fe: // 03fe: call 2ba1h ; write #credits on screen // cant find a jump to here... sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; goto L2ba1; case 0x0401: // 0401: ld a, (credits) ; get credits sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6e]); // 0404: and a, a ; set flags u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0405: jr z, 0413h ; no credits -> 0x13 if (((u8Flags & 0x40) >> 6) == 1) { goto L0413;; } // 0407: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xfe; // 0408: ld (4e04h), a ; level complete register sg_u8mspacman_memory[0x4e04] = sg_sZ80Context.z80A; // 040b: ld (gmemode), a sg_u8mspacman_memory[0x4e02] = sg_sZ80Context.z80A; // 040e: ld hl, 4e00h sg_sZ80Context.z80HL = (UINT16) (0x4e00); { UINT8 u8Temp0; // 0411: inc (hl) ; start game mode mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 0412: ret goto returnInstruction;; // 0413: jp 3e5ch ; no credits? // table lookup (mspac patch) L0413: goto L3e5c;; case 0x045f: // 045f: rst 28h // code resumes here sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x60; goto L0028; case 0x0462: // 0462: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x63; goto L0028; case 0x0465: // 0465: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x66; goto L0028; case 0x0468: // 0468: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x69; goto L0028; case 0x046b: // 046b: ld c, 0ch sg_sZ80Context.z80C = (UINT8) (0x0c); // 046d: call 0585h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x70; goto L0585; case 0x0470: // 0470: ret goto returnInstruction;; case 0x0471: // 0471: ld hl, 4304h sg_sZ80Context.z80HL = (UINT16) (0x4304); // 0474: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 0476: call 05bfh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x79; goto L05bf; case 0x0479: // 0479: ld c, 0ch sg_sZ80Context.z80C = (UINT8) (0x0c); // 047b: call 0585h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x7e; goto L0585; case 0x047e: // 047e: ret goto returnInstruction;; case 0x047f: // 047f: ld c, 14h sg_sZ80Context.z80C = (UINT8) (0x14); // 0481: call 0593h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x84; goto L0593; case 0x0484: // 0484: ret goto returnInstruction;; case 0x0485: // 0485: ld c, 0dh sg_sZ80Context.z80C = (UINT8) (0x0d); // 0487: call 0593h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8a; goto L0593; case 0x048a: // 048a: ret goto returnInstruction;; case 0x048b: // 048b: ld hl, 4307h sg_sZ80Context.z80HL = (UINT16) (0x4307); // 048e: ld a, 03h sg_sZ80Context.z80A = (UINT8) (0x03); // 0490: call 05bfh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x93; goto L05bf; case 0x0493: // 0493: ld c, 0ch sg_sZ80Context.z80C = (UINT8) (0x0c); // 0495: call 0585h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x98; goto L0585; case 0x0498: // 0498: ret goto returnInstruction;; case 0x0499: // 0499: ld c, 16h sg_sZ80Context.z80C = (UINT8) (0x16); // 049b: call 0593h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9e; goto L0593; case 0x049e: // 049e: ret goto returnInstruction;; case 0x049f: // 049f: ld c, 0fh sg_sZ80Context.z80C = (UINT8) (0x0f); // 04a1: call 0593h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa4; goto L0593; case 0x04a4: // 04a4: ret goto returnInstruction;; case 0x04a5: // 04a5: ld hl, 430ah sg_sZ80Context.z80HL = (UINT16) (0x430a); // 04a8: ld a, 05h sg_sZ80Context.z80A = (UINT8) (0x05); // 04aa: call 05bfh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xad; goto L05bf; case 0x04ad: // 04ad: ld c, 0ch sg_sZ80Context.z80C = (UINT8) (0x0c); // 04af: call 0585h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb2; goto L0585; case 0x04b2: // 04b2: ret goto returnInstruction;; case 0x04b3: // 04b3: ld c, 33h sg_sZ80Context.z80C = (UINT8) (0x33); // 04b5: call 0593h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb8; goto L0593; case 0x04b8: // 04b8: ret goto returnInstruction;; case 0x04b9: // 04b9: ld c, 2fh sg_sZ80Context.z80C = (UINT8) (0x2f); // 04bb: call 0593h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbe; goto L0593; case 0x04be: // 04be: ret goto returnInstruction;; case 0x04bf: // 04bf: ld hl, 430dh sg_sZ80Context.z80HL = (UINT16) (0x430d); // 04c2: ld a, 07h sg_sZ80Context.z80A = (UINT8) (0x07); // 04c4: call 05bfh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc7; goto L05bf; case 0x04c7: // 04c7: ld c, 0ch sg_sZ80Context.z80C = (UINT8) (0x0c); // 04c9: call 0585h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xcc; goto L0585; case 0x04cc: // 04cc: ret goto returnInstruction;; case 0x04cd: // 04cd: ld c, 35h sg_sZ80Context.z80C = (UINT8) (0x35); // 04cf: call 0593h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd2; goto L0593; case 0x04d2: // 04d2: ret goto returnInstruction;; case 0x04e9: // 04e9: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xea; goto L0028; case 0x04ec: // 04ec: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xed; goto L0028; case 0x04ef: // 04ef: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf0; goto L0028; case 0x04f2: // 04f2: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf3; goto L0028; case 0x04f5: // 04f5: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 04f7: ld (lives), a ; number of lives left sg_u8mspacman_memory[0x4e14] = sg_sZ80Context.z80A; // 04fa: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 04fb: ld (coincrd), a ; number of players 0=1 1=2 sg_u8mspacman_memory[0x4e70] = sg_sZ80Context.z80A; // 04fe: ld (scrlves), a ; number of lives displayed sg_u8mspacman_memory[0x4e15] = sg_sZ80Context.z80A; // 0501: ld hl, 4332h sg_sZ80Context.z80HL = (UINT16) (0x4332); // 0504: ld (hl), 14h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x14); // 0506: ld a, 0fch L0506: sg_sZ80Context.z80A = (UINT8) (0xfc); // 0508: ld de, 0020h sg_sZ80Context.z80DE = (UINT16) (0x20); // 050b: ld b, 1ch sg_sZ80Context.z80B = (UINT8) (0x1c); // 050d: ld ix, 4040h sg_sZ80Context.z80IX = (UINT16) (0x4040); // 0511: ld (ix+11h), a L0511: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x11, sg_sZ80Context.z80A); // 0514: ld (ix+13h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x13, sg_sZ80Context.z80A); { UINT32 u32Temp0; // 0517: add ix, de u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80IX ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 0519: djnz 0511h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L0511;; } // 051b: ret goto returnInstruction;; case 0x051c: // 051c: ld hl, 4da0h // check for moving through a tunnel? sg_sZ80Context.z80HL = (UINT16) (0x4da0); // 051f: ld b, 21h sg_sZ80Context.z80B = (UINT8) (0x21); // 0521: ld a, (4d3ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3a]); { UINT16 u16Temp0; // 0524: sub a, b ; pac going through a tunnel? u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80B))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 0525: jr nz, 052ch if (((u8Flags & 0x40) >> 6) != 1) { goto L052c;; } // 0527: ld (hl), 01h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 1); // 0529: jp 058eh goto L058e;; // 052c: call 1017h // another core game loop? L052c: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2f; goto L1017; case 0x052f: // 052f: call 1017h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x32; goto L1017; case 0x0532: // 0532: call 0e23h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; goto L0e23; case 0x0535: // 0535: call 0c0dh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x38; goto L0c0d; case 0x0538: // 0538: call 0bd6h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3b; goto L0bd6; case 0x053b: // 053b: call 05a5h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; goto L05a5; case 0x053e: // 053e: call 1efeh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x41; goto L1efe; case 0x0541: // 0541: call 1f25h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x44; goto L1f25; case 0x0544: // 0544: call 1f4ch sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x47; goto L1f4c; case 0x0547: // 0547: call 1f73h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x4a; goto L1f73; case 0x054a: // 054a: ret goto returnInstruction;; // 057c: call 06beh L057c: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x7f; goto L06be; case 0x057f: // 057f: ret goto returnInstruction;; // 0585: ld b, 1ch L0585: sg_sZ80Context.z80B = (UINT8) (0x1c); // 0587: call 0042h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8a; goto L0042; case 0x058a: // 058a: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8b; goto L0030; case 0x058b: // 058b: ld c, d sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80D); // 058c: ld (bc), a mspacmanIndirectWrite8(sg_sZ80Context.z80BC, sg_sZ80Context.z80A); // 058d: nop case 0x058e: // 058e: ld hl, gmemode L058e: sg_sZ80Context.z80HL = (UINT16) (0x4e02); { UINT8 u8Temp0; // 0591: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 0592: ret goto returnInstruction;; // 0593: ld a, (4e75h) L0593: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e75]); { UINT16 u16Temp0; // 0596: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80C))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80C ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80C ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 0597: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 0598: ld b, 1ch sg_sZ80Context.z80B = (UINT8) (0x1c); // 059a: call 0042h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9d; goto L0042; case 0x059d: // 059d: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9e; goto L0030; case 0x05a1: // 05a1: call 058eh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa4; goto L058e; case 0x05a4: // 05a4: ret goto returnInstruction;; // 05a5: ld a, (4db5h) L05a5: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4db5]); // 05a8: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 05a9: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 05aa: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 05ab: ld (4db5h), a sg_u8mspacman_memory[0x4db5] = sg_sZ80Context.z80A; // 05ae: ld a, (4d30h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d30]); // 05b1: xor a, 02h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0x02); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 05b3: ld (4d3ch), a sg_u8mspacman_memory[0x4d3c] = sg_sZ80Context.z80A; // 05b6: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 05b7: ld hl, 32ffh sg_sZ80Context.z80HL = (UINT16) (0x32ff); // 05ba: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbb; goto L0018; case 0x05bb: // 05bb: ld (4d26h), hl sg_u8mspacman_memory[0x4d26] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d27] = sg_sZ80Context.z80H; // 05be: ret goto returnInstruction;; // 05bf: ld (hl), 0b1h L05bf: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0xb1); // 05c1: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 05c2: ld (hl), 0b3h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0xb3); // 05c4: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 05c5: ld (hl), 0b5h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0xb5); // 05c7: ld bc, 001eh sg_sZ80Context.z80BC = (UINT16) (0x1e); { UINT32 u32Temp0; // 05ca: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 05cb: ld (hl), 0b0h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0xb0); // 05cd: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 05ce: ld (hl), 0b2h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0xb2); // 05d0: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 05d1: ld (hl), 0b4h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0xb4); // 05d3: ld de, 0400h sg_sZ80Context.z80DE = (UINT16) (0x0400); { UINT32 u32Temp0; // 05d6: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 05d7: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 05d8: dec l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L - 1); // 05d9: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 05da: dec l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L - 1); // 05db: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 05dc: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 05dd: sbc hl, bc u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80BC - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } // 05df: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 05e0: dec l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L - 1); // 05e1: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 05e2: dec l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80L & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80L & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 05e3: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 05e4: ret goto returnInstruction;; case 0x05e5: // 05e5: ld a, (4e03h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e03]); // 05e8: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe9; goto L0020; case 0x05f3: // 05f3: call 2ba1h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf6; goto L2ba1; case 0x05f6: // 05f6: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf7; goto L0028; case 0x05f9: // 05f9: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xfa; goto L0028; case 0x05fc: // 05fc: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x05; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xfd; goto L0028; case 0x05ff: // 05ff: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0; goto L0028; case 0x0602: // 0602: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; goto L0028; case 0x0605: // 0605: ld hl, 4e03h sg_sZ80Context.z80HL = (UINT16) (0x4e03); { UINT8 u8Temp0; // 0608: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0609: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 060b: ld (4dd6h), a sg_u8mspacman_memory[0x4dd6] = sg_sZ80Context.z80A; // 060e: ld a, (bonusk) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e71]); { UINT16 u16Temp0; // 0611: cp a, 0ffh u16Temp0 = sg_sZ80Context.z80A - 0xff; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0xff))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0xff ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0613: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 0614: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x15; goto L0028; case 0x0617: // 0617: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x18; goto L0028; case 0x061a: // 061a: ret goto returnInstruction;; case 0x061b: // 061b: call 2ba1h // can't find a jump to here // display 1/2 player and check start buttons sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; goto L2ba1; case 0x061e: // 061e: ld a, (credits) ; credits sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6e]); { UINT16 u16Temp0; // 0621: cp a, 01h ; is it 1? u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0623: ld b, 09h ; msg #9: 1 OR 2 PLAYERS sg_sZ80Context.z80B = (UINT8) (0x09); // 0625: jr nz, 0629h ; >2 credits if (((u8Flags & 0x40) >> 6) != 1) { goto L0629;; } // 0627: ld b, 08h ; msg #8: 1 PLAYER ONLY sg_sZ80Context.z80B = (UINT8) (0x08); // 0629: call 2c5eh ; print message L0629: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2c; goto L2c5e; case 0x062c: // 062c: ld a, (credits) ; get credits sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6e]); { UINT16 u16Temp0; // 062f: cp a, 01h ; 1 credit u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0631: ld a, (V1Acc) ; check in1 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 0634: jr z, 0642h ; don't check p2 with 1 credit if (((u8Flags & 0x40) >> 6) == 1) { goto L0642;; } // 0636: bit 6, a u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0x40) == 0)) ? 0x40 : 0); // 0638: jr nz, 0642h if (((u8Flags & 0x40) >> 6) != 1) { goto L0642;; } // 063a: ld a, 01h ; set 2 players sg_sZ80Context.z80A = (UINT8) (1); // 063c: ld (coincrd), a ; players 0=1 1=2 players sg_u8mspacman_memory[0x4e70] = sg_sZ80Context.z80A; // 063f: jp 0649h goto L0649;; // 0642: bit 5, a L0642: u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0x20) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 0644: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0645: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 0646: ld (coincrd), a sg_u8mspacman_memory[0x4e70] = sg_sZ80Context.z80A; // 0649: ld a, (xcoin) L0649: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6b]); // 064c: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 064d: jr z, 0664h ; one coin per game or two? if (((u8Flags & 0x40) >> 6) == 1) { goto L0664;; } // 064f: ld a, (coincrd) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e70]); // 0652: and a, a ; 0 means 1 coin per game u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0653: ld a, (credits) ; number of credits sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6e]); // 0656: jr z, OnePerGame if (((u8Flags & 0x40) >> 6) == 1) { goto L065b;; } { UINT16 u16Temp0; // 0658: add a, 99h ; subtract 1 in BCD u16Temp0 = sg_sZ80Context.z80A + 0x99; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x99))) ? 0x10 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; } { UINT16 u16Temp0; // 065a: daa u16Temp0 = (sg_sZ80Context.z80A | (((u8Flags & 0x01) >> 0) << 0x08) | (((u8Flags & 0x10) >> 4) << 0x09) | (((u8Flags & 0x02) >> 1) << 0x0a)); sg_sZ80Context.z80A = (UINT8) (sg_u16DAATable[u16Temp0] & 0xff); } { UINT16 u16Temp0; // 065b: add a, 99h ; second coin L065b: u16Temp0 = sg_sZ80Context.z80A + 0x99; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x99))) ? 0x10 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; } { UINT16 u16Temp0; // 065d: daa u16Temp0 = (sg_sZ80Context.z80A | (((u8Flags & 0x01) >> 0) << 0x08) | (((u8Flags & 0x10) >> 4) << 0x09) | (((u8Flags & 0x02) >> 1) << 0x0a)); sg_sZ80Context.z80A = (UINT8) (sg_u16DAATable[u16Temp0] & 0xff); } // 065e: ld (credits), a ; resave credits sg_u8mspacman_memory[0x4e6e] = sg_sZ80Context.z80A; // 0661: call 2ba1h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x64; goto L2ba1; case 0x0664: // 0664: ld hl, 4e03h L0664: sg_sZ80Context.z80HL = (UINT16) (0x4e03); { UINT8 u8Temp0; // 0667: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0668: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xfe; // 0669: ld (4dd6h), a sg_u8mspacman_memory[0x4dd6] = sg_sZ80Context.z80A; // 066c: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 066d: ld (4ecch), a sg_u8mspacman_memory[0x4ecc] = sg_sZ80Context.z80A; // 0670: ld (4edch), a sg_u8mspacman_memory[0x4edc] = sg_sZ80Context.z80A; // 0673: ret goto returnInstruction;; case 0x0674: // 0674: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x75; goto L0028; case 0x0677: // 0677: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x78; goto L0028; case 0x067a: // 067a: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x7b; goto L0028; case 0x067d: // 067d: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x7e; goto L0028; case 0x0680: // 0680: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x81; goto L0028; case 0x0683: // 0683: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x84; goto L0028; case 0x0686: // 0686: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x87; goto L0028; case 0x0689: // 0689: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8a; goto L0028; case 0x068c: // 068c: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8d; goto L0028; case 0x068f: // 068f: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xfe; // 0690: ld (boardno), a ; current board level = 0 sg_u8mspacman_memory[0x4e13] = sg_sZ80Context.z80A; // 0693: ld a, (inlives) ; number of lives to start sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6f]); // 0696: ld (lives), a ; number of lives sg_u8mspacman_memory[0x4e14] = sg_sZ80Context.z80A; // 0699: ld (scrlves), a ; number of lives displayed sg_u8mspacman_memory[0x4e15] = sg_sZ80Context.z80A; // 069c: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9d; goto L0028; case 0x069f: // 069f: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa0; goto L0030; case 0x06a3: // 06a3: ld hl, 4e03h sg_sZ80Context.z80HL = (UINT16) (0x4e03); { UINT8 u8Temp0; // 06a6: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 06a7: ret goto returnInstruction;; case 0x06a8: // 06a8: ld hl, scrlves ; hl= lives displayed on screen loc // draw lives displayed onto the screen sg_sZ80Context.z80HL = (UINT16) (0x4e15); { UINT8 u8Temp0; // 06ab: dec (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 06ac: call 2b6ah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xaf; goto L2b6a; case 0x06af: // 06af: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xfe; // 06b0: ld (4e03h), a sg_u8mspacman_memory[0x4e03] = sg_sZ80Context.z80A; // 06b3: ld (gmemode), a sg_u8mspacman_memory[0x4e02] = sg_sZ80Context.z80A; // 06b6: ld (4e04h), a ; level complete register sg_u8mspacman_memory[0x4e04] = sg_sZ80Context.z80A; // 06b9: ld hl, 4e00h ; inc game mode sg_sZ80Context.z80HL = (UINT16) (0x4e00); { UINT8 u8Temp0; // 06bc: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 06bd: ret goto returnInstruction;; case 0x06be: // 06be: ld a, (4e04h) L06be: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e04]); // 06c1: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc2; goto L0020; case 0x070e: // 070e: ld a, b L070e: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 070f: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0710: jr nz, 0716h if (((u8Flags & 0x40) >> 6) != 1) { goto L0716;; } // 0712: ld hl, (4e0ah) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4e0a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4e0b]); // 0715: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 0716: ld ix, 0796h L0716: sg_sZ80Context.z80IX = (UINT16) (0x0796); // 071a: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 071b: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 071c: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 071d: add a, b u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80B; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 071e: add a, b u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80B; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 071f: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 0720: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); { UINT32 u32Temp0; // 0722: add ix, de u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); } // 0724: ld a, (ix+00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); { UINT16 u16Temp0; // 0727: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 0728: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 0729: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 072a: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 072b: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 072c: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 072d: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 072e: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 072f: add a, b u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80B; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 0730: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 0731: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); // 0733: ld hl, 330fh sg_sZ80Context.z80HL = (UINT16) (0x330f); { UINT32 u32Temp0; // 0736: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 0737: call 0814h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x07; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3a; goto L0814; case 0x073a: // 073a: ld a, (ix+01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); // 073d: ld (4db0h), a sg_u8mspacman_memory[0x4db0] = sg_sZ80Context.z80A; // 0740: ld a, (ix+02h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x02]); // 0743: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 0744: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 0745: add a, b u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80B; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 0746: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 0747: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); // 0749: ld hl, 0843h ; hard/easy data table check sg_sZ80Context.z80HL = (UINT16) (0x0843); { UINT32 u32Temp0; // 074c: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 074d: call 083ah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x07; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x50; goto L083a; case 0x0750: // 0750: ld a, (ix+03h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x03]); { UINT16 u16Temp0; // 0753: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 0754: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 0755: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); // 0757: ld iy, 084fh ; another data table check sg_sZ80Context.z80IY = (UINT16) (0x084f); { UINT32 u32Temp0; // 075b: add iy, de u32Temp0 = sg_sZ80Context.z80IY + sg_sZ80Context.z80DE; sg_sZ80Context.z80IY = (UINT16) (u32Temp0 & 0xffff); } // 075d: ld l, (iy+00h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY]); // 0760: ld h, (iy+01h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY + 1]); // 0763: ld (4dbbh), hl sg_u8mspacman_memory[0x4dbb] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dbc] = sg_sZ80Context.z80H; // 0766: ld a, (ix+04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x04]); { UINT16 u16Temp0; // 0769: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 076a: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 076b: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); // 076d: ld iy, 0861h sg_sZ80Context.z80IY = (UINT16) (0x0861); { UINT32 u32Temp0; // 0771: add iy, de u32Temp0 = sg_sZ80Context.z80IY + sg_sZ80Context.z80DE; sg_sZ80Context.z80IY = (UINT16) (u32Temp0 & 0xffff); } // 0773: ld l, (iy+00h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY]); // 0776: ld h, (iy+01h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY + 1]); // 0779: ld (4dbdh), hl sg_u8mspacman_memory[0x4dbd] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dbe] = sg_sZ80Context.z80H; // 077c: ld a, (ix+05h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x05]); { UINT16 u16Temp0; // 077f: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80A ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 0780: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 0781: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); // 0783: ld iy, 0873h sg_sZ80Context.z80IY = (UINT16) (0x0873); { UINT32 u32Temp0; // 0787: add iy, de u32Temp0 = sg_sZ80Context.z80IY + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80IY ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80IY = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 0789: ld l, (iy+00h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY]); // 078c: ld h, (iy+01h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY + 1]); // 078f: ld (4d95h), hl sg_u8mspacman_memory[0x4d95] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d96] = sg_sZ80Context.z80H; // 0792: call 2beah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x07; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; goto L2bea; case 0x0795: // 0795: ret goto returnInstruction;; // 0814: ld de, 4d46h L0814: sg_sZ80Context.z80DE = (UINT16) (0x4d46); // 0817: ld bc, 001ch sg_sZ80Context.z80BC = (UINT16) (0x1c); // 081a: ldir UniqueLabel4: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel4;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 081c: ld bc, 000ch sg_sZ80Context.z80BC = (UINT16) (0x0c); // 081f: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 0820: sbc hl, bc u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80BC - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80BC ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 0822: ldir UniqueLabel5: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel5;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 0824: ld bc, 000ch sg_sZ80Context.z80BC = (UINT16) (0x0c); // 0827: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 0828: sbc hl, bc u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80BC - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80BC ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 082a: ldir UniqueLabel6: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel6;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 082c: ld bc, 000ch sg_sZ80Context.z80BC = (UINT16) (0x0c); // 082f: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 0830: sbc hl, bc u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80BC - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80BC ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 0832: ldir UniqueLabel7: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel7;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 0834: ld bc, 000eh sg_sZ80Context.z80BC = (UINT16) (0x0e); // 0837: ldir UniqueLabel8: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel8;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 0839: ret goto returnInstruction;; // 083a: ld de, 4db8h L083a: sg_sZ80Context.z80DE = (UINT16) (0x4db8); // 083d: ld bc, 0003h sg_sZ80Context.z80BC = (UINT16) (0x03); // 0840: ldir UniqueLabel9: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel9;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 0842: ret goto returnInstruction;; case 0x0879: // 0879: ld hl, 4e09h sg_sZ80Context.z80HL = (UINT16) (0x4e09); // 087c: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 087d: ld b, 0bh sg_sZ80Context.z80B = (UINT8) (0x0b); // 087f: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x80; goto L0008; case 0x0880: // 0880: call 24c9h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x83; goto L24c9; case 0x0883: // 0883: ld hl, (difftyp) ; difficulty sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4e73]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4e74]); // 0886: ld (4e0ah), hl sg_u8mspacman_memory[0x4e0a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4e0b] = sg_sZ80Context.z80H; // 0889: ld hl, 4e0ah sg_sZ80Context.z80HL = (UINT16) (0x4e0a); // 088c: ld de, 4e38h sg_sZ80Context.z80DE = (UINT16) (0x4e38); // 088f: ld bc, 002eh sg_sZ80Context.z80BC = (UINT16) (0x2e); // 0892: ldir UniqueLabel10: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel10;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } case 0x0894: // 0894: ld hl, 4e04h ; inc level complete register L0894: sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 0897: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 0898: ret goto returnInstruction;; case 0x0899: // 0899: ld a, (4e00h) ; game mode sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); // 089c: dec a ; check mode sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 089d: jr nz, 08a5h ; jump if not in intro mode if (((u8Flags & 0x40) >> 6) != 1) { goto L08a5;; } // 089f: ld a, 09h sg_sZ80Context.z80A = (UINT8) (0x09); // 08a1: ld (4e04h), a ; set intro mode? sg_u8mspacman_memory[0x4e04] = sg_sZ80Context.z80A; // 08a4: ret goto returnInstruction;; // 08a5: rst 28h L08a5: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa6; goto L0028; case 0x08a8: // 08a8: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa9; goto L0028; case 0x08ab: // 08ab: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xac; goto L0028; case 0x08ae: // 08ae: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xaf; goto L0028; case 0x08b1: // 08b1: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb2; goto L0028; case 0x08b4: // 08b4: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb5; goto L0028; case 0x08b7: // 08b7: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb8; goto L0030; case 0x08bb: // 08bb: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbc; goto L0030; case 0x08bf: // 08bf: ld a, (cabtype) ; cocktail or upright sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e72]); // 08c2: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 08c3: ld a, (4e09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 08c6: and a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80B); u8Flags &= 0xfe; // 08c7: ld (flpscr), a ; flip screen MSStuffWrite(0x5003,sg_sZ80Context.z80A); // 08ca: jp 0894h goto L0894;; case 0x08cd: // 08cd: ld a, (IRQEn) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5000]); // 08d0: bit 4, a ; rack test u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0x10) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 08d2: jp nz, 08deh ; not on then continue game if (((u8Flags & 0x40) >> 6) != 1) { goto L08de;; } // 08d5: ld hl, 4e04h ; rack switch on, so advance sg_sZ80Context.z80HL = (UINT16) (0x4e04); // 08d8: ld (hl), 0eh ; level complete register gets $0E?? mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x0e); // 08da: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xdb; goto L0028; case 0x08dd: // 08dd: ret goto returnInstruction;; // 08de: ld a, (peleatn) ; number of pellets eaten // routine to determine the number of pellets must be eaten L08de: // 08e1: jp 94a1h ; jump to check routine goto L94a1;; // 08e5: ld hl, 4e04h // returns here L08e5: sg_sZ80Context.z80HL = (UINT16) (0x4e04); // 08e8: ld (hl), 0ch mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x0c); // 08ea: ret goto returnInstruction;; // 08eb: call 1017h // another core game loop? L08eb: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xee; goto L1017; case 0x08ee: // 08ee: call 1017h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf1; goto L1017; case 0x08f1: // 08f1: call 13ddh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf4; goto L13dd; case 0x08f4: // 08f4: call 0c42h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf7; goto L0c42; case 0x08f7: // 08f7: call 0e23h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xfa; goto L0e23; case 0x08fa: // 08fa: call 0e36h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xfd; goto L0e36; case 0x08fd: // 08fd: call 0ac3h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0; goto L0ac3; case 0x0900: // 0900: call 0bd6h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; goto L0bd6; case 0x0903: // 0903: call 0c0dh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; goto L0c0d; case 0x0906: // 0906: call 0e6ch sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; goto L0e6c; case 0x0909: // 0909: call 0eadh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0c; goto L0ead; case 0x090c: // 090c: ret goto returnInstruction;; case 0x090d: // 090d: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 090f: ld (4e12h), a sg_u8mspacman_memory[0x4e12] = sg_sZ80Context.z80A; // 0912: call 2487h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x15; goto L2487; case 0x0915: // 0915: ld hl, 4e04h sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 0918: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0919: ld a, (lives) ; number of lives left sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e14]); // 091c: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 091d: jr nz, 093eh if (((u8Flags & 0x40) >> 6) != 1) { goto L093e;; } // 091f: ld a, (coincrd) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e70]); // 0922: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0923: jr z, 093eh if (((u8Flags & 0x40) >> 6) == 1) { goto L093e;; } // 0925: ld a, (4e42h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e42]); // 0928: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0929: jr z, 093eh if (((u8Flags & 0x40) >> 6) == 1) { goto L093e;; } // 092b: ld a, (4e09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); { UINT16 u16Temp0; // 092e: add a, 03h u16Temp0 = sg_sZ80Context.z80A + 0x03; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x03))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x03 ^ sg_sZ80Context.z80A ^ 0x80) & (0x03 ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 0930: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 0931: ld b, 1ch sg_sZ80Context.z80B = (UINT8) (0x1c); // 0933: call 0042h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x36; goto L0042; case 0x0936: // 0936: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x37; goto L0028; case 0x0939: // 0939: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3a; goto L0030; case 0x093d: // 093d: ret goto returnInstruction;; { UINT8 u8Temp0; // 093e: inc (hl) L093e: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 093f: ret goto returnInstruction;; case 0x0940: // 0940: ld a, (coincrd) ; number of players sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e70]); // 0943: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0944: jr z, 094ch ; jump if 1 player if (((u8Flags & 0x40) >> 6) == 1) { goto L094c;; } // 0946: ld a, (4e42h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e42]); // 0949: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 094a: jr nz, 0961h if (((u8Flags & 0x40) >> 6) != 1) { goto L0961;; } // 094c: ld a, (lives) ; number of lives left L094c: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e14]); // 094f: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0950: jr nz, 096ch ; jump if lives left // change 0950 to // for never-ending pac goodness if (((u8Flags & 0x40) >> 6) != 1) { goto L096c;; } // 0952: call 2ba1h ; draw # credits or free play sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x55; goto L2ba1; case 0x0955: // 0955: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x56; goto L0028; case 0x0958: // 0958: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x59; goto L0030; case 0x095c: // 095c: ld hl, 4e04h sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 095f: inc (hl) ; increment level cleared mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 0960: ret goto returnInstruction;; // 0961: call 0aa6h L0961: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x64; goto L0aa6; case 0x0964: // 0964: ld a, (4e09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 0967: xor a, 01h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 1); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0969: ld (4e09h), a sg_u8mspacman_memory[0x4e09] = sg_sZ80Context.z80A; // 096c: ld a, 09h L096c: sg_sZ80Context.z80A = (UINT8) (0x09); // 096e: ld (4e04h), a sg_u8mspacman_memory[0x4e04] = sg_sZ80Context.z80A; // 0971: ret goto returnInstruction;; case 0x0972: // 0972: xor a, a // zero some important variables sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0973: ld (gmemode), a sg_u8mspacman_memory[0x4e02] = sg_sZ80Context.z80A; // 0976: ld (4e04h), a sg_u8mspacman_memory[0x4e04] = sg_sZ80Context.z80A; // 0979: ld (coincrd), a sg_u8mspacman_memory[0x4e70] = sg_sZ80Context.z80A; // 097c: ld (4e09h), a sg_u8mspacman_memory[0x4e09] = sg_sZ80Context.z80A; // 097f: ld (flpscr), a ; flip screen MSStuffWrite(0x5003,sg_sZ80Context.z80A); // 0982: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 0984: ld (4e00h), a sg_u8mspacman_memory[0x4e00] = sg_sZ80Context.z80A; // 0987: ret goto returnInstruction;; case 0x0988: // 0988: rst 28h L0988: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x89; goto L0028; case 0x098b: // 098b: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8c; goto L0028; case 0x098e: // 098e: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8f; goto L0028; case 0x0991: // 0991: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x92; goto L0028; case 0x0994: // 0994: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; goto L0028; case 0x0997: // 0997: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x98; goto L0028; case 0x099a: // 099a: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9b; goto L0028; case 0x099d: // 099d: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9e; goto L0028; case 0x09a0: // 09a0: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa1; goto L0028; case 0x09a3: // 09a3: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa4; goto L0028; case 0x09a6: // 09a6: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa7; goto L0028; case 0x09a9: // 09a9: ld a, (4e00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); { UINT16 u16Temp0; // 09ac: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 09ae: jr z, 09b6h if (((u8Flags & 0x40) >> 6) == 1) { goto L09b6;; } // 09b0: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb1; goto L0028; case 0x09b3: // 09b3: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb4; goto L0028; case 0x09b6: // 09b6: rst 30h L09b6: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb7; goto L0030; case 0x09ba: // 09ba: ld a, (4e00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); // 09bd: dec a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 09be: jr z, 09c4h if (((u8Flags & 0x40) >> 6) == 1) { goto L09c4;; } // 09c0: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc1; goto L0030; case 0x09c4: // 09c4: ld a, (cabtype) L09c4: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e72]); // 09c7: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 09c8: ld a, (4e09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 09cb: and a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80B); u8Flags &= 0xfe; // 09cc: ld (flpscr), a ; flip screen MSStuffWrite(0x5003,sg_sZ80Context.z80A); // 09cf: jp 0894h goto L0894;; case 0x09d2: // 09d2: ld a, 03h L09d2: sg_sZ80Context.z80A = (UINT8) (0x03); // 09d4: ld (4e04h), a sg_u8mspacman_memory[0x4e04] = sg_sZ80Context.z80A; // 09d7: ret goto returnInstruction;; case 0x09d8: // 09d8: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd9; goto L0030; case 0x09dc: // 09dc: ld hl, 4e04h sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 09df: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 09e0: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 09e1: ld (4each), a sg_u8mspacman_memory[0x4eac] = sg_sZ80Context.z80A; // 09e4: ld (4ebch), a sg_u8mspacman_memory[0x4ebc] = sg_sZ80Context.z80A; // 09e7: ret goto returnInstruction;; case 0x09e8: // 09e8: ld c, 02h L09e8: sg_sZ80Context.z80C = (UINT8) (0x02); // 09ea: ld b, 01h L09ea: sg_sZ80Context.z80B = (UINT8) (1); // 09ec: call 0042h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xef; goto L0042; case 0x09ef: // 09ef: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf0; goto L0030; case 0x09f3: // 09f3: ld hl, 0000h sg_sZ80Context.z80HL = (UINT16) (0); // 09f6: call 267eh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf9; goto L267e; case 0x09f9: // 09f9: ld hl, 4e04h sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 09fc: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 09fd: ret goto returnInstruction;; case 0x09fe: // 09fe: ld c, 00h L09fe: sg_sZ80Context.z80C = (UINT8) (0); // 0a00: jr 09eah goto L09ea;; case 0x0a02: // 0a02: jr 09e8h goto L09e8;; case 0x0a04: // 0a04: jr 09feh goto L09fe;; case 0x0a06: // 0a06: jr 09e8h goto L09e8;; case 0x0a08: // 0a08: jr 09feh goto L09fe;; case 0x0a0a: // 0a0a: jr 09e8h goto L09e8;; case 0x0a0c: // 0a0c: jr 09feh goto L09fe;; case 0x0a0e: // 0a0e: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0f; goto L0028; case 0x0a11: // 0a11: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x12; goto L0028; case 0x0a14: // 0a14: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x15; goto L0028; case 0x0a17: // 0a17: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x18; goto L0028; case 0x0a1a: // 0a1a: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1b; goto L0028; case 0x0a1d: // 0a1d: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; goto L0028; case 0x0a20: // 0a20: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; goto L0028; case 0x0a23: // 0a23: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x24; goto L0030; case 0x0a27: // 0a27: ld hl, 4e04h sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 0a2a: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 0a2b: ret goto returnInstruction;; case 0x0a2c: // 0a2c: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 0a2d: ld (4each), a sg_u8mspacman_memory[0x4eac] = sg_sZ80Context.z80A; // 0a30: ld (4ebch), a sg_u8mspacman_memory[0x4ebc] = sg_sZ80Context.z80A; // 0a33: jr 0a3bh goto L0a3b;; case 0x0a35: // 0a35: ld (4ecch), a sg_u8mspacman_memory[0x4ecc] = sg_sZ80Context.z80A; // 0a38: ld (4edch), a sg_u8mspacman_memory[0x4edc] = sg_sZ80Context.z80A; // 0a3b: ld a, (boardno) ; current board level L0a3b: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e13]); { UINT16 u16Temp0; // 0a3e: cp a, 14h u16Temp0 = sg_sZ80Context.z80A - 0x14; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 0a40: jr c, 0a44h if (((u8Flags & 0x01) >> 0) == 1) { goto L0a44;; } // 0a42: ld a, 14h sg_sZ80Context.z80A = (UINT8) (0x14); // 0a44: rst 20h L0a44: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x45; goto L0020; case 0x0a6f: // 0a6f: ld hl, 4e04h // increment level state and stop sound sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 0a72: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } { UINT8 u8Temp0; // 0a73: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0a74: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0a75: ld (4ecch), a sg_u8mspacman_memory[0x4ecc] = sg_sZ80Context.z80A; // 0a78: ld (4edch), a sg_u8mspacman_memory[0x4edc] = sg_sZ80Context.z80A; // 0a7b: ret goto returnInstruction;; case 0x0a7c: // 0a7c: xor a, a // we're about to start the next board, (it's about to be drawn) sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0a7d: ld (4ecch), a sg_u8mspacman_memory[0x4ecc] = sg_sZ80Context.z80A; // 0a80: ld (4edch), a sg_u8mspacman_memory[0x4edc] = sg_sZ80Context.z80A; // 0a83: ld b, 07h sg_sZ80Context.z80B = (UINT8) (0x07); // 0a85: ld hl, 4e0ch sg_sZ80Context.z80HL = (UINT16) (0x4e0c); // 0a88: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x89; goto L0008; case 0x0a89: // 0a89: call 24c9h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8c; goto L24c9; case 0x0a8c: // 0a8c: ld hl, 4e04h sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 0a8f: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0a90: ld hl, boardno ; current board level // level 255 pac fix ; HACK8 // level 141 mspac fix ; HACK9 sg_sZ80Context.z80HL = (UINT16) (0x4e13); { UINT8 u8Temp0; // 0a93: inc (hl) ; increment board level mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0a94: ld hl, (4e0ah) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4e0a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4e0b]); // 0a97: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 0a98: cp a, 14h u16Temp0 = sg_sZ80Context.z80A - 0x14; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x14))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x14 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0a9a: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 0a9b: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 0a9c: ld (4e0ah), hl sg_u8mspacman_memory[0x4e0a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4e0b] = sg_sZ80Context.z80H; // 0a9f: ret goto returnInstruction;; case 0x0aa0: // 0aa0: jp 0988h goto L0988;; case 0x0aa3: // 0aa3: jp 09d2h goto L09d2;; // 0aa6: ld b, 2eh L0aa6: sg_sZ80Context.z80B = (UINT8) (0x2e); // 0aa8: ld ix, 4e0ah sg_sZ80Context.z80IX = (UINT16) (0x4e0a); // 0aac: ld iy, 4e38h sg_sZ80Context.z80IY = (UINT16) (0x4e38); // 0ab0: ld d, (ix+00h) L0ab0: sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 0ab3: ld e, (iy+00h) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY]); // 0ab6: ld (iy+00h), d mspacmanIndirectWrite8(sg_sZ80Context.z80IY, sg_sZ80Context.z80D); // 0ab9: ld (ix+00h), e mspacmanIndirectWrite8(sg_sZ80Context.z80IX, sg_sZ80Context.z80E); // 0abc: inc ix sg_sZ80Context.z80IX = (UINT16) (sg_sZ80Context.z80IX + 1); // 0abe: inc iy sg_sZ80Context.z80IY = (UINT16) (sg_sZ80Context.z80IY + 1); // 0ac0: djnz 0ab0h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L0ab0;; } // 0ac2: ret goto returnInstruction;; // 0ac3: ld a, (4da4h) L0ac3: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da4]); // 0ac6: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0ac7: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0ac8: ld ix, 4c00h sg_sZ80Context.z80IX = (UINT16) (0x4c00); // 0acc: ld iy, 4dc8h sg_sZ80Context.z80IY = (UINT16) (0x4dc8); // 0ad0: ld de, 0100h sg_sZ80Context.z80DE = (UINT16) (0x0100); { UINT16 u16Temp0; // 0ad3: cp a, (iy+00h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IY]; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0ad6: jp nz, 0bd2h if (((u8Flags & 0x40) >> 6) != 1) { goto L0bd2;; } // 0ad9: ld (iy+00h), 0eh mspacmanIndirectWrite8(sg_sZ80Context.z80IY, 0x0e); // 0add: ld a, (4da6h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da6]); // 0ae0: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0ae1: jr z, 0afeh if (((u8Flags & 0x40) >> 6) == 1) { goto L0afe;; } // 0ae3: ld hl, (4dcbh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dcb]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dcc]); // 0ae6: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 0ae7: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } // 0ae9: jr nc, 0afeh if (((u8Flags & 0x01) >> 0) != 1) { goto L0afe;; } // 0aeb: ld hl, 4each sg_sZ80Context.z80HL = (UINT16) (0x4eac); // 0aee: set 7, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 0x80); // 0af0: ld a, 09h sg_sZ80Context.z80A = (UINT8) (0x09); { UINT16 u16Temp0; // 0af2: cp a, (ix+0bh) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0b]; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0af5: jr nz, 0afbh if (((u8Flags & 0x40) >> 6) != 1) { goto L0afb;; } // 0af7: res 7, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] & 0x7f); // 0af9: ld a, 09h sg_sZ80Context.z80A = (UINT8) (0x09); // 0afb: ld (4c0bh), a L0afb: sg_u8mspacman_memory[0x4c0b] = sg_sZ80Context.z80A; // 0afe: ld a, (4da7h) L0afe: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da7]); // 0b01: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0b02: jr z, 0b21h if (((u8Flags & 0x40) >> 6) == 1) { goto L0b21;; } // 0b04: ld hl, (4dcbh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dcb]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dcc]); // 0b07: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 0b08: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } // 0b0a: jr nc, 0b33h if (((u8Flags & 0x01) >> 0) != 1) { goto L0b33;; } // 0b0c: ld a, 11h sg_sZ80Context.z80A = (UINT8) (0x11); { UINT16 u16Temp0; // 0b0e: cp a, (ix+03h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x03]; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0b11: jr z, 0b1ah if (((u8Flags & 0x40) >> 6) == 1) { goto L0b1a;; } // 0b13: ld (ix+03h), 11h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x03, 0x11); // 0b17: jp 0b33h goto L0b33;; // 0b1a: ld (ix+03h), 12h L0b1a: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x03, 0x12); // 0b1e: jp 0b33h goto L0b33;; // 0b21: ld a, 01h L0b21: sg_sZ80Context.z80A = (UINT8) (1); { UINT16 u16Temp0; // 0b23: cp a, (ix+03h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x03]; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0b26: jr z, 0b2fh if (((u8Flags & 0x40) >> 6) == 1) { goto L0b2f;; } // 0b28: ld (ix+03h), 01h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x03, 1); // 0b2c: jp 0b33h goto L0b33;; // 0b2f: ld (ix+03h), 01h L0b2f: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x03, 1); // 0b33: ld a, (4da8h) L0b33: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da8]); // 0b36: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0b37: jr z, 0b56h if (((u8Flags & 0x40) >> 6) == 1) { goto L0b56;; } // 0b39: ld hl, (4dcbh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dcb]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dcc]); // 0b3c: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 0b3d: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } // 0b3f: jr nc, 0b68h if (((u8Flags & 0x01) >> 0) != 1) { goto L0b68;; } // 0b41: ld a, 11h sg_sZ80Context.z80A = (UINT8) (0x11); { UINT16 u16Temp0; // 0b43: cp a, (ix+05h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x05]; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0b46: jr z, 0b4fh if (((u8Flags & 0x40) >> 6) == 1) { goto L0b4f;; } // 0b48: ld (ix+05h), 11h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x05, 0x11); // 0b4c: jp 0b68h goto L0b68;; // 0b4f: ld (ix+05h), 12h L0b4f: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x05, 0x12); // 0b53: jp 0b68h goto L0b68;; // 0b56: ld a, 03h L0b56: sg_sZ80Context.z80A = (UINT8) (0x03); { UINT16 u16Temp0; // 0b58: cp a, (ix+05h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x05]; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0b5b: jr z, 0b64h if (((u8Flags & 0x40) >> 6) == 1) { goto L0b64;; } // 0b5d: ld (ix+05h), 03h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x05, 0x03); // 0b61: jp 0b68h goto L0b68;; // 0b64: ld (ix+05h), 03h L0b64: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x05, 0x03); // 0b68: ld a, (4da9h) L0b68: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da9]); // 0b6b: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0b6c: jr z, 0b8bh if (((u8Flags & 0x40) >> 6) == 1) { goto L0b8b;; } // 0b6e: ld hl, (4dcbh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dcb]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dcc]); // 0b71: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 0b72: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } // 0b74: jr nc, 0b9dh if (((u8Flags & 0x01) >> 0) != 1) { goto L0b9d;; } // 0b76: ld a, 11h sg_sZ80Context.z80A = (UINT8) (0x11); { UINT16 u16Temp0; // 0b78: cp a, (ix+07h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x07]; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0b7b: jr z, 0b84h if (((u8Flags & 0x40) >> 6) == 1) { goto L0b84;; } // 0b7d: ld (ix+07h), 11h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, 0x11); // 0b81: jp 0b9dh goto L0b9d;; // 0b84: ld (ix+07h), 12h L0b84: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, 0x12); // 0b88: jp 0b9dh goto L0b9d;; // 0b8b: ld a, 05h L0b8b: sg_sZ80Context.z80A = (UINT8) (0x05); { UINT16 u16Temp0; // 0b8d: cp a, (ix+07h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x07]; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0b90: jr z, 0b99h if (((u8Flags & 0x40) >> 6) == 1) { goto L0b99;; } // 0b92: ld (ix+07h), 05h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, 0x05); // 0b96: jp 0b9dh goto L0b9d;; // 0b99: ld (ix+07h), 05h L0b99: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, 0x05); // 0b9d: ld a, (4daah) L0b9d: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daa]); // 0ba0: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0ba1: jr z, 0bc0h if (((u8Flags & 0x40) >> 6) == 1) { goto L0bc0;; } // 0ba3: ld hl, (4dcbh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dcb]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dcc]); // 0ba6: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 0ba7: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } // 0ba9: jr nc, 0bd2h if (((u8Flags & 0x01) >> 0) != 1) { goto L0bd2;; } // 0bab: ld a, 11h sg_sZ80Context.z80A = (UINT8) (0x11); { UINT16 u16Temp0; // 0bad: cp a, (ix+09h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x09]; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0bb0: jr z, 0bb9h if (((u8Flags & 0x40) >> 6) == 1) { goto L0bb9;; } // 0bb2: ld (ix+09h), 11h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x09, 0x11); // 0bb6: jp 0bd2h goto L0bd2;; // 0bb9: ld (ix+09h), 12h L0bb9: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x09, 0x12); // 0bbd: jp 0bd2h goto L0bd2;; // 0bc0: ld a, 07h L0bc0: sg_sZ80Context.z80A = (UINT8) (0x07); { UINT16 u16Temp0; // 0bc2: cp a, (ix+09h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x09]; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0bc5: jr z, 0bceh if (((u8Flags & 0x40) >> 6) == 1) { goto L0bce;; } // 0bc7: ld (ix+09h), 07h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x09, 0x07); // 0bcb: jp 0bd2h goto L0bd2;; // 0bce: ld (ix+09h), 07h L0bce: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x09, 0x07); { UINT8 u8Temp0; // 0bd2: dec (iy+00h) L0bd2: mspacmanIndirectWrite8(sg_sZ80Context.z80IY, sg_u8mspacman_memory[sg_sZ80Context.z80IY] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80IY]; u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 0bd5: ret goto returnInstruction;; // 0bd6: ld b, 19h L0bd6: sg_sZ80Context.z80B = (UINT8) (0x19); // 0bd8: ld a, (gmemode) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e02]); { UINT16 u16Temp0; // 0bdb: cp a, 22h u16Temp0 = sg_sZ80Context.z80A - 0x22; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0bdd: jp nz, 0be2h if (((u8Flags & 0x40) >> 6) != 1) { goto L0be2;; } // 0be0: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 0be2: ld ix, 4c00h L0be2: sg_sZ80Context.z80IX = (UINT16) (0x4c00); // 0be6: ld a, (4dach) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dac]); // 0be9: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0bea: jp z, 0bf0h if (((u8Flags & 0x40) >> 6) == 1) { goto L0bf0;; } // 0bed: ld (ix+03h), b mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x03, sg_sZ80Context.z80B); // 0bf0: ld a, (4dadh) L0bf0: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dad]); // 0bf3: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0bf4: jp z, 0bfah if (((u8Flags & 0x40) >> 6) == 1) { goto L0bfa;; } // 0bf7: ld (ix+05h), b mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x05, sg_sZ80Context.z80B); // 0bfa: ld a, (4daeh) L0bfa: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dae]); // 0bfd: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0bfe: jp z, 0c04h if (((u8Flags & 0x40) >> 6) == 1) { goto L0c04;; } // 0c01: ld (ix+07h), b mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, sg_sZ80Context.z80B); // 0c04: ld a, (4dafh) L0c04: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daf]); // 0c07: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0c08: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 0c09: ld (ix+09h), b mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x09, sg_sZ80Context.z80B); // 0c0c: ret goto returnInstruction;; // 0c0d: ld hl, 4dcfh L0c0d: sg_sZ80Context.z80HL = (UINT16) (0x4dcf); { UINT8 u8Temp0; // 0c10: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0c11: ld a, 0ah sg_sZ80Context.z80A = (UINT8) (0x0a); { UINT16 u16Temp0; UINT8 u8Temp0; // 0c13: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0c14: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0c15: ld (hl), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0); // 0c17: ld a, (4e04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e04]); { UINT16 u16Temp0; // 0c1a: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0c1c: jr nz, 0c33h if (((u8Flags & 0x40) >> 6) != 1) { goto L0c33;; } // 0c1e: ld hl, 4464h // 0c21: jp 9524h goto L9524;; // 0c33: ld hl, 4732h L0c33: sg_sZ80Context.z80HL = (UINT16) (0x4732); // 0c36: ld a, 10h sg_sZ80Context.z80A = (UINT8) (0x10); { UINT16 u16Temp0; UINT8 u8Temp0; // 0c38: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0c39: jr nz, 0c3dh if (((u8Flags & 0x40) >> 6) != 1) { goto L0c3d;; } // 0c3b: ld a, 00h sg_sZ80Context.z80A = (UINT8) (0); // 0c3d: ld (hl), a L0c3d: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 0c3e: ld (4678h), a MSPacVideoWrite(0x4678,sg_sZ80Context.z80A); // 0c41: ret goto returnInstruction;; // 0c42: ld a, (4da4h) L0c42: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da4]); // 0c45: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0c46: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0c47: ld a, (4d94h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d94]); // 0c4a: rlca u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 0x80) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); u8Flags &= 0xef; u8Flags &= 0xfd; // 0c4b: ld (4d94h), a sg_u8mspacman_memory[0x4d94] = sg_sZ80Context.z80A; // 0c4e: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 0c4f: ld a, (4da0h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da0]); // 0c52: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0c53: jp nz, 0c90h if (((u8Flags & 0x40) >> 6) != 1) { goto L0c90;; } // 0c56: ld ix, 3305h sg_sZ80Context.z80IX = (UINT16) (0x3305); // 0c5a: ld iy, 4d00h sg_sZ80Context.z80IY = (UINT16) (0x4d00); // 0c5e: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x61; goto L2000; case 0x0c61: // 0c61: ld (4d00h), hl sg_u8mspacman_memory[0x4d00] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d01] = sg_sZ80Context.z80H; // 0c64: ld a, 03h sg_sZ80Context.z80A = (UINT8) (0x03); // 0c66: ld (4d28h), a sg_u8mspacman_memory[0x4d28] = sg_sZ80Context.z80A; // 0c69: ld (4d2ch), a sg_u8mspacman_memory[0x4d2c] = sg_sZ80Context.z80A; // 0c6c: ld a, (4d00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d00]); { UINT16 u16Temp0; // 0c6f: cp a, 64h u16Temp0 = sg_sZ80Context.z80A - 0x64; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0c71: jp nz, 0c90h if (((u8Flags & 0x40) >> 6) != 1) { goto L0c90;; } // 0c74: ld hl, 2e2ch sg_sZ80Context.z80HL = (UINT16) (0x2e2c); // 0c77: ld (4d0ah), hl sg_u8mspacman_memory[0x4d0a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0b] = sg_sZ80Context.z80H; // 0c7a: ld hl, 0100h sg_sZ80Context.z80HL = (UINT16) (0x0100); // 0c7d: ld (4d14h), hl sg_u8mspacman_memory[0x4d14] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d15] = sg_sZ80Context.z80H; // 0c80: ld (4d1eh), hl sg_u8mspacman_memory[0x4d1e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1f] = sg_sZ80Context.z80H; // 0c83: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 0c85: ld (4d28h), a sg_u8mspacman_memory[0x4d28] = sg_sZ80Context.z80A; // 0c88: ld (4d2ch), a sg_u8mspacman_memory[0x4d2c] = sg_sZ80Context.z80A; // 0c8b: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 0c8d: ld (4da0h), a sg_u8mspacman_memory[0x4da0] = sg_sZ80Context.z80A; // 0c90: ld a, (4da1h) L0c90: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da1]); { UINT16 u16Temp0; // 0c93: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0c95: jp z, 0cfbh if (((u8Flags & 0x40) >> 6) == 1) { goto L0cfb;; } { UINT16 u16Temp0; // 0c98: cp a, 00h u16Temp0 = sg_sZ80Context.z80A; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0c9a: jp nz, 0cc1h if (((u8Flags & 0x40) >> 6) != 1) { goto L0cc1;; } // 0c9d: ld a, (4d02h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d02]); { UINT16 u16Temp0; // 0ca0: cp a, 78h u16Temp0 = sg_sZ80Context.z80A - 0x78; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0ca2: call z, 1f2eh if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa5; goto L1f2e; } case 0x0ca5: { UINT16 u16Temp0; // 0ca5: cp a, 80h u16Temp0 = sg_sZ80Context.z80A - 0x80; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0ca7: call z, 1f2eh if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xaa; goto L1f2e; } case 0x0caa: // 0caa: ld a, (4d2dh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2d]); // 0cad: ld (4d29h), a sg_u8mspacman_memory[0x4d29] = sg_sZ80Context.z80A; // 0cb0: ld ix, 4d20h sg_sZ80Context.z80IX = (UINT16) (0x4d20); // 0cb4: ld iy, 4d02h sg_sZ80Context.z80IY = (UINT16) (0x4d02); // 0cb8: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbb; goto L2000; case 0x0cbb: // 0cbb: ld (4d02h), hl sg_u8mspacman_memory[0x4d02] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d03] = sg_sZ80Context.z80H; // 0cbe: jp 0cfbh goto L0cfb;; // 0cc1: ld ix, 3305h L0cc1: sg_sZ80Context.z80IX = (UINT16) (0x3305); // 0cc5: ld iy, 4d02h sg_sZ80Context.z80IY = (UINT16) (0x4d02); // 0cc9: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xcc; goto L2000; case 0x0ccc: // 0ccc: ld (4d02h), hl sg_u8mspacman_memory[0x4d02] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d03] = sg_sZ80Context.z80H; // 0ccf: ld a, 03h sg_sZ80Context.z80A = (UINT8) (0x03); // 0cd1: ld (4d2dh), a sg_u8mspacman_memory[0x4d2d] = sg_sZ80Context.z80A; // 0cd4: ld (4d29h), a sg_u8mspacman_memory[0x4d29] = sg_sZ80Context.z80A; // 0cd7: ld a, (4d02h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d02]); { UINT16 u16Temp0; // 0cda: cp a, 64h u16Temp0 = sg_sZ80Context.z80A - 0x64; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0cdc: jp nz, 0cfbh if (((u8Flags & 0x40) >> 6) != 1) { goto L0cfb;; } // 0cdf: ld hl, 2e2ch sg_sZ80Context.z80HL = (UINT16) (0x2e2c); // 0ce2: ld (4d0ch), hl sg_u8mspacman_memory[0x4d0c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0d] = sg_sZ80Context.z80H; // 0ce5: ld hl, 0100h sg_sZ80Context.z80HL = (UINT16) (0x0100); // 0ce8: ld (4d16h), hl sg_u8mspacman_memory[0x4d16] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d17] = sg_sZ80Context.z80H; // 0ceb: ld (4d20h), hl sg_u8mspacman_memory[0x4d20] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d21] = sg_sZ80Context.z80H; // 0cee: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 0cf0: ld (4d29h), a sg_u8mspacman_memory[0x4d29] = sg_sZ80Context.z80A; // 0cf3: ld (4d2dh), a sg_u8mspacman_memory[0x4d2d] = sg_sZ80Context.z80A; // 0cf6: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 0cf8: ld (4da1h), a sg_u8mspacman_memory[0x4da1] = sg_sZ80Context.z80A; // 0cfb: ld a, (4da2h) L0cfb: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da2]); { UINT16 u16Temp0; // 0cfe: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0d00: jp z, 0d93h if (((u8Flags & 0x40) >> 6) == 1) { goto L0d93;; } { UINT16 u16Temp0; // 0d03: cp a, 00h u16Temp0 = sg_sZ80Context.z80A; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0d05: jp nz, 0d2ch if (((u8Flags & 0x40) >> 6) != 1) { goto L0d2c;; } // 0d08: ld a, (4d04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d04]); { UINT16 u16Temp0; // 0d0b: cp a, 78h u16Temp0 = sg_sZ80Context.z80A - 0x78; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0d0d: call z, 1f55h if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; goto L1f55; } case 0x0d10: { UINT16 u16Temp0; // 0d10: cp a, 80h u16Temp0 = sg_sZ80Context.z80A - 0x80; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0d12: call z, 1f55h if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x15; goto L1f55; } case 0x0d15: // 0d15: ld a, (4d2eh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2e]); // 0d18: ld (4d2ah), a sg_u8mspacman_memory[0x4d2a] = sg_sZ80Context.z80A; // 0d1b: ld ix, 4d22h sg_sZ80Context.z80IX = (UINT16) (0x4d22); // 0d1f: ld iy, 4d04h sg_sZ80Context.z80IY = (UINT16) (0x4d04); // 0d23: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x26; goto L2000; case 0x0d26: // 0d26: ld (4d04h), hl sg_u8mspacman_memory[0x4d04] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d05] = sg_sZ80Context.z80H; // 0d29: jp 0d93h goto L0d93;; // 0d2c: ld a, (4da2h) L0d2c: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da2]); { UINT16 u16Temp0; // 0d2f: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0d31: jp nz, 0d59h if (((u8Flags & 0x40) >> 6) != 1) { goto L0d59;; } // 0d34: ld ix, 32ffh sg_sZ80Context.z80IX = (UINT16) (0x32ff); // 0d38: ld iy, 4d04h sg_sZ80Context.z80IY = (UINT16) (0x4d04); // 0d3c: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3f; goto L2000; case 0x0d3f: // 0d3f: ld (4d04h), hl sg_u8mspacman_memory[0x4d04] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d05] = sg_sZ80Context.z80H; // 0d42: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 0d43: ld (4d2ah), a sg_u8mspacman_memory[0x4d2a] = sg_sZ80Context.z80A; // 0d46: ld (4d2eh), a sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80A; // 0d49: ld a, (4d05h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d05]); { UINT16 u16Temp0; // 0d4c: cp a, 80h u16Temp0 = sg_sZ80Context.z80A - 0x80; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0d4e: jp nz, 0d93h if (((u8Flags & 0x40) >> 6) != 1) { goto L0d93;; } // 0d51: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 0d53: ld (4da2h), a sg_u8mspacman_memory[0x4da2] = sg_sZ80Context.z80A; // 0d56: jp 0d93h goto L0d93;; // 0d59: ld ix, 3305h L0d59: sg_sZ80Context.z80IX = (UINT16) (0x3305); // 0d5d: ld iy, 4d04h sg_sZ80Context.z80IY = (UINT16) (0x4d04); // 0d61: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x64; goto L2000; case 0x0d64: // 0d64: ld (4d04h), hl sg_u8mspacman_memory[0x4d04] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d05] = sg_sZ80Context.z80H; // 0d67: ld a, 03h sg_sZ80Context.z80A = (UINT8) (0x03); // 0d69: ld (4d2ah), a sg_u8mspacman_memory[0x4d2a] = sg_sZ80Context.z80A; // 0d6c: ld (4d2eh), a sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80A; // 0d6f: ld a, (4d04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d04]); { UINT16 u16Temp0; // 0d72: cp a, 64h u16Temp0 = sg_sZ80Context.z80A - 0x64; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0d74: jp nz, 0d93h if (((u8Flags & 0x40) >> 6) != 1) { goto L0d93;; } // 0d77: ld hl, 2e2ch sg_sZ80Context.z80HL = (UINT16) (0x2e2c); // 0d7a: ld (4d0eh), hl sg_u8mspacman_memory[0x4d0e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0f] = sg_sZ80Context.z80H; // 0d7d: ld hl, 0100h sg_sZ80Context.z80HL = (UINT16) (0x0100); // 0d80: ld (4d18h), hl sg_u8mspacman_memory[0x4d18] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d19] = sg_sZ80Context.z80H; // 0d83: ld (4d22h), hl sg_u8mspacman_memory[0x4d22] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d23] = sg_sZ80Context.z80H; // 0d86: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 0d88: ld (4d2ah), a sg_u8mspacman_memory[0x4d2a] = sg_sZ80Context.z80A; // 0d8b: ld (4d2eh), a sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80A; // 0d8e: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 0d90: ld (4da2h), a sg_u8mspacman_memory[0x4da2] = sg_sZ80Context.z80A; // 0d93: ld a, (4da3h) L0d93: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da3]); { UINT16 u16Temp0; // 0d96: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 1))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0d98: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } { UINT16 u16Temp0; // 0d99: cp a, 00h u16Temp0 = sg_sZ80Context.z80A; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0d9b: jp nz, 0dc0h if (((u8Flags & 0x40) >> 6) != 1) { goto L0dc0;; } // 0d9e: ld a, (4d06h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d06]); { UINT16 u16Temp0; // 0da1: cp a, 78h u16Temp0 = sg_sZ80Context.z80A - 0x78; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0da3: call z, 1f7ch if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa6; goto L1f7c; } case 0x0da6: { UINT16 u16Temp0; // 0da6: cp a, 80h u16Temp0 = sg_sZ80Context.z80A - 0x80; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x80))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x80 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0da8: call z, 1f7ch if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xab; goto L1f7c; } case 0x0dab: // 0dab: ld a, (4d2fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2f]); // 0dae: ld (4d2bh), a sg_u8mspacman_memory[0x4d2b] = sg_sZ80Context.z80A; // 0db1: ld ix, 4d24h sg_sZ80Context.z80IX = (UINT16) (0x4d24); // 0db5: ld iy, 4d06h sg_sZ80Context.z80IY = (UINT16) (0x4d06); // 0db9: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbc; goto L2000; case 0x0dbc: // 0dbc: ld (4d06h), hl sg_u8mspacman_memory[0x4d06] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d07] = sg_sZ80Context.z80H; // 0dbf: ret goto returnInstruction;; // 0dc0: ld a, (4da3h) L0dc0: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da3]); { UINT16 u16Temp0; // 0dc3: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0dc5: jp nz, 0deah if (((u8Flags & 0x40) >> 6) != 1) { goto L0dea;; } // 0dc8: ld ix, 3303h sg_sZ80Context.z80IX = (UINT16) (0x3303); // 0dcc: ld iy, 4d06h sg_sZ80Context.z80IY = (UINT16) (0x4d06); // 0dd0: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd3; goto L2000; case 0x0dd3: // 0dd3: ld (4d06h), hl sg_u8mspacman_memory[0x4d06] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d07] = sg_sZ80Context.z80H; // 0dd6: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 0dd8: ld (4d2bh), a sg_u8mspacman_memory[0x4d2b] = sg_sZ80Context.z80A; // 0ddb: ld (4d2fh), a sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80A; // 0dde: ld a, (4d07h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d07]); { UINT16 u16Temp0; // 0de1: cp a, 80h u16Temp0 = sg_sZ80Context.z80A - 0x80; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x80))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x80 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0de3: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0de4: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 0de6: ld (4da3h), a sg_u8mspacman_memory[0x4da3] = sg_sZ80Context.z80A; // 0de9: ret goto returnInstruction;; // 0dea: ld ix, 3305h L0dea: sg_sZ80Context.z80IX = (UINT16) (0x3305); // 0dee: ld iy, 4d06h sg_sZ80Context.z80IY = (UINT16) (0x4d06); // 0df2: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf5; goto L2000; case 0x0df5: // 0df5: ld (4d06h), hl sg_u8mspacman_memory[0x4d06] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d07] = sg_sZ80Context.z80H; // 0df8: ld a, 03h sg_sZ80Context.z80A = (UINT8) (0x03); // 0dfa: ld (4d2bh), a sg_u8mspacman_memory[0x4d2b] = sg_sZ80Context.z80A; // 0dfd: ld (4d2fh), a sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80A; // 0e00: ld a, (4d06h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d06]); { UINT16 u16Temp0; // 0e03: cp a, 64h u16Temp0 = sg_sZ80Context.z80A - 0x64; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x64))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x64 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0e05: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0e06: ld hl, 2e2ch sg_sZ80Context.z80HL = (UINT16) (0x2e2c); // 0e09: ld (4d10h), hl sg_u8mspacman_memory[0x4d10] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d11] = sg_sZ80Context.z80H; // 0e0c: ld hl, 0100h sg_sZ80Context.z80HL = (UINT16) (0x0100); // 0e0f: ld (4d1ah), hl sg_u8mspacman_memory[0x4d1a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1b] = sg_sZ80Context.z80H; // 0e12: ld (4d24h), hl sg_u8mspacman_memory[0x4d24] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d25] = sg_sZ80Context.z80H; // 0e15: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 0e17: ld (4d2bh), a sg_u8mspacman_memory[0x4d2b] = sg_sZ80Context.z80A; // 0e1a: ld (4d2fh), a sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80A; // 0e1d: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 0e1f: ld (4da3h), a sg_u8mspacman_memory[0x4da3] = sg_sZ80Context.z80A; // 0e22: ret goto returnInstruction;; // 0e23: ld hl, 4dc4h L0e23: sg_sZ80Context.z80HL = (UINT16) (0x4dc4); { UINT8 u8Temp0; // 0e26: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0e27: ld a, 08h sg_sZ80Context.z80A = (UINT8) (0x08); { UINT16 u16Temp0; UINT8 u8Temp0; // 0e29: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0e2a: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0e2b: ld (hl), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0); // 0e2d: ld a, (4dc0h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dc0]); // 0e30: xor a, 01h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 1); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0e32: ld (4dc0h), a sg_u8mspacman_memory[0x4dc0] = sg_sZ80Context.z80A; // 0e35: ret goto returnInstruction;; // 0e36: ld a, (4da6h) L0e36: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da6]); // 0e39: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0e3a: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0e3b: ld a, (4dc1h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dc1]); { UINT16 u16Temp0; // 0e3e: cp a, 07h u16Temp0 = sg_sZ80Context.z80A - 0x07; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x07))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x07 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0e40: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } { UINT16 u16Temp0; // 0e41: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 0e42: ld hl, (4dc2h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dc2]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dc3]); // 0e45: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 0e46: ld (4dc2h), hl sg_u8mspacman_memory[0x4dc2] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dc3] = sg_sZ80Context.z80H; // 0e49: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 0e4a: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); // 0e4c: ld ix, 4d86h sg_sZ80Context.z80IX = (UINT16) (0x4d86); { UINT32 u32Temp0; // 0e50: add ix, de u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); } // 0e52: ld e, (ix+00h) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 0e55: ld d, (ix+01h) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); // 0e58: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 0e59: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 0e5b: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0e5c: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xfe; // 0e5d: nop // 0e5e: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 0e5f: ld (4dc1h), a sg_u8mspacman_memory[0x4dc1] = sg_sZ80Context.z80A; // 0e62: ld hl, 0101h sg_sZ80Context.z80HL = (UINT16) (0x0101); // 0e65: ld (4db1h), hl sg_u8mspacman_memory[0x4db1] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4db2] = sg_sZ80Context.z80H; // 0e68: ld (4db3h), hl sg_u8mspacman_memory[0x4db3] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4db4] = sg_sZ80Context.z80H; // 0e6b: ret goto returnInstruction;; // 0e6c: ld a, (4da5h) L0e6c: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da5]); // 0e6f: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 0e70: jr z, 0e77h if (((u8Flags & 0x40) >> 6) == 1) { goto L0e77;; } // 0e72: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0e73: ld (4each), a sg_u8mspacman_memory[0x4eac] = sg_sZ80Context.z80A; // 0e76: ret goto returnInstruction;; // 0e77: ld hl, 4each L0e77: sg_sZ80Context.z80HL = (UINT16) (0x4eac); // 0e7a: ld b, 0e0h sg_sZ80Context.z80B = (UINT8) (0xe0); // 0e7c: ld a, (peleatn) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e0e]); { UINT16 u16Temp0; // 0e7f: cp a, 0e4h u16Temp0 = sg_sZ80Context.z80A - 0xe4; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 0e81: jr c, 0e89h if (((u8Flags & 0x01) >> 0) == 1) { goto L0e89;; } // 0e83: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 0e84: and a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80HL]); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0e85: set 4, a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | 0x10); // 0e87: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 0e88: ret goto returnInstruction;; { UINT16 u16Temp0; // 0e89: cp a, 0d4h L0e89: u16Temp0 = sg_sZ80Context.z80A - 0xd4; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 0e8b: jr c, 0e93h if (((u8Flags & 0x01) >> 0) == 1) { goto L0e93;; } // 0e8d: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 0e8e: and a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80HL]); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0e8f: set 3, a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | 0x08); // 0e91: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 0e92: ret goto returnInstruction;; { UINT16 u16Temp0; // 0e93: cp a, 0b4h L0e93: u16Temp0 = sg_sZ80Context.z80A - 0xb4; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 0e95: jr c, 0e9dh if (((u8Flags & 0x01) >> 0) == 1) { goto L0e9d;; } // 0e97: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 0e98: and a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80HL]); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0e99: set 2, a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | 0x04); // 0e9b: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 0e9c: ret goto returnInstruction;; { UINT16 u16Temp0; // 0e9d: cp a, 74h L0e9d: u16Temp0 = sg_sZ80Context.z80A - 0x74; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 0e9f: jr c, 0ea7h if (((u8Flags & 0x01) >> 0) == 1) { goto L0ea7;; } // 0ea1: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 0ea2: and a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80HL]); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0ea3: set 1, a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | 0x02); // 0ea5: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 0ea6: ret goto returnInstruction;; // 0ea7: ld a, b L0ea7: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 0ea8: and a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80HL]); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0ea9: set 0, a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | 1); // 0eab: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 0eac: ret goto returnInstruction;; // 0ead: jp 86eeh L0ead: goto L86ee;; case 0x0eb0: // 0eb0: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0eb1: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0eb2: ld a, (frbonus) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd4]); // 0eb5: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0eb6: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0eb7: ld a, (peleatn) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e0e]); { UINT16 u16Temp0; // 0eba: cp a, 46h u16Temp0 = sg_sZ80Context.z80A - 0x46; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 0ebc: jr z, 0ecch if (((u8Flags & 0x40) >> 6) == 1) { goto L0ecc;; } { UINT16 u16Temp0; // 0ebe: cp a, 0aah u16Temp0 = sg_sZ80Context.z80A - 0xaa; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0xaa))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0xaa ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 0ec0: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0ec1: ld a, (4e0dh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e0d]); // 0ec4: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0ec5: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0ec6: ld hl, 4e0dh sg_sZ80Context.z80HL = (UINT16) (0x4e0d); { UINT8 u8Temp0; // 0ec9: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0eca: jr 0ed5h goto L0ed5;; // 0ecc: ld a, (4e0ch) L0ecc: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e0c]); // 0ecf: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 0ed0: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 0ed1: ld hl, 4e0ch sg_sZ80Context.z80HL = (UINT16) (0x4e0c); { UINT8 u8Temp0; // 0ed4: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 0ed5: ld hl, 8094h L0ed5: sg_sZ80Context.z80HL = (UINT16) (0x8094); // 0ed8: ld (4dd2h), hl sg_u8mspacman_memory[0x4dd2] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dd3] = sg_sZ80Context.z80H; // 0edb: ld hl, 0efdh sg_sZ80Context.z80HL = (UINT16) (0x0efd); // 0ede: ld a, (boardno) ; compare board level with sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e13]); { UINT16 u16Temp0; // 0ee1: cp a, 14h ; 14 u16Temp0 = sg_sZ80Context.z80A - 0x14; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 0ee3: jr c, 0ee7h if (((u8Flags & 0x01) >> 0) == 1) { goto L0ee7;; } // 0ee5: ld a, 14h sg_sZ80Context.z80A = (UINT8) (0x14); // 0ee7: ld b, a L0ee7: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 0ee8: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 0ee9: add a, b u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80B))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80B ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 0eea: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xeb; goto L0010; case 0x0eeb: // 0eeb: ld (frshape), a sg_u8mspacman_memory[0x4c0c] = sg_sZ80Context.z80A; // 0eee: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 0eef: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 0ef0: ld (frcol), a // $0efd - 0f3b = table for fruit shapes, colors, point value. // (the 3 bytes are stored in the above order) // offset 0 1 2 3 4 5 6 7 8 9 a b c d e f sg_u8mspacman_memory[0x4c0d] = sg_sZ80Context.z80A; // 0ef3: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 0ef4: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 0ef5: ld (frbonus), a sg_u8mspacman_memory[0x4dd4] = sg_sZ80Context.z80A; // 0ef8: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf9; goto L0030; case 0x0efc: // 0efc: ret goto returnInstruction;; case 0x1000: // 1000: xor a, a L1000: sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1001: ld (frbonus), a sg_u8mspacman_memory[0x4dd4] = sg_sZ80Context.z80A; // 1004: ret goto returnInstruction;; case 0x100b: // 100b: jp 3678h goto L3678;; // 1017: call 1291h L1017: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1a; goto L1291; case 0x101a: // 101a: ld a, (4da5h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da5]); // 101d: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 101e: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 101f: call 1066h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x22; goto L1066; case 0x1022: // 1022: call 1094h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x25; goto L1094; case 0x1025: // 1025: call 109eh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; goto L109e; case 0x1028: // 1028: call 10a8h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2b; goto L10a8; case 0x102b: // 102b: call 10b4h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2e; goto L10b4; case 0x102e: // 102e: ld a, (4da4h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da4]); // 1031: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1032: jp z, 1039h if (((u8Flags & 0x40) >> 6) == 1) { goto L1039;; } // 1035: call 1235h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x38; goto L1235; case 0x1038: // 1038: ret goto returnInstruction;; // 1039: call 171dh L1039: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3c; goto L171d; case 0x103c: // 103c: call 1789h ; check for collision with blue ghost sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3f; goto L1789; case 0x103f: // 103f: ld a, (4da4h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da4]); // 1042: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1043: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1044: call 1806h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x47; goto L1806; case 0x1047: // 1047: call 1b36h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x4a; goto L1b36; case 0x104a: // 104a: call 1c4bh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x4d; goto L1c4b; case 0x104d: // 104d: call 1d22h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x50; goto L1d22; case 0x1050: // 1050: call 1df9h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x53; goto L1df9; case 0x1053: // 1053: ld a, (4e04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e04]); { UINT16 u16Temp0; // 1056: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x03))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x03 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1058: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1059: call 1376h ; control blue time sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x5c; goto L1376; case 0x105c: // 105c: call 2069h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x5f; goto L2069; case 0x105f: // 105f: call 208ch sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x62; goto L208c; case 0x1062: // 1062: call 20afh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x65; goto L20af; case 0x1065: // 1065: ret goto returnInstruction;; // 1066: ld a, (4dabh) L1066: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dab]); // 1069: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 106a: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 106b: dec a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 106c: jr nz, 01076h if (((u8Flags & 0x40) >> 6) != 1) { goto L1076;; } // 106e: ld (4dabh), a sg_u8mspacman_memory[0x4dab] = sg_sZ80Context.z80A; // 1071: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 1072: ld (4dach), a sg_u8mspacman_memory[0x4dac] = sg_sZ80Context.z80A; // 1075: ret goto returnInstruction;; // 1076: dec a L1076: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1077: jr nz, 01081h if (((u8Flags & 0x40) >> 6) != 1) { goto L1081;; } // 1079: ld (4dabh), a sg_u8mspacman_memory[0x4dab] = sg_sZ80Context.z80A; // 107c: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 107d: ld (4dadh), a sg_u8mspacman_memory[0x4dad] = sg_sZ80Context.z80A; // 1080: ret goto returnInstruction;; // 1081: dec a L1081: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1082: jr nz, 0108ch if (((u8Flags & 0x40) >> 6) != 1) { goto L108c;; } // 1084: ld (4dabh), a sg_u8mspacman_memory[0x4dab] = sg_sZ80Context.z80A; // 1087: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 1088: ld (4daeh), a sg_u8mspacman_memory[0x4dae] = sg_sZ80Context.z80A; // 108b: ret goto returnInstruction;; // 108c: ld (4dafh), a L108c: sg_u8mspacman_memory[0x4daf] = sg_sZ80Context.z80A; // 108f: dec a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 1090: ld (4dabh), a sg_u8mspacman_memory[0x4dab] = sg_sZ80Context.z80A; // 1093: ret goto returnInstruction;; // 1094: ld a, (4dach) L1094: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dac]); // 1097: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x98; goto L0020; case 0x109e: // 109e: ld a, (4dadh) L109e: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dad]); // 10a1: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa2; goto L0020; case 0x10a8: // 10a8: ld a, (4daeh) L10a8: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dae]); // 10ab: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xac; goto L0020; case 0x10b4: // 10b4: ld a, (4dafh) L10b4: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daf]); // 10b7: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb8; goto L0020; case 0x10c0: // 10c0: call 1bd8h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc3; goto L1bd8; case 0x10c3: // 10c3: ld hl, (4d00h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d00]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d01]); // 10c6: ld de, 8064h sg_sZ80Context.z80DE = (UINT16) (0x8064); // 10c9: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 10ca: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 10cc: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 10cd: ld hl, 4dach sg_sZ80Context.z80HL = (UINT16) (0x4dac); { UINT8 u8Temp0; // 10d0: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 10d1: ret goto returnInstruction;; case 0x10d2: // 10d2: ld ix, 3301h sg_sZ80Context.z80IX = (UINT16) (0x3301); // 10d6: ld iy, 4d00h sg_sZ80Context.z80IY = (UINT16) (0x4d00); // 10da: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x10; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xdd; goto L2000; case 0x10dd: // 10dd: ld (4d00h), hl sg_u8mspacman_memory[0x4d00] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d01] = sg_sZ80Context.z80H; // 10e0: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 10e2: ld (4d28h), a sg_u8mspacman_memory[0x4d28] = sg_sZ80Context.z80A; // 10e5: ld (4d2ch), a sg_u8mspacman_memory[0x4d2c] = sg_sZ80Context.z80A; // 10e8: ld a, (4d00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d00]); { UINT16 u16Temp0; // 10eb: cp a, 80h u16Temp0 = sg_sZ80Context.z80A - 0x80; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x80))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x80 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 10ed: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 10ee: ld hl, 2e2fh sg_sZ80Context.z80HL = (UINT16) (0x2e2f); // 10f1: ld (4d0ah), hl sg_u8mspacman_memory[0x4d0a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0b] = sg_sZ80Context.z80H; // 10f4: ld (4d31h), hl sg_u8mspacman_memory[0x4d31] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d32] = sg_sZ80Context.z80H; // 10f7: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 10f8: ld (4da0h), a sg_u8mspacman_memory[0x4da0] = sg_sZ80Context.z80A; // 10fb: ld (4dach), a sg_u8mspacman_memory[0x4dac] = sg_sZ80Context.z80A; // 10fe: ld (4da7h), a sg_u8mspacman_memory[0x4da7] = sg_sZ80Context.z80A; // 1101: ld ix, 4dach L1101: sg_sZ80Context.z80IX = (UINT16) (0x4dac); // 1105: or a, (ix+00h) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 1108: or a, (ix+01h) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); // 110b: or a, (ix+02h) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x02]); // 110e: or a, (ix+03h) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x03]); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1111: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1112: ld hl, 4each sg_sZ80Context.z80HL = (UINT16) (0x4eac); // 1115: res 6, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] & 0xbf); // 1117: ret goto returnInstruction;; case 0x1118: // 1118: call 1cafh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x11; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1b; goto L1caf; case 0x111b: // 111b: ld hl, (4d02h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d02]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d03]); // 111e: ld de, 8064h sg_sZ80Context.z80DE = (UINT16) (0x8064); // 1121: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 1122: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 1124: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1125: ld hl, 4dadh sg_sZ80Context.z80HL = (UINT16) (0x4dad); { UINT8 u8Temp0; // 1128: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 1129: ret goto returnInstruction;; case 0x112a: // 112a: ld ix, 3301h sg_sZ80Context.z80IX = (UINT16) (0x3301); // 112e: ld iy, 4d02h sg_sZ80Context.z80IY = (UINT16) (0x4d02); // 1132: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x11; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; goto L2000; case 0x1135: // 1135: ld (4d02h), hl sg_u8mspacman_memory[0x4d02] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d03] = sg_sZ80Context.z80H; // 1138: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 113a: ld (4d29h), a sg_u8mspacman_memory[0x4d29] = sg_sZ80Context.z80A; // 113d: ld (4d2dh), a sg_u8mspacman_memory[0x4d2d] = sg_sZ80Context.z80A; // 1140: ld a, (4d02h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d02]); { UINT16 u16Temp0; // 1143: cp a, 80h u16Temp0 = sg_sZ80Context.z80A - 0x80; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x80))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x80 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1145: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1146: ld hl, 2e2fh sg_sZ80Context.z80HL = (UINT16) (0x2e2f); // 1149: ld (4d0ch), hl sg_u8mspacman_memory[0x4d0c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0d] = sg_sZ80Context.z80H; // 114c: ld (4d33h), hl sg_u8mspacman_memory[0x4d33] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d34] = sg_sZ80Context.z80H; // 114f: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 1150: ld (4da1h), a sg_u8mspacman_memory[0x4da1] = sg_sZ80Context.z80A; // 1153: ld (4dadh), a sg_u8mspacman_memory[0x4dad] = sg_sZ80Context.z80A; // 1156: ld (4da8h), a sg_u8mspacman_memory[0x4da8] = sg_sZ80Context.z80A; // 1159: jp 1101h goto L1101;; case 0x115c: // 115c: call 1d86h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x11; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x5f; goto L1d86; case 0x115f: // 115f: ld hl, (4d04h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d04]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d05]); // 1162: ld de, 8064h sg_sZ80Context.z80DE = (UINT16) (0x8064); // 1165: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 1166: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 1168: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1169: ld hl, 4daeh sg_sZ80Context.z80HL = (UINT16) (0x4dae); { UINT8 u8Temp0; // 116c: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 116d: ret goto returnInstruction;; case 0x116e: // 116e: ld ix, 3301h sg_sZ80Context.z80IX = (UINT16) (0x3301); // 1172: ld iy, 4d04h sg_sZ80Context.z80IY = (UINT16) (0x4d04); // 1176: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x11; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x79; goto L2000; case 0x1179: // 1179: ld (4d04h), hl sg_u8mspacman_memory[0x4d04] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d05] = sg_sZ80Context.z80H; // 117c: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 117e: ld (4d2ah), a sg_u8mspacman_memory[0x4d2a] = sg_sZ80Context.z80A; // 1181: ld (4d2eh), a sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80A; // 1184: ld a, (4d04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d04]); { UINT16 u16Temp0; // 1187: cp a, 80h u16Temp0 = sg_sZ80Context.z80A - 0x80; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x80))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x80 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1189: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 118a: ld hl, 4daeh sg_sZ80Context.z80HL = (UINT16) (0x4dae); { UINT8 u8Temp0; // 118d: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 118e: ret goto returnInstruction;; case 0x118f: // 118f: ld ix, 3303h sg_sZ80Context.z80IX = (UINT16) (0x3303); // 1193: ld iy, 4d04h sg_sZ80Context.z80IY = (UINT16) (0x4d04); // 1197: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x11; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9a; goto L2000; case 0x119a: // 119a: ld (4d04h), hl sg_u8mspacman_memory[0x4d04] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d05] = sg_sZ80Context.z80H; // 119d: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 119f: ld (4d2ah), a sg_u8mspacman_memory[0x4d2a] = sg_sZ80Context.z80A; // 11a2: ld (4d2eh), a sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80A; // 11a5: ld a, (4d05h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d05]); { UINT16 u16Temp0; // 11a8: cp a, 90h u16Temp0 = sg_sZ80Context.z80A - 0x90; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x90))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x90 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 11aa: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 11ab: ld hl, 302fh sg_sZ80Context.z80HL = (UINT16) (0x302f); // 11ae: ld (4d0eh), hl sg_u8mspacman_memory[0x4d0e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0f] = sg_sZ80Context.z80H; // 11b1: ld (4d35h), hl sg_u8mspacman_memory[0x4d35] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d36] = sg_sZ80Context.z80H; // 11b4: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 11b6: ld (4d2ah), a sg_u8mspacman_memory[0x4d2a] = sg_sZ80Context.z80A; // 11b9: ld (4d2eh), a sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80A; // 11bc: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 11bd: ld (4da2h), a sg_u8mspacman_memory[0x4da2] = sg_sZ80Context.z80A; // 11c0: ld (4daeh), a sg_u8mspacman_memory[0x4dae] = sg_sZ80Context.z80A; // 11c3: ld (4da9h), a sg_u8mspacman_memory[0x4da9] = sg_sZ80Context.z80A; // 11c6: jp 1101h goto L1101;; case 0x11c9: // 11c9: call 1e5dh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x11; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xcc; goto L1e5d; case 0x11cc: // 11cc: ld hl, (4d06h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d06]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d07]); // 11cf: ld de, 8064h sg_sZ80Context.z80DE = (UINT16) (0x8064); // 11d2: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 11d3: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 11d5: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 11d6: ld hl, 4dafh sg_sZ80Context.z80HL = (UINT16) (0x4daf); { UINT8 u8Temp0; // 11d9: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 11da: ret goto returnInstruction;; case 0x11db: // 11db: ld ix, 3301h sg_sZ80Context.z80IX = (UINT16) (0x3301); // 11df: ld iy, 4d06h sg_sZ80Context.z80IY = (UINT16) (0x4d06); // 11e3: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x11; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe6; goto L2000; case 0x11e6: // 11e6: ld (4d06h), hl sg_u8mspacman_memory[0x4d06] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d07] = sg_sZ80Context.z80H; // 11e9: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 11eb: ld (4d2bh), a sg_u8mspacman_memory[0x4d2b] = sg_sZ80Context.z80A; // 11ee: ld (4d2fh), a sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80A; // 11f1: ld a, (4d06h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d06]); { UINT16 u16Temp0; // 11f4: cp a, 80h u16Temp0 = sg_sZ80Context.z80A - 0x80; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x80))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x80 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 11f6: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 11f7: ld hl, 4dafh sg_sZ80Context.z80HL = (UINT16) (0x4daf); { UINT8 u8Temp0; // 11fa: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 11fb: ret goto returnInstruction;; case 0x11fc: // 11fc: ld ix, 32ffh sg_sZ80Context.z80IX = (UINT16) (0x32ff); // 1200: ld iy, 4d06h sg_sZ80Context.z80IY = (UINT16) (0x4d06); // 1204: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x12; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x07; goto L2000; case 0x1207: // 1207: ld (4d06h), hl sg_u8mspacman_memory[0x4d06] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d07] = sg_sZ80Context.z80H; // 120a: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 120b: ld (4d2bh), a sg_u8mspacman_memory[0x4d2b] = sg_sZ80Context.z80A; // 120e: ld (4d2fh), a sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80A; // 1211: ld a, (4d07h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d07]); { UINT16 u16Temp0; // 1214: cp a, 70h u16Temp0 = sg_sZ80Context.z80A - 0x70; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x70))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x70 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1216: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1217: ld hl, 2c2fh sg_sZ80Context.z80HL = (UINT16) (0x2c2f); // 121a: ld (4d10h), hl sg_u8mspacman_memory[0x4d10] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d11] = sg_sZ80Context.z80H; // 121d: ld (4d37h), hl sg_u8mspacman_memory[0x4d37] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d38] = sg_sZ80Context.z80H; // 1220: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 1222: ld (4d2bh), a sg_u8mspacman_memory[0x4d2b] = sg_sZ80Context.z80A; // 1225: ld (4d2fh), a sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80A; // 1228: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 1229: ld (4da3h), a sg_u8mspacman_memory[0x4da3] = sg_sZ80Context.z80A; // 122c: ld (4dafh), a sg_u8mspacman_memory[0x4daf] = sg_sZ80Context.z80A; // 122f: ld (4daah), a sg_u8mspacman_memory[0x4daa] = sg_sZ80Context.z80A; // 1232: jp 1101h goto L1101;; // 1235: ld a, (4dd1h) L1235: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd1]); // 1238: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x12; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x39; goto L0020; case 0x123f: // 123f: ld hl, 4c00h sg_sZ80Context.z80HL = (UINT16) (0x4c00); // 1242: ld a, (4da4h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da4]); { UINT16 u16Temp0; // 1245: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1246: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 1247: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); { UINT32 u32Temp0; // 1249: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 124a: ld a, (4dd1h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd1]); // 124d: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 124e: jr nz, 01277h if (((u8Flags & 0x40) >> 6) != 1) { goto L1277;; } // 1250: ld a, (4dd0h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd0]); // 1253: ld b, 27h sg_sZ80Context.z80B = (UINT8) (0x27); { UINT16 u16Temp0; // 1255: add a, b u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80B; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1256: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 1257: ld a, (cabtype) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e72]); // 125a: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 125b: ld a, (4e09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 125e: and a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80C); u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 125f: jr z, 01265h if (((u8Flags & 0x40) >> 6) == 1) { goto L1265;; } // 1261: set 6, b sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B | 0x40); // 1263: set 7, b sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B | 0x80); // 1265: ld (hl), b L1265: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80B); // 1266: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 1267: ld (hl), 18h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x18); // 1269: ld a, 00h sg_sZ80Context.z80A = (UINT8) (0); // 126b: ld (4c0bh), a sg_u8mspacman_memory[0x4c0b] = sg_sZ80Context.z80A; // 126e: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x12; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x6f; goto L0030; case 0x1272: // 1272: ld hl, 4dd1h sg_sZ80Context.z80HL = (UINT16) (0x4dd1); { UINT8 u8Temp0; // 1275: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 1276: ret goto returnInstruction;; // 1277: ld (hl), 20h L1277: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x20); // 1279: ld a, 09h sg_sZ80Context.z80A = (UINT8) (0x09); // 127b: ld (4c0bh), a sg_u8mspacman_memory[0x4c0b] = sg_sZ80Context.z80A; // 127e: ld a, (4da4h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da4]); // 1281: ld (4dabh), a sg_u8mspacman_memory[0x4dab] = sg_sZ80Context.z80A; // 1284: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1285: ld (4da4h), a sg_u8mspacman_memory[0x4da4] = sg_sZ80Context.z80A; // 1288: ld (4dd1h), a sg_u8mspacman_memory[0x4dd1] = sg_sZ80Context.z80A; // 128b: ld hl, 4each sg_sZ80Context.z80HL = (UINT16) (0x4eac); // 128e: set 6, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 0x40); // 1290: ret goto returnInstruction;; // 1291: ld a, (4da5h) L1291: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da5]); // 1294: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x12; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; goto L0020; case 0x12b7: // 12b7: ld hl, (4dc5h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dc5]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dc6]); // 12ba: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 12bb: ld (4dc5h), hl sg_u8mspacman_memory[0x4dc5] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dc6] = sg_sZ80Context.z80H; // 12be: ld de, 0078h sg_sZ80Context.z80DE = (UINT16) (0x78); // 12c1: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 12c2: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 12c4: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 12c5: ld a, 05h sg_sZ80Context.z80A = (UINT8) (0x05); // 12c7: ld (4da5h), a sg_u8mspacman_memory[0x4da5] = sg_sZ80Context.z80A; // 12ca: ret goto returnInstruction;; case 0x12cb: // 12cb: ld hl, 0000h // adjust mspac sprite animation? sg_sZ80Context.z80HL = (UINT16) (0); // 12ce: call 267eh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x12; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd1; goto L267e; case 0x12d1: // 12d1: ld a, 34h sg_sZ80Context.z80A = (UINT8) (0x34); // 12d3: ld de, 00b4h sg_sZ80Context.z80DE = (UINT16) (0xb4); // 12d6: ld c, a L12d6: sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 12d7: ld a, (cabtype) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e72]); // 12da: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 12db: ld a, (4e09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 12de: and a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80B); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 12df: jr z, 012e5h if (((u8Flags & 0x40) >> 6) == 1) { goto L12e5;; } // 12e1: ld a, 0c0h sg_sZ80Context.z80A = (UINT8) (0xc0); // 12e3: or a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80C); // 12e4: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 12e5: ld a, c L12e5: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 12e6: ld (4c0ah), a ; mspac sprite number sg_u8mspacman_memory[0x4c0a] = sg_sZ80Context.z80A; // 12e9: ld hl, (4dc5h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dc5]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dc6]); // 12ec: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 12ed: ld (4dc5h), hl sg_u8mspacman_memory[0x4dc5] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dc6] = sg_sZ80Context.z80H; // 12f0: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 12f1: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 12f3: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 12f4: ld hl, 4da5h sg_sZ80Context.z80HL = (UINT16) (0x4da5); { UINT8 u8Temp0; // 12f7: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 12f8: ret goto returnInstruction;; case 0x12f9: // 12f9: ld hl, 4ebch sg_sZ80Context.z80HL = (UINT16) (0x4ebc); // 12fc: set 4, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 0x10); // 12fe: ld a, 35h sg_sZ80Context.z80A = (UINT8) (0x35); // 1300: ld de, 00c3h sg_sZ80Context.z80DE = (UINT16) (0xc3); // 1303: jp 12d6h goto L12d6;; case 0x1306: // 1306: ld a, 36h sg_sZ80Context.z80A = (UINT8) (0x36); // 1308: ld de, 00d2h sg_sZ80Context.z80DE = (UINT16) (0xd2); // 130b: jp 12d6h goto L12d6;; case 0x130e: // 130e: ld a, 37h sg_sZ80Context.z80A = (UINT8) (0x37); // 1310: ld de, 00e1h sg_sZ80Context.z80DE = (UINT16) (0xe1); // 1313: jp 12d6h goto L12d6;; case 0x1316: // 1316: ld a, 38h sg_sZ80Context.z80A = (UINT8) (0x38); // 1318: ld de, 00f0h sg_sZ80Context.z80DE = (UINT16) (0xf0); // 131b: jp 12d6h goto L12d6;; case 0x131e: // 131e: ld a, 39h sg_sZ80Context.z80A = (UINT8) (0x39); // 1320: ld de, 00ffh sg_sZ80Context.z80DE = (UINT16) (0xff); // 1323: jp 12d6h goto L12d6;; case 0x1326: // 1326: ld a, 3ah sg_sZ80Context.z80A = (UINT8) (0x3a); // 1328: ld de, 010eh sg_sZ80Context.z80DE = (UINT16) (0x010e); // 132b: jp 12d6h goto L12d6;; case 0x132e: // 132e: ld a, 3bh sg_sZ80Context.z80A = (UINT8) (0x3b); // 1330: ld de, 011dh sg_sZ80Context.z80DE = (UINT16) (0x011d); // 1333: jp 12d6h goto L12d6;; case 0x1336: // 1336: ld a, 3ch sg_sZ80Context.z80A = (UINT8) (0x3c); // 1338: ld de, 012ch sg_sZ80Context.z80DE = (UINT16) (0x012c); // 133b: jp 12d6h goto L12d6;; case 0x133e: // 133e: ld a, 3dh sg_sZ80Context.z80A = (UINT8) (0x3d); // 1340: ld de, 013bh sg_sZ80Context.z80DE = (UINT16) (0x013b); // 1343: jp 12d6h goto L12d6;; case 0x1346: // 1346: ld hl, 4ebch sg_sZ80Context.z80HL = (UINT16) (0x4ebc); // 1349: ld (hl), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0); // 134b: ld a, 3eh sg_sZ80Context.z80A = (UINT8) (0x3e); // 134d: ld de, 0159h sg_sZ80Context.z80DE = (UINT16) (0x0159); // 1350: jp 12d6h goto L12d6;; case 0x1353: // 1353: ld a, 3fh // game end tests? sg_sZ80Context.z80A = (UINT8) (0x3f); // 1355: ld (4c0ah), a ; mspac sprite number sg_u8mspacman_memory[0x4c0a] = sg_sZ80Context.z80A; // 1358: ld hl, (4dc5h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dc5]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dc6]); // 135b: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 135c: ld (4dc5h), hl sg_u8mspacman_memory[0x4dc5] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dc6] = sg_sZ80Context.z80H; // 135f: ld de, 01b8h sg_sZ80Context.z80DE = (UINT16) (0x01b8); // 1362: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 1363: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 1365: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1366: ld hl, lives ; hl = number of lives left // decrement lives // this gets called after the death animation, but before the // screen gets redrawn. // -- probably a good hook point for 'insert coin to contunue' -- sg_sZ80Context.z80HL = (UINT16) (0x4e14); { UINT8 u8Temp0; // 1369: dec (hl) ; subtract 1 mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 136a: ld hl, scrlves ; hl = number of lives on screen sg_sZ80Context.z80HL = (UINT16) (0x4e15); { UINT8 u8Temp0; // 136d: dec (hl) ; subtract 1 mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 136e: call 2675h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x13; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x71; goto L2675; case 0x1371: // 1371: ld hl, 4e04h ; 3=ghost move 2=ghost wait sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 1374: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 1375: ret goto returnInstruction;; // 1376: ld a, (4da6h) // routine to control blue time // ret immediately to make ghosts stay blue till eaten L1376: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da6]); // 1379: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 137a: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 137b: ld ix, 4da7h sg_sZ80Context.z80IX = (UINT16) (0x4da7); // 137f: ld a, (ix+00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 1382: or a, (ix+01h) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); // 1385: or a, (ix+02h) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x02]); // 1388: or a, (ix+03h) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x03]); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 138b: jp z, 1398h if (((u8Flags & 0x40) >> 6) == 1) { goto L1398;; } // 138e: ld hl, (4dcbh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dcb]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dcc]); // 1391: dec hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL - 1); // 1392: ld (4dcbh), hl sg_u8mspacman_memory[0x4dcb] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dcc] = sg_sZ80Context.z80H; // 1395: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); // 1396: or a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80L); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1397: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1398: ld hl, 4c0bh L1398: sg_sZ80Context.z80HL = (UINT16) (0x4c0b); // 139b: ld (hl), 09h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x09); // 139d: ld a, (4dach) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dac]); // 13a0: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 13a1: jp nz, 13a7h if (((u8Flags & 0x40) >> 6) != 1) { goto L13a7;; } // 13a4: ld (4da7h), a sg_u8mspacman_memory[0x4da7] = sg_sZ80Context.z80A; // 13a7: ld a, (4dadh) L13a7: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dad]); // 13aa: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 13ab: jp nz, 13b1h if (((u8Flags & 0x40) >> 6) != 1) { goto L13b1;; } // 13ae: ld (4da8h), a sg_u8mspacman_memory[0x4da8] = sg_sZ80Context.z80A; // 13b1: ld a, (4daeh) L13b1: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dae]); // 13b4: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 13b5: jp nz, 13bbh if (((u8Flags & 0x40) >> 6) != 1) { goto L13bb;; } // 13b8: ld (4da9h), a sg_u8mspacman_memory[0x4da9] = sg_sZ80Context.z80A; // 13bb: ld a, (4dafh) L13bb: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daf]); // 13be: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 13bf: jp nz, 13c5h if (((u8Flags & 0x40) >> 6) != 1) { goto L13c5;; } // 13c2: ld (4daah), a sg_u8mspacman_memory[0x4daa] = sg_sZ80Context.z80A; // 13c5: xor a, a L13c5: sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 13c6: ld (4dcbh), a sg_u8mspacman_memory[0x4dcb] = sg_sZ80Context.z80A; // 13c9: ld (4dcch), a sg_u8mspacman_memory[0x4dcc] = sg_sZ80Context.z80A; // 13cc: ld (4da6h), a sg_u8mspacman_memory[0x4da6] = sg_sZ80Context.z80A; // 13cf: ld (4dc8h), a sg_u8mspacman_memory[0x4dc8] = sg_sZ80Context.z80A; // 13d2: ld (4dd0h), a sg_u8mspacman_memory[0x4dd0] = sg_sZ80Context.z80A; // 13d5: ld hl, 4each sg_sZ80Context.z80HL = (UINT16) (0x4eac); // 13d8: res 5, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] & 0xdf); // 13da: res 7, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] & 0x7f); // 13dc: ret goto returnInstruction;; // 13dd: ld hl, 4d9eh L13dd: sg_sZ80Context.z80HL = (UINT16) (0x4d9e); // 13e0: ld a, (peleatn) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e0e]); { UINT16 u16Temp0; UINT8 u8Temp0; // 13e3: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 13e4: jp z, 13eeh if (((u8Flags & 0x40) >> 6) == 1) { goto L13ee;; } // 13e7: ld hl, 0000h sg_sZ80Context.z80HL = (UINT16) (0); // 13ea: ld (4d97h), hl sg_u8mspacman_memory[0x4d97] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d98] = sg_sZ80Context.z80H; // 13ed: ret goto returnInstruction;; // 13ee: ld hl, (4d97h) L13ee: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d97]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d98]); // 13f1: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 13f2: ld (4d97h), hl sg_u8mspacman_memory[0x4d97] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d98] = sg_sZ80Context.z80H; // 13f5: ld de, (4d95h) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[0x4d95]); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[0x4d96]); // 13f9: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 13fa: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 13fc: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 13fd: ld hl, 0000h sg_sZ80Context.z80HL = (UINT16) (0); // 1400: ld (4d97h), hl sg_u8mspacman_memory[0x4d97] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d98] = sg_sZ80Context.z80H; // 1403: ld a, (4da1h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da1]); // 1406: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1407: push af sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80A; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = u8Flags; // 1408: call z, 2086h if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x14; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0b; goto L2086; } case 0x140b: // 140b: pop af u8Flags = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 140c: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 140d: ld a, (4da2h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da2]); // 1410: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1411: push af sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80A; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = u8Flags; // 1412: call z, 20a9h if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x14; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x15; goto L20a9; } case 0x1415: // 1415: pop af u8Flags = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 1416: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1417: ld a, (4da3h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da3]); // 141a: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 141b: call z, 20d1h if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x14; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; goto L20d1; } case 0x141e: // 141e: ret goto returnInstruction;; // 141f: ld a, (cabtype) L141f: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e72]); // 1422: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 1423: ld a, (4e09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 1426: and a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80B); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1427: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1428: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 1429: ld ix, 4c00h sg_sZ80Context.z80IX = (UINT16) (0x4c00); // 142d: ld e, 08h sg_sZ80Context.z80E = (UINT8) (0x08); // 142f: ld c, 08h sg_sZ80Context.z80C = (UINT8) (0x08); // 1431: ld d, 07h sg_sZ80Context.z80D = (UINT8) (0x07); // 1433: ld a, (4d00h) // this looks to be some kind of data? it's ver repetitions till 1500 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d00]); { UINT16 u16Temp0; // 1436: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1437: ld (ix+13h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x13, sg_sZ80Context.z80A); // 143a: ld a, (4d01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); // 143d: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 143e: add a, d u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80D; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 143f: ld (ix+12h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x12, sg_sZ80Context.z80A); // 1442: ld a, (4d02h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d02]); { UINT16 u16Temp0; // 1445: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1446: ld (ix+15h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x15, sg_sZ80Context.z80A); // 1449: ld a, (4d03h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d03]); // 144c: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 144d: add a, d u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80D; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 144e: ld (ix+14h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x14, sg_sZ80Context.z80A); // 1451: ld a, (4d04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d04]); { UINT16 u16Temp0; // 1454: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1455: ld (ix+17h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x17, sg_sZ80Context.z80A); // 1458: ld a, (4d05h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d05]); // 145b: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 145c: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 145d: ld (ix+16h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x16, sg_sZ80Context.z80A); // 1460: ld a, (4d06h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d06]); { UINT16 u16Temp0; // 1463: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1464: ld (ix+19h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x19, sg_sZ80Context.z80A); // 1467: ld a, (4d07h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d07]); // 146a: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 146b: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 146c: ld (ix+18h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x18, sg_sZ80Context.z80A); // 146f: ld a, (4d08h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d08]); { UINT16 u16Temp0; // 1472: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1473: ld (ix+1bh), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x1b, sg_sZ80Context.z80A); // 1476: ld a, (4d09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d09]); // 1479: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 147a: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 147b: ld (ix+1ah), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x1a, sg_sZ80Context.z80A); // 147e: ld a, (4dd2h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd2]); { UINT16 u16Temp0; // 1481: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1482: ld (ix+1dh), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x1d, sg_sZ80Context.z80A); // 1485: ld a, (4dd3h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd3]); // 1488: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 1489: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 148a: ld (ix+1ch), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x1c, sg_sZ80Context.z80A); // 148d: jp 14feh goto L14fe;; // 1490: ld a, (cabtype) // display the sprites in the intro and game L1490: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e72]); // 1493: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 1494: ld a, (4e09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 1497: and a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80B); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1498: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1499: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 149a: ld e, 09h sg_sZ80Context.z80E = (UINT8) (0x09); // 149c: ld c, 07h sg_sZ80Context.z80C = (UINT8) (0x07); // 149e: ld d, 06h sg_sZ80Context.z80D = (UINT8) (0x06); // 14a0: ld ix, 4c00h sg_sZ80Context.z80IX = (UINT16) (0x4c00); // 14a4: ld a, (4d00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d00]); // 14a7: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 14a8: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14a9: ld (ix+13h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x13, sg_sZ80Context.z80A); // 14ac: ld a, (4d01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); { UINT16 u16Temp0; // 14af: add a, d u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80D; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14b0: ld (ix+12h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x12, sg_sZ80Context.z80A); // 14b3: ld a, (4d02h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d02]); // 14b6: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 14b7: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14b8: ld (ix+15h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x15, sg_sZ80Context.z80A); // 14bb: ld a, (4d03h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d03]); { UINT16 u16Temp0; // 14be: add a, d u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80D; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14bf: ld (ix+14h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x14, sg_sZ80Context.z80A); // 14c2: ld a, (4d04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d04]); // 14c5: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 14c6: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14c7: ld (ix+17h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x17, sg_sZ80Context.z80A); // 14ca: ld a, (4d05h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d05]); { UINT16 u16Temp0; // 14cd: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14ce: ld (ix+16h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x16, sg_sZ80Context.z80A); // 14d1: ld a, (4d06h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d06]); // 14d4: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 14d5: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14d6: ld (ix+19h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x19, sg_sZ80Context.z80A); // 14d9: ld a, (4d07h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d07]); { UINT16 u16Temp0; // 14dc: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14dd: ld (ix+18h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x18, sg_sZ80Context.z80A); // 14e0: ld a, (4d08h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d08]); // 14e3: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 14e4: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14e5: ld (ix+1bh), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x1b, sg_sZ80Context.z80A); // 14e8: ld a, (4d09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d09]); { UINT16 u16Temp0; // 14eb: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14ec: ld (ix+1ah), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x1a, sg_sZ80Context.z80A); // 14ef: ld a, (4dd2h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd2]); // 14f2: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); { UINT16 u16Temp0; // 14f3: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14f4: ld (ix+1dh), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x1d, sg_sZ80Context.z80A); // 14f7: ld a, (4dd3h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd3]); { UINT16 u16Temp0; // 14fa: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 14fb: ld (ix+1ch), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x1c, sg_sZ80Context.z80A); // 14fe: ld a, (4da5h) L14fe: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da5]); // 1501: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1502: jp nz, 154bh if (((u8Flags & 0x40) >> 6) != 1) { goto L154b;; } // 1505: ld a, (4da4h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da4]); // 1508: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1509: jp nz, 15b4h if (((u8Flags & 0x40) >> 6) != 1) { goto L15b4;; } // 150c: ld hl, 151ch sg_sZ80Context.z80HL = (UINT16) (0x151c); // 150f: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 1510: ld a, (4d30h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d30]); // 1513: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x15; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x14; goto L0020; case 0x151c: // 151c: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 151d: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 151e: jr z, 0154bh if (((u8Flags & 0x40) >> 6) == 1) { goto L154b;; } // 1520: ld c, 0c0h sg_sZ80Context.z80C = (UINT8) (0xc0); // 1522: ld a, (4c0ah) ; mspac sprite number sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c0a]); // 1525: ld d, a sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80A); // 1526: and a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80C); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1527: jr nz, 0152eh if (((u8Flags & 0x40) >> 6) != 1) { goto L152e;; } // 1529: ld a, d sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80D); // 152a: or a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80C); // 152b: jp 1548h goto L1548;; // 152e: ld a, (4d30h) L152e: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d30]); { UINT16 u16Temp0; // 1531: cp a, 02h u16Temp0 = sg_sZ80Context.z80A - 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 1533: jr nz, 0153eh if (((u8Flags & 0x40) >> 6) != 1) { goto L153e;; } // 1535: bit 7, d u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80D & 0x80) == 0)) ? 0x40 : 0); // 1537: jr z, 0154bh if (((u8Flags & 0x40) >> 6) == 1) { goto L154b;; } // 1539: ld a, d sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80D); // 153a: xor a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ sg_sZ80Context.z80C); // 153b: jp 1548h goto L1548;; { UINT16 u16Temp0; // 153e: cp a, 03h L153e: u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 1540: jr nz, 0154bh if (((u8Flags & 0x40) >> 6) != 1) { goto L154b;; } // 1542: bit 6, d u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80D & 0x40) == 0)) ? 0x40 : 0); // 1544: jr z, 0154bh if (((u8Flags & 0x40) >> 6) == 1) { goto L154b;; } // 1546: ld a, d sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80D); // 1547: xor a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ sg_sZ80Context.z80C); // 1548: ld (4c0ah), a ; mspac sprite number L1548: sg_u8mspacman_memory[0x4c0a] = sg_sZ80Context.z80A; // 154b: ld hl, 4dc0h L154b: sg_sZ80Context.z80HL = (UINT16) (0x4dc0); // 154e: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 154f: ld a, 1ch sg_sZ80Context.z80A = (UINT8) (0x1c); { UINT16 u16Temp0; // 1551: add a, d u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80D; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1552: ld (ix+02h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, sg_sZ80Context.z80A); // 1555: ld (ix+04h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x04, sg_sZ80Context.z80A); // 1558: ld (ix+06h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, sg_sZ80Context.z80A); // 155b: ld (ix+08h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x08, sg_sZ80Context.z80A); // 155e: ld c, 20h sg_sZ80Context.z80C = (UINT8) (0x20); // 1560: ld a, (4dach) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dac]); // 1563: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1564: jr nz, 0156ch if (((u8Flags & 0x40) >> 6) != 1) { goto L156c;; } // 1566: ld a, (4da7h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da7]); // 1569: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 156a: jr nz, 01575h if (((u8Flags & 0x40) >> 6) != 1) { goto L1575;; } // 156c: ld a, (4d2ch) L156c: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2c]); { UINT16 u16Temp0; // 156f: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 1570: add a, d u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80D; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 1571: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1572: ld (ix+02h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, sg_sZ80Context.z80A); // 1575: ld a, (4dadh) L1575: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dad]); // 1578: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1579: jr nz, 01581h if (((u8Flags & 0x40) >> 6) != 1) { goto L1581;; } // 157b: ld a, (4da8h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da8]); // 157e: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 157f: jr nz, 0158ah if (((u8Flags & 0x40) >> 6) != 1) { goto L158a;; } // 1581: ld a, (4d2dh) L1581: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2d]); { UINT16 u16Temp0; // 1584: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 1585: add a, d u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80D; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 1586: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1587: ld (ix+04h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x04, sg_sZ80Context.z80A); // 158a: ld a, (4daeh) L158a: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dae]); // 158d: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 158e: jr nz, 01596h if (((u8Flags & 0x40) >> 6) != 1) { goto L1596;; } // 1590: ld a, (4da9h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da9]); // 1593: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1594: jr nz, 0159fh if (((u8Flags & 0x40) >> 6) != 1) { goto L159f;; } // 1596: ld a, (4d2eh) L1596: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2e]); { UINT16 u16Temp0; // 1599: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 159a: add a, d u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80D; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 159b: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 159c: ld (ix+06h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, sg_sZ80Context.z80A); // 159f: ld a, (4dafh) L159f: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daf]); // 15a2: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 15a3: jr nz, 015abh if (((u8Flags & 0x40) >> 6) != 1) { goto L15ab;; } // 15a5: ld a, (4daah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daa]); // 15a8: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 15a9: jr nz, 015b4h if (((u8Flags & 0x40) >> 6) != 1) { goto L15b4;; } // 15ab: ld a, (4d2fh) L15ab: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2f]); { UINT16 u16Temp0; // 15ae: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 15af: add a, d u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80D; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 15b0: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 15b1: ld (ix+08h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x08, sg_sZ80Context.z80A); // 15b4: call 15e6h L15b4: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x15; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb7; goto L15e6; case 0x15b7: // 15b7: call 162dh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x15; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xba; goto L162d; case 0x15ba: // 15ba: call 1652h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x15; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbd; goto L1652; case 0x15bd: // 15bd: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 15be: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 15bf: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 15c0: ld c, 0c0h sg_sZ80Context.z80C = (UINT8) (0xc0); // 15c2: ld a, (4c02h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c02]); // 15c5: or a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80C); // 15c6: ld (4c02h), a sg_u8mspacman_memory[0x4c02] = sg_sZ80Context.z80A; // 15c9: ld a, (4c04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c04]); // 15cc: or a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80C); // 15cd: ld (4c04h), a sg_u8mspacman_memory[0x4c04] = sg_sZ80Context.z80A; // 15d0: ld a, (4c06h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c06]); // 15d3: or a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80C); // 15d4: ld (4c06h), a sg_u8mspacman_memory[0x4c06] = sg_sZ80Context.z80A; // 15d7: ld a, (4c08h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c08]); // 15da: or a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80C); // 15db: ld (4c08h), a sg_u8mspacman_memory[0x4c08] = sg_sZ80Context.z80A; // 15de: ld a, (frshape) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c0c]); // 15e1: or a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80C); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 15e2: ld (frshape), a sg_u8mspacman_memory[0x4c0c] = sg_sZ80Context.z80A; // 15e5: ret goto returnInstruction;; // 15e6: ld a, (4e06h) L15e6: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e06]); { UINT16 u16Temp0; // 15e9: sub a, 05h u16Temp0 = sg_sZ80Context.z80A - 0x05; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x05))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x05 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 15eb: ret c if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 15ec: ld a, (4d09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d09]); // 15ef: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); { UINT16 u16Temp0; // 15f1: cp a, 0ch u16Temp0 = sg_sZ80Context.z80A - 0x0c; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 15f3: jr c, 015f9h if (((u8Flags & 0x01) >> 0) == 1) { goto L15f9;; } // 15f5: ld d, 18h sg_sZ80Context.z80D = (UINT8) (0x18); // 15f7: jr 0160bh goto L160b;; { UINT16 u16Temp0; // 15f9: cp a, 08h L15f9: u16Temp0 = sg_sZ80Context.z80A - 0x08; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 15fb: jr c, 01601h if (((u8Flags & 0x01) >> 0) == 1) { goto L1601;; } // 15fd: ld d, 14h sg_sZ80Context.z80D = (UINT8) (0x14); // 15ff: jr 0160bh goto L160b;; { UINT16 u16Temp0; // 1601: cp a, 04h L1601: u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 1603: jr c, 01609h if (((u8Flags & 0x01) >> 0) == 1) { goto L1609;; } // 1605: ld d, 10h sg_sZ80Context.z80D = (UINT8) (0x10); // 1607: jr 0160bh goto L160b;; // 1609: ld d, 14h L1609: sg_sZ80Context.z80D = (UINT8) (0x14); // 160b: ld (ix+04h), d L160b: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x04, sg_sZ80Context.z80D); // 160e: inc d sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80D + 1); // 160f: ld (ix+06h), d mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, sg_sZ80Context.z80D); // 1612: inc d sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80D + 1); // 1613: ld (ix+08h), d mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x08, sg_sZ80Context.z80D); // 1616: inc d sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80D + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80D == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80D & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80D & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80D == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 1617: ld (ix+0ch), d mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0c, sg_sZ80Context.z80D); // 161a: ld (ix+0ah), 3fh mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, 0x3f); // 161e: ld d, 16h sg_sZ80Context.z80D = (UINT8) (0x16); // 1620: ld (ix+05h), d mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x05, sg_sZ80Context.z80D); // 1623: ld (ix+07h), d mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, sg_sZ80Context.z80D); // 1626: ld (ix+09h), d mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x09, sg_sZ80Context.z80D); // 1629: ld (ix+0dh), d mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0d, sg_sZ80Context.z80D); // 162c: ret goto returnInstruction;; // 162d: ld a, (4e07h) L162d: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e07]); // 1630: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1631: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1632: ld d, a // check for pac moving though the other tunnel? sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80A); // 1633: ld a, (4d3ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3a]); { UINT16 u16Temp0; // 1636: sub a, 3dh u16Temp0 = sg_sZ80Context.z80A - 0x3d; sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); } // 1638: jr nz, 0163eh if (((u8Flags & 0x40) >> 6) != 1) { goto L163e;; } // 163a: ld (ix+0bh), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0b, 0); // 163e: ld a, d L163e: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80D); { UINT16 u16Temp0; // 163f: cp a, 0ah u16Temp0 = sg_sZ80Context.z80A - 0x0a; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x0a))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x0a ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1641: ret c if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 1642: ld (ix+02h), 32h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, 0x32); // 1646: ld (ix+03h), 1dh mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x03, 0x1d); { UINT16 u16Temp0; // 164a: cp a, 0ch u16Temp0 = sg_sZ80Context.z80A - 0x0c; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x0c))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x0c ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 164c: ret c if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 164d: ld (ix+02h), 33h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, 0x33); // 1651: ret goto returnInstruction;; // 1652: ld a, (4e08h) ; partial difficulty? L1652: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e08]); // 1655: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1656: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1657: ld d, a sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80A); // 1658: ld a, (4d3ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3a]); { UINT16 u16Temp0; // 165b: sub a, 3dh u16Temp0 = sg_sZ80Context.z80A - 0x3d; sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); } // 165d: jr nz, 01663h if (((u8Flags & 0x40) >> 6) != 1) { goto L1663;; } // 165f: ld (ix+0bh), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0b, 0); // 1663: ld a, d L1663: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80D); { UINT16 u16Temp0; // 1664: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 1))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1666: ret c if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 1667: ld a, (4dc0h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dc0]); // 166a: ld e, 08h sg_sZ80Context.z80E = (UINT8) (0x08); { UINT16 u16Temp0; // 166c: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 166d: ld (ix+02h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, sg_sZ80Context.z80A); // 1670: ld a, d sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80D); { UINT16 u16Temp0; // 1671: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x03))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x03 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1673: ret c if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 1674: ld a, (4d01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); // 1677: and a, 08h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x08); // 1679: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 167a: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 167b: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 167c: ld e, 0ah sg_sZ80Context.z80E = (UINT8) (0x0a); { UINT16 u16Temp0; // 167e: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 167f: ld (ix+0ch), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0c, sg_sZ80Context.z80A); // 1682: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 1683: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 1684: ld (ix+02h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, sg_sZ80Context.z80A); // 1687: ld (ix+0dh), 1eh mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0d, 0x1e); // 168b: ret goto returnInstruction;; case 0x168c: // 168c: jp 869ch goto L869c;; case 0x168f: // 168f: ret goto returnInstruction;; case 0x1690: // 1690: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); { UINT16 u16Temp0; // 1691: cp a, 06h u16Temp0 = sg_sZ80Context.z80A - 0x06; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x06))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x06 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1693: jr c, 0169ah if (((u8Flags & 0x01) >> 0) == 1) { goto L169a;; } // 1695: ld (ix+0ah), 30h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, 0x30); // 1699: ret goto returnInstruction;; { UINT16 u16Temp0; // 169a: cp a, 04h L169a: u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 169c: jr c, 016a3h if (((u8Flags & 0x01) >> 0) == 1) { goto L16a3;; } // 169e: ld (ix+0ah), 2eh mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, 0x2e); // 16a2: ret goto returnInstruction;; { UINT16 u16Temp0; // 16a3: cp a, 02h L16a3: u16Temp0 = sg_sZ80Context.z80A - 0x02; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x02))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x02 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 16a5: jr c, 016ach if (((u8Flags & 0x01) >> 0) == 1) { goto L16ac;; } // 16a7: ld (ix+0ah), 2ch mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, 0x2c); // 16ab: ret goto returnInstruction;; // 16ac: ld (ix+0ah), 2eh L16ac: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, 0x2e); // 16b0: ret goto returnInstruction;; case 0x16b1: // 16b1: jp 86b1h goto L86b1;; case 0x16b4: // 16b4: ret goto returnInstruction;; case 0x16b5: // 16b5: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); { UINT16 u16Temp0; // 16b6: cp a, 06h u16Temp0 = sg_sZ80Context.z80A - 0x06; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x06))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x06 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 16b8: jr c, 016bfh if (((u8Flags & 0x01) >> 0) == 1) { goto L16bf;; } case 0x16ba: // 16ba: ld (ix+0ah), 2fh mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, 0x2f); // 16be: ret goto returnInstruction;; case 0x16bf: { UINT16 u16Temp0; // 16bf: cp a, 04h L16bf: u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 16c1: jr c, 016c8h if (((u8Flags & 0x01) >> 0) == 1) { goto L16c8;; } // 16c3: ld (ix+0ah), 2dh mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, 0x2d); // 16c7: ret goto returnInstruction;; { UINT16 u16Temp0; // 16c8: cp a, 02h L16c8: u16Temp0 = sg_sZ80Context.z80A - 0x02; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x02))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x02 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 16ca: jr c, 016d1h if (((u8Flags & 0x01) >> 0) == 1) { goto L16d1;; } // 16cc: ld (ix+0ah), 2fh mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, 0x2f); // 16d0: ret goto returnInstruction;; // 16d1: ld (ix+0ah), 30h L16d1: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, 0x30); // 16d5: ret goto returnInstruction;; case 0x16d6: // 16d6: ld a, (4d09h) // 16d9: jp 86c5h goto L86c5;; case 0x16dc: // 16dc: ret goto returnInstruction;; case 0x16dd: // 16dd: jr c, 016e7h if (((u8Flags & 0x01) >> 0) == 1) { goto L16e7;; } // 16df: ld e, 2eh L16df: sg_sZ80Context.z80E = (UINT8) (0x2e); // 16e1: set 7, e L16e1: sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80E | 0x80); // 16e3: ld (ix+0ah), e mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, sg_sZ80Context.z80E); // 16e6: ret goto returnInstruction;; { UINT16 u16Temp0; // 16e7: cp a, 04h L16e7: u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 16e9: jr c, 016efh if (((u8Flags & 0x01) >> 0) == 1) { goto L16ef;; } // 16eb: ld e, 2ch sg_sZ80Context.z80E = (UINT8) (0x2c); // 16ed: jr 016e1h goto L16e1;; { UINT16 u16Temp0; // 16ef: cp a, 02h L16ef: u16Temp0 = sg_sZ80Context.z80A - 0x02; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x02))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x02 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 16f1: jr nc, 016dfh if (((u8Flags & 0x01) >> 0) != 1) { goto L16df;; } // 16f3: ld e, 30h sg_sZ80Context.z80E = (UINT8) (0x30); // 16f5: jr 016e1h goto L16e1;; case 0x16f7: // 16f7: ld a, (4d08h) // 16fa: jp 86d9h goto L86d9;; case 0x16fd: // 16fd: ret goto returnInstruction;; case 0x16fe: // 16fe: jr c, 01705h if (((u8Flags & 0x01) >> 0) == 1) { goto L1705;; } case 0x1700: // 1700: ld (ix+0ah), 30h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, 0x30); // 1704: ret goto returnInstruction;; case 0x1705: { UINT16 u16Temp0; // 1705: cp a, 04h L1705: u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1707: jr c, 01711h if (((u8Flags & 0x01) >> 0) == 1) { goto L1711;; } // 1709: ld e, 2fh sg_sZ80Context.z80E = (UINT8) (0x2f); // 170b: set 6, e L170b: sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80E | 0x40); // 170d: ld (ix+0ah), e mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, sg_sZ80Context.z80E); // 1710: ret goto returnInstruction;; case 0x1711: { UINT16 u16Temp0; // 1711: cp a, 02h L1711: u16Temp0 = sg_sZ80Context.z80A - 0x02; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x02))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x02 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1713: jr c, 01719h if (((u8Flags & 0x01) >> 0) == 1) { goto L1719;; } // 1715: ld e, 2dh sg_sZ80Context.z80E = (UINT8) (0x2d); // 1717: jr 0170bh goto L170b;; // 1719: ld e, 2fh L1719: sg_sZ80Context.z80E = (UINT8) (0x2f); // 171b: jr 0170bh goto L170b;; // 171d: ld b, 04h // normal ghost collision detect L171d: sg_sZ80Context.z80B = (UINT8) (0x04); // 171f: ld de, (4d39h) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[0x4d39]); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[0x4d3a]); // 1723: ld a, (4dafh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daf]); // 1726: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1727: jr nz, 01732h if (((u8Flags & 0x40) >> 6) != 1) { goto L1732;; } // 1729: ld hl, (4d37h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d37]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d38]); // 172c: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 172d: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); } // 172f: jp z, 1763h ; check for collision with ghost if (((u8Flags & 0x40) >> 6) == 1) { goto L1763;; } // 1732: dec b L1732: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); // 1733: ld a, (4daeh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dae]); // 1736: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1737: jr nz, 01742h if (((u8Flags & 0x40) >> 6) != 1) { goto L1742;; } // 1739: ld hl, (4d35h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d35]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d36]); // 173c: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 173d: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); } // 173f: jp z, 1763h if (((u8Flags & 0x40) >> 6) == 1) { goto L1763;; } // 1742: dec b L1742: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); // 1743: ld a, (4dadh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dad]); // 1746: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1747: jr nz, 01752h if (((u8Flags & 0x40) >> 6) != 1) { goto L1752;; } // 1749: ld hl, (4d33h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d33]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d34]); // 174c: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 174d: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); } // 174f: jp z, 1763h if (((u8Flags & 0x40) >> 6) == 1) { goto L1763;; } // 1752: dec b L1752: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); // 1753: ld a, (4dach) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dac]); // 1756: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1757: jr nz, 01762h if (((u8Flags & 0x40) >> 6) != 1) { goto L1762;; } // 1759: ld hl, (4d31h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d31]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d32]); // 175c: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 175d: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); } // 175f: jp z, 1763h if (((u8Flags & 0x40) >> 6) == 1) { goto L1763;; } // 1762: dec b L1762: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); // 1763: ld a, b ; collision detection routine L1763: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 1764: ld (4da4h), a sg_u8mspacman_memory[0x4da4] = sg_sZ80Context.z80A; // 1767: ld (4da5h), a // invincibility check ; HACK3 sg_u8mspacman_memory[0x4da5] = sg_sZ80Context.z80A; // 176a: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 176b: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 176c: ld hl, 4da6h ; check sg_sZ80Context.z80HL = (UINT16) (0x4da6); // 176f: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 1770: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); { UINT32 u32Temp0; // 1772: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1773: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 1774: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1775: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1776: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xfe; // 1777: ld (4da5h), a sg_u8mspacman_memory[0x4da5] = sg_sZ80Context.z80A; // 177a: ld hl, 4dd0h sg_sZ80Context.z80HL = (UINT16) (0x4dd0); { UINT8 u8Temp0; // 177d: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 177e: ld b, (hl) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 177f: inc b sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80B == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80B & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80B & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80B == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 1780: call 2a5ah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x17; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x83; goto L2a5a; case 0x1783: // 1783: ld hl, 4ebch sg_sZ80Context.z80HL = (UINT16) (0x4ebc); // 1786: set 3, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 0x08); // 1788: ret goto returnInstruction;; // 1789: ld a, (4da4h) // end normal ghost collision detect // blue ghost collision detect L1789: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da4]); // 178c: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 178d: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 178e: ld a, (4da6h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da6]); // 1791: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1792: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1793: ld c, 04h sg_sZ80Context.z80C = (UINT8) (0x04); // 1795: ld b, 04h sg_sZ80Context.z80B = (UINT8) (0x04); // 1797: ld ix, 4d08h sg_sZ80Context.z80IX = (UINT16) (0x4d08); // 179b: ld a, (4dafh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daf]); // 179e: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 179f: jr nz, 017b4h if (((u8Flags & 0x40) >> 6) != 1) { goto L17b4;; } // 17a1: ld a, (4d06h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d06]); { UINT16 u16Temp0; // 17a4: sub a, (ix+00h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 17a7: cp a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 17a8: jr nc, 017b4h if (((u8Flags & 0x01) >> 0) != 1) { goto L17b4;; } // 17aa: ld a, (4d07h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d07]); { UINT16 u16Temp0; // 17ad: sub a, (ix+01h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 17b0: cp a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 17b1: jp c, 1763h ; collision detection routine if (((u8Flags & 0x01) >> 0) == 1) { goto L1763;; } // 17b4: dec b L17b4: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); // 17b5: ld a, (4daeh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dae]); // 17b8: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 17b9: jr nz, 017ceh if (((u8Flags & 0x40) >> 6) != 1) { goto L17ce;; } // 17bb: ld a, (4d04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d04]); { UINT16 u16Temp0; // 17be: sub a, (ix+00h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 17c1: cp a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 17c2: jr nc, 017ceh if (((u8Flags & 0x01) >> 0) != 1) { goto L17ce;; } // 17c4: ld a, (4d05h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d05]); { UINT16 u16Temp0; // 17c7: sub a, (ix+01h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 17ca: cp a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 17cb: jp c, 1763h ; collision detection routine if (((u8Flags & 0x01) >> 0) == 1) { goto L1763;; } // 17ce: dec b L17ce: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); // 17cf: ld a, (4dadh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dad]); // 17d2: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 17d3: jr nz, 017e8h if (((u8Flags & 0x40) >> 6) != 1) { goto L17e8;; } // 17d5: ld a, (4d02h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d02]); { UINT16 u16Temp0; // 17d8: sub a, (ix+00h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 17db: cp a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 17dc: jr nc, 017e8h if (((u8Flags & 0x01) >> 0) != 1) { goto L17e8;; } // 17de: ld a, (4d03h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d03]); { UINT16 u16Temp0; // 17e1: sub a, (ix+01h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 17e4: cp a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 17e5: jp c, 1763h ; check for collision with ghost if (((u8Flags & 0x01) >> 0) == 1) { goto L1763;; } // 17e8: dec b L17e8: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); // 17e9: ld a, (4dach) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dac]); // 17ec: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 17ed: jr nz, 01802h if (((u8Flags & 0x40) >> 6) != 1) { goto L1802;; } // 17ef: ld a, (4d00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d00]); { UINT16 u16Temp0; // 17f2: sub a, (ix+00h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 17f5: cp a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 17f6: jr nc, 01802h if (((u8Flags & 0x01) >> 0) != 1) { goto L1802;; } // 17f8: ld a, (4d01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); { UINT16 u16Temp0; // 17fb: sub a, (ix+01h) u16Temp0 = sg_sZ80Context.z80A - sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 17fe: cp a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 17ff: jp c, 1763h ; check for collision with ghost if (((u8Flags & 0x01) >> 0) == 1) { goto L1763;; } // 1802: dec b L1802: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); // 1803: jp 1763h ; check for collision with ghost goto L1763;; // 1806: ld hl, 4d9dh L1806: sg_sZ80Context.z80HL = (UINT16) (0x4d9d); // 1809: ld a, 0ffh sg_sZ80Context.z80A = (UINT8) (0xff); { UINT16 u16Temp0; UINT8 u8Temp0; // 180b: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 180c: jp z, 1811h // set 0xbe to 0x01 for fast cheat. ; HACK2 if (((u8Flags & 0x40) >> 6) == 1) { goto L1811;; } { UINT8 u8Temp0; // 180f: dec (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 1810: ret goto returnInstruction;; // 1811: ld a, (4da6h) L1811: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da6]); // 1814: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1815: jp z, 182fh if (((u8Flags & 0x40) >> 6) == 1) { goto L182f;; } // 1818: ld hl, (4d4ch) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d4c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d4d]); { UINT32 u32Temp0; // 181b: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 181c: ld (4d4ch), hl sg_u8mspacman_memory[0x4d4c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d4d] = sg_sZ80Context.z80H; // 181f: ld hl, (4d4ah) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d4a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d4b]); { UINT32 u32Temp0; // 1822: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1824: ld (4d4ah), hl sg_u8mspacman_memory[0x4d4a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d4b] = sg_sZ80Context.z80H; // 1827: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1828: ld hl, 4d4ch sg_sZ80Context.z80HL = (UINT16) (0x4d4c); { UINT8 u8Temp0; // 182b: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 182c: jp 1843h goto L1843;; // 182f: ld hl, (4d48h) L182f: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d48]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d49]); { UINT32 u32Temp0; // 1832: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1833: ld (4d48h), hl sg_u8mspacman_memory[0x4d48] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d49] = sg_sZ80Context.z80H; // 1836: ld hl, (4d46h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d46]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d47]); { UINT32 u32Temp0; // 1839: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 183b: ld (4d46h), hl sg_u8mspacman_memory[0x4d46] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d47] = sg_sZ80Context.z80H; // 183e: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 183f: ld hl, 4d48h sg_sZ80Context.z80HL = (UINT16) (0x4d48); { UINT8 u8Temp0; // 1842: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1843: ld a, (peleatn) L1843: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e0e]); // 1846: ld (4d9eh), a sg_u8mspacman_memory[0x4d9e] = sg_sZ80Context.z80A; // 1849: ld a, (cabtype) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e72]); // 184c: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 184d: ld a, (4e09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 1850: and a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80C); // 1851: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 1852: ld hl, 4d3ah sg_sZ80Context.z80HL = (UINT16) (0x4d3a); // 1855: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 1856: ld b, 21h sg_sZ80Context.z80B = (UINT8) (0x21); { UINT16 u16Temp0; // 1858: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1859: jr c, 01864h if (((u8Flags & 0x01) >> 0) == 1) { goto L1864;; } // 185b: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 185c: ld b, 3bh sg_sZ80Context.z80B = (UINT8) (0x3b); { UINT16 u16Temp0; // 185e: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 185f: jr nc, 01864h if (((u8Flags & 0x01) >> 0) != 1) { goto L1864;; } // 1861: jp 18abh goto L18ab;; // 1864: ld a, 01h L1864: sg_sZ80Context.z80A = (UINT8) (1); // 1866: ld (4dbfh), a sg_u8mspacman_memory[0x4dbf] = sg_sZ80Context.z80A; // 1869: ld a, (4e00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); { UINT16 u16Temp0; // 186c: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 186e: jp z, 1a19h if (((u8Flags & 0x40) >> 6) == 1) { goto L1a19;; } // 1871: ld a, (4e04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e04]); { UINT16 u16Temp0; // 1874: cp a, 10h u16Temp0 = sg_sZ80Context.z80A - 0x10; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 1876: jp nc, 1a19h if (((u8Flags & 0x01) >> 0) != 1) { goto L1a19;; } // 1879: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 187a: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 187b: jr z, 01883h if (((u8Flags & 0x40) >> 6) == 1) { goto L1883;; } // 187d: ld a, (V1Acc) ; check in1 (p2) // check player 1 or player 2 depending on who is playing sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 1880: jp 1886h goto L1886;; // 1883: ld a, (IRQEn) ; check in0 (p1) L1883: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5000]); // 1886: bit 1, a ; left L1886: u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0x02) == 0)) ? 0x40 : 0); // 1888: jp nz, 1899h if (((u8Flags & 0x40) >> 6) != 1) { goto L1899;; } // 188b: ld hl, (3303h) sg_sZ80Context.z80L = (UINT8) (0); sg_sZ80Context.z80H = (UINT8) (1); // 188e: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 1890: ld (4d30h), a sg_u8mspacman_memory[0x4d30] = sg_sZ80Context.z80A; // 1893: ld (4d1ch), hl sg_u8mspacman_memory[0x4d1c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1d] = sg_sZ80Context.z80H; // 1896: jp 1950h goto L1950;; // 1899: bit 2, a ; right L1899: u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0x04) == 0)) ? 0x40 : 0); // 189b: jp nz, 1950h if (((u8Flags & 0x40) >> 6) != 1) { goto L1950;; } // 189e: ld hl, (32ffh) sg_sZ80Context.z80L = (UINT8) (0); sg_sZ80Context.z80H = (UINT8) (0xff); // 18a1: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 18a2: ld (4d30h), a sg_u8mspacman_memory[0x4d30] = sg_sZ80Context.z80A; // 18a5: ld (4d1ch), hl sg_u8mspacman_memory[0x4d1c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1d] = sg_sZ80Context.z80H; // 18a8: jp 1950h goto L1950;; // 18ab: ld a, (4e00h) L18ab: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); { UINT16 u16Temp0; // 18ae: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 18b0: jp z, 1a19h if (((u8Flags & 0x40) >> 6) == 1) { goto L1a19;; } // 18b3: ld a, (4e04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e04]); { UINT16 u16Temp0; // 18b6: cp a, 10h u16Temp0 = sg_sZ80Context.z80A - 0x10; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 18b8: jp nc, 1a19h if (((u8Flags & 0x01) >> 0) != 1) { goto L1a19;; } // 18bb: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 18bc: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 18bd: jr z, 018c5h if (((u8Flags & 0x40) >> 6) == 1) { goto L18c5;; } // 18bf: ld a, (V1Acc) ; check in1 // p2 movement check sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 18c2: jp 18c8h goto L18c8;; // 18c5: ld a, (IRQEn) ; a = IN0 // p1 movement check L18c5: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5000]); // 18c8: bit 1, a ; left L18c8: u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0x02) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 18ca: jp z, 1ac9h if (((u8Flags & 0x40) >> 6) == 1) { goto L1ac9;; } // 18cd: bit 2, a ; right u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0x04) == 0)) ? 0x40 : 0); // 18cf: jp z, 1ad9h if (((u8Flags & 0x40) >> 6) == 1) { goto L1ad9;; } // 18d2: bit 0, a ; up u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 1) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 18d4: jp z, 1ae8h if (((u8Flags & 0x40) >> 6) == 1) { goto L1ae8;; } // 18d7: bit 3, a ; down u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0x08) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 18d9: jp z, 1af8h if (((u8Flags & 0x40) >> 6) == 1) { goto L1af8;; } // 18dc: ld hl, (4d1ch) // no movement sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d1c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d1d]); // 18df: ld (4d26h), hl sg_u8mspacman_memory[0x4d26] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d27] = sg_sZ80Context.z80H; // 18e2: ld b, 01h sg_sZ80Context.z80B = (UINT8) (1); // 18e4: ld ix, 4d26h // movement checks return to here L18e4: sg_sZ80Context.z80IX = (UINT16) (0x4d26); // 18e8: ld iy, 4d39h sg_sZ80Context.z80IY = (UINT16) (0x4d39); // 18ec: call 200fh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x18; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xef; goto L200f; case 0x18ef: // 18ef: and a, 0c0h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0xc0); { UINT16 u16Temp0; // 18f1: sub a, 0c0h u16Temp0 = sg_sZ80Context.z80A - 0xc0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); } // 18f3: jr nz, 01940h if (((u8Flags & 0x40) >> 6) != 1) { goto L1940;; } // 18f5: dec b sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80B == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80B & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80B & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80B == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 18f6: jp nz, 1916h if (((u8Flags & 0x40) >> 6) != 1) { goto L1916;; } // 18f9: ld a, (4d30h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d30]); // 18fc: rrca u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 1) ? 0x01 : 0); // 18fd: jp c, 190bh if (((u8Flags & 0x01) >> 0) == 1) { goto L190b;; } // 1900: ld a, (4d09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d09]); // 1903: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1905: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1907: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1908: jp 1940h goto L1940;; // 190b: ld a, (4d08h) L190b: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d08]); // 190e: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1910: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1912: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1913: jp 1940h goto L1940;; // 1916: ld ix, 4d1ch L1916: sg_sZ80Context.z80IX = (UINT16) (0x4d1c); // 191a: call 200fh ; calls 2000 and 0065 sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x19; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; goto L200f; case 0x191d: // 191d: and a, 0c0h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0xc0); { UINT16 u16Temp0; // 191f: sub a, 0c0h u16Temp0 = sg_sZ80Context.z80A - 0xc0; sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); } // 1921: jr nz, 01950h if (((u8Flags & 0x40) >> 6) != 1) { goto L1950;; } // 1923: ld a, (4d30h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d30]); // 1926: rrca u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 1) ? 0x01 : 0); // 1927: jp c, 1935h if (((u8Flags & 0x01) >> 0) == 1) { goto L1935;; } // 192a: ld a, (4d09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d09]); // 192d: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 192f: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1931: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1932: jp 1950h goto L1950;; // 1935: ld a, (4d08h) L1935: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d08]); // 1938: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 193a: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 193c: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 193d: jp 1950h goto L1950;; // 1940: ld hl, (4d26h) L1940: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d26]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d27]); // 1943: ld (4d1ch), hl sg_u8mspacman_memory[0x4d1c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1d] = sg_sZ80Context.z80H; // 1946: dec b sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80B == 0) ? 0x40 : 0); // 1947: jp z, 1950h if (((u8Flags & 0x40) >> 6) == 1) { goto L1950;; } // 194a: ld a, (4d3ch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3c]); // 194d: ld (4d30h), a sg_u8mspacman_memory[0x4d30] = sg_sZ80Context.z80A; // 1950: ld ix, 4d1ch L1950: sg_sZ80Context.z80IX = (UINT16) (0x4d1c); // 1954: ld iy, 4d08h sg_sZ80Context.z80IY = (UINT16) (0x4d08); // 1958: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x19; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x5b; goto L2000; case 0x195b: // 195b: ld a, (4d30h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d30]); // 195e: rrca u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 1) ? 0x01 : 0); // 195f: jp c, 1975h if (((u8Flags & 0x01) >> 0) == 1) { goto L1975;; } // 1962: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); // 1963: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1965: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 1967: jp z, 1985h if (((u8Flags & 0x40) >> 6) == 1) { goto L1985;; } // 196a: jp c, 1971h if (((u8Flags & 0x01) >> 0) == 1) { goto L1971;; } // 196d: dec l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L - 1); // 196e: jp 1985h goto L1985;; // 1971: inc l L1971: sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 1972: jp 1985h goto L1985;; // 1975: ld a, h L1975: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); // 1976: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1978: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 197a: jp z, 1985h if (((u8Flags & 0x40) >> 6) == 1) { goto L1985;; } // 197d: jp c, 1984h if (((u8Flags & 0x01) >> 0) == 1) { goto L1984;; } // 1980: dec h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H - 1); // 1981: jp 1985h goto L1985;; // 1984: inc h L1984: sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H + 1); // 1985: ld (4d08h), hl L1985: sg_u8mspacman_memory[0x4d08] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d09] = sg_sZ80Context.z80H; // 1988: call 2018h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x19; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8b; goto L2018; case 0x198b: // 198b: ld (4d39h), hl sg_u8mspacman_memory[0x4d39] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d3a] = sg_sZ80Context.z80H; // 198e: ld ix, 4dbfh sg_sZ80Context.z80IX = (UINT16) (0x4dbf); // 1992: ld a, (ix+00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 1995: ld (ix+00h), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IX, 0); // 1999: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 199a: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 199b: ld a, (4dd2h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd2]); // 199e: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 199f: jr z, 019cdh if (((u8Flags & 0x40) >> 6) == 1) { goto L19cd;; } // 19a1: ld a, (frbonus) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd4]); // 19a4: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 19a5: jr z, 019cdh if (((u8Flags & 0x40) >> 6) == 1) { goto L19cd;; } // 19a7: ld hl, (4d08h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d08]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d09]); // 19aa: ld de, 8094h // 19ad: jp 8818h goto L8818;; // 19b2: ld b, 19h L19b2: sg_sZ80Context.z80B = (UINT8) (0x19); // 19b4: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 19b5: call 0042h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x19; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb8; goto L0042; case 0x19b8: // 19b8: call 1000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x19; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbb; goto L1000; case 0x19bb: // 19bb: jr 019c4h goto L19c4;; // 19c4: rst 30h L19c4: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x19; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc5; goto L0030; case 0x19c8: // 19c8: ld hl, 4ebch sg_sZ80Context.z80HL = (UINT16) (0x4ebc); // 19cb: set 2, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 0x04); // 19cd: ld a, 0ffh L19cd: sg_sZ80Context.z80A = (UINT8) (0xff); // 19cf: ld (4d9dh), a sg_u8mspacman_memory[0x4d9d] = sg_sZ80Context.z80A; // 19d2: ld hl, (4d39h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d39]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d3a]); // 19d5: call 0065h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x19; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd8; goto L0065; case 0x19d8: // 19d8: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 19d9: cp a, 10h u16Temp0 = sg_sZ80Context.z80A - 0x10; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 19db: jr z, 019e0h if (((u8Flags & 0x40) >> 6) == 1) { goto L19e0;; } { UINT16 u16Temp0; // 19dd: cp a, 14h u16Temp0 = sg_sZ80Context.z80A - 0x14; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x14))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x14 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 19df: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 19e0: ld ix, peleatn L19e0: sg_sZ80Context.z80IX = (UINT16) (0x4e0e); { UINT8 u8Temp0; // 19e4: inc (ix+00h) mspacmanIndirectWrite8(sg_sZ80Context.z80IX, sg_u8mspacman_memory[sg_sZ80Context.z80IX] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80IX]; } // 19e7: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); // 19e9: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 19eb: ld b, 40h sg_sZ80Context.z80B = (UINT8) (0x40); // 19ed: ld (hl), b mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80B); // 19ee: ld b, 19h sg_sZ80Context.z80B = (UINT8) (0x19); // 19f0: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 19f1: srl c u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80C & 1) ? 0x01 : 0); sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C >> 1); // 19f3: call 0042h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x19; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf6; goto L0042; case 0x19f6: // 19f6: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); { UINT16 u16Temp0; // 19f7: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x04) | ((((1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 19f9: jp z, 19fdh if (((u8Flags & 0x40) >> 6) == 1) { goto L19fd;; } { UINT16 u16Temp0; // 19fc: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80A ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 19fd: ld (4d9dh), a L19fd: sg_u8mspacman_memory[0x4d9d] = sg_sZ80Context.z80A; // 1a00: call 1b08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; goto L1b08; case 0x1a03: // 1a03: call 1a6ah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; goto L1a6a; case 0x1a06: // 1a06: ld hl, 4ebch sg_sZ80Context.z80HL = (UINT16) (0x4ebc); // 1a09: ld a, (peleatn) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e0e]); // 1a0c: rrca u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 1) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); u8Flags &= 0xef; u8Flags &= 0xfd; // 1a0d: jr c, 01a14h if (((u8Flags & 0x01) >> 0) == 1) { goto L1a14;; } // 1a0f: set 0, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 1); // 1a11: res 1, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] & 0xfd); // 1a13: ret goto returnInstruction;; // 1a14: res 0, (hl) L1a14: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] & 0xfe); // 1a16: set 1, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 0x02); // 1a18: ret goto returnInstruction;; // 1a19: ld hl, 4d1ch L1a19: sg_sZ80Context.z80HL = (UINT16) (0x4d1c); // 1a1c: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 1a1d: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1a1e: jp z, 1a2eh if (((u8Flags & 0x40) >> 6) == 1) { goto L1a2e;; } // 1a21: ld a, (4d08h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d08]); // 1a24: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1a26: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 1a28: jp z, 1a38h if (((u8Flags & 0x40) >> 6) == 1) { goto L1a38;; } // 1a2b: jp 1a5ch goto L1a5c;; // 1a2e: ld a, (4d09h) L1a2e: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d09]); // 1a31: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1a33: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 1a35: jp nz, 1a5ch if (((u8Flags & 0x40) >> 6) != 1) { goto L1a5c;; } // 1a38: ld a, 05h L1a38: sg_sZ80Context.z80A = (UINT8) (0x05); // 1a3a: call 1ed0h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3d; goto L1ed0; case 0x1a3d: // 1a3d: jr c, 01a42h if (((u8Flags & 0x01) >> 0) == 1) { goto L1a42;; } // 1a3f: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x40; goto L0028; case 0x1a42: // 1a42: ld ix, 4d26h L1a42: sg_sZ80Context.z80IX = (UINT16) (0x4d26); // 1a46: ld iy, 4d12h sg_sZ80Context.z80IY = (UINT16) (0x4d12); // 1a4a: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x4d; goto L2000; case 0x1a4d: // 1a4d: ld (4d12h), hl sg_u8mspacman_memory[0x4d12] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d13] = sg_sZ80Context.z80H; // 1a50: ld hl, (4d26h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d26]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d27]); // 1a53: ld (4d1ch), hl sg_u8mspacman_memory[0x4d1c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1d] = sg_sZ80Context.z80H; // 1a56: ld a, (4d3ch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3c]); // 1a59: ld (4d30h), a sg_u8mspacman_memory[0x4d30] = sg_sZ80Context.z80A; // 1a5c: ld ix, 4d1ch L1a5c: sg_sZ80Context.z80IX = (UINT16) (0x4d1c); // 1a60: ld iy, 4d08h sg_sZ80Context.z80IY = (UINT16) (0x4d08); // 1a64: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x67; goto L2000; case 0x1a67: // 1a67: jp 1985h goto L1985;; // 1a6a: ld a, (4d9dh) L1a6a: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d9d]); { UINT16 u16Temp0; // 1a6d: cp a, 06h u16Temp0 = sg_sZ80Context.z80A - 0x06; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x06))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x06 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1a6f: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1a70: ld hl, (4dbdh) L1a70: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dbd]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dbe]); // 1a73: ld (4dcbh), hl sg_u8mspacman_memory[0x4dcb] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dcc] = sg_sZ80Context.z80H; // 1a76: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 1a78: ld (4da6h), a sg_u8mspacman_memory[0x4da6] = sg_sZ80Context.z80A; // 1a7b: ld (4da7h), a sg_u8mspacman_memory[0x4da7] = sg_sZ80Context.z80A; // 1a7e: ld (4da8h), a sg_u8mspacman_memory[0x4da8] = sg_sZ80Context.z80A; // 1a81: ld (4da9h), a sg_u8mspacman_memory[0x4da9] = sg_sZ80Context.z80A; // 1a84: ld (4daah), a sg_u8mspacman_memory[0x4daa] = sg_sZ80Context.z80A; // 1a87: ld (4db1h), a sg_u8mspacman_memory[0x4db1] = sg_sZ80Context.z80A; // 1a8a: ld (4db2h), a sg_u8mspacman_memory[0x4db2] = sg_sZ80Context.z80A; // 1a8d: ld (4db3h), a sg_u8mspacman_memory[0x4db3] = sg_sZ80Context.z80A; // 1a90: ld (4db4h), a sg_u8mspacman_memory[0x4db4] = sg_sZ80Context.z80A; // 1a93: ld (4db5h), a sg_u8mspacman_memory[0x4db5] = sg_sZ80Context.z80A; // 1a96: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1a97: ld (4dc8h), a sg_u8mspacman_memory[0x4dc8] = sg_sZ80Context.z80A; // 1a9a: ld (4dd0h), a sg_u8mspacman_memory[0x4dd0] = sg_sZ80Context.z80A; // 1a9d: ld ix, 4c00h sg_sZ80Context.z80IX = (UINT16) (0x4c00); // 1aa1: ld (ix+02h), 1ch mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, 0x1c); // 1aa5: ld (ix+04h), 1ch mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x04, 0x1c); // 1aa9: ld (ix+06h), 1ch mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, 0x1c); // 1aad: ld (ix+08h), 1ch mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x08, 0x1c); // 1ab1: ld (ix+03h), 11h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x03, 0x11); // 1ab5: ld (ix+05h), 11h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x05, 0x11); // 1ab9: ld (ix+07h), 11h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, 0x11); // 1abd: ld (ix+09h), 11h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x09, 0x11); // 1ac1: ld hl, 4each sg_sZ80Context.z80HL = (UINT16) (0x4eac); // 1ac4: set 5, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 0x20); // 1ac6: res 7, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] & 0x7f); // 1ac8: ret goto returnInstruction;; // 1ac9: ld hl, (3303h) // Player move Left L1ac9: sg_sZ80Context.z80L = (UINT8) (0); sg_sZ80Context.z80H = (UINT8) (1); // 1acc: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 1ace: ld (4d3ch), a sg_u8mspacman_memory[0x4d3c] = sg_sZ80Context.z80A; // 1ad1: ld (4d26h), hl sg_u8mspacman_memory[0x4d26] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d27] = sg_sZ80Context.z80H; // 1ad4: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 1ad6: jp 18e4h goto L18e4;; // 1ad9: ld hl, (32ffh) // player move Right L1ad9: sg_sZ80Context.z80L = (UINT8) (0); sg_sZ80Context.z80H = (UINT8) (0xff); // 1adc: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1add: ld (4d3ch), a sg_u8mspacman_memory[0x4d3c] = sg_sZ80Context.z80A; // 1ae0: ld (4d26h), hl sg_u8mspacman_memory[0x4d26] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d27] = sg_sZ80Context.z80H; // 1ae3: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 1ae5: jp 18e4h goto L18e4;; // 1ae8: ld hl, (3305h) // player move Up L1ae8: sg_sZ80Context.z80L = (UINT8) (0xff); sg_sZ80Context.z80H = (UINT8) (0); // 1aeb: ld a, 03h sg_sZ80Context.z80A = (UINT8) (0x03); // 1aed: ld (4d3ch), a sg_u8mspacman_memory[0x4d3c] = sg_sZ80Context.z80A; // 1af0: ld (4d26h), hl sg_u8mspacman_memory[0x4d26] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d27] = sg_sZ80Context.z80H; // 1af3: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 1af5: jp 18e4h goto L18e4;; // 1af8: ld hl, (3301h) // player move Down L1af8: sg_sZ80Context.z80L = (UINT8) (1); sg_sZ80Context.z80H = (UINT8) (0); // 1afb: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 1afd: ld (4d3ch), a sg_u8mspacman_memory[0x4d3c] = sg_sZ80Context.z80A; // 1b00: ld (4d26h), hl sg_u8mspacman_memory[0x4d26] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d27] = sg_sZ80Context.z80H; // 1b03: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 1b05: jp 18e4h goto L18e4;; // 1b08: ld a, (4e12h) L1b08: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e12]); // 1b0b: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1b0c: jp z, 1b14h if (((u8Flags & 0x40) >> 6) == 1) { goto L1b14;; } // 1b0f: ld hl, 4d9fh sg_sZ80Context.z80HL = (UINT16) (0x4d9f); { UINT8 u8Temp0; // 1b12: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 1b13: ret goto returnInstruction;; // 1b14: ld a, (4da3h) L1b14: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da3]); // 1b17: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1b18: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1b19: ld a, (4da2h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da2]); // 1b1c: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1b1d: jp z, 1b25h if (((u8Flags & 0x40) >> 6) == 1) { goto L1b25;; } // 1b20: ld hl, 4e11h sg_sZ80Context.z80HL = (UINT16) (0x4e11); { UINT8 u8Temp0; // 1b23: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 1b24: ret goto returnInstruction;; // 1b25: ld a, (4da1h) L1b25: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da1]); // 1b28: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1b29: jp z, 1b31h if (((u8Flags & 0x40) >> 6) == 1) { goto L1b31;; } // 1b2c: ld hl, 4e10h sg_sZ80Context.z80HL = (UINT16) (0x4e10); { UINT8 u8Temp0; // 1b2f: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 1b30: ret goto returnInstruction;; // 1b31: ld hl, 4e0fh L1b31: sg_sZ80Context.z80HL = (UINT16) (0x4e0f); { UINT8 u8Temp0; // 1b34: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 1b35: ret goto returnInstruction;; // 1b36: ld a, (4da0h) L1b36: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da0]); // 1b39: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1b3a: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1b3b: ld a, (4dach) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dac]); // 1b3e: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1b3f: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1b40: call 20d7h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1b; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x43; goto L20d7; case 0x1b43: // 1b43: ld hl, (4d31h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d31]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d32]); // 1b46: ld bc, 4d99h sg_sZ80Context.z80BC = (UINT16) (0x4d99); // 1b49: call 205ah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1b; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x4c; goto L205a; case 0x1b4c: // 1b4c: ld a, (4d99h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d99]); // 1b4f: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1b50: jp z, 1b6ah if (((u8Flags & 0x40) >> 6) == 1) { goto L1b6a;; } // 1b53: ld hl, (4d60h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d60]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d61]); { UINT32 u32Temp0; // 1b56: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1b57: ld (4d60h), hl sg_u8mspacman_memory[0x4d60] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d61] = sg_sZ80Context.z80H; // 1b5a: ld hl, (4d5eh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d5e]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d5f]); { UINT32 u32Temp0; // 1b5d: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1b5f: ld (4d5eh), hl sg_u8mspacman_memory[0x4d5e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d5f] = sg_sZ80Context.z80H; // 1b62: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1b63: ld hl, 4d60h sg_sZ80Context.z80HL = (UINT16) (0x4d60); { UINT8 u8Temp0; // 1b66: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1b67: jp 1bd8h goto L1bd8;; // 1b6a: ld a, (4da7h) L1b6a: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da7]); // 1b6d: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1b6e: jp z, 1b88h if (((u8Flags & 0x40) >> 6) == 1) { goto L1b88;; } // 1b71: ld hl, (4d5ch) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d5c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d5d]); { UINT32 u32Temp0; // 1b74: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1b75: ld (4d5ch), hl sg_u8mspacman_memory[0x4d5c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d5d] = sg_sZ80Context.z80H; // 1b78: ld hl, (4d5ah) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d5a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d5b]); { UINT32 u32Temp0; // 1b7b: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1b7d: ld (4d5ah), hl sg_u8mspacman_memory[0x4d5a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d5b] = sg_sZ80Context.z80H; // 1b80: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1b81: ld hl, 4d5ch sg_sZ80Context.z80HL = (UINT16) (0x4d5c); { UINT8 u8Temp0; // 1b84: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1b85: jp 1bd8h goto L1bd8;; // 1b88: ld a, (4db7h) L1b88: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4db7]); // 1b8b: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1b8c: jp z, 1ba6h if (((u8Flags & 0x40) >> 6) == 1) { goto L1ba6;; } // 1b8f: ld hl, (4d50h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d50]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d51]); { UINT32 u32Temp0; // 1b92: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1b93: ld (4d50h), hl sg_u8mspacman_memory[0x4d50] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d51] = sg_sZ80Context.z80H; // 1b96: ld hl, (4d4eh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d4e]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d4f]); { UINT32 u32Temp0; // 1b99: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1b9b: ld (4d4eh), hl sg_u8mspacman_memory[0x4d4e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d4f] = sg_sZ80Context.z80H; // 1b9e: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1b9f: ld hl, 4d50h sg_sZ80Context.z80HL = (UINT16) (0x4d50); { UINT8 u8Temp0; // 1ba2: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1ba3: jp 1bd8h goto L1bd8;; // 1ba6: ld a, (4db6h) L1ba6: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4db6]); // 1ba9: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1baa: jp z, 1bc4h if (((u8Flags & 0x40) >> 6) == 1) { goto L1bc4;; } // 1bad: ld hl, (4d54h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d54]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d55]); { UINT32 u32Temp0; // 1bb0: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1bb1: ld (4d54h), hl sg_u8mspacman_memory[0x4d54] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d55] = sg_sZ80Context.z80H; // 1bb4: ld hl, (4d52h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d52]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d53]); { UINT32 u32Temp0; // 1bb7: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1bb9: ld (4d52h), hl sg_u8mspacman_memory[0x4d52] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d53] = sg_sZ80Context.z80H; // 1bbc: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1bbd: ld hl, 4d54h sg_sZ80Context.z80HL = (UINT16) (0x4d54); { UINT8 u8Temp0; // 1bc0: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1bc1: jp 1bd8h goto L1bd8;; // 1bc4: ld hl, (4d58h) L1bc4: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d58]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d59]); { UINT32 u32Temp0; // 1bc7: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1bc8: ld (4d58h), hl sg_u8mspacman_memory[0x4d58] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d59] = sg_sZ80Context.z80H; // 1bcb: ld hl, (4d56h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d56]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d57]); { UINT32 u32Temp0; // 1bce: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1bd0: ld (4d56h), hl sg_u8mspacman_memory[0x4d56] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d57] = sg_sZ80Context.z80H; // 1bd3: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1bd4: ld hl, 4d58h sg_sZ80Context.z80HL = (UINT16) (0x4d58); { UINT8 u8Temp0; // 1bd7: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1bd8: ld hl, 4d14h L1bd8: sg_sZ80Context.z80HL = (UINT16) (0x4d14); // 1bdb: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 1bdc: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1bdd: jp z, 1bedh if (((u8Flags & 0x40) >> 6) == 1) { goto L1bed;; } // 1be0: ld a, (4d00h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d00]); // 1be3: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1be5: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1be7: jp z, 1bf7h if (((u8Flags & 0x40) >> 6) == 1) { goto L1bf7;; } // 1bea: jp 1c36h goto L1c36;; // 1bed: ld a, (4d01h) L1bed: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); // 1bf0: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1bf2: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1bf4: jp nz, 1c36h if (((u8Flags & 0x40) >> 6) != 1) { goto L1c36;; } // 1bf7: ld a, 01h L1bf7: sg_sZ80Context.z80A = (UINT8) (1); // 1bf9: call 1ed0h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1b; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xfc; goto L1ed0; case 0x1bfc: // 1bfc: jr c, 01c19h if (((u8Flags & 0x01) >> 0) == 1) { goto L1c19;; } // 1bfe: ld a, (4da7h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da7]); // 1c01: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1c02: jp z, 1c0bh if (((u8Flags & 0x40) >> 6) == 1) { goto L1c0b;; } // 1c05: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; goto L0028; case 0x1c08: // 1c08: jp 1c19h goto L1c19;; // 1c0b: ld hl, (4d0ah) L1c0b: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0b]); // 1c0e: call 2052h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x11; goto L2052; case 0x1c11: // 1c11: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 1c12: cp a, 1ah u16Temp0 = sg_sZ80Context.z80A - 0x1a; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x1a))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x1a ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1c14: jr z, 01c19h if (((u8Flags & 0x40) >> 6) == 1) { goto L1c19;; } // 1c16: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x17; goto L0028; case 0x1c19: // 1c19: call 1efeh L1c19: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; goto L1efe; case 0x1c1c: // 1c1c: ld ix, 4d1eh sg_sZ80Context.z80IX = (UINT16) (0x4d1e); // 1c20: ld iy, 4d0ah sg_sZ80Context.z80IY = (UINT16) (0x4d0a); // 1c24: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; goto L2000; case 0x1c27: // 1c27: ld (4d0ah), hl sg_u8mspacman_memory[0x4d0a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0b] = sg_sZ80Context.z80H; // 1c2a: ld hl, (4d1eh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d1e]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d1f]); // 1c2d: ld (4d14h), hl sg_u8mspacman_memory[0x4d14] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d15] = sg_sZ80Context.z80H; // 1c30: ld a, (4d2ch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2c]); // 1c33: ld (4d28h), a sg_u8mspacman_memory[0x4d28] = sg_sZ80Context.z80A; // 1c36: ld ix, 4d14h L1c36: sg_sZ80Context.z80IX = (UINT16) (0x4d14); // 1c3a: ld iy, 4d00h sg_sZ80Context.z80IY = (UINT16) (0x4d00); // 1c3e: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x41; goto L2000; case 0x1c41: // 1c41: ld (4d00h), hl sg_u8mspacman_memory[0x4d00] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d01] = sg_sZ80Context.z80H; // 1c44: call 2018h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x47; goto L2018; case 0x1c47: // 1c47: ld (4d31h), hl sg_u8mspacman_memory[0x4d31] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d32] = sg_sZ80Context.z80H; // 1c4a: ret goto returnInstruction;; // 1c4b: ld a, (4da1h) L1c4b: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da1]); { UINT16 u16Temp0; // 1c4e: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 1))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1c50: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1c51: ld a, (4dadh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dad]); // 1c54: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1c55: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1c56: ld hl, (4d33h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d33]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d34]); // 1c59: ld bc, 4d9ah sg_sZ80Context.z80BC = (UINT16) (0x4d9a); // 1c5c: call 205ah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x5f; goto L205a; case 0x1c5f: // 1c5f: ld a, (4d9ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d9a]); // 1c62: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1c63: jp z, 1c7dh if (((u8Flags & 0x40) >> 6) == 1) { goto L1c7d;; } // 1c66: ld hl, (4d6ch) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d6c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d6d]); { UINT32 u32Temp0; // 1c69: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1c6a: ld (4d6ch), hl sg_u8mspacman_memory[0x4d6c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d6d] = sg_sZ80Context.z80H; // 1c6d: ld hl, (4d6ah) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d6a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d6b]); { UINT32 u32Temp0; // 1c70: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1c72: ld (4d6ah), hl sg_u8mspacman_memory[0x4d6a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d6b] = sg_sZ80Context.z80H; // 1c75: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1c76: ld hl, 4d6ch sg_sZ80Context.z80HL = (UINT16) (0x4d6c); { UINT8 u8Temp0; // 1c79: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1c7a: jp 1cafh goto L1caf;; // 1c7d: ld a, (4da8h) L1c7d: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da8]); // 1c80: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1c81: jp z, 1c9bh if (((u8Flags & 0x40) >> 6) == 1) { goto L1c9b;; } // 1c84: ld hl, (4d68h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d68]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d69]); { UINT32 u32Temp0; // 1c87: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1c88: ld (4d68h), hl sg_u8mspacman_memory[0x4d68] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d69] = sg_sZ80Context.z80H; // 1c8b: ld hl, (4d66h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d66]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d67]); { UINT32 u32Temp0; // 1c8e: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1c90: ld (4d66h), hl sg_u8mspacman_memory[0x4d66] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d67] = sg_sZ80Context.z80H; // 1c93: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1c94: ld hl, 4d68h sg_sZ80Context.z80HL = (UINT16) (0x4d68); { UINT8 u8Temp0; // 1c97: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1c98: jp 1cafh goto L1caf;; // 1c9b: ld hl, (4d64h) L1c9b: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d64]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d65]); { UINT32 u32Temp0; // 1c9e: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1c9f: ld (4d64h), hl sg_u8mspacman_memory[0x4d64] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d65] = sg_sZ80Context.z80H; // 1ca2: ld hl, (4d62h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d62]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d63]); { UINT32 u32Temp0; // 1ca5: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1ca7: ld (4d62h), hl sg_u8mspacman_memory[0x4d62] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d63] = sg_sZ80Context.z80H; // 1caa: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1cab: ld hl, 4d64h sg_sZ80Context.z80HL = (UINT16) (0x4d64); { UINT8 u8Temp0; // 1cae: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1caf: ld hl, 4d16h L1caf: sg_sZ80Context.z80HL = (UINT16) (0x4d16); // 1cb2: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 1cb3: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1cb4: jp z, 1cc4h if (((u8Flags & 0x40) >> 6) == 1) { goto L1cc4;; } // 1cb7: ld a, (4d02h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d02]); // 1cba: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1cbc: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1cbe: jp z, 1cceh if (((u8Flags & 0x40) >> 6) == 1) { goto L1cce;; } // 1cc1: jp 1d0dh goto L1d0d;; // 1cc4: ld a, (4d03h) L1cc4: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d03]); // 1cc7: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1cc9: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1ccb: jp nz, 1d0dh if (((u8Flags & 0x40) >> 6) != 1) { goto L1d0d;; } // 1cce: ld a, 02h L1cce: sg_sZ80Context.z80A = (UINT8) (0x02); // 1cd0: call 1ed0h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd3; goto L1ed0; case 0x1cd3: // 1cd3: jr c, 01cf0h if (((u8Flags & 0x01) >> 0) == 1) { goto L1cf0;; } // 1cd5: ld a, (4da8h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da8]); // 1cd8: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1cd9: jp z, 1ce2h if (((u8Flags & 0x40) >> 6) == 1) { goto L1ce2;; } // 1cdc: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xdd; goto L0028; case 0x1cdf: // 1cdf: jp 1cf0h goto L1cf0;; // 1ce2: ld hl, (4d0ch) L1ce2: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0d]); // 1ce5: call 2052h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe8; goto L2052; case 0x1ce8: // 1ce8: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 1ce9: cp a, 1ah u16Temp0 = sg_sZ80Context.z80A - 0x1a; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x1a))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x1a ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1ceb: jr z, 01cf0h if (((u8Flags & 0x40) >> 6) == 1) { goto L1cf0;; } // 1ced: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xee; goto L0028; case 0x1cf0: // 1cf0: call 1f25h L1cf0: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf3; goto L1f25; case 0x1cf3: // 1cf3: ld ix, 4d20h sg_sZ80Context.z80IX = (UINT16) (0x4d20); // 1cf7: ld iy, 4d0ch sg_sZ80Context.z80IY = (UINT16) (0x4d0c); // 1cfb: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xfe; goto L2000; case 0x1cfe: // 1cfe: ld (4d0ch), hl sg_u8mspacman_memory[0x4d0c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0d] = sg_sZ80Context.z80H; // 1d01: ld hl, (4d20h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d20]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d21]); // 1d04: ld (4d16h), hl sg_u8mspacman_memory[0x4d16] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d17] = sg_sZ80Context.z80H; // 1d07: ld a, (4d2dh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2d]); // 1d0a: ld (4d29h), a sg_u8mspacman_memory[0x4d29] = sg_sZ80Context.z80A; // 1d0d: ld ix, 4d16h L1d0d: sg_sZ80Context.z80IX = (UINT16) (0x4d16); // 1d11: ld iy, 4d02h sg_sZ80Context.z80IY = (UINT16) (0x4d02); // 1d15: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x18; goto L2000; case 0x1d18: // 1d18: ld (4d02h), hl sg_u8mspacman_memory[0x4d02] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d03] = sg_sZ80Context.z80H; // 1d1b: call 2018h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; goto L2018; case 0x1d1e: // 1d1e: ld (4d33h), hl sg_u8mspacman_memory[0x4d33] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d34] = sg_sZ80Context.z80H; // 1d21: ret goto returnInstruction;; // 1d22: ld a, (4da2h) L1d22: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da2]); { UINT16 u16Temp0; // 1d25: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 1))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1d27: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1d28: ld a, (4daeh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dae]); // 1d2b: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1d2c: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1d2d: ld hl, (4d35h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d35]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d36]); // 1d30: ld bc, 4d9bh sg_sZ80Context.z80BC = (UINT16) (0x4d9b); // 1d33: call 205ah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x36; goto L205a; case 0x1d36: // 1d36: ld a, (4d9bh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d9b]); // 1d39: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1d3a: jp z, 1d54h if (((u8Flags & 0x40) >> 6) == 1) { goto L1d54;; } // 1d3d: ld hl, (4d78h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d78]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d79]); { UINT32 u32Temp0; // 1d40: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1d41: ld (4d78h), hl sg_u8mspacman_memory[0x4d78] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d79] = sg_sZ80Context.z80H; // 1d44: ld hl, (4d76h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d76]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d77]); { UINT32 u32Temp0; // 1d47: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1d49: ld (4d76h), hl sg_u8mspacman_memory[0x4d76] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d77] = sg_sZ80Context.z80H; // 1d4c: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1d4d: ld hl, 4d78h sg_sZ80Context.z80HL = (UINT16) (0x4d78); { UINT8 u8Temp0; // 1d50: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1d51: jp 1d86h goto L1d86;; // 1d54: ld a, (4da9h) L1d54: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da9]); // 1d57: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1d58: jp z, 1d72h if (((u8Flags & 0x40) >> 6) == 1) { goto L1d72;; } // 1d5b: ld hl, (4d74h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d74]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d75]); { UINT32 u32Temp0; // 1d5e: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1d5f: ld (4d74h), hl sg_u8mspacman_memory[0x4d74] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d75] = sg_sZ80Context.z80H; // 1d62: ld hl, (4d72h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d72]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d73]); { UINT32 u32Temp0; // 1d65: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1d67: ld (4d72h), hl sg_u8mspacman_memory[0x4d72] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d73] = sg_sZ80Context.z80H; // 1d6a: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1d6b: ld hl, 4d74h sg_sZ80Context.z80HL = (UINT16) (0x4d74); { UINT8 u8Temp0; // 1d6e: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1d6f: jp 1d86h goto L1d86;; // 1d72: ld hl, (4d70h) L1d72: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d70]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d71]); { UINT32 u32Temp0; // 1d75: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1d76: ld (4d70h), hl sg_u8mspacman_memory[0x4d70] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d71] = sg_sZ80Context.z80H; // 1d79: ld hl, (4d6eh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d6e]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d6f]); { UINT32 u32Temp0; // 1d7c: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1d7e: ld (4d6eh), hl sg_u8mspacman_memory[0x4d6e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d6f] = sg_sZ80Context.z80H; // 1d81: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1d82: ld hl, 4d70h sg_sZ80Context.z80HL = (UINT16) (0x4d70); { UINT8 u8Temp0; // 1d85: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1d86: ld hl, 4d18h L1d86: sg_sZ80Context.z80HL = (UINT16) (0x4d18); // 1d89: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 1d8a: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1d8b: jp z, 1d9bh if (((u8Flags & 0x40) >> 6) == 1) { goto L1d9b;; } // 1d8e: ld a, (4d04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d04]); // 1d91: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1d93: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1d95: jp z, 1da5h if (((u8Flags & 0x40) >> 6) == 1) { goto L1da5;; } // 1d98: jp 1de4h goto L1de4;; // 1d9b: ld a, (4d05h) L1d9b: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d05]); // 1d9e: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1da0: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1da2: jp nz, 1de4h if (((u8Flags & 0x40) >> 6) != 1) { goto L1de4;; } // 1da5: ld a, 03h L1da5: sg_sZ80Context.z80A = (UINT8) (0x03); // 1da7: call 1ed0h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xaa; goto L1ed0; case 0x1daa: // 1daa: jr c, 01dc7h if (((u8Flags & 0x01) >> 0) == 1) { goto L1dc7;; } // 1dac: ld a, (4da9h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da9]); // 1daf: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1db0: jp z, 1db9h if (((u8Flags & 0x40) >> 6) == 1) { goto L1db9;; } // 1db3: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb4; goto L0028; case 0x1db6: // 1db6: jp 1dc7h goto L1dc7;; // 1db9: ld hl, (4d0eh) L1db9: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0e]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0f]); // 1dbc: call 2052h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbf; goto L2052; case 0x1dbf: // 1dbf: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 1dc0: cp a, 1ah u16Temp0 = sg_sZ80Context.z80A - 0x1a; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x1a))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x1a ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1dc2: jr z, 01dc7h if (((u8Flags & 0x40) >> 6) == 1) { goto L1dc7;; } // 1dc4: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc5; goto L0028; case 0x1dc7: // 1dc7: call 1f4ch L1dc7: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xca; goto L1f4c; case 0x1dca: // 1dca: ld ix, 4d22h sg_sZ80Context.z80IX = (UINT16) (0x4d22); // 1dce: ld iy, 4d0eh sg_sZ80Context.z80IY = (UINT16) (0x4d0e); // 1dd2: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd5; goto L2000; case 0x1dd5: // 1dd5: ld (4d0eh), hl sg_u8mspacman_memory[0x4d0e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0f] = sg_sZ80Context.z80H; // 1dd8: ld hl, (4d22h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d22]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d23]); // 1ddb: ld (4d18h), hl sg_u8mspacman_memory[0x4d18] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d19] = sg_sZ80Context.z80H; // 1dde: ld a, (4d2eh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2e]); // 1de1: ld (4d2ah), a sg_u8mspacman_memory[0x4d2a] = sg_sZ80Context.z80A; // 1de4: ld ix, 4d18h L1de4: sg_sZ80Context.z80IX = (UINT16) (0x4d18); // 1de8: ld iy, 4d04h sg_sZ80Context.z80IY = (UINT16) (0x4d04); // 1dec: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xef; goto L2000; case 0x1def: // 1def: ld (4d04h), hl sg_u8mspacman_memory[0x4d04] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d05] = sg_sZ80Context.z80H; // 1df2: call 2018h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf5; goto L2018; case 0x1df5: // 1df5: ld (4d35h), hl sg_u8mspacman_memory[0x4d35] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d36] = sg_sZ80Context.z80H; // 1df8: ret goto returnInstruction;; // 1df9: ld a, (4da3h) L1df9: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da3]); { UINT16 u16Temp0; // 1dfc: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 1))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1dfe: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1dff: ld a, (4dafh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daf]); // 1e02: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1e03: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1e04: ld hl, (4d37h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d37]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d38]); // 1e07: ld bc, 4d9ch sg_sZ80Context.z80BC = (UINT16) (0x4d9c); // 1e0a: call 205ah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0d; goto L205a; case 0x1e0d: // 1e0d: ld a, (4d9ch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d9c]); // 1e10: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1e11: jp z, 1e2bh if (((u8Flags & 0x40) >> 6) == 1) { goto L1e2b;; } // 1e14: ld hl, (4d84h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d84]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d85]); { UINT32 u32Temp0; // 1e17: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1e18: ld (4d84h), hl sg_u8mspacman_memory[0x4d84] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d85] = sg_sZ80Context.z80H; // 1e1b: ld hl, (4d82h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d82]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d83]); { UINT32 u32Temp0; // 1e1e: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1e20: ld (4d82h), hl sg_u8mspacman_memory[0x4d82] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d83] = sg_sZ80Context.z80H; // 1e23: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1e24: ld hl, 4d84h sg_sZ80Context.z80HL = (UINT16) (0x4d84); { UINT8 u8Temp0; // 1e27: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1e28: jp 1e5dh goto L1e5d;; // 1e2b: ld a, (4daah) L1e2b: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daa]); // 1e2e: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1e2f: jp z, 1e49h if (((u8Flags & 0x40) >> 6) == 1) { goto L1e49;; } // 1e32: ld hl, (4d80h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d80]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d81]); { UINT32 u32Temp0; // 1e35: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1e36: ld (4d80h), hl sg_u8mspacman_memory[0x4d80] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d81] = sg_sZ80Context.z80H; // 1e39: ld hl, (4d7eh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d7e]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d7f]); { UINT32 u32Temp0; // 1e3c: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1e3e: ld (4d7eh), hl sg_u8mspacman_memory[0x4d7e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d7f] = sg_sZ80Context.z80H; // 1e41: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1e42: ld hl, 4d80h sg_sZ80Context.z80HL = (UINT16) (0x4d80); { UINT8 u8Temp0; // 1e45: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1e46: jp 1e5dh goto L1e5d;; // 1e49: ld hl, (4d7ch) L1e49: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d7c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d7d]); { UINT32 u32Temp0; // 1e4c: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1e4d: ld (4d7ch), hl sg_u8mspacman_memory[0x4d7c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d7d] = sg_sZ80Context.z80H; // 1e50: ld hl, (4d7ah) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d7a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d7b]); { UINT32 u32Temp0; // 1e53: adc hl, hl u32Temp0 = (sg_sZ80Context.z80HL + sg_sZ80Context.z80HL + ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80HL) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80HL ^ sg_sZ80Context.z80HL ^ 0x8000) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000)) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); } // 1e55: ld (4d7ah), hl sg_u8mspacman_memory[0x4d7a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d7b] = sg_sZ80Context.z80H; // 1e58: ret nc if (((u8Flags & 0x01) >> 0) != 1) { goto returnInstruction;; } // 1e59: ld hl, 4d7ch sg_sZ80Context.z80HL = (UINT16) (0x4d7c); { UINT8 u8Temp0; // 1e5c: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 1e5d: ld hl, 4d1ah L1e5d: sg_sZ80Context.z80HL = (UINT16) (0x4d1a); // 1e60: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 1e61: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1e62: jp z, 1e72h if (((u8Flags & 0x40) >> 6) == 1) { goto L1e72;; } // 1e65: ld a, (4d06h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d06]); // 1e68: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1e6a: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1e6c: jp z, 1e7ch if (((u8Flags & 0x40) >> 6) == 1) { goto L1e7c;; } // 1e6f: jp 1ebbh goto L1ebb;; // 1e72: ld a, (4d07h) L1e72: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d07]); // 1e75: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); { UINT16 u16Temp0; // 1e77: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x04))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x04 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1e79: jp nz, 1ebbh if (((u8Flags & 0x40) >> 6) != 1) { goto L1ebb;; } // 1e7c: ld a, 04h L1e7c: sg_sZ80Context.z80A = (UINT8) (0x04); // 1e7e: call 1ed0h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x81; goto L1ed0; case 0x1e81: // 1e81: jr c, 01e9eh if (((u8Flags & 0x01) >> 0) == 1) { goto L1e9e;; } // 1e83: ld a, (4daah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daa]); // 1e86: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1e87: jp z, 1e90h if (((u8Flags & 0x40) >> 6) == 1) { goto L1e90;; } // 1e8a: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8b; goto L0028; case 0x1e8d: // 1e8d: jp 1e9eh goto L1e9e;; // 1e90: ld hl, (4d10h) L1e90: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d10]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d11]); // 1e93: call 2052h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x96; goto L2052; case 0x1e96: // 1e96: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 1e97: cp a, 1ah u16Temp0 = sg_sZ80Context.z80A - 0x1a; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x1a))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x1a ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1e99: jr z, 01e9eh if (((u8Flags & 0x40) >> 6) == 1) { goto L1e9e;; } // 1e9b: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9c; goto L0028; case 0x1e9e: // 1e9e: call 1f73h L1e9e: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa1; goto L1f73; case 0x1ea1: // 1ea1: ld ix, 4d24h sg_sZ80Context.z80IX = (UINT16) (0x4d24); // 1ea5: ld iy, 4d10h sg_sZ80Context.z80IY = (UINT16) (0x4d10); // 1ea9: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xac; goto L2000; case 0x1eac: // 1eac: ld (4d10h), hl sg_u8mspacman_memory[0x4d10] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d11] = sg_sZ80Context.z80H; // 1eaf: ld hl, (4d24h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d24]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d25]); // 1eb2: ld (4d1ah), hl sg_u8mspacman_memory[0x4d1a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1b] = sg_sZ80Context.z80H; // 1eb5: ld a, (4d2fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2f]); // 1eb8: ld (4d2bh), a sg_u8mspacman_memory[0x4d2b] = sg_sZ80Context.z80A; // 1ebb: ld ix, 4d1ah L1ebb: sg_sZ80Context.z80IX = (UINT16) (0x4d1a); // 1ebf: ld iy, 4d06h sg_sZ80Context.z80IY = (UINT16) (0x4d06); // 1ec3: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc6; goto L2000; case 0x1ec6: // 1ec6: ld (4d06h), hl sg_u8mspacman_memory[0x4d06] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d07] = sg_sZ80Context.z80H; // 1ec9: call 2018h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xcc; goto L2018; case 0x1ecc: // 1ecc: ld (4d37h), hl sg_u8mspacman_memory[0x4d37] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d38] = sg_sZ80Context.z80H; // 1ecf: ret goto returnInstruction;; { UINT16 u16Temp0; // 1ed0: add a, a L1ed0: u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 1ed1: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 1ed2: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 1ed4: ld hl, 4d09h sg_sZ80Context.z80HL = (UINT16) (0x4d09); { UINT32 u32Temp0; // 1ed7: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 1ed8: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 1ed9: cp a, 1dh u16Temp0 = sg_sZ80Context.z80A - 0x1d; u8Flags = (u8Flags & ~0x04) | ((((0x1d ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1edb: jp nz, 1ee3h if (((u8Flags & 0x40) >> 6) != 1) { goto L1ee3;; } // 1ede: ld (hl), 3dh mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x3d); // 1ee0: jp 1efch goto L1efc;; { UINT16 u16Temp0; // 1ee3: cp a, 3eh L1ee3: u16Temp0 = sg_sZ80Context.z80A - 0x3e; u8Flags = (u8Flags & ~0x04) | ((((0x3e ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1ee5: jp nz, 1eedh if (((u8Flags & 0x40) >> 6) != 1) { goto L1eed;; } // 1ee8: ld (hl), 1eh mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x1e); // 1eea: jp 1efch goto L1efc;; // 1eed: ld b, 21h L1eed: sg_sZ80Context.z80B = (UINT8) (0x21); { UINT16 u16Temp0; // 1eef: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 1ef0: jp c, 1efch if (((u8Flags & 0x01) >> 0) == 1) { goto L1efc;; } // 1ef3: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 1ef4: ld b, 3bh sg_sZ80Context.z80B = (UINT8) (0x3b); { UINT16 u16Temp0; // 1ef6: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 1ef7: jp nc, 1efch if (((u8Flags & 0x01) >> 0) != 1) { goto L1efc;; } // 1efa: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1efb: ret goto returnInstruction;; // 1efc: scf L1efc: u8Flags |= 0x01; u8Flags &= 0xfd; u8Flags &= 0xef; // 1efd: ret goto returnInstruction;; // 1efe: ld a, (4db1h) L1efe: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4db1]); // 1f01: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1f02: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1f03: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 1f04: ld (4db1h), a sg_u8mspacman_memory[0x4db1] = sg_sZ80Context.z80A; // 1f07: ld hl, 32ffh sg_sZ80Context.z80HL = (UINT16) (0x32ff); // 1f0a: ld a, (4d28h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d28]); // 1f0d: xor a, 02h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0x02); // 1f0f: ld (4d2ch), a sg_u8mspacman_memory[0x4d2c] = sg_sZ80Context.z80A; // 1f12: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 1f13: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1f; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x14; goto L0018; case 0x1f14: // 1f14: ld (4d1eh), hl sg_u8mspacman_memory[0x4d1e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1f] = sg_sZ80Context.z80H; // 1f17: ld a, (gmemode) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e02]); { UINT16 u16Temp0; // 1f1a: cp a, 22h u16Temp0 = sg_sZ80Context.z80A - 0x22; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x22))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x22 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1f1c: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1f1d: ld (4d14h), hl sg_u8mspacman_memory[0x4d14] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d15] = sg_sZ80Context.z80H; // 1f20: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 1f21: ld (4d28h), a sg_u8mspacman_memory[0x4d28] = sg_sZ80Context.z80A; // 1f24: ret goto returnInstruction;; // 1f25: ld a, (4db2h) L1f25: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4db2]); // 1f28: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1f29: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1f2a: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 1f2b: ld (4db2h), a sg_u8mspacman_memory[0x4db2] = sg_sZ80Context.z80A; // 1f2e: ld hl, 32ffh L1f2e: sg_sZ80Context.z80HL = (UINT16) (0x32ff); // 1f31: ld a, (4d29h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d29]); // 1f34: xor a, 02h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0x02); // 1f36: ld (4d2dh), a sg_u8mspacman_memory[0x4d2d] = sg_sZ80Context.z80A; // 1f39: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 1f3a: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1f; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3b; goto L0018; case 0x1f3b: // 1f3b: ld (4d20h), hl sg_u8mspacman_memory[0x4d20] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d21] = sg_sZ80Context.z80H; // 1f3e: ld a, (gmemode) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e02]); { UINT16 u16Temp0; // 1f41: cp a, 22h u16Temp0 = sg_sZ80Context.z80A - 0x22; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x22))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x22 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1f43: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1f44: ld (4d16h), hl sg_u8mspacman_memory[0x4d16] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d17] = sg_sZ80Context.z80H; // 1f47: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 1f48: ld (4d29h), a sg_u8mspacman_memory[0x4d29] = sg_sZ80Context.z80A; // 1f4b: ret goto returnInstruction;; // 1f4c: ld a, (4db3h) L1f4c: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4db3]); // 1f4f: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1f50: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1f51: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 1f52: ld (4db3h), a sg_u8mspacman_memory[0x4db3] = sg_sZ80Context.z80A; // 1f55: ld hl, 32ffh L1f55: sg_sZ80Context.z80HL = (UINT16) (0x32ff); // 1f58: ld a, (4d2ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2a]); // 1f5b: xor a, 02h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0x02); // 1f5d: ld (4d2eh), a sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80A; // 1f60: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 1f61: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1f; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x62; goto L0018; case 0x1f62: // 1f62: ld (4d22h), hl sg_u8mspacman_memory[0x4d22] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d23] = sg_sZ80Context.z80H; // 1f65: ld a, (gmemode) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e02]); { UINT16 u16Temp0; // 1f68: cp a, 22h u16Temp0 = sg_sZ80Context.z80A - 0x22; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x22))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x22 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1f6a: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1f6b: ld (4d18h), hl sg_u8mspacman_memory[0x4d18] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d19] = sg_sZ80Context.z80H; // 1f6e: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 1f6f: ld (4d2ah), a sg_u8mspacman_memory[0x4d2a] = sg_sZ80Context.z80A; // 1f72: ret goto returnInstruction;; // 1f73: ld a, (4db4h) L1f73: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4db4]); // 1f76: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 1f77: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 1f78: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 1f79: ld (4db4h), a sg_u8mspacman_memory[0x4db4] = sg_sZ80Context.z80A; // 1f7c: ld hl, 32ffh L1f7c: sg_sZ80Context.z80HL = (UINT16) (0x32ff); // 1f7f: ld a, (4d2bh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2b]); // 1f82: xor a, 02h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0x02); // 1f84: ld (4d2fh), a sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80A; // 1f87: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 1f88: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1f; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x89; goto L0018; case 0x1f89: // 1f89: ld (4d24h), hl sg_u8mspacman_memory[0x4d24] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d25] = sg_sZ80Context.z80H; // 1f8c: ld a, (gmemode) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e02]); { UINT16 u16Temp0; // 1f8f: cp a, 22h u16Temp0 = sg_sZ80Context.z80A - 0x22; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x22))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x22 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 1f91: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 1f92: ld (4d1ah), hl sg_u8mspacman_memory[0x4d1a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1b] = sg_sZ80Context.z80H; // 1f95: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 1f96: ld (4d2bh), a sg_u8mspacman_memory[0x4d2b] = sg_sZ80Context.z80A; // 1f99: ret goto returnInstruction;; // 1f9b: push af // new for ms-pacman // rst 38 continuation (vblank) L1f9b: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80A; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = u8Flags; // 1f9c: ld a, i sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80i); // 1f9e: or a, a ; check to see if we're in test mode u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 1f9f: jr z, 01fa5h ; jp if yes if (((u8Flags & 0x40) >> 6) == 1) { goto L1fa5;; } // 1fa1: pop af // not in test mode u8Flags = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 1fa2: jp 008dh ; continue the normal handler goto L008d;; // 1fa5: pop af // in test mode L1fa5: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 1fa6: jp 3000h ; we're in init, continue testing goto L3000;; // 2000: ld a, (iy+00h) // fast/invincibilty checksum ; HACK3 // fast intermission fix ; HACK10 // this is a common function as well. L2000: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY]); { UINT16 u16Temp0; // 2003: add a, (ix+00h) u16Temp0 = sg_sZ80Context.z80A + sg_u8mspacman_memory[sg_sZ80Context.z80IX]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2006: ld l, a sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80A); // 2007: ld a, (iy+01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY + 1]); { UINT16 u16Temp0; // 200a: add a, (ix+01h) u16Temp0 = sg_sZ80Context.z80A + sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1] ^ sg_sZ80Context.z80A ^ 0x80) & (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1] ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 200d: ld h, a sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80A); // 200e: ret goto returnInstruction;; // 200f: call 2000h L200f: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x20; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x12; goto L2000; case 0x2012: // 2012: call 0065h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x20; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x15; goto L0065; case 0x2015: // 2015: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2016: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2017: ret goto returnInstruction;; // 2018: ld a, l L2018: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); // 2019: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 201b: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 201d: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); { UINT16 u16Temp0; // 201f: add a, 20h u16Temp0 = sg_sZ80Context.z80A + 0x20; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2021: ld l, a sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80A); // 2022: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); // 2023: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 2025: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 2027: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); { UINT16 u16Temp0; // 2029: add a, 1eh u16Temp0 = sg_sZ80Context.z80A + 0x1e; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x1e))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x1e ^ sg_sZ80Context.z80A ^ 0x80) & (0x1e ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 202b: ld h, a sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80A); // 202c: ret goto returnInstruction;; // 202d: push af // this does something that happens often. // same as 'call $0065' L202d: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80A; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = u8Flags; // 202e: push bc sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80B; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80C; // 202f: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); { UINT16 u16Temp0; // 2030: sub a, 20h u16Temp0 = sg_sZ80Context.z80A - 0x20; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2032: ld l, a sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80A); // 2033: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); { UINT16 u16Temp0; // 2034: sub a, 20h u16Temp0 = sg_sZ80Context.z80A - 0x20; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2036: ld h, a sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80A); // 2037: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 2039: sla h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H << 1); // 203b: sla h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H << 1); // 203d: sla h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H << 1); // 203f: sla h u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80H & 0x80) ? 0x01 : 0); sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H << 1); { UINT8 u8Temp0; // 2041: rl b u8Temp0 = sg_sZ80Context.z80B; sg_sZ80Context.z80B = (UINT8) (((sg_sZ80Context.z80B << 1) | ((u8Flags & 0x01) >> 0))); } // 2043: sla h u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80H & 0x80) ? 0x01 : 0); sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H << 1); { UINT8 u8Temp0; // 2045: rl b u8Temp0 = sg_sZ80Context.z80B; sg_sZ80Context.z80B = (UINT8) (((sg_sZ80Context.z80B << 1) | ((u8Flags & 0x01) >> 0))); } // 2047: ld c, h sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80H); // 2048: ld h, 00h sg_sZ80Context.z80H = (UINT8) (0); { UINT32 u32Temp0; // 204a: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 204b: ld bc, 4040h sg_sZ80Context.z80BC = (UINT16) (0x4040); { UINT32 u32Temp0; // 204e: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 204f: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2050: pop af u8Flags = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2051: ret goto returnInstruction;; // 2052: call 0065h L2052: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x20; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x55; goto L0065; case 0x2055: // 2055: ld de, 0400h sg_sZ80Context.z80DE = (UINT16) (0x0400); { UINT32 u32Temp0; // 2058: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 2059: ret goto returnInstruction;; // 205a: call 2052h L205a: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x20; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x5d; goto L2052; case 0x205d: // 205d: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 205e: cp a, 1bh u16Temp0 = sg_sZ80Context.z80A - 0x1b; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x1b ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 2060: jp 366fh goto L366f;; // 2066: xor a, a L2066: sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2067: ld (bc), a mspacmanIndirectWrite8(sg_sZ80Context.z80BC, sg_sZ80Context.z80A); // 2068: ret goto returnInstruction;; // 2069: ld a, (4da1h) L2069: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da1]); // 206c: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 206d: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 206e: ld a, (4e12h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e12]); // 2071: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2072: jp z, 207eh if (((u8Flags & 0x40) >> 6) == 1) { goto L207e;; } // 2075: ld a, (4d9fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d9f]); { UINT16 u16Temp0; // 2078: cp a, 07h u16Temp0 = sg_sZ80Context.z80A - 0x07; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x07))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x07 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 207a: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 207b: jp 2086h goto L2086;; // 207e: ld hl, 4db8h L207e: sg_sZ80Context.z80HL = (UINT16) (0x4db8); // 2081: ld a, (4e0fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e0f]); { UINT16 u16Temp0; UINT8 u8Temp0; // 2084: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 2085: ret c if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 2086: ld a, 02h L2086: sg_sZ80Context.z80A = (UINT8) (0x02); // 2088: ld (4da1h), a sg_u8mspacman_memory[0x4da1] = sg_sZ80Context.z80A; // 208b: ret goto returnInstruction;; // 208c: ld a, (4da2h) L208c: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da2]); // 208f: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2090: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 2091: ld a, (4e12h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e12]); // 2094: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2095: jp z, 20a1h if (((u8Flags & 0x40) >> 6) == 1) { goto L20a1;; } // 2098: ld a, (4d9fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d9f]); { UINT16 u16Temp0; // 209b: cp a, 11h u16Temp0 = sg_sZ80Context.z80A - 0x11; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x11))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x11 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 209d: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 209e: jp 20a9h goto L20a9;; // 20a1: ld hl, 4db9h L20a1: sg_sZ80Context.z80HL = (UINT16) (0x4db9); // 20a4: ld a, (4e10h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e10]); { UINT16 u16Temp0; UINT8 u8Temp0; // 20a7: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 20a8: ret c if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 20a9: ld a, 03h L20a9: sg_sZ80Context.z80A = (UINT8) (0x03); // 20ab: ld (4da2h), a sg_u8mspacman_memory[0x4da2] = sg_sZ80Context.z80A; // 20ae: ret goto returnInstruction;; // 20af: ld a, (4da3h) L20af: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da3]); // 20b2: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 20b3: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 20b4: ld a, (4e12h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e12]); // 20b7: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 20b8: jp z, 20c9h if (((u8Flags & 0x40) >> 6) == 1) { goto L20c9;; } // 20bb: ld a, (4d9fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d9f]); { UINT16 u16Temp0; // 20be: cp a, 20h u16Temp0 = sg_sZ80Context.z80A - 0x20; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x20))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x20 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 20c0: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 20c1: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 20c2: ld (4e12h), a sg_u8mspacman_memory[0x4e12] = sg_sZ80Context.z80A; // 20c5: ld (4d9fh), a sg_u8mspacman_memory[0x4d9f] = sg_sZ80Context.z80A; // 20c8: ret goto returnInstruction;; // 20c9: ld hl, 4dbah L20c9: sg_sZ80Context.z80HL = (UINT16) (0x4dba); // 20cc: ld a, (4e11h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e11]); { UINT16 u16Temp0; UINT8 u8Temp0; // 20cf: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 20d0: ret c if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 20d1: ld a, 03h L20d1: sg_sZ80Context.z80A = (UINT8) (0x03); // 20d3: ld (4da3h), a sg_u8mspacman_memory[0x4da3] = sg_sZ80Context.z80A; // 20d6: ret goto returnInstruction;; // 20d7: ld a, (4da3h) L20d7: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da3]); // 20da: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 20db: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 20dc: ld hl, peleatn ; number of pellets eaten sg_sZ80Context.z80HL = (UINT16) (0x4e0e); // 20df: ld a, (4db6h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4db6]); // 20e2: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 20e3: jp nz, 20f4h if (((u8Flags & 0x40) >> 6) != 1) { goto L20f4;; } // 20e6: ld a, 0f4h sg_sZ80Context.z80A = (UINT8) (0xf4); { UINT16 u16Temp0; UINT8 u8Temp0; // 20e8: sub a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 20e9: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 20ea: ld a, (4dbbh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dbb]); { UINT16 u16Temp0; // 20ed: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80B))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 20ee: ret c if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 20ef: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 20f1: ld (4db6h), a sg_u8mspacman_memory[0x4db6] = sg_sZ80Context.z80A; // 20f4: ld a, (4db7h) L20f4: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4db7]); // 20f7: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 20f8: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 20f9: ld a, 0f4h sg_sZ80Context.z80A = (UINT8) (0xf4); { UINT16 u16Temp0; UINT8 u8Temp0; // 20fb: sub a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 20fc: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 20fd: ld a, (4dbch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dbc]); { UINT16 u16Temp0; // 2100: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80B))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2101: ret c if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 2102: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 2104: ld (4db7h), a sg_u8mspacman_memory[0x4db7] = sg_sZ80Context.z80A; // 2107: ret goto returnInstruction;; case 0x2108: // 2108: jp 3435h goto L3435;; case 0x210b: // 210b: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0c; goto L0020; case 0x211a: // 211a: ld a, (4d3ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3a]); { UINT16 u16Temp0; // 211d: sub a, 21h u16Temp0 = sg_sZ80Context.z80A - 0x21; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x21))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x21 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 211f: jr nz, 02130h if (((u8Flags & 0x40) >> 6) != 1) { goto L2130;; } // 2121: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if (sg_sZ80Context.z80A == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2122: ld (4da0h), a sg_u8mspacman_memory[0x4da0] = sg_sZ80Context.z80A; // 2125: ld (4db7h), a sg_u8mspacman_memory[0x4db7] = sg_sZ80Context.z80A; // 2128: call 0506h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2b; goto L0506; case 0x212b: // 212b: ld hl, 4e06h L212b: sg_sZ80Context.z80HL = (UINT16) (0x4e06); { UINT8 u8Temp0; // 212e: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 212f: ret goto returnInstruction;; case 0x2130: // 2130: call 1806h L2130: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x33; goto L1806; case 0x2133: // 2133: call 1806h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x36; goto L1806; case 0x2136: // 2136: call 1b36h L2136: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x39; goto L1b36; case 0x2139: // 2139: call 1b36h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3c; goto L1b36; case 0x213c: // 213c: call 0e23h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3f; goto L0e23; case 0x213f: // 213f: ret goto returnInstruction;; case 0x2140: // 2140: ld a, (4d3ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3a]); { UINT16 u16Temp0; // 2143: sub a, 1eh u16Temp0 = sg_sZ80Context.z80A - 0x1e; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x1e))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x1e ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2145: jp nz, 2130h if (((u8Flags & 0x40) >> 6) != 1) { goto L2130;; } // 2148: jp 212bh goto L212b;; case 0x214b: // 214b: ld a, (4d32h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d32]); { UINT16 u16Temp0; // 214e: sub a, 1eh u16Temp0 = sg_sZ80Context.z80A - 0x1e; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x1e))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x1e ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2150: jp nz, 2136h if (((u8Flags & 0x40) >> 6) != 1) { goto L2136;; } // 2153: call 1a70h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x56; goto L1a70; case 0x2156: // 2156: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xfe; // 2157: ld (4each), a sg_u8mspacman_memory[0x4eac] = sg_sZ80Context.z80A; // 215a: ld (4ebch), a sg_u8mspacman_memory[0x4ebc] = sg_sZ80Context.z80A; // 215d: call 05a5h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x60; goto L05a5; case 0x2160: // 2160: ld (4d1ch), hl sg_u8mspacman_memory[0x4d1c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1d] = sg_sZ80Context.z80H; // 2163: ld a, (4d3ch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3c]); // 2166: ld (4d30h), a // text lookup table? sg_u8mspacman_memory[0x4d30] = sg_sZ80Context.z80A; // 2169: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x6a; goto L0030; case 0x216d: // 216d: jp 212bh goto L212b;; case 0x2170: // 2170: ld a, (4d32h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d32]); { UINT16 u16Temp0; // 2173: sub a, 2fh u16Temp0 = sg_sZ80Context.z80A - 0x2f; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x2f))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x2f ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2175: jp nz, 2136h if (((u8Flags & 0x40) >> 6) != 1) { goto L2136;; } // 2178: jp 212bh goto L212b;; case 0x217b: // 217b: ld a, (4d32h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d32]); { UINT16 u16Temp0; // 217e: sub a, 3dh u16Temp0 = sg_sZ80Context.z80A - 0x3d; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x3d))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x3d ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2180: jp nz, 2130h if (((u8Flags & 0x40) >> 6) != 1) { goto L2130;; } // 2183: jp 212bh goto L212b;; case 0x2186: // 2186: call 1806h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x89; goto L1806; case 0x2189: // 2189: call 1806h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8c; goto L1806; case 0x218c: // 218c: ld a, (4d3ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3a]); { UINT16 u16Temp0; // 218f: sub a, 3dh u16Temp0 = sg_sZ80Context.z80A - 0x3d; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x3d))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x3d ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2191: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 2192: ld (4e06h), a sg_u8mspacman_memory[0x4e06] = sg_sZ80Context.z80A; // 2195: rst 30h L2195: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x96; goto L0030; case 0x2199: // 2199: ld hl, 4e04h sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 219c: inc (hl) ; add one to level cleared register? mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 219d: ret goto returnInstruction;; case 0x219e: // 219e: ld a, (4e07h) // 21a1: jp 344fh goto L344f;; case 0x21a4: // 21a4: ld b, c sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80C); // 21a5: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa6; goto L0020; case 0x21c4: // 21c4: ld (45d2h), a MSPacVideoWrite(0x45d2,sg_sZ80Context.z80A); // 21c7: ld (45d3h), a MSPacVideoWrite(0x45d3,sg_sZ80Context.z80A); // 21ca: ld (45f2h), a MSPacVideoWrite(0x45f2,sg_sZ80Context.z80A); // 21cd: ld (45f3h), a MSPacVideoWrite(0x45f3,sg_sZ80Context.z80A); // 21d0: call 0506h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd3; goto L0506; case 0x21d3: // 21d3: ld (iy+00h), 60h mspacmanIndirectWrite8(sg_sZ80Context.z80IY, 0x60); // 21d7: ld (iy+01h), 61h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 1, 0x61); // 21db: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x21; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xdc; goto L0030; case 0x21df: // 21df: jr 021f0h goto L21f0;; case 0x21e1: // 21e1: ld a, (4d3ah) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3a]); { UINT16 u16Temp0; // 21e4: sub a, 2ch u16Temp0 = sg_sZ80Context.z80A - 0x2c; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x2c))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x2c ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 21e6: jp nz, 2130h if (((u8Flags & 0x40) >> 6) != 1) { goto L2130;; } // 21e9: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 21ea: ld (4da0h), a sg_u8mspacman_memory[0x4da0] = sg_sZ80Context.z80A; // 21ed: ld (4db7h), a sg_u8mspacman_memory[0x4db7] = sg_sZ80Context.z80A; case 0x21f0: // 21f0: ld hl, 4e07h L21f0: sg_sZ80Context.z80HL = (UINT16) (0x4e07); { UINT8 u8Temp0; // 21f3: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 21f4: ret goto returnInstruction;; case 0x21f5: // 21f5: ld a, (4d01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); { UINT16 u16Temp0; // 21f8: cp a, 77h u16Temp0 = sg_sZ80Context.z80A - 0x77; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 21fa: jr z, 02201h if (((u8Flags & 0x40) >> 6) == 1) { goto L2201;; } { UINT16 u16Temp0; // 21fc: cp a, 78h u16Temp0 = sg_sZ80Context.z80A - 0x78; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x78))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x78 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 21fe: jp nz, 2130h if (((u8Flags & 0x40) >> 6) != 1) { goto L2130;; } // 2201: ld hl, 2084h L2201: sg_sZ80Context.z80HL = (UINT16) (0x2084); // 2204: ld (4d4eh), hl sg_u8mspacman_memory[0x4d4e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d4f] = sg_sZ80Context.z80H; // 2207: ld (4d50h), hl sg_u8mspacman_memory[0x4d50] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d51] = sg_sZ80Context.z80H; case 0x220a: // 220a: jr 021f0h goto L21f0;; case 0x220c: // 220c: ld a, (4d01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); { UINT16 u16Temp0; // 220f: sub a, 78h u16Temp0 = sg_sZ80Context.z80A - 0x78; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x78))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x78 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2211: jp nz, 2237h if (((u8Flags & 0x40) >> 6) != 1) { goto L2237;; } // 2214: ld (iy+00h), 62h mspacmanIndirectWrite8(sg_sZ80Context.z80IY, 0x62); // 2218: ld (iy+01h), 63h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 1, 0x63); // 221c: jr 021f0h goto L21f0;; case 0x221e: // 221e: ld a, (4d01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); { UINT16 u16Temp0; // 2221: sub a, 7bh u16Temp0 = sg_sZ80Context.z80A - 0x7b; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x7b))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x7b ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2223: jr nz, 02237h if (((u8Flags & 0x40) >> 6) != 1) { goto L2237;; } // 2225: ld (iy+00h), 64h mspacmanIndirectWrite8(sg_sZ80Context.z80IY, 0x64); // 2229: ld (iy+01h), 65h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 1, 0x65); // 222d: ld (iy+20h), 66h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x20, 0x66); // 2231: ld (iy+21h), 67h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x21, 0x67); // 2235: jr 021f0h goto L21f0;; // 2237: call 1806h L2237: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x22; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3a; goto L1806; case 0x223a: // 223a: call 1806h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x22; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3d; goto L1806; case 0x223d: // 223d: call 1b36h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x22; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x40; goto L1b36; case 0x2240: // 2240: call 0e23h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x22; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x43; goto L0e23; case 0x2243: // 2243: ret goto returnInstruction;; case 0x2244: // 2244: ld a, (4d01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); { UINT16 u16Temp0; // 2247: sub a, 7eh u16Temp0 = sg_sZ80Context.z80A - 0x7e; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x7e))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x7e ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2249: jr nz, 02237h if (((u8Flags & 0x40) >> 6) != 1) { goto L2237;; } case 0x224b: // 224b: ld (iy+00h), 68h mspacmanIndirectWrite8(sg_sZ80Context.z80IY, 0x68); // 224f: ld (iy+01h), 69h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 1, 0x69); // 2253: ld (iy+20h), 6ah mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x20, 0x6a); // 2257: ld (iy+21h), 6bh mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x21, 0x6b); // 225b: jr 021f0h goto L21f0;; case 0x225d: // 225d: ld a, (4d01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); { UINT16 u16Temp0; // 2260: sub a, 80h u16Temp0 = sg_sZ80Context.z80A - 0x80; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x80))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x80 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2262: jr nz, 02237h if (((u8Flags & 0x40) >> 6) != 1) { goto L2237;; } // 2264: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x22; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x65; goto L0030; case 0x2268: // 2268: jr 021f0h goto L21f0;; case 0x226a: // 226a: ld hl, 4d01h sg_sZ80Context.z80HL = (UINT16) (0x4d01); { UINT8 u8Temp0; // 226d: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } { UINT8 u8Temp0; // 226e: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 226f: ld (iy+00h), 6ch mspacmanIndirectWrite8(sg_sZ80Context.z80IY, 0x6c); // 2273: ld (iy+01h), 6dh mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 1, 0x6d); // 2277: ld (iy+20h), 40h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x20, 0x40); // 227b: ld (iy+21h), 40h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x21, 0x40); // 227f: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x22; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x80; goto L0030; case 0x2283: // 2283: jp 21f0h goto L21f0;; case 0x2286: // 2286: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x22; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x87; goto L0030; case 0x228a: // 228a: jp 21f0h goto L21f0;; case 0x228d: // 228d: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xfe; // 228e: ld (4e07h), a sg_u8mspacman_memory[0x4e07] = sg_sZ80Context.z80A; // 2291: ld hl, 4e04h sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 2294: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } { UINT8 u8Temp0; // 2295: inc (hl) ; add 2 to level cleared register? mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 2296: ret goto returnInstruction;; case 0x2297: // 2297: ld a, (4e08h) // 229a: jp 3469h goto L3469;; case 0x22b9: // 22b9: ld hl, 4e08h L22b9: sg_sZ80Context.z80HL = (UINT16) (0x4e08); { UINT8 u8Temp0; // 22bc: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 22bd: ret goto returnInstruction;; case 0x22be: // 22be: ld a, (4d01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); { UINT16 u16Temp0; // 22c1: cp a, 0ffh u16Temp0 = sg_sZ80Context.z80A - 0xff; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 22c3: jr z, 022cah if (((u8Flags & 0x40) >> 6) == 1) { goto L22ca;; } { UINT16 u16Temp0; // 22c5: cp a, 0feh u16Temp0 = sg_sZ80Context.z80A - 0xfe; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0xfe))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0xfe ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 22c7: jp nz, 2130h if (((u8Flags & 0x40) >> 6) != 1) { goto L2130;; } // 22ca: inc a L22ca: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 22cb: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 22cc: ld (4d01h), a sg_u8mspacman_memory[0x4d01] = sg_sZ80Context.z80A; // 22cf: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 22d1: ld (4db1h), a sg_u8mspacman_memory[0x4db1] = sg_sZ80Context.z80A; // 22d4: call 1efeh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x22; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd7; goto L1efe; case 0x22d7: // 22d7: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x22; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd8; goto L0030; case 0x22db: // 22db: jr 022b9h goto L22b9;; case 0x22dd: // 22dd: ld a, (4d32h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d32]); { UINT16 u16Temp0; // 22e0: sub a, 2dh u16Temp0 = sg_sZ80Context.z80A - 0x2d; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); } // 22e2: jr z, 022b9h if (((u8Flags & 0x40) >> 6) == 1) { goto L22b9;; } // 22e4: ld a, (4d00h) L22e4: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d00]); // 22e7: ld (4dd2h), a sg_u8mspacman_memory[0x4dd2] = sg_sZ80Context.z80A; // 22ea: ld a, (4d01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d01]); { UINT16 u16Temp0; // 22ed: sub a, 08h u16Temp0 = sg_sZ80Context.z80A - 0x08; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x08))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x08 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 22ef: ld (4dd3h), a sg_u8mspacman_memory[0x4dd3] = sg_sZ80Context.z80A; // 22f2: jp 2130h goto L2130;; case 0x22f5: // 22f5: ld a, (4d32h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d32]); { UINT16 u16Temp0; // 22f8: sub a, 1eh u16Temp0 = sg_sZ80Context.z80A - 0x1e; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); } // 22fa: jr z, 022b9h if (((u8Flags & 0x40) >> 6) == 1) { goto L22b9;; } case 0x22fc: // 22fc: jr 022e4h goto L22e4;; case 0x22fe: // 22fe: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xfe; // 22ff: ld (4e08h), a sg_u8mspacman_memory[0x4e08] = sg_sZ80Context.z80A; // 2302: rst 30h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; goto L0030; case 0x2306: // 2306: ld hl, 4e04h sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 2309: inc (hl) ; add 1 to level clared register mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 230a: ret goto returnInstruction;; // 230b: ld hl, IRQEn // Main program start (reset) // 0 -> 5000 - 5007 (special registers) // irq off, sound off, flip off, etc. L230b: sg_sZ80Context.z80HL = (UINT16) (0x5000); // 230e: ld b, 08h sg_sZ80Context.z80B = (UINT8) (0x08); // 2310: xor a, a ; 0 -> a sg_sZ80Context.z80A = (UINT8) (0); // 2311: ld (hl), a L2311: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2312: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); if ((sg_sZ80Context.z80L & 0x0f) == 0) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2313: djnz 02311h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L2311;; } // 2315: ld hl, 4000h // Clear screen // 40 -> 4000-43ff (Video RAM) sg_sZ80Context.z80HL = (UINT16) (0x4000); // 2318: ld b, 04h sg_sZ80Context.z80B = (UINT8) (0x04); // 231a: ld (Wdog), a ; kick the dog L231a: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 231d: ld (coinct), a ; kick coin counter? MSStuffWrite(0x5007,sg_sZ80Context.z80A); // 2320: ld a, 40h sg_sZ80Context.z80A = (UINT8) (0x40); // 2322: ld (hl), a L2322: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2323: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80L & 0x0f) == 0) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2324: jr nz, 02322h ; loop if (((u8Flags & 0x40) >> 6) != 1) { goto L2322;; } // 2326: inc h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80H & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80H & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80H == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2327: djnz 0231ah ; loop sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L231a;; } // 2329: ld b, 04h // 0f -> 4400 - 47ff (Color RAM) sg_sZ80Context.z80B = (UINT8) (0x04); // 232b: ld (Wdog), a ; kick the dog L232b: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 232e: xor a, a ; 0 -> a sg_sZ80Context.z80A = (UINT8) (0); // 232f: ld (coinct), a ; kick coin counter? MSStuffWrite(0x5007,sg_sZ80Context.z80A); // 2332: ld a, 0fh sg_sZ80Context.z80A = (UINT8) (0x0f); // 2334: ld (hl), a L2334: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2335: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80L & 0x0f) == 0) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2336: jr nz, 02334h ; loop if (((u8Flags & 0x40) >> 6) != 1) { goto L2334;; } // 2338: inc h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80H & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80H & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80H == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2339: djnz 0232bh ; loop sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L232b;; } // 233b: im 1 ; set interrupt mode 1 // test the interrupt hardware now sg_sZ80Context.z80interruptMode = (UINT8) (1); // 233d: nop ; interrupt vector hardware not set // 233e: nop // 233f: nop // 2340: nop // 2341: xor a, a ; a = 0 // Pac's routine: sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xfe; // 2342: ld (coinct), a ; clear coin counter MSStuffWrite(0x5007,sg_sZ80Context.z80A); // 2345: inc a ; a = 1 (a++) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2346: ld (IRQEn), a ; Enable interrupts (pcb) MSStuffWrite(0x5000,sg_sZ80Context.z80A); // 2349: ei ; Enable interrupts (cpu) sg_sZ80Context.z80iff |= 0x01; sg_sZ80Context.z80iff |= 0x02; s32CyclesRemaining = s32CyclesRemaining - 0x04; // 234a: halt ; WAIT for interrupt then jump 0x0038 sg_sZ80Context.z80halted = 1; s32CyclesRemaining = s32CyclesRemaining - 0x04; if (s32CyclesRemaining >= 0) { s32CyclesRemaining = (s32CyclesRemaining - ((s32CyclesRemaining + 0x03) & 0xfffffffc)); } goto Exit234b;; // 234b: ld (Wdog), a ; kick dog // main program init // perhaps a contiuation from 3295 L234b: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 234e: ld sp, 4fc0h ; set stack pointer sg_sZ80Context.z80SP = (UINT16) (0x4fc0); // 2351: xor a, a // reset custom registers. Set them to 0 sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2352: ld hl, IRQEn ; from $5000 sg_sZ80Context.z80HL = (UINT16) (0x5000); // 2355: ld bc, 0808h ; for $0808 bytes sg_sZ80Context.z80BC = (UINT16) (0x0808); // 2358: rst 08h ; disable all sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x59; goto L0008; case 0x2359: // 2359: ld hl, 4c00h // clear ram sg_sZ80Context.z80HL = (UINT16) (0x4c00); // 235c: ld b, 0beh sg_sZ80Context.z80B = (UINT8) (0xbe); // 235e: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x5f; goto L0008; case 0x235f: // 235f: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x60; goto L0008; case 0x2360: // 2360: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x61; goto L0008; case 0x2361: // 2361: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x62; goto L0008; case 0x2362: // 2362: ld hl, V1Acc // clear sound registers, sprite positions sg_sZ80Context.z80HL = (UINT16) (0x5040); // 2365: ld b, 40h sg_sZ80Context.z80B = (UINT8) (0x40); // 2367: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x68; goto L0008; case 0x2368: // 2368: ld (Wdog), a ; kick dog MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 236b: call 240dh ; clear color ram sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x6e; goto L240d; case 0x236e: // 236e: ld (Wdog), a ; kick dog MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 2371: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 2373: call 23edh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x76; goto L23ed; case 0x2376: // 2376: ld (Wdog), a ; kick dog MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 2379: ld hl, 4cc0h sg_sZ80Context.z80HL = (UINT16) (0x4cc0); // 237c: ld (4c80h), hl sg_u8mspacman_memory[0x4c80] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4c81] = sg_sZ80Context.z80H; // 237f: ld (4c82h), hl sg_u8mspacman_memory[0x4c82] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4c83] = sg_sZ80Context.z80H; // 2382: ld a, 0ffh // 0xff -> 4cc0-4cff sg_sZ80Context.z80A = (UINT8) (0xff); // 2384: ld b, 40h sg_sZ80Context.z80B = (UINT8) (0x40); // 2386: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x87; goto L0008; case 0x2387: // 2387: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 2389: ld (IRQEn), a ; enable interrupts MSStuffWrite(0x5000,sg_sZ80Context.z80A); // 238c: ei ; enable interrupts sg_sZ80Context.z80iff |= 0x01; sg_sZ80Context.z80iff |= 0x02; s32CyclesRemaining = s32CyclesRemaining - 0x04; case 0x238d: // 238d: ld hl, (4c82h) L238d: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4c82]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4c83]); // 2390: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2391: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); // Replaced code from 0x2392-0x2394 with the following: if (sg_sZ80Context.z80A & 0x80) { sg_sZ80Context.z80pc = 0x238d; sg_sZ80Context.z80clockticks += 45; sg_sZ80Context.z80rCounter += 45; goto adjustTimingCounter; } // 2395: ld (hl), 0ffh mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0xff); // 2397: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 2398: ld b, (hl) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2399: ld (hl), 0ffh mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0xff); // 239b: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); // 239c: jr nz, 023a0h if (((u8Flags & 0x40) >> 6) != 1) { goto L23a0;; } // 239e: ld L, 0c0h sg_sZ80Context.z80L = (UINT8) (0xc0); // 23a0: ld (4c82h), hl L23a0: sg_u8mspacman_memory[0x4c82] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4c83] = sg_sZ80Context.z80H; // 23a3: ld hl, 238dh sg_sZ80Context.z80HL = (UINT16) (0x238d); // 23a6: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 23a7: rst 20h ; where does it jmp from here? sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa8; goto L0020; case 0x23e8: // 23e8: ld hl, 4e04h sg_sZ80Context.z80HL = (UINT16) (0x4e04); { UINT8 u8Temp0; // 23eb: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 23ec: ret goto returnInstruction;; case 0x23ed: // 23ed: ld a, b // subroutine L23ed: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 23ee: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xef; goto L0020; case 0x23f3: // 23f3: ld a, 40h sg_sZ80Context.z80A = (UINT8) (0x40); // 23f5: ld bc, 0004h sg_sZ80Context.z80BC = (UINT16) (0x04); // 23f8: ld hl, 4000h ; start of video ram sg_sZ80Context.z80HL = (UINT16) (0x4000); // 23fb: rst 08h L23fb: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x23; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xfc; goto L0008; case 0x23fc: // 23fc: dec c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80C == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80C & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 23fd: jr nz, 023fbh if (((u8Flags & 0x40) >> 6) != 1) { goto L23fb;; } // 23ff: ret goto returnInstruction;; case 0x2400: // 2400: ld a, 40h // set video ram to 0x40 ; just before boxes sg_sZ80Context.z80A = (UINT8) (0x40); // 2402: ld hl, 4040h sg_sZ80Context.z80HL = (UINT16) (0x4040); // 2405: ld bc, 8004h sg_sZ80Context.z80BC = (UINT16) (0x8004); // 2408: rst 08h L2408: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x24; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; goto L0008; case 0x2409: // 2409: dec c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80C == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80C & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 240a: jr nz, 02408h if (((u8Flags & 0x40) >> 6) != 1) { goto L2408;; } // 240c: ret goto returnInstruction;; case 0x240d: // 240d: xor a, a // set color ram to 0x00 L240d: sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 240e: ld bc, 0004h sg_sZ80Context.z80BC = (UINT16) (0x04); // 2411: ld hl, 4400h ; start of color ram sg_sZ80Context.z80HL = (UINT16) (0x4400); // 2414: rst 08h L2414: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x24; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x15; goto L0008; case 0x2415: // 2415: dec c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80C == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80C & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2416: jr nz, 02414h if (((u8Flags & 0x40) >> 6) != 1) { goto L2414;; } // 2418: ret goto returnInstruction;; case 0x2419: // 2419: ld hl, 4000h ; start of video ram // this is probably the routine that draws the power pellets on // the screen. It calls 94ec, which probably draws the pellets // in the proper locations according to the ms-pac mazes. // Draw out the maze to the screen sg_sZ80Context.z80HL = (UINT16) (0x4000); // 241c: call 946ah ; patch to retreive map info sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x24; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1f; goto L946a; case 0x241f: // 241f: ld a, (bc) ; get data L241f: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80BC]); // 2420: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2421: ret z ; 0 is the end of the level data if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 2422: jp m, 242ch ; if it's < 0x80, data is an offset if (((u8Flags & 0x80) >> 7) == 1) { goto L242c;; } // 2425: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 2426: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); { UINT32 u32Temp0; // 2428: add hl, de ; adjust VRAM pointer u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 2429: dec hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL - 1); // 242a: inc bc ; point to next data sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC + 1); // 242b: ld a, (bc) ; load data and store in VRAM sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80BC]); // 242c: inc hl L242c: sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 242d: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 242e: push af sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80A; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = u8Flags; // 242f: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 2430: ld de, 83e0h ; calculate mirror position sg_sZ80Context.z80DE = (UINT16) (0x83e0); // 2433: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); // 2434: and a, 1fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x1f); { UINT16 u16Temp0; // 2436: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2437: ld h, 00h sg_sZ80Context.z80H = (UINT8) (0); // 2439: ld l, a sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80A); { UINT32 u32Temp0; // 243a: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 243b: pop de sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 243c: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 243d: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } // 243f: pop af sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2440: xor a, 01h ; calculate reflected title sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 1); // 2442: ld (hl), a ; store reflected title in position mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); { UINT16 u16Temp0; // 2443: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 2444: inc bc ; next data sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC + 1); // 2445: jp 241fh ; keep going goto L241f;; case 0x2448: // 2448: ld hl, 4000h ; start of video ram // draw out the player pills // 244b: jp 947ch ; patch goto L947c;; case 0x244e: // 244e: ld c, (hl) ; junk // 244f: ld iy, 35b5h ; points to pill data sg_sZ80Context.z80IY = (UINT16) (0x35b5); case 0x2453: // 2453: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); // 2455: ld b, 1eh ; total # pills entries sg_sZ80Context.z80B = (UINT8) (0x1e); // 2457: ld c, 08h ; 8x L2457: sg_sZ80Context.z80C = (UINT8) (0x08); // 2459: ld a, (ix+00h) ; get current pill entry sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 245c: ld e, (iy+00h) ; get current offset L245c: sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY]); { UINT32 u32Temp0; // 245f: add hl, de ; adjust vram u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 2460: rlca ; get current byte u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 0x80) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 2461: jr nc, 02465h ; skip pill if no carry if (((u8Flags & 0x01) >> 0) != 1) { goto L2465;; } // 2463: ld (hl), 10h ; draw pill mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x10); // 2465: inc iy ; next entry L2465: sg_sZ80Context.z80IY = (UINT16) (sg_sZ80Context.z80IY + 1); // 2467: dec c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80C == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2468: jr nz, 0245ch ; keep testing all the bits if (((u8Flags & 0x40) >> 6) != 1) { goto L245c;; } // 246a: inc ix ; go to next pill entry sg_sZ80Context.z80IX = (UINT16) (sg_sZ80Context.z80IX + 1); // 246c: dec b sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80B == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80B & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80B & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80B == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 246d: jr nz, 02457h ; keep drawing pills if (((u8Flags & 0x40) >> 6) != 1) { goto L2457;; } // 246f: ld hl, brdno2 ; copy big pill // 2472: jp 94ech ; pellet check routine goto L94ec;; case 0x2475: // 2475: ldi // pac's version: // junk: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); // 2477: ld de, 4078h ; power pellet address (lower right) sg_sZ80Context.z80DE = (UINT16) (0x4078); // 247a: ldi mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); // 247c: ld de, 4384h ; power pellet address (upper left) sg_sZ80Context.z80DE = (UINT16) (0x4384); // 247f: ldi mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); // 2481: ld de, 4398h ; power pellet address (lower left) sg_sZ80Context.z80DE = (UINT16) (0x4398); // 2484: ldi mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 2486: ret goto returnInstruction;; case 0x2487: // 2487: ld hl, 4000h ; start of work ram // update the current screen pill config to work ram L2487: // 248a: jp 9481h goto L9481;; case 0x248d: // 248d: ld c, (hl) // 248e: ld iy, 35b5h ; start of some data // pac's version: sg_sZ80Context.z80IY = (UINT16) (0x35b5); case 0x2492: // 2492: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); // 2494: ld b, 1eh sg_sZ80Context.z80B = (UINT8) (0x1e); // 2496: ld c, 08h L2496: sg_sZ80Context.z80C = (UINT8) (0x08); // 2498: ld e, (iy+00h) L2498: sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY]); { UINT32 u32Temp0; // 249b: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 249c: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 249d: cp a, 10h u16Temp0 = sg_sZ80Context.z80A - 0x10; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 249f: scf u8Flags |= 0x01; // 24a0: jr z, 024a3h if (((u8Flags & 0x40) >> 6) == 1) { goto L24a3;; } // 24a2: ccf u8Flags = (u8Flags & ~0x01) | ((((u8Flags & 0x01) >> 0) ^ 1) ? 0x01 : 0); { UINT8 u8Temp0; // 24a3: rl (ix+00h) L24a3: u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80IX]; mspacmanIndirectWrite8(sg_sZ80Context.z80IX, (u8Temp0 << 1) | ((u8Flags & 0x01) >> 0)); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80IX]; } // 24a7: inc iy sg_sZ80Context.z80IY = (UINT16) (sg_sZ80Context.z80IY + 1); // 24a9: dec c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80C == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 24aa: jr nz, 02498h if (((u8Flags & 0x40) >> 6) != 1) { goto L2498;; } // 24ac: inc ix sg_sZ80Context.z80IX = (UINT16) (sg_sZ80Context.z80IX + 1); // 24ae: dec b sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80B == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80B & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80B & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80B == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 24af: jr nz, 02496h if (((u8Flags & 0x40) >> 6) != 1) { goto L2496;; } // 24b1: ld hl, 4064h ; power pellet address // 24b4: jp 9504h ; pellet check routine goto L9504;; case 0x24c9: // 24c9: ld hl, 4e16h L24c9: sg_sZ80Context.z80HL = (UINT16) (0x4e16); // 24cc: ld a, 0ffh sg_sZ80Context.z80A = (UINT8) (0xff); // 24ce: ld b, 1eh sg_sZ80Context.z80B = (UINT8) (0x1e); // 24d0: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x24; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd1; goto L0008; case 0x24d1: // 24d1: ld a, 14h sg_sZ80Context.z80A = (UINT8) (0x14); // 24d3: ld b, 04h sg_sZ80Context.z80B = (UINT8) (0x04); // 24d5: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x24; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd6; goto L0008; case 0x24d6: // 24d6: ret goto returnInstruction;; case 0x24d7: // 24d7: ld e, b // sets up the maze color sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80B); // 24d8: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); { UINT16 u16Temp0; // 24d9: cp a, 02h u16Temp0 = sg_sZ80Context.z80A - 0x02; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x02))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x02 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 24db: ld a, 1fh sg_sZ80Context.z80A = (UINT8) (0x1f); // 24dd: jp 9580h goto L9580;; // 24e1: ld hl, 4440h ; draw color to screen L24e1: sg_sZ80Context.z80HL = (UINT16) (0x4440); // 24e4: ld bc, 8004h sg_sZ80Context.z80BC = (UINT16) (0x8004); // 24e7: rst 08h L24e7: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x24; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe8; goto L0008; case 0x24e8: // 24e8: dec c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80C == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80C & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 24e9: jr nz, 024e7h if (((u8Flags & 0x40) >> 6) != 1) { goto L24e7;; } // 24eb: ld a, 0fh sg_sZ80Context.z80A = (UINT8) (0x0f); // 24ed: ld b, 40h sg_sZ80Context.z80B = (UINT8) (0x40); // 24ef: ld hl, 47c0h sg_sZ80Context.z80HL = (UINT16) (0x47c0); // 24f2: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x24; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf3; goto L0008; case 0x24f3: // 24f3: ld a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80E); { UINT16 u16Temp0; // 24f4: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 1))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 24f6: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 24f7: ld a, 1ah // 24f9: jp 95c3h goto L95c3;; // 2534: ld a, 18h L2534: sg_sZ80Context.z80A = (UINT8) (0x18); // 2536: ld (45edh), a MSPacVideoWrite(0x45ed,sg_sZ80Context.z80A); // 2539: ld (460dh), a MSPacVideoWrite(0x460d,sg_sZ80Context.z80A); // 253c: ret goto returnInstruction;; case 0x253d: // 253d: ld ix, 4c00h // this is strange... possibly data of some kind? sg_sZ80Context.z80IX = (UINT16) (0x4c00); // 2541: ld (ix+02h), 20h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, 0x20); // 2545: ld (ix+04h), 20h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x04, 0x20); // 2549: ld (ix+06h), 20h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, 0x20); // 254d: ld (ix+08h), 20h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x08, 0x20); // 2551: ld (ix+0ah), 2ch mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0a, 0x2c); // 2555: ld (ix+0ch), 3fh mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0c, 0x3f); // 2559: ld (ix+03h), 01h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x03, 1); // 255d: ld (ix+05h), 03h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x05, 0x03); // 2561: ld (ix+07h), 05h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, 0x05); // 2565: ld (ix+09h), 07h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x09, 0x07); // 2569: ld (ix+0bh), 09h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0b, 0x09); // 256d: ld (ix+0dh), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0d, 0); // 2571: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2572: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2573: jp nz, 260fh if (((u8Flags & 0x40) >> 6) != 1) { goto L260f;; } // 2576: ld hl, 8064h sg_sZ80Context.z80HL = (UINT16) (0x8064); // 2579: ld (4d00h), hl sg_u8mspacman_memory[0x4d00] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d01] = sg_sZ80Context.z80H; // 257c: ld hl, 807ch sg_sZ80Context.z80HL = (UINT16) (0x807c); // 257f: ld (4d02h), hl sg_u8mspacman_memory[0x4d02] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d03] = sg_sZ80Context.z80H; // 2582: ld hl, 907ch sg_sZ80Context.z80HL = (UINT16) (0x907c); // 2585: ld (4d04h), hl sg_u8mspacman_memory[0x4d04] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d05] = sg_sZ80Context.z80H; // 2588: ld hl, 707ch sg_sZ80Context.z80HL = (UINT16) (0x707c); // 258b: ld (4d06h), hl sg_u8mspacman_memory[0x4d06] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d07] = sg_sZ80Context.z80H; // 258e: ld hl, 80c4h sg_sZ80Context.z80HL = (UINT16) (0x80c4); // 2591: ld (4d08h), hl sg_u8mspacman_memory[0x4d08] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d09] = sg_sZ80Context.z80H; // 2594: ld hl, 2e2ch sg_sZ80Context.z80HL = (UINT16) (0x2e2c); // 2597: ld (4d0ah), hl sg_u8mspacman_memory[0x4d0a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0b] = sg_sZ80Context.z80H; // 259a: ld (4d31h), hl sg_u8mspacman_memory[0x4d31] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d32] = sg_sZ80Context.z80H; // 259d: ld hl, 2e2fh sg_sZ80Context.z80HL = (UINT16) (0x2e2f); // 25a0: ld (4d0ch), hl sg_u8mspacman_memory[0x4d0c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0d] = sg_sZ80Context.z80H; // 25a3: ld (4d33h), hl sg_u8mspacman_memory[0x4d33] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d34] = sg_sZ80Context.z80H; // 25a6: ld hl, 302fh sg_sZ80Context.z80HL = (UINT16) (0x302f); // 25a9: ld (4d0eh), hl sg_u8mspacman_memory[0x4d0e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0f] = sg_sZ80Context.z80H; // 25ac: ld (4d35h), hl sg_u8mspacman_memory[0x4d35] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d36] = sg_sZ80Context.z80H; // 25af: ld hl, 2c2fh sg_sZ80Context.z80HL = (UINT16) (0x2c2f); // 25b2: ld (4d10h), hl sg_u8mspacman_memory[0x4d10] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d11] = sg_sZ80Context.z80H; // 25b5: ld (4d37h), hl sg_u8mspacman_memory[0x4d37] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d38] = sg_sZ80Context.z80H; // 25b8: ld hl, 2e38h sg_sZ80Context.z80HL = (UINT16) (0x2e38); // 25bb: ld (4d12h), hl sg_u8mspacman_memory[0x4d12] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d13] = sg_sZ80Context.z80H; // 25be: ld (4d39h), hl sg_u8mspacman_memory[0x4d39] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d3a] = sg_sZ80Context.z80H; // 25c1: ld hl, 0100h sg_sZ80Context.z80HL = (UINT16) (0x0100); // 25c4: ld (4d14h), hl sg_u8mspacman_memory[0x4d14] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d15] = sg_sZ80Context.z80H; // 25c7: ld (4d1eh), hl sg_u8mspacman_memory[0x4d1e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1f] = sg_sZ80Context.z80H; // 25ca: ld hl, 0001h sg_sZ80Context.z80HL = (UINT16) (1); // 25cd: ld (4d16h), hl sg_u8mspacman_memory[0x4d16] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d17] = sg_sZ80Context.z80H; // 25d0: ld (4d20h), hl sg_u8mspacman_memory[0x4d20] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d21] = sg_sZ80Context.z80H; // 25d3: ld hl, 00ffh sg_sZ80Context.z80HL = (UINT16) (0xff); // 25d6: ld (4d18h), hl sg_u8mspacman_memory[0x4d18] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d19] = sg_sZ80Context.z80H; // 25d9: ld (4d22h), hl sg_u8mspacman_memory[0x4d22] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d23] = sg_sZ80Context.z80H; // 25dc: ld hl, 00ffh sg_sZ80Context.z80HL = (UINT16) (0xff); // 25df: ld (4d1ah), hl sg_u8mspacman_memory[0x4d1a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1b] = sg_sZ80Context.z80H; // 25e2: ld (4d24h), hl sg_u8mspacman_memory[0x4d24] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d25] = sg_sZ80Context.z80H; // 25e5: ld hl, 0100h sg_sZ80Context.z80HL = (UINT16) (0x0100); // 25e8: ld (4d1ch), hl sg_u8mspacman_memory[0x4d1c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1d] = sg_sZ80Context.z80H; // 25eb: ld (4d26h), hl sg_u8mspacman_memory[0x4d26] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d27] = sg_sZ80Context.z80H; // 25ee: ld hl, 0102h sg_sZ80Context.z80HL = (UINT16) (0x0102); // 25f1: ld (4d28h), hl sg_u8mspacman_memory[0x4d28] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d29] = sg_sZ80Context.z80H; // 25f4: ld (4d2ch), hl sg_u8mspacman_memory[0x4d2c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d2d] = sg_sZ80Context.z80H; // 25f7: ld hl, 0303h sg_sZ80Context.z80HL = (UINT16) (0x0303); // 25fa: ld (4d2ah), hl sg_u8mspacman_memory[0x4d2a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d2b] = sg_sZ80Context.z80H; // 25fd: ld (4d2eh), hl sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80H; // 2600: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 2602: ld (4d30h), a sg_u8mspacman_memory[0x4d30] = sg_sZ80Context.z80A; // 2605: ld (4d3ch), a sg_u8mspacman_memory[0x4d3c] = sg_sZ80Context.z80A; // 2608: ld hl, 0000h sg_sZ80Context.z80HL = (UINT16) (0); // 260b: ld (4dd2h), hl sg_u8mspacman_memory[0x4dd2] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dd3] = sg_sZ80Context.z80H; // 260e: ret goto returnInstruction;; case 0x260f: // 260f: ld hl, 0094h L260f: sg_sZ80Context.z80HL = (UINT16) (0x94); // 2612: ld (4d00h), hl sg_u8mspacman_memory[0x4d00] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d01] = sg_sZ80Context.z80H; // 2615: ld (4d02h), hl sg_u8mspacman_memory[0x4d02] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d03] = sg_sZ80Context.z80H; // 2618: ld (4d04h), hl sg_u8mspacman_memory[0x4d04] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d05] = sg_sZ80Context.z80H; // 261b: ld (4d06h), hl sg_u8mspacman_memory[0x4d06] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d07] = sg_sZ80Context.z80H; // 261e: ld hl, 1e32h sg_sZ80Context.z80HL = (UINT16) (0x1e32); // 2621: ld (4d0ah), hl sg_u8mspacman_memory[0x4d0a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0b] = sg_sZ80Context.z80H; // 2624: ld (4d0ch), hl sg_u8mspacman_memory[0x4d0c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0d] = sg_sZ80Context.z80H; // 2627: ld (4d0eh), hl sg_u8mspacman_memory[0x4d0e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d0f] = sg_sZ80Context.z80H; // 262a: ld (4d10h), hl sg_u8mspacman_memory[0x4d10] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d11] = sg_sZ80Context.z80H; // 262d: ld (4d31h), hl sg_u8mspacman_memory[0x4d31] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d32] = sg_sZ80Context.z80H; // 2630: ld (4d33h), hl sg_u8mspacman_memory[0x4d33] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d34] = sg_sZ80Context.z80H; // 2633: ld (4d35h), hl sg_u8mspacman_memory[0x4d35] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d36] = sg_sZ80Context.z80H; // 2636: ld (4d37h), hl sg_u8mspacman_memory[0x4d37] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d38] = sg_sZ80Context.z80H; // 2639: ld hl, 0100h sg_sZ80Context.z80HL = (UINT16) (0x0100); // 263c: ld (4d14h), hl sg_u8mspacman_memory[0x4d14] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d15] = sg_sZ80Context.z80H; // 263f: ld (4d16h), hl sg_u8mspacman_memory[0x4d16] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d17] = sg_sZ80Context.z80H; // 2642: ld (4d18h), hl sg_u8mspacman_memory[0x4d18] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d19] = sg_sZ80Context.z80H; // 2645: ld (4d1ah), hl sg_u8mspacman_memory[0x4d1a] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1b] = sg_sZ80Context.z80H; // 2648: ld (4d1eh), hl sg_u8mspacman_memory[0x4d1e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1f] = sg_sZ80Context.z80H; // 264b: ld (4d20h), hl sg_u8mspacman_memory[0x4d20] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d21] = sg_sZ80Context.z80H; // 264e: ld (4d22h), hl sg_u8mspacman_memory[0x4d22] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d23] = sg_sZ80Context.z80H; // 2651: ld (4d24h), hl sg_u8mspacman_memory[0x4d24] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d25] = sg_sZ80Context.z80H; // 2654: ld (4d1ch), hl sg_u8mspacman_memory[0x4d1c] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1d] = sg_sZ80Context.z80H; // 2657: ld (4d26h), hl sg_u8mspacman_memory[0x4d26] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d27] = sg_sZ80Context.z80H; // 265a: ld hl, 4d28h sg_sZ80Context.z80HL = (UINT16) (0x4d28); // 265d: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 265f: ld b, 09h sg_sZ80Context.z80B = (UINT8) (0x09); // 2661: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x26; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x62; goto L0008; case 0x2662: // 2662: ld (4d3ch), a sg_u8mspacman_memory[0x4d3c] = sg_sZ80Context.z80A; // 2665: ld hl, 0894h sg_sZ80Context.z80HL = (UINT16) (0x0894); // 2668: ld (4d08h), hl sg_u8mspacman_memory[0x4d08] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d09] = sg_sZ80Context.z80H; // 266b: ld hl, 1f32h sg_sZ80Context.z80HL = (UINT16) (0x1f32); // 266e: ld (4d12h), hl sg_u8mspacman_memory[0x4d12] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d13] = sg_sZ80Context.z80H; // 2671: ld (4d39h), hl sg_u8mspacman_memory[0x4d39] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d3a] = sg_sZ80Context.z80H; // 2674: ret goto returnInstruction;; case 0x2675: // 2675: ld hl, 0000h L2675: sg_sZ80Context.z80HL = (UINT16) (0); // 2678: ld (4dd2h), hl sg_u8mspacman_memory[0x4dd2] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dd3] = sg_sZ80Context.z80H; // 267b: ld (4d08h), hl sg_u8mspacman_memory[0x4d08] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d09] = sg_sZ80Context.z80H; // 267e: ld (4d00h), hl L267e: sg_u8mspacman_memory[0x4d00] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d01] = sg_sZ80Context.z80H; // 2681: ld (4d02h), hl sg_u8mspacman_memory[0x4d02] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d03] = sg_sZ80Context.z80H; // 2684: ld (4d04h), hl sg_u8mspacman_memory[0x4d04] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d05] = sg_sZ80Context.z80H; // 2687: ld (4d06h), hl sg_u8mspacman_memory[0x4d06] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d07] = sg_sZ80Context.z80H; // 268a: ret goto returnInstruction;; case 0x268b: // 268b: ld a, 55h sg_sZ80Context.z80A = (UINT8) (0x55); // 268d: ld (4d94h), a sg_u8mspacman_memory[0x4d94] = sg_sZ80Context.z80A; // 2690: dec b sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80B == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80B & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80B & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80B == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2691: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 2692: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 2694: ld (4da0h), a sg_u8mspacman_memory[0x4da0] = sg_sZ80Context.z80A; // 2697: ret goto returnInstruction;; case 0x2698: // 2698: ld a, 01h ; set intro mode sg_sZ80Context.z80A = (UINT8) (1); // 269a: ld (4e00h), a sg_u8mspacman_memory[0x4e00] = sg_sZ80Context.z80A; // 269d: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 269e: ld (4e01h), a sg_u8mspacman_memory[0x4e01] = sg_sZ80Context.z80A; // 26a1: ret goto returnInstruction;; case 0x26a2: // 26a2: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 26a3: ld de, 4d00h sg_sZ80Context.z80DE = (UINT16) (0x4d00); // 26a6: ld hl, 4e00h ; game mode L26a6: sg_sZ80Context.z80HL = (UINT16) (0x4e00); // 26a9: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 26aa: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 26ab: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 26ac: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 26ae: jp nz, 26a6h if (((u8Flags & 0x40) >> 6) != 1) { goto L26a6;; } case 0x26b1: // 26b1: ret goto returnInstruction;; case 0x26b2: // 26b2: ld ix, 4136h sg_sZ80Context.z80IX = (UINT16) (0x4136); // 26b6: ld a, (bonusk) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e71]); // 26b9: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); { UINT16 u16Temp0; // 26bb: add a, 30h u16Temp0 = sg_sZ80Context.z80A + 0x30; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 26bd: ld (ix+00h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX, sg_sZ80Context.z80A); // 26c0: ld a, (bonusk) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e71]); // 26c3: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 26c4: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 26c5: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 26c6: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 26c7: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 26c9: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } { UINT16 u16Temp0; // 26ca: add a, 30h u16Temp0 = sg_sZ80Context.z80A + 0x30; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x30))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x30 ^ sg_sZ80Context.z80A ^ 0x80) & (0x30 ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 26cc: ld (ix+20h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x20, sg_sZ80Context.z80A); // 26cf: ret goto returnInstruction;; case 0x26d0: // 26d0: ld a, (5080h) ; check in0 for free play sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5080]); // 26d3: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 26d4: and a, 03h ; free play switch sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x03); u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 26d6: jp nz, 26deh if (((u8Flags & 0x40) >> 6) != 1) { goto L26de;; } // 26d9: ld hl, credits ; credit memory sg_sZ80Context.z80HL = (UINT16) (0x4e6e); // 26dc: ld (hl), 0ffh ; store $FF for free play mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0xff); // 26de: ld c, a L26de: sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); { UINT8 u8Temp0; // 26df: rra u8Temp0 = ((u8Flags & 0x01) >> 0) << 0x07; u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 1) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | u8Temp0)); } { UINT16 u16Temp0; // 26e0: adc a, 00h u16Temp0 = sg_sZ80Context.z80A + ((u8Flags & 0x01) >> 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 26e2: ld (xcoin), a sg_u8mspacman_memory[0x4e6b] = sg_sZ80Context.z80A; // 26e5: and a, 02h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x02); // 26e7: xor a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ sg_sZ80Context.z80C); // 26e8: ld (xcred), a sg_u8mspacman_memory[0x4e6d] = sg_sZ80Context.z80A; // 26eb: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 26ec: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 26ed: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 26ee: and a, 03h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x03); // 26f0: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); { UINT16 u16Temp0; // 26f1: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 26f3: jr nz, 026f6h if (((u8Flags & 0x40) >> 6) != 1) { goto L26f6;; } // 26f5: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 26f6: ld (inlives), a L26f6: sg_u8mspacman_memory[0x4e6f] = sg_sZ80Context.z80A; // 26f9: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 26fa: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 26fb: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 26fc: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 26fd: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 26fe: and a, 03h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x03); // 2700: ld hl, 2728h sg_sZ80Context.z80HL = (UINT16) (0x2728); // 2703: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x04; goto L0010; case 0x2704: // 2704: ld (bonusk), a sg_u8mspacman_memory[0x4e71] = sg_sZ80Context.z80A; // 2707: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2708: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 2709: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); // 270a: and a, 01h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 1); // 270c: ld (4e75h), a sg_u8mspacman_memory[0x4e75] = sg_sZ80Context.z80A; // 270f: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2710: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 2711: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 2712: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); // 2713: and a, 01h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 1); // 2715: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 2716: ld hl, 272ch sg_sZ80Context.z80HL = (UINT16) (0x272c); // 2719: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1a; goto L0018; case 0x271a: // 271a: ld (difftyp), hl ; difficulty sg_u8mspacman_memory[0x4e73] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4e74] = sg_sZ80Context.z80H; // 271d: ld a, (V1Acc) ; check in1 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 2720: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 2721: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); // 2722: and a, 01h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 1); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2724: ld (cabtype), a sg_u8mspacman_memory[0x4e72] = sg_sZ80Context.z80A; // 2727: ret goto returnInstruction;; case 0x2730: // 2730: ld a, (4dc1h) ; 0= random movement 1= normal movement // red ghost logic: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dc1]); // 2733: bit 0, a u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 1) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 2735: jp nz, 2758h ; get norm red movement if (((u8Flags & 0x40) >> 6) != 1) { goto L2758;; } // 2738: ld a, (4db6h) ; 0=normal 1= faster ghost,most dots sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4db6]); // 273b: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 273c: jr nz, 02758h ; get norm red direction (below) if (((u8Flags & 0x40) >> 6) != 1) { goto L2758;; } // 273e: ld a, (4e04h) ; 3=ghost move, 2=ghost wait for start sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e04]); { UINT16 u16Temp0; // 2741: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x03))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x03 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 2743: jr nz, 02758h ; get norm red direction (below) if (((u8Flags & 0x40) >> 6) != 1) { goto L2758;; } // 2745: ld hl, (4d0ah) ; read red ghost location YY XX sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0b]); // 2748: ld a, (4d2ch) ; read direction sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2c]); // 274b: call 9561h ; pick a quadrant for the destination sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x4e; goto L9561; case 0x274e: // 274e: call 2966h ; get dir. by finding shortest distance sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x51; goto L2966; case 0x2751: // 2751: ld (4d1eh), hl ; store offset sg_u8mspacman_memory[0x4d1e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1f] = sg_sZ80Context.z80H; // 2754: ld (4d2ch), a ; store direction sg_u8mspacman_memory[0x4d2c] = sg_sZ80Context.z80A; // 2757: ret goto returnInstruction;; // 2758: ld hl, (4d0ah) ; red ghost location YY XX // normal movement get direction for red ghost L2758: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0b]); // 275b: ld de, (4d39h) ; ms pac location YY XX sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[0x4d39]); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[0x4d3a]); // 275f: ld a, (4d2ch) ; current direction sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2c]); // 2762: call 2966h ; get dir. by finding shortest distance sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x65; goto L2966; case 0x2765: // 2765: ld (4d1eh), hl sg_u8mspacman_memory[0x4d1e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1f] = sg_sZ80Context.z80H; // 2768: ld (4d2ch), a sg_u8mspacman_memory[0x4d2c] = sg_sZ80Context.z80A; // 276b: ret ; HL= offset for direction, a= dir. goto returnInstruction;; case 0x276c: // 276c: ld a, (4dc1h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dc1]); // 276f: bit 0, a u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 1) == 0)) ? 0x40 : 0); // 2771: jp nz, 278eh if (((u8Flags & 0x40) >> 6) != 1) { goto L278e;; } // 2774: ld a, (4e04h) ; level cleared register sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e04]); { UINT16 u16Temp0; // 2777: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x03))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x03 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 2779: jr nz, 0278eh ; jump if not 3 if (((u8Flags & 0x40) >> 6) != 1) { goto L278e;; } // 277b: ld hl, (4d0ch) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0d]); // 277e: ld a, (4d2dh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2d]); // 2781: call 9561h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x84; goto L9561; case 0x2784: // 2784: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x87; goto L2966; case 0x2787: // 2787: ld (4d20h), hl sg_u8mspacman_memory[0x4d20] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d21] = sg_sZ80Context.z80H; // 278a: ld (4d2dh), a sg_u8mspacman_memory[0x4d2d] = sg_sZ80Context.z80A; // 278d: ret goto returnInstruction;; case 0x278e: // 278e: ld de, (4d39h) L278e: sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[0x4d39]); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[0x4d3a]); // 2792: ld hl, (4d1ch) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d1c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d1d]); { UINT32 u32Temp0; // 2795: add hl, hl // hard hack: HACK6 u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } { UINT32 u32Temp0; // 2796: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } { UINT32 u32Temp0; // 2797: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } { UINT16 u16Temp0; // 2798: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 2799: ld hl, (4d0ch) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0d]); // 279c: ld a, (4d2dh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2d]); // 279f: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa2; goto L2966; case 0x27a2: // 27a2: ld (4d20h), hl sg_u8mspacman_memory[0x4d20] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d21] = sg_sZ80Context.z80H; // 27a5: ld (4d2dh), a sg_u8mspacman_memory[0x4d2d] = sg_sZ80Context.z80A; // 27a8: ret goto returnInstruction;; case 0x27a9: // 27a9: ld a, (4dc1h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dc1]); // 27ac: bit 0, a u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 1) == 0)) ? 0x40 : 0); // 27ae: jp nz, 27cbh if (((u8Flags & 0x40) >> 6) != 1) { goto L27cb;; } // 27b1: ld a, (4e04h) ; level cleared register sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e04]); { UINT16 u16Temp0; // 27b4: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x03))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x03 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 27b6: jr nz, 027cbh ; jump if not 3 if (((u8Flags & 0x40) >> 6) != 1) { goto L27cb;; } // 27b8: ld hl, (4d0eh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0e]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0f]); // 27bb: call 9559h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbe; goto L9559; case 0x27be: // 27be: ld de, 2040h sg_sZ80Context.z80DE = (UINT16) (0x2040); // 27c1: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc4; goto L2966; case 0x27c4: // 27c4: ld (4d22h), hl sg_u8mspacman_memory[0x4d22] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d23] = sg_sZ80Context.z80H; // 27c7: ld (4d2eh), a sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80A; // 27ca: ret goto returnInstruction;; case 0x27cb: // 27cb: ld bc, (4d0ah) L27cb: sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[0x4d0a]); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[0x4d0b]); // 27cf: ld de, (4d39h) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[0x4d39]); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[0x4d3a]); // 27d3: ld hl, (4d1ch) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d1c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d1d]); { UINT32 u32Temp0; // 27d6: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } { UINT32 u32Temp0; // 27d7: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 27d8: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); { UINT16 u16Temp0; // 27d9: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 27da: sub a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 27db: ld l, a sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80A); // 27dc: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); { UINT16 u16Temp0; // 27dd: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 27de: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80B))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 27df: ld h, a sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 27e0: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 27e1: ld hl, (4d0eh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0e]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0f]); // 27e4: ld a, (4d2eh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2e]); // 27e7: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xea; goto L2966; case 0x27ea: // 27ea: ld (4d22h), hl sg_u8mspacman_memory[0x4d22] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d23] = sg_sZ80Context.z80H; // 27ed: ld (4d2eh), a sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80A; // 27f0: ret goto returnInstruction;; case 0x27f1: // 27f1: ld a, (4dc1h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dc1]); // 27f4: bit 0, a u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 1) == 0)) ? 0x40 : 0); // 27f6: jp nz, 2813h if (((u8Flags & 0x40) >> 6) != 1) { goto L2813;; } // 27f9: ld a, (4e04h) ; level cleared register sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e04]); { UINT16 u16Temp0; // 27fc: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x03))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x03 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 27fe: jr nz, 02813h ; jump if not 3 if (((u8Flags & 0x40) >> 6) != 1) { goto L2813;; } // 2800: ld hl, (4d10h) L2800: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d10]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d11]); // 2803: call 955eh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; goto L955e; case 0x2806: // 2806: ld de, 3b40h sg_sZ80Context.z80DE = (UINT16) (0x3b40); // 2809: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0c; goto L2966; case 0x280c: // 280c: ld (4d24h), hl sg_u8mspacman_memory[0x4d24] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d25] = sg_sZ80Context.z80H; // 280f: ld (4d2fh), a sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80A; // 2812: ret goto returnInstruction;; // 2813: ld ix, 4d39h L2813: sg_sZ80Context.z80IX = (UINT16) (0x4d39); // 2817: ld iy, 4d10h sg_sZ80Context.z80IY = (UINT16) (0x4d10); // 281b: call 29eah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; goto L29ea; case 0x281e: // 281e: ld de, 0040h sg_sZ80Context.z80DE = (UINT16) (0x40); // 2821: and a, a // hard hack: HACK6 u8Flags &= 0xfe; { UINT32 u32Temp0; // 2822: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 2824: jp c, 2800h if (((u8Flags & 0x01) >> 0) == 1) { goto L2800;; } // 2827: ld hl, (4d10h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d10]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d11]); // 282a: ld de, (4d39h) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[0x4d39]); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[0x4d3a]); // 282e: ld a, (4d2fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2f]); // 2831: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; goto L2966; case 0x2834: // 2834: ld (4d24h), hl sg_u8mspacman_memory[0x4d24] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d25] = sg_sZ80Context.z80H; // 2837: ld (4d2fh), a sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80A; // 283a: ret goto returnInstruction;; case 0x283b: // 283b: ld a, (4dach) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dac]); // 283e: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 283f: jp z, 2855h if (((u8Flags & 0x40) >> 6) == 1) { goto L2855;; } // 2842: ld de, 2e2ch sg_sZ80Context.z80DE = (UINT16) (0x2e2c); // 2845: ld hl, (4d0ah) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0b]); // 2848: ld a, (4d2ch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2c]); // 284b: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x4e; goto L2966; case 0x284e: // 284e: ld (4d1eh), hl sg_u8mspacman_memory[0x4d1e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1f] = sg_sZ80Context.z80H; // 2851: ld (4d2ch), a sg_u8mspacman_memory[0x4d2c] = sg_sZ80Context.z80A; // 2854: ret goto returnInstruction;; case 0x2855: // 2855: ld hl, (4d0ah) L2855: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0a]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0b]); // 2858: ld a, (4d2ch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2c]); // 285b: call 291eh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x5e; goto L291e; case 0x285e: // 285e: ld (4d1eh), hl sg_u8mspacman_memory[0x4d1e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d1f] = sg_sZ80Context.z80H; // 2861: ld (4d2ch), a sg_u8mspacman_memory[0x4d2c] = sg_sZ80Context.z80A; // 2864: ret goto returnInstruction;; case 0x2865: // 2865: ld a, (4dadh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dad]); // 2868: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2869: jp z, 287fh if (((u8Flags & 0x40) >> 6) == 1) { goto L287f;; } // 286c: ld de, 2e2ch sg_sZ80Context.z80DE = (UINT16) (0x2e2c); // 286f: ld hl, (4d0ch) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0d]); // 2872: ld a, (4d2dh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2d]); // 2875: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x78; goto L2966; case 0x2878: // 2878: ld (4d20h), hl sg_u8mspacman_memory[0x4d20] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d21] = sg_sZ80Context.z80H; // 287b: ld (4d2dh), a sg_u8mspacman_memory[0x4d2d] = sg_sZ80Context.z80A; // 287e: ret goto returnInstruction;; case 0x287f: // 287f: ld hl, (4d0ch) L287f: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0c]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0d]); // 2882: ld a, (4d2dh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2d]); // 2885: call 291eh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x88; goto L291e; case 0x2888: // 2888: ld (4d20h), hl sg_u8mspacman_memory[0x4d20] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d21] = sg_sZ80Context.z80H; // 288b: ld (4d2dh), a sg_u8mspacman_memory[0x4d2d] = sg_sZ80Context.z80A; // 288e: ret goto returnInstruction;; case 0x288f: // 288f: ld a, (4daeh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dae]); // 2892: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2893: jp z, 28a9h if (((u8Flags & 0x40) >> 6) == 1) { goto L28a9;; } // 2896: ld de, 2e2ch sg_sZ80Context.z80DE = (UINT16) (0x2e2c); // 2899: ld hl, (4d0eh) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0e]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0f]); // 289c: ld a, (4d2eh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2e]); // 289f: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa2; goto L2966; case 0x28a2: // 28a2: ld (4d22h), hl sg_u8mspacman_memory[0x4d22] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d23] = sg_sZ80Context.z80H; // 28a5: ld (4d2eh), a sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80A; // 28a8: ret goto returnInstruction;; case 0x28a9: // 28a9: ld hl, (4d0eh) L28a9: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d0e]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d0f]); // 28ac: ld a, (4d2eh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2e]); // 28af: call 291eh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb2; goto L291e; case 0x28b2: // 28b2: ld (4d22h), hl sg_u8mspacman_memory[0x4d22] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d23] = sg_sZ80Context.z80H; // 28b5: ld (4d2eh), a sg_u8mspacman_memory[0x4d2e] = sg_sZ80Context.z80A; // 28b8: ret goto returnInstruction;; case 0x28b9: // 28b9: ld a, (4dafh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4daf]); // 28bc: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 28bd: jp z, 28d3h if (((u8Flags & 0x40) >> 6) == 1) { goto L28d3;; } // 28c0: ld de, 2e2ch sg_sZ80Context.z80DE = (UINT16) (0x2e2c); // 28c3: ld hl, (4d10h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d10]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d11]); // 28c6: ld a, (4d2fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2f]); // 28c9: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xcc; goto L2966; case 0x28cc: // 28cc: ld (4d24h), hl sg_u8mspacman_memory[0x4d24] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d25] = sg_sZ80Context.z80H; // 28cf: ld (4d2fh), a sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80A; // 28d2: ret goto returnInstruction;; case 0x28d3: // 28d3: ld hl, (4d10h) L28d3: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d10]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d11]); // 28d6: ld a, (4d2fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2f]); // 28d9: call 291eh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xdc; goto L291e; case 0x28dc: // 28dc: ld (4d24h), hl sg_u8mspacman_memory[0x4d24] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d25] = sg_sZ80Context.z80H; // 28df: ld (4d2fh), a sg_u8mspacman_memory[0x4d2f] = sg_sZ80Context.z80A; // 28e2: ret goto returnInstruction;; case 0x28e3: // 28e3: ld a, (4da7h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da7]); // 28e6: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 28e7: jp z, 28feh if (((u8Flags & 0x40) >> 6) == 1) { goto L28fe;; } // 28ea: ld hl, (4d12h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d12]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d13]); // 28ed: ld de, (4d0ch) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[0x4d0c]); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[0x4d0d]); // 28f1: ld a, (4d3ch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3c]); // 28f4: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x28; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf7; goto L2966; case 0x28f7: // 28f7: ld (4d26h), hl sg_u8mspacman_memory[0x4d26] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d27] = sg_sZ80Context.z80H; // 28fa: ld (4d3ch), a sg_u8mspacman_memory[0x4d3c] = sg_sZ80Context.z80A; // 28fd: ret goto returnInstruction;; // 28fe: ld hl, (4d39h) L28fe: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d39]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d3a]); // 2901: ld bc, (4d0ch) sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[0x4d0c]); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[0x4d0d]); // 2905: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); { UINT16 u16Temp0; // 2906: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 2907: sub a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2908: ld l, a sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80A); // 2909: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); { UINT16 u16Temp0; // 290a: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 290b: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80B))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 290c: ld h, a sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 290d: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 290e: ld hl, (4d12h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d12]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d13]); // 2911: ld a, (4d3ch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3c]); // 2914: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x29; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x17; goto L2966; case 0x2917: // 2917: ld (4d26h), hl sg_u8mspacman_memory[0x4d26] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d27] = sg_sZ80Context.z80H; // 291a: ld (4d3ch), a sg_u8mspacman_memory[0x4d3c] = sg_sZ80Context.z80A; // 291d: ret goto returnInstruction;; // 291e: ld (4d3eh), hl L291e: sg_u8mspacman_memory[0x4d3e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d3f] = sg_sZ80Context.z80H; // 2921: xor a, 02h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0x02); // 2923: ld (4d3dh), a sg_u8mspacman_memory[0x4d3d] = sg_sZ80Context.z80A; // 2926: call 2a23h ; get a random number sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x29; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x29; goto L2a23; case 0x2929: // 2929: and a, 03h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x03); // 292b: ld hl, 4d3bh sg_sZ80Context.z80HL = (UINT16) (0x4d3b); // 292e: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); { UINT16 u16Temp0; // 292f: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2930: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 2931: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); // 2933: ld ix, 32ffh sg_sZ80Context.z80IX = (UINT16) (0x32ff); { UINT32 u32Temp0; // 2937: add ix, de u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); } // 2939: ld iy, 4d3eh sg_sZ80Context.z80IY = (UINT16) (0x4d3e); // 293d: ld a, (4d3dh) L293d: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3d]); { UINT16 u16Temp0; UINT8 u8Temp0; // 2940: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 2941: jp z, 2957h if (((u8Flags & 0x40) >> 6) == 1) { goto L2957;; } // 2944: call 200fh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x29; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x47; goto L200f; case 0x2947: // 2947: and a, 0c0h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0xc0); { UINT16 u16Temp0; // 2949: sub a, 0c0h u16Temp0 = sg_sZ80Context.z80A - 0xc0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0xc0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0xc0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 294b: jr z, 02957h ; (10) if (((u8Flags & 0x40) >> 6) == 1) { goto L2957;; } // 294d: ld l, (ix+00h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 2950: ld h, (ix+01h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); // 2953: ld a, (4d3bh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3b]); // 2956: ret goto returnInstruction;; // 2957: inc ix L2957: sg_sZ80Context.z80IX = (UINT16) (sg_sZ80Context.z80IX + 1); // 2959: inc ix sg_sZ80Context.z80IX = (UINT16) (sg_sZ80Context.z80IX + 1); // 295b: ld hl, 4d3bh sg_sZ80Context.z80HL = (UINT16) (0x4d3b); // 295e: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 295f: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 2960: and a, 03h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x03); // 2962: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2963: jp 293dh goto L293d;; // 2966: ld (4d3eh), hl // distance check. (used for ghost logic) L2966: sg_u8mspacman_memory[0x4d3e] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d3f] = sg_sZ80Context.z80H; // 2969: ld (4d40h), de sg_u8mspacman_memory[0x4d40] = sg_sZ80Context.z80E; sg_u8mspacman_memory[0x4d41] = sg_sZ80Context.z80D; // 296d: ld (4d3bh), a sg_u8mspacman_memory[0x4d3b] = sg_sZ80Context.z80A; // 2970: xor a, 02h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0x02); // 2972: ld (4d3dh), a sg_u8mspacman_memory[0x4d3d] = sg_sZ80Context.z80A; // 2975: ld hl, 0ffffh sg_sZ80Context.z80HL = (UINT16) (0xffff); // 2978: ld (4d44h), hl sg_u8mspacman_memory[0x4d44] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d45] = sg_sZ80Context.z80H; // 297b: ld ix, 32ffh sg_sZ80Context.z80IX = (UINT16) (0x32ff); // 297f: ld iy, 4d3eh sg_sZ80Context.z80IY = (UINT16) (0x4d3e); // 2983: ld hl, 4dc7h sg_sZ80Context.z80HL = (UINT16) (0x4dc7); // 2986: ld (hl), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0); // 2988: ld a, (4d3dh) L2988: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3d]); { UINT16 u16Temp0; UINT8 u8Temp0; // 298b: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 298c: jp z, 29c6h if (((u8Flags & 0x40) >> 6) == 1) { goto L29c6;; } // 298f: call 2000h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x29; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x92; goto L2000; case 0x2992: // 2992: ld (4d42h), hl sg_u8mspacman_memory[0x4d42] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4d43] = sg_sZ80Context.z80H; // 2995: call 0065h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x29; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x98; goto L0065; case 0x2998: // 2998: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2999: and a, 0c0h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0xc0); { UINT16 u16Temp0; // 299b: sub a, 0c0h u16Temp0 = sg_sZ80Context.z80A - 0xc0; sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); } // 299d: jr z, 029c6h ; (39) if (((u8Flags & 0x40) >> 6) == 1) { goto L29c6;; } // 299f: push ix sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80XH; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80XL; // 29a1: push iy sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80YH; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80YL; // 29a3: ld ix, 4d40h sg_sZ80Context.z80IX = (UINT16) (0x4d40); // 29a7: ld iy, 4d42h sg_sZ80Context.z80IY = (UINT16) (0x4d42); // 29ab: call 29eah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x29; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xae; goto L29ea; case 0x29ae: // 29ae: pop iy sg_sZ80Context.z80YL = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80YH = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 29b0: pop ix sg_sZ80Context.z80XL = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80XH = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); { UINT16 u16Temp0; // 29b2: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 29b3: ld hl, (4d44h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4d44]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4d45]); // 29b6: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 29b7: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } // 29b9: jp c, 29c6h if (((u8Flags & 0x01) >> 0) == 1) { goto L29c6;; } // 29bc: ld (4d44h), de sg_u8mspacman_memory[0x4d44] = sg_sZ80Context.z80E; sg_u8mspacman_memory[0x4d45] = sg_sZ80Context.z80D; // 29c0: ld a, (4dc7h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dc7]); // 29c3: ld (4d3bh), a sg_u8mspacman_memory[0x4d3b] = sg_sZ80Context.z80A; // 29c6: inc ix L29c6: sg_sZ80Context.z80IX = (UINT16) (sg_sZ80Context.z80IX + 1); // 29c8: inc ix sg_sZ80Context.z80IX = (UINT16) (sg_sZ80Context.z80IX + 1); // 29ca: ld hl, 4dc7h sg_sZ80Context.z80HL = (UINT16) (0x4dc7); { UINT8 u8Temp0; // 29cd: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 29ce: ld a, 04h sg_sZ80Context.z80A = (UINT8) (0x04); { UINT16 u16Temp0; UINT8 u8Temp0; // 29d0: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 29d1: jp nz, 2988h if (((u8Flags & 0x40) >> 6) != 1) { goto L2988;; } // 29d4: ld a, (4d3bh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d3b]); { UINT16 u16Temp0; // 29d7: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 29d8: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 29d9: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); // 29db: ld ix, 32ffh sg_sZ80Context.z80IX = (UINT16) (0x32ff); { UINT32 u32Temp0; // 29df: add ix, de u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); } // 29e1: ld l, (ix+00h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 29e4: ld h, (ix+01h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); // 29e7: srl a u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 1) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags &= 0xef; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 29e9: ret goto returnInstruction;; // 29ea: ld a, (ix+00h) L29ea: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 29ed: ld b, (iy+00h) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY]); { UINT16 u16Temp0; // 29f0: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 29f1: jp nc, 29f9h if (((u8Flags & 0x01) >> 0) != 1) { goto L29f9;; } // 29f4: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 29f5: ld b, (ix+00h) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); { UINT16 u16Temp0; // 29f8: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 29f9: call 2a12h L29f9: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x29; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xfc; goto L2a12; case 0x29fc: // 29fc: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 29fd: ld a, (ix+01h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); // 2a00: ld b, (iy+01h) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IY + 1]); { UINT16 u16Temp0; // 2a03: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2a04: jp nc, 2a0ch if (((u8Flags & 0x01) >> 0) != 1) { goto L2a0c;; } // 2a07: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2a08: ld b, (ix+01h) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); { UINT16 u16Temp0; // 2a0b: sub a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2a0c: call 2a12h L2a0c: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0f; goto L2a12; case 0x2a0f: // 2a0f: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); { UINT32 u32Temp0; // 2a10: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 2a11: ret goto returnInstruction;; // 2a12: ld h, a L2a12: sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80A); // 2a13: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 2a14: ld L, 00h sg_sZ80Context.z80L = (UINT8) (0); // 2a16: ld d, l sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80L); // 2a17: ld c, 08h sg_sZ80Context.z80C = (UINT8) (0x08); { UINT32 u32Temp0; // 2a19: add hl, hl L2a19: u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 2a1a: jp nc, 2a1eh if (((u8Flags & 0x01) >> 0) != 1) { goto L2a1e;; } { UINT32 u32Temp0; // 2a1d: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 2a1e: dec c L2a1e: sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80C == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80C & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2a1f: jp nz, 2a19h if (((u8Flags & 0x40) >> 6) != 1) { goto L2a19;; } // 2a22: ret goto returnInstruction;; // 2a23: ld hl, (4dc9h) // Random number generator L2a23: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4dc9]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4dca]); // 2a26: ld d, h sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80H); // 2a27: ld e, l sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80L); { UINT32 u32Temp0; // 2a28: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } { UINT32 u32Temp0; // 2a29: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } { UINT32 u32Temp0; // 2a2a: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 2a2b: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2a2c: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); // 2a2d: and a, 1fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x1f); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2a2f: ld h, a sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80A); // 2a30: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2a31: ld (4dc9h), hl sg_u8mspacman_memory[0x4dc9] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dca] = sg_sZ80Context.z80H; // 2a34: ret goto returnInstruction;; case 0x2a35: // 2a35: ld de, 4040h sg_sZ80Context.z80DE = (UINT16) (0x4040); // 2a38: ld hl, 43c0h L2a38: sg_sZ80Context.z80HL = (UINT16) (0x43c0); // 2a3b: and a, a u8Flags &= 0xfe; { UINT32 u32Temp0; // 2a3c: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 2a3e: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 2a3f: ld a, (de) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80DE]); { UINT16 u16Temp0; // 2a40: cp a, 10h u16Temp0 = sg_sZ80Context.z80A - 0x10; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 2a42: jp z, 2a53h if (((u8Flags & 0x40) >> 6) == 1) { goto L2a53;; } { UINT16 u16Temp0; // 2a45: cp a, 12h u16Temp0 = sg_sZ80Context.z80A - 0x12; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 2a47: jp z, 2a53h if (((u8Flags & 0x40) >> 6) == 1) { goto L2a53;; } { UINT16 u16Temp0; // 2a4a: cp a, 14h u16Temp0 = sg_sZ80Context.z80A - 0x14; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 2a4c: jp z, 2a53h if (((u8Flags & 0x40) >> 6) == 1) { goto L2a53;; } // 2a4f: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 2a50: jp 2a38h goto L2a38;; // 2a53: ld a, 40h L2a53: sg_sZ80Context.z80A = (UINT8) (0x40); // 2a55: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 2a56: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 2a57: jp 2a38h goto L2a38;; case 0x2a5a: // 2a5a: ld a, (4e00h) ; game mode L2a5a: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); { UINT16 u16Temp0; // 2a5d: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 1))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 2a5f: ret z ; return if intro mode if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 2a60: ld hl, 2b17h // this updates the score when something is eaten // (from the above table at 2b17) // load a with the item eaten sg_sZ80Context.z80HL = (UINT16) (0x2b17); // 2a63: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x64; goto L0018; case 0x2a64: { UINT16 u16Temp0; // 2a64: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 2a65: call 2b0bh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x68; goto L2b0b; case 0x2a68: // 2a68: ld a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80E); { UINT16 u16Temp0; UINT8 u8Temp0; // 2a69: add a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A + u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; } { UINT16 u16Temp0; // 2a6a: daa u16Temp0 = (sg_sZ80Context.z80A | (((u8Flags & 0x01) >> 0) << 0x08) | (((u8Flags & 0x10) >> 4) << 0x09) | (((u8Flags & 0x02) >> 1) << 0x0a)); u8Flags = (UINT8) (sg_u16DAATable[u16Temp0] >> 0x08); sg_sZ80Context.z80A = (UINT8) (sg_u16DAATable[u16Temp0] & 0xff); } // 2a6b: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2a6c: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2a6d: ld a, d sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80D); { UINT16 u16Temp0; UINT8 u8Temp0; // 2a6e: adc a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = (sg_sZ80Context.z80A + ((u8Flags & 0x01) >> 0) + u8Temp0); u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; } { UINT16 u16Temp0; // 2a6f: daa u16Temp0 = (sg_sZ80Context.z80A | (((u8Flags & 0x01) >> 0) << 0x08) | (((u8Flags & 0x10) >> 4) << 0x09) | (((u8Flags & 0x02) >> 1) << 0x0a)); u8Flags = (UINT8) (sg_u16DAATable[u16Temp0] >> 0x08); sg_sZ80Context.z80A = (UINT8) (sg_u16DAATable[u16Temp0] & 0xff); } // 2a70: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2a71: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 2a72: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2a73: ld a, 00h sg_sZ80Context.z80A = (UINT8) (0); { UINT16 u16Temp0; UINT8 u8Temp0; // 2a75: adc a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = (sg_sZ80Context.z80A + ((u8Flags & 0x01) >> 0) + u8Temp0); u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; } { UINT16 u16Temp0; // 2a76: daa u16Temp0 = (sg_sZ80Context.z80A | (((u8Flags & 0x01) >> 0) << 0x08) | (((u8Flags & 0x10) >> 4) << 0x09) | (((u8Flags & 0x02) >> 1) << 0x0a)); sg_sZ80Context.z80A = (UINT8) (sg_u16DAATable[u16Temp0] & 0xff); } // 2a77: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2a78: ld d, a sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 2a79: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } { UINT32 u32Temp0; // 2a7a: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } { UINT32 u32Temp0; // 2a7b: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } { UINT32 u32Temp0; // 2a7c: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } { UINT32 u32Temp0; // 2a7d: add hl, hl u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 2a7e: ld a, (bonusk) ; bonus life sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e71]); // 2a81: dec a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); { UINT16 u16Temp0; // 2a82: cp a, h u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80H; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80H ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 2a83: call c, 2b33h if (((u8Flags & 0x01) >> 0) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x86; goto L2b33; } case 0x2a86: // 2a86: call 2aafh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x89; goto L2aaf; case 0x2a89: // 2a89: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 2a8a: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 2a8b: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 2a8c: ld hl, topsc2 ; msb high score ram area sg_sZ80Context.z80HL = (UINT16) (0x4e8a); // 2a8f: ld b, 03h sg_sZ80Context.z80B = (UINT8) (0x03); // 2a91: ld a, (de) L2a91: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80DE]); { UINT16 u16Temp0; UINT8 u8Temp0; // 2a92: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 2a93: ret c ; return if high score not beat? if (((u8Flags & 0x01) >> 0) == 1) { goto returnInstruction;; } // 2a94: jr nz, 02a9bh ; jump if not even // perhaps this part draws the new high score atop the screen // if it is higher than the current high score? if (((u8Flags & 0x40) >> 6) != 1) { goto L2a9b;; } // 2a96: dec de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE - 1); // 2a97: dec hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL - 1); // 2a98: djnz 02a91h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L2a91;; } // 2a9a: ret goto returnInstruction;; // 2a9b: call 2b0bh // possibly checking the high score? L2a9b: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9e; goto L2b0b; case 0x2a9e: // 2a9e: ld de, topsc0 ; lsb high score memory sg_sZ80Context.z80DE = (UINT16) (0x4e88); // 2aa1: ld bc, 0003h sg_sZ80Context.z80BC = (UINT16) (0x03); // 2aa4: ldir UniqueLabel11: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel11;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 2aa6: dec de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE - 1); // 2aa7: ld bc, 0304h sg_sZ80Context.z80BC = (UINT16) (0x0304); // 2aaa: ld hl, 43f2h sg_sZ80Context.z80HL = (UINT16) (0x43f2); // 2aad: jr 02abeh goto L2abe;; // 2aaf: ld a, (4e09h) L2aaf: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 2ab2: ld bc, 0304h sg_sZ80Context.z80BC = (UINT16) (0x0304); // 2ab5: ld hl, 43fch ; screen pos for current score sg_sZ80Context.z80HL = (UINT16) (0x43fc); // 2ab8: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2ab9: jr z, 02abeh if (((u8Flags & 0x40) >> 6) == 1) { goto L2abe;; } // 2abb: ld hl, 43e9h ; screen pos for high score sg_sZ80Context.z80HL = (UINT16) (0x43e9); // 2abe: ld a, (de) // draw the score to the screen? L2abe: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80DE]); // 2abf: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2ac0: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2ac1: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2ac2: rrca u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 1) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); u8Flags &= 0xef; u8Flags &= 0xfd; // 2ac3: call 2aceh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc6; goto L2ace; case 0x2ac6: // 2ac6: ld a, (de) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80DE]); // 2ac7: call 2aceh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xca; goto L2ace; case 0x2aca: // 2aca: dec de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE - 1); // 2acb: djnz 02abeh sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L2abe;; } // 2acd: ret goto returnInstruction;; // 2ace: and a, 0fh L2ace: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2ad0: jr z, 02ad6h if (((u8Flags & 0x40) >> 6) == 1) { goto L2ad6;; } // 2ad2: ld c, 00h sg_sZ80Context.z80C = (UINT8) (0); // 2ad4: jr 02addh goto L2add;; // 2ad6: ld a, c L2ad6: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 2ad7: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2ad8: jr z, 02addh if (((u8Flags & 0x40) >> 6) == 1) { goto L2add;; } // 2ada: ld a, 40h sg_sZ80Context.z80A = (UINT8) (0x40); // 2adc: dec c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80C == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80C & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2add: ld (hl), a L2add: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2ade: dec hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL - 1); // 2adf: ret goto returnInstruction;; case 0x2ae0: // 2ae0: ld b, 00h // something with the player 1 score sg_sZ80Context.z80B = (UINT8) (0); // 2ae2: call 2c5eh ; print HIGH SCORE sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe5; goto L2c5e; case 0x2ae5: // 2ae5: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2ae6: ld hl, p1sc0 sg_sZ80Context.z80HL = (UINT16) (0x4e80); // 2ae9: ld b, 08h sg_sZ80Context.z80B = (UINT8) (0x08); // 2aeb: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xec; goto L0008; case 0x2aec: // 2aec: ld bc, 0304h sg_sZ80Context.z80BC = (UINT16) (0x0304); // 2aef: ld de, p1sc2 ; p1 msb of score sg_sZ80Context.z80DE = (UINT16) (0x4e82); // 2af2: ld hl, 43fch ; screen pos for p1 current score sg_sZ80Context.z80HL = (UINT16) (0x43fc); // 2af5: call 2abeh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2a; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf8; goto L2abe; case 0x2af8: // 2af8: ld bc, 0304h sg_sZ80Context.z80BC = (UINT16) (0x0304); // 2afb: ld de, p2sc2 ; high score sg_sZ80Context.z80DE = (UINT16) (0x4e86); // 2afe: ld hl, 43e9h ; screen pos for high score sg_sZ80Context.z80HL = (UINT16) (0x43e9); // 2b01: ld a, (coincrd) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e70]); // 2b04: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2b05: jr nz, 02abeh if (((u8Flags & 0x40) >> 6) != 1) { goto L2abe;; } // 2b07: ld c, 06h sg_sZ80Context.z80C = (UINT8) (0x06); // 2b09: jr 02abeh goto L2abe;; // 2b0b: ld a, (4e09h) L2b0b: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 2b0e: ld hl, p1sc0 sg_sZ80Context.z80HL = (UINT16) (0x4e80); // 2b11: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2b12: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 2b13: ld hl, p2sc0 sg_sZ80Context.z80HL = (UINT16) (0x4e84); // 2b16: ret goto returnInstruction;; // 2b33: inc de L2b33: sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 2b34: ld l, e // [The 8th fruit is a legacy thing from pacman, which // used 8 bonus items. it is not used in mspac] sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80E); // 2b35: ld h, d sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80D); // 2b36: dec de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE - 1); // 2b37: bit 0, (hl) u8Flags = (u8Flags & ~0x40) | ((((sg_u8mspacman_memory[sg_sZ80Context.z80HL] & 1) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 2b39: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 2b3a: set 0, (hl) // bonus life routine mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 1); // 2b3c: ld hl, 4e9ch ; set sound 0 sg_sZ80Context.z80HL = (UINT16) (0x4e9c); // 2b3f: set 0, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 1); // 2b41: ld hl, lives ; number of lives left sg_sZ80Context.z80HL = (UINT16) (0x4e14); { UINT8 u8Temp0; // 2b44: inc (hl) ; inc lives left mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 2b45: ld hl, scrlves ; number of lives on the screen sg_sZ80Context.z80HL = (UINT16) (0x4e15); { UINT8 u8Temp0; // 2b48: inc (hl) ; inc lives displayed mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 2b49: ld b, (hl) ; number of lives on the screen sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2b4a: ld hl, 401ah ; screen location L2b4a: sg_sZ80Context.z80HL = (UINT16) (0x401a); // 2b4d: ld c, 05h sg_sZ80Context.z80C = (UINT8) (0x05); // 2b4f: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2b50: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2b51: jr z, 02b61h if (((u8Flags & 0x40) >> 6) == 1) { goto L2b61;; } { UINT16 u16Temp0; // 2b53: cp a, 06h u16Temp0 = sg_sZ80Context.z80A - 0x06; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 2b55: jr nc, 02b61h if (((u8Flags & 0x01) >> 0) != 1) { goto L2b61;; } // 2b57: ld a, 20h // draw the pacs on the screen (or another 4 character string) L2b57: sg_sZ80Context.z80A = (UINT8) (0x20); // 2b59: call 2b8fh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2b; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x5c; goto L2b8f; case 0x2b5c: // 2b5c: dec hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL - 1); // 2b5d: dec hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL - 1); // 2b5e: dec c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2b5f: djnz 02b57h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L2b57;; } // 2b61: dec c // perhaps display the number of lives left on the screen? L2b61: sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80C == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80C & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2b62: ret M if (((u8Flags & 0x80) >> 7) == 1) { goto returnInstruction;; } // 2b63: call 2b7eh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2b; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x66; goto L2b7e; case 0x2b66: // 2b66: dec hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL - 1); // 2b67: dec hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL - 1); // 2b68: jr 02b61h goto L2b61;; case 0x2b6a: // 2b6a: ld a, (4e00h) ; game mode L2b6a: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); { UINT16 u16Temp0; // 2b6d: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 1))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 2b6f: ret z ; return if intro mode if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 2b70: call 2bcdh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2b; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x73; goto L2bcd; case 0x2b73: // 2b73: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 2b74: ld b, h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80H); { UINT32 u32Temp0; // 2b75: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags &= 0xfd; } // 2b76: ld a, (bc) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80BC]); // 2b77: ld (bc), a mspacmanIndirectWrite8(sg_sZ80Context.z80BC, sg_sZ80Context.z80A); case 0x2b78: // 2b78: ld hl, scrlves ; number of lives to display sg_sZ80Context.z80HL = (UINT16) (0x4e15); // 2b7b: ld b, (hl) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2b7c: jr 02b4ah goto L2b4a;; // 2b7e: ld a, 40h L2b7e: sg_sZ80Context.z80A = (UINT8) (0x40); // 2b80: push hl // draw [a] to 2x2 char square L2b80: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 2b81: push de sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80D; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80E; // 2b82: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2b83: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2b84: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2b85: ld de, 001fh sg_sZ80Context.z80DE = (UINT16) (0x1f); { UINT32 u32Temp0; // 2b88: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 2b89: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2b8a: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2b8b: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2b8c: pop de sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2b8d: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2b8e: ret goto returnInstruction;; // 2b8f: push hl // draw fruit L2b8f: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 2b90: push de sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80D; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80E; // 2b91: ld de, 001fh sg_sZ80Context.z80DE = (UINT16) (0x1f); // 2b94: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2b95: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 2b96: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2b97: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2b98: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); { UINT32 u32Temp0; // 2b99: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 2b9a: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2b9b: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2b9c: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2b9d: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 2b9e: pop de sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2b9f: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2ba0: ret goto returnInstruction;; case 0x2ba1: // 2ba1: ld a, (credits) ; number of credits in ram // display number of credits L2ba1: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6e]); { UINT16 u16Temp0; // 2ba4: cp a, 0ffh ; set for free play? u16Temp0 = sg_sZ80Context.z80A - 0xff; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 2ba6: jr nz, 02badh ; no? then jump if (((u8Flags & 0x40) >> 6) != 1) { goto L2bad;; } // 2ba8: ld b, 02h ; 'FREE PLAY' sg_sZ80Context.z80B = (UINT8) (0x02); // 2baa: jp 2c5eh ; print FREE PLAY goto L2c5e;; // 2bad: ld b, 01h L2bad: sg_sZ80Context.z80B = (UINT8) (1); // 2baf: call 2c5eh ; print CREDIT sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2b; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb2; goto L2c5e; case 0x2bb2: // 2bb2: ld a, (credits) ; number of credits in ram sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6e]); // 2bb5: and a, 0f0h ; bigger than 9? sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0xf0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2bb7: jr z, 02bc2h ; yes, only inc 1 position if (((u8Flags & 0x40) >> 6) == 1) { goto L2bc2;; } // 2bb9: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2bba: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2bbb: rrca ; increment tens sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2bbc: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); { UINT16 u16Temp0; // 2bbd: add a, 30h u16Temp0 = sg_sZ80Context.z80A + 0x30; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2bbf: ld (4034h), a ; put number of credits on screen MSPacVideoWrite(0x4034,sg_sZ80Context.z80A); // 2bc2: ld a, (credits) ; number of credits in ram L2bc2: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e6e]); // 2bc5: and a, 0fh ; strip sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); { UINT16 u16Temp0; // 2bc7: add a, 30h u16Temp0 = sg_sZ80Context.z80A + 0x30; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x30))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x30 ^ sg_sZ80Context.z80A ^ 0x80) & (0x30 ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2bc9: ld (4033h), a ; put number of credits on screen MSPacVideoWrite(0x4033,sg_sZ80Context.z80A); // 2bcc: ret goto returnInstruction;; // 2bcd: pop hl L2bcd: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2bce: ld e, (hl) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2bcf: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2bd0: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2bd1: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2bd2: ld c, (hl) sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2bd3: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2bd4: ld b, (hl) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2bd5: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2bd6: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2bd7: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2bd8: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; { UINT16 u16Temp0; // 2bd9: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); } // 2bda: ld de, 0020h sg_sZ80Context.z80DE = (UINT16) (0x20); // 2bdd: push hl L2bdd: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 2bde: push bc sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80B; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80C; // 2bdf: ld (hl), c L2bdf: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80C); // 2be0: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2be1: djnz 02bdfh sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L2bdf;; } // 2be3: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2be4: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); { UINT32 u32Temp0; // 2be5: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 2be6: dec a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2be7: jr nz, 02bddh if (((u8Flags & 0x40) >> 6) != 1) { goto L2bdd;; } // 2be9: ret goto returnInstruction;; case 0x2bea: // 2bea: ld a, (4e00h) ; game mode L2bea: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e00]); { UINT16 u16Temp0; // 2bed: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 1))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 2bef: ret z ; return if intro mode if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 2bf0: ld a, (boardno) ; current board level // new board, increment? sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e13]); // 2bf3: inc a ; increment it sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 2bf4: jp 8793h ; pac compares to 8 here... do goto L8793;; // 2bf9: ld de, 3b08h ; fruit table? // returns here from 8793... L2bf9: sg_sZ80Context.z80DE = (UINT16) (0x3b08); // 2bfc: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 2bfd: ld c, 07h ; fruit count sg_sZ80Context.z80C = (UINT8) (0x07); // 2bff: ld hl, 4004h ; starting loc sg_sZ80Context.z80HL = (UINT16) (0x4004); // 2c02: ld a, (de) L2c02: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80DE]); // 2c03: call 2b8fh ; draw fruit sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x06; goto L2b8f; case 0x2c06: // 2c06: ld a, 04h ; v sg_sZ80Context.z80A = (UINT8) (0x04); { UINT16 u16Temp0; // 2c08: add a, h ; v u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80H; u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80H ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80H ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2c09: ld h, a ; v sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80A); // 2c0a: inc de ; v sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 2c0b: ld a, (de) ; v sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80DE]); // 2c0c: call 2b80h ; erase next fruit sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0f; goto L2b80; case 0x2c0f: // 2c0f: ld a, 0fch sg_sZ80Context.z80A = (UINT8) (0xfc); { UINT16 u16Temp0; // 2c11: add a, h u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80H; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2c12: ld h, a sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80A); // 2c13: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 2c14: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2c15: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2c16: dec c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { } else { u8Flags &= 0xef; } // 2c17: djnz 02c02h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L2c02;; } // 2c19: dec c L2c19: sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80C == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80C & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80C & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2c1a: ret M if (((u8Flags & 0x80) >> 7) == 1) { goto returnInstruction;; } // 2c1b: call 2b7eh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1e; goto L2b7e; case 0x2c1e: // 2c1e: ld a, 04h sg_sZ80Context.z80A = (UINT8) (0x04); { UINT16 u16Temp0; // 2c20: add a, h u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80H; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2c21: ld h, a sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80A); // 2c22: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2c23: call 2b80h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x26; goto L2b80; case 0x2c26: // 2c26: ld a, 0fch sg_sZ80Context.z80A = (UINT8) (0xfc); { UINT16 u16Temp0; // 2c28: add a, h u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80H; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2c29: ld h, a sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80A); // 2c2a: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2c2b: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2c2c: jr 02c19h goto L2c19;; // 2c5e: ld hl, 36a5h ; 36a5 is the text string lookup table // Renders messages from a table with // coordinates and message data // b=message # in table L2c5e: sg_sZ80Context.z80HL = (UINT16) (0x36a5); // 2c61: rst 18h ; (hl+2*b) -> hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x62; goto L0018; case 0x2c62: // 2c62: ld e, (hl) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2c63: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2c64: ld d, (hl) ; de contains start offset sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2c65: ld ix, 4400h ; start of color RAM sg_sZ80Context.z80IX = (UINT16) (0x4400); { UINT32 u32Temp0; // 2c69: add ix, de ; calculate start pos in CRAM u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); } // 2c6b: push ix ; 4400 + (hl) -> stack sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80XH; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80XL; // 2c6d: ld de, 0fc00h sg_sZ80Context.z80DE = (UINT16) (0xfc00); { UINT32 u32Temp0; // 2c70: add ix, de ; calc start pos in VRAM u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); } // 2c72: ld de, 0ffffh ; offset for normal text sg_sZ80Context.z80DE = (UINT16) (0xffff); // 2c75: bit 7, (hl) u8Flags = (u8Flags & ~0x40) | ((((sg_u8mspacman_memory[sg_sZ80Context.z80HL] & 0x80) == 0)) ? 0x40 : 0); // 2c77: jr nz, 02c7ch if (((u8Flags & 0x40) >> 6) != 1) { goto L2c7c;; } // 2c79: ld de, 0ffe0h ; offset for top + bot 2 lines sg_sZ80Context.z80DE = (UINT16) (0xffe0); // 2c7c: inc hl L2c7c: sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2c7d: ld a, b ; b -> a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2c7e: ld bc, 0000h ; 0 -> b,c sg_sZ80Context.z80BC = (UINT16) (0); { UINT16 u16Temp0; // 2c81: add a, a ; 2*a -> a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2c82: jr c, 02cach ; special draw for entries 80+ if (((u8Flags & 0x01) >> 0) == 1) { goto L2cac;; } // 2c84: ld a, (hl) ; read next char L2c84: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 2c85: cp a, 2fh ; #2f is end of text u16Temp0 = sg_sZ80Context.z80A - 0x2f; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 2c87: jr z, 02c92h ; done with VRAM if (((u8Flags & 0x40) >> 6) == 1) { goto L2c92;; } // 2c89: ld (ix+00h), a ; write char to screen mspacmanIndirectWrite8(sg_sZ80Context.z80IX, sg_sZ80Context.z80A); // 2c8c: inc hl ; next char sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); { UINT32 u32Temp0; // 2c8d: add ix, de ; calc next VRAM pos u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); } // 2c8f: inc b ; inc char count sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B + 1); if ((sg_sZ80Context.z80B & 0x0f) == 0) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80B == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2c90: jr 02c84h ; loop goto L2c84;; // 2c92: inc hl L2c92: sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2c93: pop ix ; get CRAM start pos L2c93: sg_sZ80Context.z80XL = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80XH = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2c95: ld a, (hl) ; get color sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2c96: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2c97: jp m, 2ca4h ; jump if > #80 if (((u8Flags & 0x80) >> 7) == 1) { goto L2ca4;; } // 2c9a: ld a, (hl) ; get color L2c9a: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2c9b: ld (ix+00h), a ; drop in CRAM mspacmanIndirectWrite8(sg_sZ80Context.z80IX, sg_sZ80Context.z80A); // 2c9e: inc hl ; next color sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); { UINT32 u32Temp0; // 2c9f: add ix, de ; calc next CRAM pos u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80IX ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 2ca1: djnz 02c9ah ; loop until b=0 sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L2c9a;; } // 2ca3: ret goto returnInstruction;; // 2ca4: ld (ix+00h), a ; drop in CRAM // same as above, but all the same color L2ca4: mspacmanIndirectWrite8(sg_sZ80Context.z80IX, sg_sZ80Context.z80A); { UINT32 u32Temp0; // 2ca7: add ix, de ; calc next CRAM pos u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80IX ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 2ca9: djnz 02ca4h ; loop until b=0 sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L2ca4;; } // 2cab: ret goto returnInstruction;; // 2cac: ld a, (hl) ; read next char // message # > 80 (erase prev message?) use 2nd color code L2cac: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 2cad: cp a, 2fh u16Temp0 = sg_sZ80Context.z80A - 0x2f; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 2caf: jr z, 02cbbh ; done with vram if (((u8Flags & 0x40) >> 6) == 1) { goto L2cbb;; } // 2cb1: ld (ix+00h), 40h ; write 40 to vram mspacmanIndirectWrite8(sg_sZ80Context.z80IX, 0x40); // 2cb5: inc hl ; next char sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); { UINT32 u32Temp0; // 2cb6: add ix, de ; next screen pos u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80DE; sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); } // 2cb8: inc b ; inc char count sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B + 1); if ((sg_sZ80Context.z80B & 0x0f) == 0) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80B == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2cb9: jr 02cach ; loop goto L2cac;; // 2cbb: inc hl ; next char L2cbb: sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2cbc: inc b ; inc char count sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80B == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80B & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80B & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80B == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } { UINT8 u8Temp0; // 2cbd: cpir ; loop until [hl] = 2f UniqueLabel12: u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC && (sg_sZ80Context.z80A != u8Temp0) && ((s32CyclesRemaining = s32CyclesRemaining - 0x15) >= 0)) { goto UniqueLabel12;; } u8Flags &= 0xfd; if (sg_sZ80Context.z80A != u8Temp0) { u8Flags &= 0xbf; } else { u8Flags |= 0x40; } if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } } // 2cbf: jr 02c93h ; do CRAM goto L2c93;; // 2cc1: jp 9797h ; does something with sprites/cocktail // prep for sound routine? L2cc1: goto L9797;; // 2cc4: ld ix, 4ecch L2cc4: sg_sZ80Context.z80IX = (UINT16) (0x4ecc); // 2cc8: ld iy, 4e8ch sg_sZ80Context.z80IY = (UINT16) (0x4e8c); // 2ccc: call 2d44h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xcf; goto L2d44; case 0x2ccf: // 2ccf: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 2cd0: ld a, (4ecch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4ecc]); // 2cd3: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2cd4: jr z, 02cdah if (((u8Flags & 0x40) >> 6) == 1) { goto L2cda;; } // 2cd6: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2cd7: ld (4e91h), a sg_u8mspacman_memory[0x4e91] = sg_sZ80Context.z80A; // 2cda: ld hl, 967dh L2cda: sg_sZ80Context.z80HL = (UINT16) (0x967d); // 2cdd: ld ix, 4edch sg_sZ80Context.z80IX = (UINT16) (0x4edc); // 2ce1: ld iy, 4e92h sg_sZ80Context.z80IY = (UINT16) (0x4e92); // 2ce5: call 2d44h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2c; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe8; goto L2d44; case 0x2ce8: // 2ce8: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 2ce9: ld a, (4edch) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4edc]); // 2cec: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2ced: jr z, 02cf3h if (((u8Flags & 0x40) >> 6) == 1) { goto L2cf3;; } // 2cef: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2cf0: ld (4e96h), a sg_u8mspacman_memory[0x4e96] = sg_sZ80Context.z80A; // 2cf3: ld hl, 968dh L2cf3: sg_sZ80Context.z80HL = (UINT16) (0x968d); // 2cf6: ld ix, 4eech sg_sZ80Context.z80IX = (UINT16) (0x4eec); // 2cfa: ld iy, 4e97h sg_sZ80Context.z80IY = (UINT16) (0x4e97); // 2cfe: call 2d44h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 1; goto L2d44; case 0x2d01: // 2d01: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 2d02: ld a, (4eech) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4eec]); // 2d05: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2d06: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 2d07: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2d08: ld (4e9bh), a sg_u8mspacman_memory[0x4e9b] = sg_sZ80Context.z80A; // 2d0b: ret goto returnInstruction;; // 2d0c: ld hl, 3b30h // sound routine... L2d0c: sg_sZ80Context.z80HL = (UINT16) (0x3b30); // 2d0f: ld ix, 4e9ch ; register 1 for sound sg_sZ80Context.z80IX = (UINT16) (0x4e9c); // 2d13: ld iy, 4e8ch ; register 2 for sound sg_sZ80Context.z80IY = (UINT16) (0x4e8c); // 2d17: call 2deeh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1a; goto L2dee; case 0x2d1a: // 2d1a: ld (4e91h), a sg_u8mspacman_memory[0x4e91] = sg_sZ80Context.z80A; // 2d1d: ld hl, 3b40h sg_sZ80Context.z80HL = (UINT16) (0x3b40); // 2d20: ld ix, 4each sg_sZ80Context.z80IX = (UINT16) (0x4eac); // 2d24: ld iy, 4e92h sg_sZ80Context.z80IY = (UINT16) (0x4e92); // 2d28: call 2deeh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2b; goto L2dee; case 0x2d2b: // 2d2b: ld (4e96h), a sg_u8mspacman_memory[0x4e96] = sg_sZ80Context.z80A; // 2d2e: ld hl, 3b80h sg_sZ80Context.z80HL = (UINT16) (0x3b80); // 2d31: ld ix, 4ebch sg_sZ80Context.z80IX = (UINT16) (0x4ebc); // 2d35: ld iy, 4e97h sg_sZ80Context.z80IY = (UINT16) (0x4e97); // 2d39: call 2deeh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3c; goto L2dee; case 0x2d3c: // 2d3c: ld (4e9bh), a sg_u8mspacman_memory[0x4e9b] = sg_sZ80Context.z80A; // 2d3f: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2d40: ld (4e90h), a sg_u8mspacman_memory[0x4e90] = sg_sZ80Context.z80A; // 2d43: ret goto returnInstruction;; // 2d44: ld a, (ix+00h) L2d44: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 2d47: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2d48: jp z, 2df4h if (((u8Flags & 0x40) >> 6) == 1) { goto L2df4;; } // 2d4b: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 2d4c: ld b, 08h sg_sZ80Context.z80B = (UINT8) (0x08); // 2d4e: ld e, 80h sg_sZ80Context.z80E = (UINT8) (0x80); // 2d50: ld a, e L2d50: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80E); // 2d51: and a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80C); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2d52: jr nz, 02d59h if (((u8Flags & 0x40) >> 6) != 1) { goto L2d59;; } // 2d54: srl e u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80E & 1) ? 0x01 : 0); sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80E >> 1); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80E & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80E == 0) ? 0x40 : 0); u8Flags &= 0xef; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80E >> 0x07) & 1) + ((sg_sZ80Context.z80E >> 0x06) & 1) + ((sg_sZ80Context.z80E >> 0x05) & 1) + ((sg_sZ80Context.z80E >> 0x04) & 1) + ((sg_sZ80Context.z80E >> 0x03) & 1) + ((sg_sZ80Context.z80E >> 0x02) & 1) + ((sg_sZ80Context.z80E >> 1) & 1) + ((sg_sZ80Context.z80E >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2d56: djnz 02d50h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L2d50;; } // 2d58: ret goto returnInstruction;; // 2d59: ld a, (ix+02h) L2d59: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x02]); // 2d5c: and a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80E); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2d5d: jr nz, 02d66h if (((u8Flags & 0x40) >> 6) != 1) { goto L2d66;; } // 2d5f: ld (ix+02h), e mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, sg_sZ80Context.z80E); // 2d62: jp 364eh goto L364e;; { UINT8 u8Temp0; // 2d66: dec (ix+0ch) L2d66: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0c, sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0c] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0c]; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); } // 2d69: jp nz, 2dd7h if (((u8Flags & 0x40) >> 6) != 1) { goto L2dd7;; } case 0x2d6c: // 2d6c: ld l, (ix+06h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x06]); // 2d6f: ld h, (ix+07h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x07]); // 2d72: ld a, (hl) L2d72: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2d73: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2d74: ld (ix+06h), l mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, sg_sZ80Context.z80L); // 2d77: ld (ix+07h), h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, sg_sZ80Context.z80H); { UINT16 u16Temp0; // 2d7a: cp a, 0f0h u16Temp0 = sg_sZ80Context.z80A - 0xf0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 2d7c: jr c, 02da5h if (((u8Flags & 0x01) >> 0) == 1) { goto L2da5;; } // 2d7e: ld hl, 2d6ch sg_sZ80Context.z80HL = (UINT16) (0x2d6c); // 2d81: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 2d82: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); // 2d84: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x85; goto L0020; case 0x2da5: // 2da5: ld b, a L2da5: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 2da6: and a, 1fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x1f); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2da8: jr z, 02dadh if (((u8Flags & 0x40) >> 6) == 1) { goto L2dad;; } // 2daa: ld (ix+0dh), b mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0d, sg_sZ80Context.z80B); // 2dad: ld c, (ix+09h) L2dad: sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x09]); // 2db0: ld a, (ix+0bh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0b]); // 2db3: and a, 08h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x08); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2db5: jr z, 02db9h if (((u8Flags & 0x40) >> 6) == 1) { goto L2db9;; } // 2db7: ld c, 00h sg_sZ80Context.z80C = (UINT8) (0); // 2db9: ld (ix+0fh), c L2db9: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0f, sg_sZ80Context.z80C); // 2dbc: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2dbd: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 2dbe: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 2dbf: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 2dc0: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); // 2dc2: ld hl, 3bb0h sg_sZ80Context.z80HL = (UINT16) (0x3bb0); // 2dc5: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc6; goto L0010; case 0x2dc6: // 2dc6: ld (ix+0ch), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0c, sg_sZ80Context.z80A); // 2dc9: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2dca: and a, 1fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x1f); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2dcc: jr z, 02dd7h if (((u8Flags & 0x40) >> 6) == 1) { goto L2dd7;; } // 2dce: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); // 2dd0: ld hl, 3bb8h sg_sZ80Context.z80HL = (UINT16) (0x3bb8); // 2dd3: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2d; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd4; goto L0010; case 0x2dd4: // 2dd4: ld (ix+0eh), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0e, sg_sZ80Context.z80A); // 2dd7: ld l, (ix+0eh) L2dd7: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0e]); // 2dda: ld h, 00h sg_sZ80Context.z80H = (UINT8) (0); // 2ddc: ld a, (ix+0dh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0d]); // 2ddf: and a, 10h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x10); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2de1: jr z, 02de5h if (((u8Flags & 0x40) >> 6) == 1) { goto L2de5;; } // 2de3: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); { UINT16 u16Temp0; // 2de5: add a, (ix+04h) L2de5: u16Temp0 = sg_sZ80Context.z80A + sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x04]; u8Flags = (u8Flags & ~0x04) | ((((sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x04] ^ sg_sZ80Context.z80A ^ 0x80) & (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x04] ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 2de8: jp z, 2ee8h if (((u8Flags & 0x40) >> 6) == 1) { goto L2ee8;; } // 2deb: jp 2ee4h goto L2ee4;; // 2dee: ld a, (ix+00h) // do something with playing the sound sound L2dee: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 2df1: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2df2: jr nz, 02e1bh if (((u8Flags & 0x40) >> 6) != 1) { goto L2e1b;; } // 2df4: ld a, (ix+02h) L2df4: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x02]); // 2df7: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2df8: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 2df9: ld (ix+02h), 00h ; this is where the score is zeroed? mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, 0); // 2dfd: ld (ix+0dh), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0d, 0); // 2e01: ld (ix+0eh), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0e, 0); // 2e05: ld (ix+0fh), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0f, 0); // 2e09: ld (iy+00h), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IY, 0); // 2e0d: ld (iy+01h), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 1, 0); // 2e11: ld (iy+02h), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x02, 0); // 2e15: ld (iy+03h), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x03, 0); // 2e19: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2e1a: ret goto returnInstruction;; // 2e1b: ld c, a // do something with playing a sound L2e1b: sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 2e1c: ld b, 08h sg_sZ80Context.z80B = (UINT8) (0x08); // 2e1e: ld e, 80h sg_sZ80Context.z80E = (UINT8) (0x80); // 2e20: ld a, e L2e20: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80E); // 2e21: and a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80C); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2e22: jr nz, 02e29h if (((u8Flags & 0x40) >> 6) != 1) { goto L2e29;; } // 2e24: srl e u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80E & 1) ? 0x01 : 0); sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80E >> 1); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80E & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80E == 0) ? 0x40 : 0); u8Flags &= 0xef; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80E >> 0x07) & 1) + ((sg_sZ80Context.z80E >> 0x06) & 1) + ((sg_sZ80Context.z80E >> 0x05) & 1) + ((sg_sZ80Context.z80E >> 0x04) & 1) + ((sg_sZ80Context.z80E >> 0x03) & 1) + ((sg_sZ80Context.z80E >> 0x02) & 1) + ((sg_sZ80Context.z80E >> 1) & 1) + ((sg_sZ80Context.z80E >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2e26: djnz 02e20h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L2e20;; } // 2e28: ret goto returnInstruction;; // 2e29: ld a, (ix+02h) // do something with playing a sound L2e29: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x02]); // 2e2c: and a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80E); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2e2d: jr nz, 02e6eh if (((u8Flags & 0x40) >> 6) != 1) { goto L2e6e;; } // 2e2f: ld (ix+02h), e mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x02, sg_sZ80Context.z80E); // 2e32: dec b sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80B == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80B & 0x80) ? 0x80 : 0); if (sg_sZ80Context.z80B == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2e33: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 2e34: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 2e35: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 2e36: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 2e37: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 2e38: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 2e3a: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; { UINT32 u32Temp0; // 2e3b: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 2e3c: push ix sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80XH; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80XL; // 2e3e: pop de sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2e3f: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 2e40: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 2e41: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 2e42: ld bc, 0008h sg_sZ80Context.z80BC = (UINT16) (0x08); // 2e45: ldir UniqueLabel13: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel13;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 2e47: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 2e48: ld a, (ix+06h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x06]); // 2e4b: and a, 7fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x7f); // 2e4d: ld (ix+0ch), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0c, sg_sZ80Context.z80A); // 2e50: ld a, (ix+04h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x04]); // 2e53: ld (ix+0eh), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0e, sg_sZ80Context.z80A); // 2e56: ld a, (ix+09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x09]); // 2e59: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 2e5a: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2e5b: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2e5c: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2e5d: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2e5e: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); // 2e60: ld (ix+0bh), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0b, sg_sZ80Context.z80A); // 2e63: and a, 08h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x08); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2e65: jr nz, 02e6eh if (((u8Flags & 0x40) >> 6) != 1) { goto L2e6e;; } // 2e67: ld (ix+0fh), b mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0f, sg_sZ80Context.z80B); // 2e6a: ld (ix+0dh), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0d, 0); { UINT8 u8Temp0; // 2e6e: dec (ix+0ch) L2e6e: mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0c, sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0c] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0c]; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); } // 2e71: jr nz, 02ecdh if (((u8Flags & 0x40) >> 6) != 1) { goto L2ecd;; } // 2e73: ld a, (ix+08h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x08]); // 2e76: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2e77: jr z, 02e89h if (((u8Flags & 0x40) >> 6) == 1) { goto L2e89;; } { UINT8 u8Temp0; // 2e79: dec (ix+08h) mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x08, sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x08] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x08]; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); } // 2e7c: jr nz, 02e89h if (((u8Flags & 0x40) >> 6) != 1) { goto L2e89;; } // 2e7e: ld a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80E); // 2e7f: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); // 2e80: and a, (ix+00h) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 2e83: ld (ix+00h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX, sg_sZ80Context.z80A); // 2e86: jp 2deeh goto L2dee;; // 2e89: ld a, (ix+06h) L2e89: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x06]); // 2e8c: and a, 7fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x7f); // 2e8e: ld (ix+0ch), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0c, sg_sZ80Context.z80A); // 2e91: bit 7, (ix+06h) u8Flags = (u8Flags & ~0x40) | ((((sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x06] & 0x80) == 0)) ? 0x40 : 0); // 2e95: jr z, 02eadh if (((u8Flags & 0x40) >> 6) == 1) { goto L2ead;; } // 2e97: ld a, (ix+05h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x05]); { UINT16 u16Temp0; // 2e9a: neg u16Temp0 = 0 - sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2e9c: ld (ix+05h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x05, sg_sZ80Context.z80A); // 2e9f: bit 0, (ix+0dh) u8Flags = (u8Flags & ~0x40) | ((((sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0d] & 1) == 0)) ? 0x40 : 0); // 2ea3: set 0, (ix+0dh) mspacmanIndirectWrite8((sg_sZ80Context.z80IX + 0x0d), sg_u8mspacman_memory[(sg_sZ80Context.z80IX + 0x0d)] | 1); // 2ea7: jr z, 02ecdh if (((u8Flags & 0x40) >> 6) == 1) { goto L2ecd;; } // 2ea9: res 0, (ix+0dh) mspacmanIndirectWrite8((sg_sZ80Context.z80IX + 0x0d), sg_u8mspacman_memory[(sg_sZ80Context.z80IX + 0x0d)] & 0xfe); // 2ead: ld a, (ix+04h) L2ead: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x04]); { UINT16 u16Temp0; // 2eb0: add a, (ix+07h) u16Temp0 = sg_sZ80Context.z80A + sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x07]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2eb3: ld (ix+04h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x04, sg_sZ80Context.z80A); // 2eb6: ld (ix+0eh), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0e, sg_sZ80Context.z80A); // 2eb9: ld a, (ix+09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x09]); { UINT16 u16Temp0; // 2ebc: add a, (ix+0ah) u16Temp0 = sg_sZ80Context.z80A + sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0a]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2ebf: ld (ix+09h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x09, sg_sZ80Context.z80A); // 2ec2: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 2ec3: ld a, (ix+0bh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0b]); // 2ec6: and a, 08h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x08); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 2ec8: jr nz, 02ecdh if (((u8Flags & 0x40) >> 6) != 1) { goto L2ecd;; } // 2eca: ld (ix+0fh), b mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0f, sg_sZ80Context.z80B); // 2ecd: ld a, (ix+0eh) L2ecd: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0e]); { UINT16 u16Temp0; // 2ed0: add a, (ix+05h) u16Temp0 = sg_sZ80Context.z80A + sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x05]; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2ed3: ld (ix+0eh), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0e, sg_sZ80Context.z80A); // 2ed6: ld l, a sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80A); // 2ed7: ld h, 00h sg_sZ80Context.z80H = (UINT8) (0); // 2ed9: ld a, (ix+03h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x03]); // 2edc: and a, 70h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x70); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2ede: jr z, 02ee8h if (((u8Flags & 0x40) >> 6) == 1) { goto L2ee8;; } // 2ee0: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2ee1: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2ee2: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2ee3: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2ee4: ld b, a L2ee4: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); { UINT32 u32Temp0; // 2ee5: add hl, hl L2ee5: u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 2ee6: djnz 02ee5h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L2ee5;; } // 2ee8: ld (iy+00h), l L2ee8: mspacmanIndirectWrite8(sg_sZ80Context.z80IY, sg_sZ80Context.z80L); // 2eeb: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); // 2eec: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2eed: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2eee: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2eef: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2ef0: ld (iy+01h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 1, sg_sZ80Context.z80A); // 2ef3: ld (iy+02h), h mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x02, sg_sZ80Context.z80H); // 2ef6: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); // 2ef7: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2ef8: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2ef9: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 2efa: rrca u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 1) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); u8Flags &= 0xef; u8Flags &= 0xfd; // 2efb: ld (iy+03h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IY + 0x03, sg_sZ80Context.z80A); // 2efe: ld a, (ix+0bh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0b]); // 2f01: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2f; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x02; goto L0020; case 0x2f22: // 2f22: ld a, (ix+0fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0f]); // 2f25: ret goto returnInstruction;; case 0x2f26: // 2f26: ld a, (ix+0fh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0f]); // 2f29: jr 02f34h goto L2f34;; case 0x2f2b: // 2f2b: ld a, (4c84h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c84]); // 2f2e: and a, 01h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 1); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2f30: ld a, (ix+0fh) L2f30: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x0f]); // 2f33: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 2f34: and a, 0fh L2f34: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2f36: ret z if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 2f37: dec a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 2f38: ld (ix+0fh), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0f, sg_sZ80Context.z80A); // 2f3b: ret goto returnInstruction;; case 0x2f3c: // 2f3c: ld a, (4c84h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c84]); // 2f3f: and a, 03h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x03); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2f41: jr 02f30h goto L2f30;; case 0x2f43: // 2f43: ld a, (4c84h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c84]); // 2f46: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 2f48: jr 02f30h goto L2f30;; case 0x2f4a: // 2f4a: ret goto returnInstruction;; case 0x2f4b: // 2f4b: ret goto returnInstruction;; case 0x2f4c: // 2f4c: ret goto returnInstruction;; case 0x2f4d: // 2f4d: ret goto returnInstruction;; case 0x2f4e: // 2f4e: ret goto returnInstruction;; case 0x2f4f: // 2f4f: ret goto returnInstruction;; case 0x2f50: // 2f50: ret goto returnInstruction;; case 0x2f51: // 2f51: ret goto returnInstruction;; case 0x2f52: // 2f52: ret goto returnInstruction;; case 0x2f53: // 2f53: ret goto returnInstruction;; case 0x2f54: // 2f54: ret goto returnInstruction;; case 0x2f55: // 2f55: ld l, (ix+06h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x06]); // 2f58: ld h, (ix+07h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x07]); // 2f5b: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2f5c: ld (ix+06h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, sg_sZ80Context.z80A); // 2f5f: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2f60: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2f61: ld (ix+07h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, sg_sZ80Context.z80A); // 2f64: ret goto returnInstruction;; case 0x2f65: // 2f65: ld l, (ix+06h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x06]); // 2f68: ld h, (ix+07h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x07]); // 2f6b: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2f6c: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2f6d: ld (ix+06h), l mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, sg_sZ80Context.z80L); // 2f70: ld (ix+07h), h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, sg_sZ80Context.z80H); // 2f73: ld (ix+03h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x03, sg_sZ80Context.z80A); // 2f76: ret goto returnInstruction;; case 0x2f77: // 2f77: ld l, (ix+06h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x06]); // 2f7a: ld h, (ix+07h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x07]); // 2f7d: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2f7e: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2f7f: ld (ix+06h), l mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, sg_sZ80Context.z80L); // 2f82: ld (ix+07h), h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, sg_sZ80Context.z80H); // 2f85: ld (ix+04h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x04, sg_sZ80Context.z80A); // 2f88: ret goto returnInstruction;; case 0x2f89: // 2f89: ld l, (ix+06h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x06]); // 2f8c: ld h, (ix+07h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x07]); // 2f8f: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2f90: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2f91: ld (ix+06h), l mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, sg_sZ80Context.z80L); // 2f94: ld (ix+07h), h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, sg_sZ80Context.z80H); // 2f97: ld (ix+09h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x09, sg_sZ80Context.z80A); // 2f9a: ret goto returnInstruction;; case 0x2f9b: // 2f9b: ld l, (ix+06h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x06]); // 2f9e: ld h, (ix+07h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x07]); // 2fa1: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 2fa2: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 2fa3: ld (ix+06h), l mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x06, sg_sZ80Context.z80L); // 2fa6: ld (ix+07h), h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x07, sg_sZ80Context.z80H); // 2fa9: ld (ix+0bh), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 0x0b, sg_sZ80Context.z80A); // 2fac: ret goto returnInstruction;; case 0x2fad: // 2fad: ld a, (ix+02h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x02]); // 2fb0: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); // 2fb1: and a, (ix+00h) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 2fb4: ld (ix+00h), a mspacmanIndirectWrite8(sg_sZ80Context.z80IX, sg_sZ80Context.z80A); // 2fb7: jp 2df4h goto L2df4;; case 0x2ffe: { UINT16 u16Temp0; // 2ffe: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 2fff: ld c, h // 3000: ld hl, 0000h // rst 38 continuation (initalization routine portion) // the rom checksum routine L3000: sg_sZ80Context.z80HL = (UINT16) (0); // 3003: ld bc, 1000h L3003: sg_sZ80Context.z80BC = (UINT16) (0x1000); // 3006: ld (Wdog), a ; kick the dog // reclaim a lot of romspace by skipping self test ; HACK4 L3006: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 3009: ld a, c ; a=0 L3009: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); { UINT16 u16Temp0; UINT8 u8Temp0; // 300a: add a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A + u8Temp0; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 300b: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 300c: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); { UINT16 u16Temp0; // 300d: add a, 02h u16Temp0 = sg_sZ80Context.z80A + 0x02; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 300f: ld l, a sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 3010: cp a, 02h u16Temp0 = sg_sZ80Context.z80A - 0x02; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 3012: jp nc, 3009h if (((u8Flags & 0x01) >> 0) != 1) { goto L3009;; } // 3015: inc h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H + 1); if ((sg_sZ80Context.z80H & 0x0f) == 0) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80H == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 3016: djnz 03006h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L3006;; } // 3018: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 3019: and a, a // 301a: nop ; this is a hack to disregard bad csums // 301b: nop ; this is a hack to disregard bad csums // 301c: ld (coinct), a ; clear coin MSStuffWrite(0x5007,sg_sZ80Context.z80A); // 301f: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); { UINT16 u16Temp0; // 3020: cp a, 30h u16Temp0 = sg_sZ80Context.z80A - 0x30; u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x30))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x30 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 3022: jp nz, 3003h ; continue for other roms if (((u8Flags & 0x40) >> 6) != 1) { goto L3003;; } // 3025: ld h, 00h sg_sZ80Context.z80H = (UINT8) (0); // 3027: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 3028: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); { UINT16 u16Temp0; // 3029: cp a, 02h u16Temp0 = sg_sZ80Context.z80A - 0x02; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x02))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x02 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 302b: jp c, 3003h if (((u8Flags & 0x01) >> 0) == 1) { goto L3003;; } // 302e: jp 3042h goto L3042;; // 3042: ld sp, 3154h // RAM TEST (4c00) L3042: sg_sZ80Context.z80SP = (UINT16) (0x3154); // 3045: ld b, 0ffh L3045: sg_sZ80Context.z80B = (UINT8) (0xff); // 3047: pop hl ; 4c00 (first time) L3047: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 3048: pop de ; 040f (first time) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 3049: ld c, b ; 0xff -> c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80B); // 304a: ld (Wdog), a ; kick the dog // write stuff to ram L304a: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 304d: ld a, c ; 0xff -> a L304d: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 304e: and a, e ; e -> a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80E); // 304f: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); { UINT16 u16Temp0; // 3050: add a, 33h u16Temp0 = sg_sZ80Context.z80A + 0x33; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 3052: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 3053: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 3054: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); // 3055: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 3057: jp nz, 304dh if (((u8Flags & 0x40) >> 6) != 1) { goto L304d;; } // 305a: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); { UINT16 u16Temp0; // 305b: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 305c: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 305d: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 305e: add a, 31h u16Temp0 = sg_sZ80Context.z80A + 0x31; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 3060: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 3061: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); // 3062: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 3063: jp nz, 304dh if (((u8Flags & 0x40) >> 6) != 1) { goto L304d;; } // 3066: inc h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H + 1); // 3067: dec d sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80D - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80D == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80D & 0x0f) == 0x0f) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80D == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 3068: jp nz, 304ah if (((u8Flags & 0x40) >> 6) != 1) { goto L304a;; } // 306b: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 306c: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 306d: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 306e: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 306f: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 3070: pop de ; 4c00 sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 3071: ld c, b ; 040f sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80B); // 3072: ld (Wdog), a ; kick the dog // check ram again L3072: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 3075: ld a, c L3075: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 3076: and a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80E); // 3077: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 3078: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 3079: and a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80E); { UINT16 u16Temp0; // 307a: cp a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 307b: jp nz, 30b5h ; ram test failed if (((u8Flags & 0x40) >> 6) != 1) { goto L30b5;; } { UINT16 u16Temp0; // 307e: add a, 33h u16Temp0 = sg_sZ80Context.z80A + 0x33; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 3080: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 3081: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); // 3082: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); // 3083: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 3085: jp nz, 3075h if (((u8Flags & 0x40) >> 6) != 1) { goto L3075;; } // 3088: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); { UINT16 u16Temp0; // 3089: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 308a: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 308b: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 308c: add a, 31h u16Temp0 = sg_sZ80Context.z80A + 0x31; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 308e: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 308f: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); // 3090: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 3091: jp nz, 3075h if (((u8Flags & 0x40) >> 6) != 1) { goto L3075;; } // 3094: inc h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H + 1); // 3095: dec d sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80D - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80D == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80D & 0x0f) == 0x0f) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80D == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 3096: jp nz, 3072h if (((u8Flags & 0x40) >> 6) != 1) { goto L3072;; } // 3099: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 309a: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 309b: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 309c: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 309d: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); { UINT16 u16Temp0; // 309e: sub a, 10h u16Temp0 = sg_sZ80Context.z80A - 0x10; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x10))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x10 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 30a0: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 30a1: djnz 03047h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L3047;; } // 30a3: pop af ; 4c00 sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 30a4: pop de sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); { UINT16 u16Temp0; // 30a5: cp a, 44h u16Temp0 = sg_sZ80Context.z80A - 0x44; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x44))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x44 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 30a7: jp nz, 3045h ; check if 0x44xx done if (((u8Flags & 0x40) >> 6) != 1) { goto L3045;; } // 30aa: ld a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80E); // 30ab: xor a, 0f0h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xf0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 30ad: jp nz, 3045h ; check if totally done if (((u8Flags & 0x40) >> 6) != 1) { goto L3045;; } // 30b0: ld b, 01h sg_sZ80Context.z80B = (UINT8) (1); // 30b2: jp 30bdh goto L30bd;; // 30b5: ld a, e // display bad ram L30b5: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80E); // 30b6: and a, 01h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 1); // 30b8: xor a, 01h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 1); // 30ba: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 30bb: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 30bd: ld sp, 4fc0h // display bad rom L30bd: sg_sZ80Context.z80SP = (UINT16) (0x4fc0); { UINT16 u16Temp0; // 30c0: exx ; swap register pairs u16Temp0 = sg_sZ80Context.z80hlprime; sg_sZ80Context.z80hlprime = (UINT16) (sg_sZ80Context.z80HL); u16Temp0 = sg_sZ80Context.z80deprime; sg_sZ80Context.z80deprime = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); u16Temp0 = sg_sZ80Context.z80bcprime; sg_sZ80Context.z80bcprime = (UINT16) (sg_sZ80Context.z80BC); } // 30c1: ld hl, 4c00h // clear all program ram sg_sZ80Context.z80HL = (UINT16) (0x4c00); // 30c4: ld b, 04h sg_sZ80Context.z80B = (UINT8) (0x04); // 30c6: ld (Wdog), a ; kick the dog L30c6: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 30c9: ld (hl), 00h L30c9: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0); // 30cb: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80L & 0x0f) == 0) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 30cc: jr nz, 030c9h if (((u8Flags & 0x40) >> 6) != 1) { goto L30c9;; } // 30ce: inc h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80H & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80H & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80H == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 30cf: djnz 030c6h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L30c6;; } // 30d1: ld hl, 4000h // set all video ram to 0x40 - clear screen sg_sZ80Context.z80HL = (UINT16) (0x4000); // 30d4: ld b, 04h sg_sZ80Context.z80B = (UINT8) (0x04); // 30d6: ld (Wdog), a ; kick the dog L30d6: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 30d9: ld a, 40h sg_sZ80Context.z80A = (UINT8) (0x40); // 30db: ld (hl), a L30db: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 30dc: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80L & 0x0f) == 0) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 30dd: jr nz, 030dbh if (((u8Flags & 0x40) >> 6) != 1) { goto L30db;; } // 30df: inc h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80H & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80H & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80H == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 30e0: djnz 030d6h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L30d6;; } // 30e2: ld b, 04h // set all color ram to 0x0f sg_sZ80Context.z80B = (UINT8) (0x04); // 30e4: ld (Wdog), a ; kick the dog L30e4: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 30e7: ld a, 0fh sg_sZ80Context.z80A = (UINT8) (0x0f); // 30e9: ld (hl), a L30e9: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 30ea: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80L & 0x0f) == 0) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 30eb: jr nz, 030e9h if (((u8Flags & 0x40) >> 6) != 1) { goto L30e9;; } // 30ed: inc h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80H & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80H & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80H == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 30ee: djnz 030e4h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L30e4;; } { UINT16 u16Temp0; // 30f0: exx ; reswap register pairs u16Temp0 = sg_sZ80Context.z80hlprime; sg_sZ80Context.z80hlprime = (UINT16) (sg_sZ80Context.z80HL); sg_sZ80Context.z80HL = (UINT16) (u16Temp0); u16Temp0 = sg_sZ80Context.z80deprime; sg_sZ80Context.z80deprime = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); u16Temp0 = sg_sZ80Context.z80bcprime; sg_sZ80Context.z80bcprime = (UINT16) (sg_sZ80Context.z80BC); sg_sZ80Context.z80BC = (UINT16) (u16Temp0); } // 30f1: djnz 030fbh ; (8) b=1 -> no errors sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L30fb;; } // 30f3: ld b, 23h sg_sZ80Context.z80B = (UINT8) (0x23); // 30f5: call 2c5eh ; print MEMORY OK // eliminate startup tests ; HACK7 sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x30; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf8; goto L2c5e; case 0x30f8: // 30f8: jp 3174h ; run the game! goto L3174;; // 30fb: ld a, e ; bad rom # => a L30fb: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80E); { UINT16 u16Temp0; // 30fc: add a, 30h u16Temp0 = sg_sZ80Context.z80A + 0x30; u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x30))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x30 ^ sg_sZ80Context.z80A ^ 0x80) & (0x30 ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 30fe: ld (4184h), a ; write to screen MSPacVideoWrite(0x4184,sg_sZ80Context.z80A); // 3101: push bc ; ff0f sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80B; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80C; // 3102: push hl ; 4c00 sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 3103: ld b, 24h ; 'BAD R M' sg_sZ80Context.z80B = (UINT8) (0x24); // 3105: call 2c5eh ; print sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x31; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; goto L2c5e; case 0x3108: // 3108: pop hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 3109: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); { UINT16 u16Temp0; // 310a: cp a, 40h u16Temp0 = sg_sZ80Context.z80A - 0x40; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 310c: ld hl, (316ch) sg_sZ80Context.z80L = (UINT8) (0x4f); sg_sZ80Context.z80H = (UINT8) (0x40); // 310f: jr c, 03122h if (((u8Flags & 0x01) >> 0) == 1) { goto L3122;; } { UINT16 u16Temp0; // 3111: cp a, 4ch u16Temp0 = sg_sZ80Context.z80A - 0x4c; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 3113: ld hl, (316eh) sg_sZ80Context.z80L = (UINT8) (0x41); sg_sZ80Context.z80H = (UINT8) (0x57); // 3116: jr nc, 03122h if (((u8Flags & 0x01) >> 0) != 1) { goto L3122;; } { UINT16 u16Temp0; // 3118: cp a, 44h u16Temp0 = sg_sZ80Context.z80A - 0x44; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 311a: ld hl, (3170h) sg_sZ80Context.z80L = (UINT8) (0x41); sg_sZ80Context.z80H = (UINT8) (0x56); // 311d: jr c, 03122h if (((u8Flags & 0x01) >> 0) == 1) { goto L3122;; } // 311f: ld hl, (3172h) sg_sZ80Context.z80L = (UINT8) (0x41); sg_sZ80Context.z80H = (UINT8) (0x43); // 3122: ld a, l L3122: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); // 3123: ld (4204h), a MSPacVideoWrite(0x4204,sg_sZ80Context.z80A); // 3126: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); // 3127: ld (4264h), a MSPacVideoWrite(0x4264,sg_sZ80Context.z80A); // 312a: ld a, (IRQEn) ; in0 // check player 1 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5000]); // 312d: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 312e: ld a, (V1Acc) ; in1 // check player 2 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 3131: or a, b ; check for both sticks up? sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80B); // 3132: and a, 01h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 3134: jr nz, 03147h if (((u8Flags & 0x40) >> 6) != 1) { goto L3147;; } // 3136: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 3137: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 3138: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); // 313a: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 313b: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 313c: and a, 0f0h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0xf0); // 313e: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 313f: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 3140: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 3141: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 3142: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 3143: ld (4185h), bc MSPacVideoWrite(0x4185,sg_sZ80Context.z80C); MSPacVideoWrite(0x4186,sg_sZ80Context.z80B); // 3147: ld (Wdog), a ; kick the dog L3147: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 314a: ld a, (V1Acc) ; check in1 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 314d: and a, 10h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x10); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 314f: jr z, 03147h if (((u8Flags & 0x40) >> 6) == 1) { goto L3147;; } // 3151: jp 230bh goto L230b;; // 3174: ld hl, coinlk // start the main section... (tests first) L3174: sg_sZ80Context.z80HL = (UINT16) (0x5006); // 3177: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 3179: ld (hl), a ; enable all L3179: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 317a: dec l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80L & 0x0f) == 0x0f) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 317b: jr nz, 03179h if (((u8Flags & 0x40) >> 6) != 1) { goto L3179;; } // 317d: xor a, a ; 0x00->a sg_sZ80Context.z80A = (UINT8) (0); // 317e: ld (flpscr), a ; unflip screen MSStuffWrite(0x5003,sg_sZ80Context.z80A); { UINT16 u16Temp0; // 3181: sub a, 04h ; 0xfc->a u16Temp0 = sg_sZ80Context.z80A - 0x04; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 3183: ld i, a ; set vector sg_sZ80Context.z80i = (UINT8) (sg_sZ80Context.z80A); // 3185: ld sp, 4fc0h // pac: sg_sZ80Context.z80SP = (UINT16) (0x4fc0); // 3188: ld (Wdog), a ; kick the dog L3188: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 318b: xor a, a ; 0x00->a sg_sZ80Context.z80A = (UINT8) (0); // 318c: ld (4e00h), a ; set service mode // Skip test mode: HACK7 sg_u8mspacman_memory[0x4e00] = sg_sZ80Context.z80A; // 318f: inc a ; 0x01->a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 3190: ld (4e01h), a sg_u8mspacman_memory[0x4e01] = sg_sZ80Context.z80A; // 3193: ld (IRQEn), a ; enable interrupts MSStuffWrite(0x5000,sg_sZ80Context.z80A); // 3196: ei ; enable interrupts sg_sZ80Context.z80iff |= 0x01; sg_sZ80Context.z80iff |= 0x02; s32CyclesRemaining = s32CyclesRemaining - 0x04; // 3197: ld a, (IRQEn) // test mode sound checks // this gets called if the test switch is on at bootup sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5000]); // 319a: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); // 319b: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 319c: and a, 0e0h ; check coin/credit inputs sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0xe0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 319e: jr z, 031a5h if (((u8Flags & 0x40) >> 6) == 1) { goto L31a5;; } // 31a0: ld a, 02h ; SOUND: pellet eat sg_sZ80Context.z80A = (UINT8) (0x02); // 31a2: ld (4e9ch), a ; choose sound 2 sg_u8mspacman_memory[0x4e9c] = sg_sZ80Context.z80A; // 31a5: ld a, (V1Acc) ; check in1 L31a5: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 31a8: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); // 31a9: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 31aa: and a, 60h ; check p1/p2 start sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x60); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 31ac: jr z, 031b3h if (((u8Flags & 0x40) >> 6) == 1) { goto L31b3;; } // 31ae: ld a, 01h ; SOUND: extra base sg_sZ80Context.z80A = (UINT8) (1); // 31b0: ld (4e9ch), a ; choose sound 1 sg_u8mspacman_memory[0x4e9c] = sg_sZ80Context.z80A; // 31b3: ld a, b L31b3: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 31b4: or a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80C); // 31b5: and a, 01h ; check up sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 31b7: jr z, 031beh if (((u8Flags & 0x40) >> 6) == 1) { goto L31be;; } // 31b9: ld a, 08h ; SOUND: fruit eat sg_sZ80Context.z80A = (UINT8) (0x08); // 31bb: ld (4ebch), a ; choose sound 8 sg_u8mspacman_memory[0x4ebc] = sg_sZ80Context.z80A; // 31be: ld a, b L31be: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 31bf: or a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80C); // 31c0: and a, 02h ; check left sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x02); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 31c2: jr z, 031c9h if (((u8Flags & 0x40) >> 6) == 1) { goto L31c9;; } // 31c4: ld a, 04h ; SOUND: Pellet eat sg_sZ80Context.z80A = (UINT8) (0x04); // 31c6: ld (4ebch), a ; choose sound 4 sg_u8mspacman_memory[0x4ebc] = sg_sZ80Context.z80A; // 31c9: ld a, b L31c9: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 31ca: or a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80C); // 31cb: and a, 04h ; check right sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x04); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 31cd: jr z, 031d4h if (((u8Flags & 0x40) >> 6) == 1) { goto L31d4;; } // 31cf: ld a, 10h ; SOUND: death sg_sZ80Context.z80A = (UINT8) (0x10); // 31d1: ld (4ebch), a ; choose sound 16 sg_u8mspacman_memory[0x4ebc] = sg_sZ80Context.z80A; // 31d4: ld a, b L31d4: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 31d5: or a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80C); // 31d6: and a, 08h ; check down sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x08); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 31d8: jr z, 031dfh if (((u8Flags & 0x40) >> 6) == 1) { goto L31df;; } // 31da: ld a, 20h ; SOUND: bassy noise sg_sZ80Context.z80A = (UINT8) (0x20); // 31dc: ld (4ebch), a ; choose sound 32 sg_u8mspacman_memory[0x4ebc] = sg_sZ80Context.z80A; // 31df: ld a, (5080h) ; read dips L31df: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5080]); // 31e2: and a, 03h ; mask coin info sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x03); { UINT16 u16Temp0; // 31e4: add a, 25h u16Temp0 = sg_sZ80Context.z80A + 0x25; u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x25))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x25 ^ sg_sZ80Context.z80A ^ 0x80) & (0x25 ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 31e6: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 31e7: call 2c5eh ; print FREE PLAY sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x31; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xea; goto L2c5e; case 0x31ea: // 31ea: ld a, (5080h) ; read dips sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5080]); // 31ed: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 31ee: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 31ef: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 31f0: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 31f1: and a, 03h ; mask extras sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x03); { UINT16 u16Temp0; // 31f3: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x03))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x03 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 31f5: jr nz, 031ffh if (((u8Flags & 0x40) >> 6) != 1) { goto L31ff;; } // 31f7: ld b, 2ah ; 'BONUS NONE' sg_sZ80Context.z80B = (UINT8) (0x2a); // 31f9: call 2c5eh ; print sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x31; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xfc; goto L2c5e; case 0x31fc: // 31fc: jp 321ch goto L321c;; // 31ff: rlca L31ff: sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); u8Flags &= 0xef; u8Flags &= 0xfd; // 3200: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 3201: push de sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80D; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80E; // 3202: ld b, 2bh ; 'BONUS' sg_sZ80Context.z80B = (UINT8) (0x2b); // 3204: call 2c5eh ; print sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x32; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x07; goto L2c5e; case 0x3207: // 3207: ld b, 2eh ; '000' sg_sZ80Context.z80B = (UINT8) (0x2e); // 3209: call 2c5eh ; print sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x32; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0c; goto L2c5e; case 0x320c: // 320c: pop de sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 320d: ld d, 00h sg_sZ80Context.z80D = (UINT8) (0); // 320f: ld hl, 32f9h sg_sZ80Context.z80HL = (UINT16) (0x32f9); { UINT32 u32Temp0; // 3212: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 3213: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 3214: ld (422ah), a MSPacVideoWrite(0x422a,sg_sZ80Context.z80A); // 3217: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 3218: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 3219: ld (424ah), a MSPacVideoWrite(0x424a,sg_sZ80Context.z80A); // 321c: ld a, (5080h) ; check in0 L321c: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5080]); // 321f: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 3220: rrca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A >> 1) | (sg_sZ80Context.z80A << 0x07))); // 3221: and a, 03h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x03); { UINT16 u16Temp0; // 3223: add a, 31h u16Temp0 = sg_sZ80Context.z80A + 0x31; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 3225: cp a, 34h u16Temp0 = sg_sZ80Context.z80A - 0x34; u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x34))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x34 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 3227: jr nz, 0322ah if (((u8Flags & 0x40) >> 6) != 1) { goto L322a;; } // 3229: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 322a: ld (41ach), a L322a: MSPacVideoWrite(0x41ac,sg_sZ80Context.z80A); // 322d: ld b, 29h ; 'MS. PAC-MEN' // pac: sg_sZ80Context.z80B = (UINT8) (0x29); // 322f: call 2c5eh ; print sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x32; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x32; goto L2c5e; case 0x3232: // 3232: ld a, (V1Acc) ; check dips sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 3235: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 3236: and a, 01h ; upright or cocktail sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 1); { UINT16 u16Temp0; // 3238: add a, 2ch u16Temp0 = sg_sZ80Context.z80A + 0x2c; u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x2c))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x2c ^ sg_sZ80Context.z80A ^ 0x80) & (0x2c ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 323a: ld b, a ; 'TABLE'/'UPRIGHT' sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 323b: call 2c5eh ; print sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x32; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; goto L2c5e; case 0x323e: // 323e: ld a, (V1Acc) ; check in1 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 3241: and a, 10h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x10); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 3243: jp z, 3188h if (((u8Flags & 0x40) >> 6) == 1) { goto L3188;; } // 3246: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 3247: ld (IRQEn), a MSStuffWrite(0x5000,sg_sZ80Context.z80A); // 324a: di ; disable interrupts sg_sZ80Context.z80iff &= 0xfe; // 324b: ld hl, coinct sg_sZ80Context.z80HL = (UINT16) (0x5007); // 324e: xor a, a sg_sZ80Context.z80A = (UINT8) (0); // 324f: ld (hl), a L324f: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 3250: dec l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80L & 0x0f) == 0x0f) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 3251: jr nz, 0324fh if (((u8Flags & 0x40) >> 6) != 1) { goto L324f;; } // 3253: ld sp, 3ae2h // eliminate just the test grid: HACK7 (alternate) // preload the stack with some data for the grid test // prep for the test grid sg_sZ80Context.z80SP = (UINT16) (0x3ae2); // 3256: ld b, 03h sg_sZ80Context.z80B = (UINT8) (0x03); { UINT16 u16Temp0; // 3258: exx L3258: u16Temp0 = sg_sZ80Context.z80hlprime; sg_sZ80Context.z80hlprime = (UINT16) (sg_sZ80Context.z80HL); u16Temp0 = sg_sZ80Context.z80deprime; sg_sZ80Context.z80deprime = (UINT16) (sg_sZ80Context.z80DE); u16Temp0 = sg_sZ80Context.z80bcprime; sg_sZ80Context.z80bcprime = (UINT16) (sg_sZ80Context.z80BC); } // 3259: pop hl ; $3ae2 goes into HL sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 325a: pop de ; $3ae2-2 into de sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 325b: ld (Wdog), a ; kick the dog L325b: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 325e: pop bc ; $3ae2-4 into bc? sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 325f: ld a, 3ch ; upper right // draw the test grid to the screen L325f: sg_sZ80Context.z80A = (UINT8) (0x3c); // 3261: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 3262: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 3263: ld (hl), d ; lower right mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80D); // 3264: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 3265: djnz 0325fh sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L325f;; } // 3267: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 3268: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 3269: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 326a: ld (hl), c ; upper right L326a: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80C); // 326b: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 326c: ld a, 3fh ; lower left sg_sZ80Context.z80A = (UINT8) (0x3f); // 326e: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 326f: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 3270: djnz 0326ah sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L326a;; } // 3272: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 3273: dec sp sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); // 3274: dec e sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80E - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80E == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80E & 0x0f) == 0x0f) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80E == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 3275: jp nz, 325bh if (((u8Flags & 0x40) >> 6) != 1) { goto L325b;; } // 3278: pop af sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); { UINT16 u16Temp0; // 3279: exx u16Temp0 = sg_sZ80Context.z80hlprime; sg_sZ80Context.z80hlprime = (UINT16) (sg_sZ80Context.z80HL); sg_sZ80Context.z80HL = (UINT16) (u16Temp0); u16Temp0 = sg_sZ80Context.z80deprime; sg_sZ80Context.z80deprime = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); u16Temp0 = sg_sZ80Context.z80bcprime; sg_sZ80Context.z80bcprime = (UINT16) (sg_sZ80Context.z80BC); sg_sZ80Context.z80BC = (UINT16) (u16Temp0); } // 327a: djnz 03258h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L3258;; } // 327c: ld sp, 4fc0h sg_sZ80Context.z80SP = (UINT16) (0x4fc0); // 327f: ld b, 08h ; delay for 8 times sg_sZ80Context.z80B = (UINT8) (0x08); // 3281: call 32edh ; call the delay routine L3281: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x32; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x84; goto L32ed; case 0x3284: // 3284: djnz 03281h ; decrement B, delay again if B not 0 sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L3281;; } // 3286: ld (Wdog), a ; kick the dog // loop until service switch turned off. L3286: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 3289: ld a, (V1Acc) ; check in1 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 328c: and a, 10h ; check service switch sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x10); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 328e: jr z, 03286h ; loop until test switch is off if (((u8Flags & 0x40) >> 6) == 1) { goto L3286;; } // 3290: ld a, (V1Acc) ; check in1 // check the condition to display the easter egg sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 3293: and a, 60h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x60); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 3295: jp nz, 234bh ; main if (((u8Flags & 0x40) >> 6) != 1) { goto L234b;; } // 3298: ld b, 08h sg_sZ80Context.z80B = (UINT8) (0x08); // 329a: call 32edh L329a: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x32; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9d; goto L32ed; case 0x329d: // 329d: djnz 0329ah sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L329a;; } // 329f: ld a, (V1Acc) ; check in1 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 32a2: and a, 10h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x10); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 32a4: jp nz, 234bh ; main if (((u8Flags & 0x40) >> 6) != 1) { goto L234b;; } // 32a7: ld e, 01h sg_sZ80Context.z80E = (UINT8) (1); // 32a9: ld b, 04h L32a9: sg_sZ80Context.z80B = (UINT8) (0x04); // 32ab: ld (Wdog), a ; kick the dog L32ab: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 32ae: call 32edh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x32; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb1; goto L32ed; case 0x32b1: // 32b1: ld a, (IRQEn) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5000]); // 32b4: and a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80E); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 32b5: jr nz, 032abh if (((u8Flags & 0x40) >> 6) != 1) { goto L32ab;; } // 32b7: call 32edh L32b7: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x32; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xba; goto L32ed; case 0x32ba: // 32ba: ld (Wdog), a ; kick the dog MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 32bd: ld a, (IRQEn) ; IN0 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5000]); // 32c0: xor a, 0ffh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 32c2: jr nz, 032b7h if (((u8Flags & 0x40) >> 6) != 1) { goto L32b7;; } // 32c4: djnz 032abh sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L32ab;; } // 32c6: rlc e sg_sZ80Context.z80E = (UINT8) (((sg_sZ80Context.z80E << 1) | (sg_sZ80Context.z80E >> 0x07))); // 32c8: ld a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80E); { UINT16 u16Temp0; // 32c9: cp a, 10h u16Temp0 = sg_sZ80Context.z80A - 0x10; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 32cb: jp c, 32a9h if (((u8Flags & 0x01) >> 0) == 1) { goto L32a9;; } // 32ce: ld hl, 4000h // draw the 'Made By Namco' easter egg // clear the screen... sg_sZ80Context.z80HL = (UINT16) (0x4000); // 32d1: ld b, 04h sg_sZ80Context.z80B = (UINT8) (0x04); // 32d3: ld a, 40h L32d3: sg_sZ80Context.z80A = (UINT8) (0x40); // 32d5: ld (hl), a L32d5: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 32d6: inc l sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80L == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80L & 0x0f) == 0) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80L == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 32d7: jr nz, 032d5h if (((u8Flags & 0x40) >> 6) != 1) { goto L32d5;; } // 32d9: inc h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80H & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80H & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80H == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 32da: djnz 032d3h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L32d3;; } // 32dc: call 3af4h // draw the egg to the screen sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x32; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xdf; goto L3af4; case 0x32df: // 32df: ld (Wdog), a ; kick the dog // wait for service switch to be off L32df: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 32e2: ld a, (V1Acc) ; check in1 sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5040]); // 32e5: and a, 10h ; service sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x10); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 32e7: jp z, 32dfh if (((u8Flags & 0x40) >> 6) == 1) { goto L32df;; } // 32ea: jp 234bh ; main program run goto L234b;; // 32ed: ld (Wdog), a ; kick the dog // delay timer L32ed: MSNothingWrite(0x50c0,sg_sZ80Context.z80A); // 32f0: ld hl, 2800h sg_sZ80Context.z80HL = (UINT16) (0x2800); // 32f3: dec hl L32f3: sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL - 1); // 32f4: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); // 32f5: or a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | sg_sZ80Context.z80L); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 32f6: jr nz, 032f3h if (((u8Flags & 0x40) >> 6) != 1) { goto L32f3;; } // 32f8: ret goto returnInstruction;; // 3435: ld a, (4f00h) // Maze information... 0x3436 (it is for pac-man...) L3435: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4f00]); { UINT16 u16Temp0; // 3438: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 343a: jp z, 349ch if (((u8Flags & 0x40) >> 6) == 1) { goto L349c;; } // 343d: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; goto L0028; case 0x3440: // 3440: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 3442: ld (42ach), a MSPacVideoWrite(0x42ac,sg_sZ80Context.z80A); // 3445: ld a, 16h sg_sZ80Context.z80A = (UINT8) (0x16); // 3447: ld (46ach), a MSPacVideoWrite(0x46ac,sg_sZ80Context.z80A); // 344a: ld c, 00h sg_sZ80Context.z80C = (UINT8) (0); // 344c: jp 349ch goto L349c;; // 344f: ld a, (4f00h) L344f: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4f00]); { UINT16 u16Temp0; // 3452: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 3454: jp z, 349ch if (((u8Flags & 0x40) >> 6) == 1) { goto L349c;; } // 3457: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x58; goto L0028; case 0x345a: // 345a: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 345c: ld (42ach), a MSPacVideoWrite(0x42ac,sg_sZ80Context.z80A); // 345f: ld a, 16h sg_sZ80Context.z80A = (UINT8) (0x16); // 3461: ld (46ach), a MSPacVideoWrite(0x46ac,sg_sZ80Context.z80A); // 3464: ld c, 0ch sg_sZ80Context.z80C = (UINT8) (0x0c); // 3466: jp 349ch goto L349c;; // 3469: ld a, (4f00h) L3469: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4f00]); { UINT16 u16Temp0; // 346c: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 346e: jp z, 349ch if (((u8Flags & 0x40) >> 6) == 1) { goto L349c;; } // 3471: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x72; goto L0028; case 0x3474: // 3474: ld a, 03h sg_sZ80Context.z80A = (UINT8) (0x03); // 3476: ld (42ach), a MSPacVideoWrite(0x42ac,sg_sZ80Context.z80A); // 3479: ld a, 16h sg_sZ80Context.z80A = (UINT8) (0x16); // 347b: ld (46ach), a MSPacVideoWrite(0x46ac,sg_sZ80Context.z80A); // 347e: ld c, 18h sg_sZ80Context.z80C = (UINT8) (0x18); // 3480: jp 349ch goto L349c;; case 0x3483: // 3483: ld c, 24h sg_sZ80Context.z80C = (UINT8) (0x24); // 3485: jp 349ch goto L349c;; case 0x3488: // 3488: ld c, 30h sg_sZ80Context.z80C = (UINT8) (0x30); // 348a: jp 349ch goto L349c;; case 0x348d: // 348d: ld c, 3ch sg_sZ80Context.z80C = (UINT8) (0x3c); // 348f: jp 349ch goto L349c;; case 0x3492: // 3492: ld c, 48h sg_sZ80Context.z80C = (UINT8) (0x48); // 3494: jp 349ch goto L349c;; case 0x3497: // 3497: ld c, 54h sg_sZ80Context.z80C = (UINT8) (0x54); // 3499: jp 349ch goto L349c;; // 349c: ld a, (4f00h) L349c: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4f00]); // 349f: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 34a0: call z, 3611h if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa3; goto L3611; } case 0x34a3: // 34a3: ld b, 06h sg_sZ80Context.z80B = (UINT8) (0x06); // 34a5: ld ix, 4f0ch sg_sZ80Context.z80IX = (UINT16) (0x4f0c); // 34a9: ld l, (ix+00h) L34a9: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 34ac: ld h, (ix+01h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); // 34af: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 34b0: cp a, 0f0h u16Temp0 = sg_sZ80Context.z80A - 0xf0; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 34b2: jp z, 34deh if (((u8Flags & 0x40) >> 6) == 1) { goto L34de;; } { UINT16 u16Temp0; // 34b5: cp a, 0f1h u16Temp0 = sg_sZ80Context.z80A - 0xf1; u8Flags = (u8Flags & ~0x04) | ((((0xf1 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 34b7: jp z, 356bh if (((u8Flags & 0x40) >> 6) == 1) { goto L356b;; } { UINT16 u16Temp0; // 34ba: cp a, 0f2h u16Temp0 = sg_sZ80Context.z80A - 0xf2; u8Flags = (u8Flags & ~0x04) | ((((0xf2 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 34bc: jp z, 3597h if (((u8Flags & 0x40) >> 6) == 1) { goto L3597;; } { UINT16 u16Temp0; // 34bf: cp a, 0f3h u16Temp0 = sg_sZ80Context.z80A - 0xf3; u8Flags = (u8Flags & ~0x04) | ((((0xf3 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 34c1: jp z, 3577h if (((u8Flags & 0x40) >> 6) == 1) { goto L3577;; } { UINT16 u16Temp0; // 34c4: cp a, 0f5h u16Temp0 = sg_sZ80Context.z80A - 0xf5; u8Flags = (u8Flags & ~0x04) | ((((0xf5 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 34c6: jp z, 3607h if (((u8Flags & 0x40) >> 6) == 1) { goto L3607;; } { UINT16 u16Temp0; // 34c9: cp a, 0f6h u16Temp0 = sg_sZ80Context.z80A - 0xf6; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 34cb: jp z, 35a4h if (((u8Flags & 0x40) >> 6) == 1) { goto L35a4;; } { UINT16 u16Temp0; // 34ce: cp a, 0f7h u16Temp0 = sg_sZ80Context.z80A - 0xf7; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((0xf7 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 34d0: jp z, 35f3h if (((u8Flags & 0x40) >> 6) == 1) { goto L35f3;; } { UINT16 u16Temp0; // 34d3: cp a, 0f8h u16Temp0 = sg_sZ80Context.z80A - 0xf8; u8Flags = (u8Flags & ~0x04) | ((((0xf8 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 34d5: jp z, 35fdh if (((u8Flags & 0x40) >> 6) == 1) { goto L35fd;; } { UINT16 u16Temp0; // 34d8: cp a, 0ffh u16Temp0 = sg_sZ80Context.z80A - 0xff; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0xff))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0xff ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 34da: jp z, 35cbh if (((u8Flags & 0x40) >> 6) == 1) { goto L35cb;; } // 34dd: halt sg_sZ80Context.z80halted = 1; s32CyclesRemaining = s32CyclesRemaining - 0x04; if (s32CyclesRemaining >= 0) { s32CyclesRemaining = (s32CyclesRemaining - ((s32CyclesRemaining + 0x03) & 0xfffffffc)); } goto Exit34de;; // 34de: push hl L34de: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 34df: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 34e1: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe2; goto L0010; case 0x34e2: // 34e2: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 34e3: ld hl, 4f2eh sg_sZ80Context.z80HL = (UINT16) (0x4f2e); // 34e6: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe7; goto L0018; case 0x34e7: // 34e7: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); { UINT16 u16Temp0; // 34e8: add a, h u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80H; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 34e9: call 3556h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xec; goto L3556; case 0x34ec: // 34ec: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 34ed: call 3641h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf0; goto L3641; case 0x34f0: // 34f0: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf1; goto L0018; case 0x34f1: // 34f1: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); { UINT16 u16Temp0; // 34f2: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 34f3: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 34f4: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 34f5: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 34f6: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 34f8: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf9; goto L0010; case 0x34f9: // 34f9: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 34fa: ld hl, 4f2eh sg_sZ80Context.z80HL = (UINT16) (0x4f2e); // 34fd: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x34; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xfe; goto L0018; case 0x34fe: // 34fe: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); { UINT16 u16Temp0; // 34ff: add a, l u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80L; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 3500: call 3556h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x03; goto L3556; case 0x3503: // 3503: dec de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE - 1); // 3504: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 3505: call 3641h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x08; goto L3641; case 0x3508: // 3508: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; goto L0018; case 0x3509: // 3509: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); { UINT16 u16Temp0; // 350a: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 350b: dec de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE - 1); // 350c: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 350d: ld hl, 4f0fh sg_sZ80Context.z80HL = (UINT16) (0x4f0f); // 3510: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 3511: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x12; goto L0010; case 0x3512: // 3512: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 3513: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 3514: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 3515: ld hl, 4f3eh L3515: sg_sZ80Context.z80HL = (UINT16) (0x4f3e); // 3518: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x19; goto L0018; case 0x3519: // 3519: ld a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80C); // 351a: sra a sg_sZ80Context.z80A = (UINT8) ((sg_sZ80Context.z80A >> 1 | (sg_sZ80Context.z80A & 0x80))); // 351c: rst 10h ; dereference sprite number for intro sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1d; goto L0010; case 0x351d: { UINT16 u16Temp0; // 351d: cp a, 0ffh u16Temp0 = sg_sZ80Context.z80A - 0xff; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 351f: jp nz, 3526h if (((u8Flags & 0x40) >> 6) != 1) { goto L3526;; } // 3522: ld c, 00h sg_sZ80Context.z80C = (UINT8) (0); // 3524: jr 03515h goto L3515;; // 3526: pop hl L3526: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 3527: ld (hl), c mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80C); // 3528: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 3529: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 352a: ld a, 03h sg_sZ80Context.z80A = (UINT8) (0x03); // 352c: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2d; goto L0010; case 0x352d: // 352d: ld d, a sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80A); // 352e: push de sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80D; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80E; // 352f: ld hl, 4f4eh sg_sZ80Context.z80HL = (UINT16) (0x4f4e); // 3532: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x33; goto L0018; case 0x3533: // 3533: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); { UINT16 u16Temp0; // 3534: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 3535: ld (hl), d mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80D); // 3536: dec hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL - 1); // 3537: ld a, (4e09h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 353a: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 353b: ld a, (cabtype) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e72]); // 353e: and a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80C); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 353f: jr z, 03545h if (((u8Flags & 0x40) >> 6) == 1) { goto L3545;; } // 3541: ld a, 0c0h sg_sZ80Context.z80A = (UINT8) (0xc0); // 3543: xor a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ sg_sZ80Context.z80E); // 3544: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 3545: ld (hl), e L3545: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80E); // 3546: ld hl, 4f17h sg_sZ80Context.z80HL = (UINT16) (0x4f17); // 3549: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 354a: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x4b; goto L0010; case 0x354b: // 354b: dec a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if (sg_sZ80Context.z80A == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 354c: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 354d: ld de, 0000h sg_sZ80Context.z80DE = (UINT16) (0); // 3550: jr nz, 035b4h if (((u8Flags & 0x40) >> 6) != 1) { goto L35b4;; } // 3552: ld e, 04h sg_sZ80Context.z80E = (UINT8) (0x04); // 3554: jr 035b4h goto L35b4;; // 3556: ld c, a L3556: sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 3557: sra c sg_sZ80Context.z80C = (UINT8) ((sg_sZ80Context.z80C >> 1 | (sg_sZ80Context.z80C & 0x80))); // 3559: sra c sg_sZ80Context.z80C = (UINT8) ((sg_sZ80Context.z80C >> 1 | (sg_sZ80Context.z80C & 0x80))); // 355b: sra c sg_sZ80Context.z80C = (UINT8) ((sg_sZ80Context.z80C >> 1 | (sg_sZ80Context.z80C & 0x80))); // 355d: sra c sg_sZ80Context.z80C = (UINT8) ((sg_sZ80Context.z80C >> 1 | (sg_sZ80Context.z80C & 0x80))); // 355f: and a, a u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); // 3560: jp p, 3568h if (((u8Flags & 0x80) >> 7) != 1) { goto L3568;; } // 3563: or a, 0f0h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A | 0xf0); u8Flags &= 0xfe; // 3565: inc c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C + 1); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80C == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80C & 0x80) ? 0x80 : 0); if ((sg_sZ80Context.z80C & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80C == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 3566: jr 0356ah goto L356a;; // 3568: and a, 0fh L3568: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 356a: ret L356a: goto returnInstruction;; { UINT16 u16Temp0; // 356b: ex de, hl L356b: u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 356c: call 3641h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x6f; goto L3641; case 0x356f: { UINT16 u16Temp0; // 356f: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 3570: push de sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80D; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80E; // 3571: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 3572: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 3573: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 3574: ld e, (hl) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 3575: jr 0358ah goto L358a;; { UINT16 u16Temp0; // 3577: ex de, hl L3577: u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 3578: ld hl, 4f0fh sg_sZ80Context.z80HL = (UINT16) (0x4f0f); // 357b: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 357c: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x7d; goto L0010; case 0x357d: // 357d: ld (hl), 00h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0); { UINT16 u16Temp0; // 357f: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); } // 3580: ld de, 4f3eh sg_sZ80Context.z80DE = (UINT16) (0x4f3e); // 3583: push de sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80D; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80E; // 3584: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 3585: ld e, (hl) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 3586: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 3587: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 3588: jr 0358ah goto L358a;; // 358a: pop hl L358a: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 358b: push de sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80D; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80E; // 358c: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8d; goto L0018; case 0x358d: { UINT16 u16Temp0; // 358d: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); } // 358e: pop de sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 358f: ld (hl), d mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80D); // 3590: dec hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL - 1); // 3591: ld (hl), e mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80E); // 3592: ld de, 0003h sg_sZ80Context.z80DE = (UINT16) (0x03); // 3595: jr 035b4h goto L35b4;; // 3597: inc hl L3597: sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 3598: ld c, (hl) sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 3599: ld hl, 4f17h sg_sZ80Context.z80HL = (UINT16) (0x4f17); // 359c: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 359d: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9e; goto L0010; case 0x359e: // 359e: ld (hl), c mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80C); // 359f: ld de, 0002h sg_sZ80Context.z80DE = (UINT16) (0x02); // 35a2: jr 035b4h goto L35b4;; // 35a4: ld hl, 4f17h L35a4: sg_sZ80Context.z80HL = (UINT16) (0x4f17); // 35a7: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 35a8: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa9; goto L0010; case 0x35a9: // 35a9: dec a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); if (sg_sZ80Context.z80A == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 35aa: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); // 35ab: ld de, 0000h sg_sZ80Context.z80DE = (UINT16) (0); // 35ae: jr nz, 035b4h if (((u8Flags & 0x40) >> 6) != 1) { goto L35b4;; } // 35b0: ld e, 01h sg_sZ80Context.z80E = (UINT8) (1); // 35b2: jr 035b4h goto L35b4;; // 35b4: ld l, (ix+00h) // 35b5 overlay for pac-man L35b4: sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 35b7: ld h, (ix+01h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); { UINT32 u32Temp0; // 35ba: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 35bb: ld (ix+00h), l mspacmanIndirectWrite8(sg_sZ80Context.z80IX, sg_sZ80Context.z80L); // 35be: ld (ix+01h), h mspacmanIndirectWrite8(sg_sZ80Context.z80IX + 1, sg_sZ80Context.z80H); // 35c1: dec ix sg_sZ80Context.z80IX = (UINT16) (sg_sZ80Context.z80IX - 1); // 35c3: dec ix sg_sZ80Context.z80IX = (UINT16) (sg_sZ80Context.z80IX - 1); // 35c5: djnz 035c8h sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); if (sg_sZ80Context.z80B != 0) { goto L35c8;; } // 35c7: ret goto returnInstruction;; // 35c8: jp 34a9h L35c8: goto L34a9;; // 35cb: ld hl, 4f1fh L35cb: sg_sZ80Context.z80HL = (UINT16) (0x4f1f); // 35ce: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 35cf: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd0; goto L0010; case 0x35d0: // 35d0: ld (hl), 01h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 1); // 35d2: ld hl, 4f20h sg_sZ80Context.z80HL = (UINT16) (0x4f20); // 35d5: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 35d6: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 35d7: and a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 35d8: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 35d9: and a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 35da: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 35db: and a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 35dc: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 35dd: and a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 35de: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 35df: and a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80HL]); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 35e0: ld de, 0000h sg_sZ80Context.z80DE = (UINT16) (0); // 35e3: jr z, 035b4h if (((u8Flags & 0x40) >> 6) == 1) { goto L35b4;; } // 35e5: ld a, (gmemode) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e02]); // 35e8: and a, a u8Flags &= 0xfe; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 35e9: jp z, 2195h if (((u8Flags & 0x40) >> 6) == 1) { goto L2195;; } // 35ec: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xfe; // 35ed: ld (4f00h), a sg_u8mspacman_memory[0x4f00] = sg_sZ80Context.z80A; // 35f0: jp 058eh goto L058e;; // 35f3: ld a, b L35f3: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 35f4: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x35; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf5; goto L0028; case 0x35f7: // 35f7: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 35f8: ld de, 0001h sg_sZ80Context.z80DE = (UINT16) (1); // 35fb: jr 035b4h goto L35b4;; // 35fd: ld a, 40h L35fd: sg_sZ80Context.z80A = (UINT8) (0x40); // 35ff: ld (42ach), a MSPacVideoWrite(0x42ac,sg_sZ80Context.z80A); // 3602: ld de, 0001h sg_sZ80Context.z80DE = (UINT16) (1); // 3605: jr 035b4h goto L35b4;; // 3607: inc hl L3607: sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 3608: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 3609: ld (4ebch), a sg_u8mspacman_memory[0x4ebc] = sg_sZ80Context.z80A; // 360c: ld de, 0002h sg_sZ80Context.z80DE = (UINT16) (0x02); // 360f: jr 035b4h goto L35b4;; // 3611: ld a, (gmemode) L3611: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e02]); // 3614: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 3615: jr nz, 0361fh if (((u8Flags & 0x40) >> 6) != 1) { goto L361f;; } // 3617: ld a, 02h sg_sZ80Context.z80A = (UINT8) (0x02); // 3619: ld (4ecch), a sg_u8mspacman_memory[0x4ecc] = sg_sZ80Context.z80A; // 361c: ld (4edch), a sg_u8mspacman_memory[0x4edc] = sg_sZ80Context.z80A; // 361f: ld hl, 81f0h ; map table? L361f: sg_sZ80Context.z80HL = (UINT16) (0x81f0); // 3622: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); { UINT32 u32Temp0; // 3624: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 3625: ld de, 4f02h sg_sZ80Context.z80DE = (UINT16) (0x4f02); // 3628: ld bc, 000ch sg_sZ80Context.z80BC = (UINT16) (0x0c); // 362b: ldir UniqueLabel14: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel14;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 362d: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 362f: ld (4f00h), a sg_u8mspacman_memory[0x4f00] = sg_sZ80Context.z80A; // 3632: ld (4da4h), a sg_u8mspacman_memory[0x4da4] = sg_sZ80Context.z80A; // 3635: ld hl, 4f1fh sg_sZ80Context.z80HL = (UINT16) (0x4f1f); // 3638: ld a, 00h sg_sZ80Context.z80A = (UINT8) (0); // 363a: ld (4da5h), a sg_u8mspacman_memory[0x4da5] = sg_sZ80Context.z80A; // 363d: ld b, 14h sg_sZ80Context.z80B = (UINT8) (0x14); // 363f: rst 08h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x36; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x40; goto L0008; case 0x3640: // 3640: ret goto returnInstruction;; // 3641: ld a, b L3641: sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); { UINT16 u16Temp0; // 3642: cp a, 06h u16Temp0 = sg_sZ80Context.z80A - 0x06; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x06))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x06 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 3644: jr nz, 0364ah if (((u8Flags & 0x40) >> 6) != 1) { goto L364a;; } // 3646: ld hl, 4dc6h sg_sZ80Context.z80HL = (UINT16) (0x4dc6); // 3649: ret goto returnInstruction;; // 364a: ld hl, 4cfeh L364a: sg_sZ80Context.z80HL = (UINT16) (0x4cfe); // 364d: ret goto returnInstruction;; // 364e: dec b L364e: sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80B - 1); // 364f: push bc sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80B; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80C; // 3650: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); { UINT16 u16Temp0; // 3651: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 3653: jr z, 03659h if (((u8Flags & 0x40) >> 6) == 1) { goto L3659;; } // 3655: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 3657: jr 0366ah goto L366a;; // 3659: ld a, (boardno) L3659: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e13]); // 365c: ld b, 01h sg_sZ80Context.z80B = (UINT8) (1); { UINT16 u16Temp0; // 365e: cp a, 01h u16Temp0 = sg_sZ80Context.z80A - 1; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 3660: jr z, 0366ah if (((u8Flags & 0x40) >> 6) == 1) { goto L366a;; } // 3662: ld b, 02h sg_sZ80Context.z80B = (UINT8) (0x02); { UINT16 u16Temp0; // 3664: cp a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 3666: jr z, 0366ah if (((u8Flags & 0x40) >> 6) == 1) { goto L366a;; } // 3668: ld b, 03h sg_sZ80Context.z80B = (UINT8) (0x03); // 366a: rst 18h L366a: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x36; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x6b; goto L0018; case 0x366b: // 366b: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 366c: jp 2d72h goto L2d72;; // 366f: bit 6, a L366f: u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0x40) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 3671: jp z, 2066h if (((u8Flags & 0x40) >> 6) == 1) { goto L2066;; } // 3674: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 3676: ld (bc), a mspacmanIndirectWrite8(sg_sZ80Context.z80BC, sg_sZ80Context.z80A); // 3677: ret goto returnInstruction;; case 0x3678: // 3678: ld hl, 0000h L3678: sg_sZ80Context.z80HL = (UINT16) (0); // 367b: ld (4dd2h), hl sg_u8mspacman_memory[0x4dd2] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dd3] = sg_sZ80Context.z80H; // 367e: ret goto returnInstruction;; case 0x367f: // 367f: ld a, (4d08h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d08]); // 3682: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); // 3684: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 3686: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 3688: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); // 3689: ld e, 1ch sg_sZ80Context.z80E = (UINT8) (0x1c); { UINT16 u16Temp0; // 368b: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 368c: cp a, 18h u16Temp0 = sg_sZ80Context.z80A - 0x18; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x18))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x18 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 368e: jr nz, 03692h if (((u8Flags & 0x40) >> 6) != 1) { goto L3692;; } // 3690: ld a, 36h sg_sZ80Context.z80A = (UINT8) (0x36); // 3692: ld (4c0ah), a ; mspac sprite number L3692: sg_u8mspacman_memory[0x4c0a] = sg_sZ80Context.z80A; // 3695: ret goto returnInstruction;; case 0x3af4: // 3af4: ld hl, 40a2h ; video ram start position // Draw the 'Made By Namco' text (egg) L3af4: sg_sZ80Context.z80HL = (UINT16) (0x40a2); // 3af7: ld de, 3a4fh ; pellet data start sg_sZ80Context.z80DE = (UINT16) (0x3a4f); // 3afa: ld (hl), 14h ; set the screen to pellet (14) L3afa: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x14); // 3afc: ld a, (de) ; a = value to use sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80DE]); // 3afd: and a, a ; bit test u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 3afe: ret z ; if 0, we're done... if (((u8Flags & 0x40) >> 6) == 1) { goto returnInstruction;; } // 3aff: inc de ; get the next pellet sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); { UINT16 u16Temp0; // 3b00: add a, l u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80L; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 3b01: ld l, a sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80A); // 3b02: jp nc, 3afah ; next byte if some condition if (((u8Flags & 0x01) >> 0) != 1) { goto L3afa;; } // 3b05: inc h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H + 1); // 3b06: jr 03afah goto L3afa;; case 0x3e5c: // 3e5c: ld a, (gmemode) L3e5c: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e02]); { UINT16 u16Temp0; // 3e5f: cp a, 10h u16Temp0 = sg_sZ80Context.z80A - 0x10; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x10))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x10 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 3e61: call nz, 3ed0h if (((u8Flags & 0x40) >> 6) != 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x64; goto L3ed0; } case 0x3e64: // 3e64: ld a, (gmemode) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e02]); // 3e67: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x68; goto L0020; case 0x3e8a: // 3e8a: ret goto returnInstruction;; case 0x3e8b: // 3e8b: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8c; goto L0028; case 0x3e8e: // 3e8e: ld a, 60h sg_sZ80Context.z80A = (UINT8) (0x60); // 3e90: ld (4f01h), a sg_u8mspacman_memory[0x4f01] = sg_sZ80Context.z80A; // 3e93: jp 058eh goto L058e;; case 0x3e96: // 3e96: call 9642h // draw the midway logo and cprt for the attract screen sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x99; goto L9642; case 0x3e99: // 3e99: jp 058eh goto L058e;; case 0x3e9c: // 3e9c: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x9d; goto L0028; case 0x3e9f: // 3e9f: jp 058eh goto L058e;; case 0x3ea2: // 3ea2: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa3; goto L0028; case 0x3ea5: // 3ea5: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa6; goto L0028; case 0x3ea8: // 3ea8: jp 058eh goto L058e;; case 0x3eab: // 3eab: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xac; goto L0028; case 0x3eae: // 3eae: jp 058eh goto L058e;; case 0x3eb1: // 3eb1: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb2; goto L0028; case 0x3eb4: // 3eb4: jp 058eh goto L058e;; case 0x3eb7: // 3eb7: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xb8; goto L0028; case 0x3eba: // 3eba: jp 058eh goto L058e;; case 0x3ebd: // 3ebd: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xbe; goto L0028; case 0x3ec0: // 3ec0: jp 058eh goto L058e;; case 0x3ec3: // 3ec3: rst 28h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x3e; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xc4; goto L0028; case 0x3ec6: // 3ec6: jp 058eh goto L058e;; case 0x3ec9: // 3ec9: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 3eca: ld (lives), a sg_u8mspacman_memory[0x4e14] = sg_sZ80Context.z80A; // 3ecd: jp 057ch goto L057c;; case 0x3ed0: // 3ed0: ld a, (4f01h) L3ed0: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4f01]); // 3ed3: inc a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A + 1); // 3ed4: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 3ed6: ld (4f01h), a sg_u8mspacman_memory[0x4f01] = sg_sZ80Context.z80A; // 3ed9: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 3eda: res 0, c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C & 0xfe); // 3edc: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 3ede: ld ix, 3f81h sg_sZ80Context.z80IX = (UINT16) (0x3f81); // 3ee2: bit 0, a u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 1) == 0)) ? 0x40 : 0); // 3ee4: jr z, 03f19h if (((u8Flags & 0x40) >> 6) == 1) { goto L3f19;; } { UINT32 u32Temp0; // 3ee6: add ix, bc u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80IX ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 3ee8: ld l, (ix+00h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 3eeb: ld h, (ix+01h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); // 3eee: ld (hl), 87h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x87); // 3ef0: ld l, (ix+10h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x10]); // 3ef3: ld h, (ix+11h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x11]); // 3ef6: ld (hl), 87h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x87); // 3ef8: ld l, (ix+20h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x20]); // 3efb: ld h, (ix+21h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x21]); // 3efe: ld (hl), 8ah mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x8a); // 3f00: ld l, (ix+30h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x30]); // 3f03: ld h, (ix+31h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x31]); // 3f06: ld (hl), 81h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x81); // 3f08: ld l, (ix+40h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x40]); // 3f0b: ld h, (ix+41h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x41]); // 3f0e: ld (hl), 81h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x81); // 3f10: ld l, (ix+50h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x50]); // 3f13: ld h, (ix+51h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x51]); // 3f16: ld (hl), 84h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x84); // 3f18: ret goto returnInstruction;; // 3f19: dec c L3f19: sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); // 3f1a: xor a, a sg_sZ80Context.z80A = (UINT8) (0); { UINT16 u16Temp0; // 3f1b: cp a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 3f1c: jp m, 3f21h if (((u8Flags & 0x80) >> 7) == 1) { goto L3f21;; } // 3f1f: ld b, 0ffh sg_sZ80Context.z80B = (UINT8) (0xff); // 3f21: dec c L3f21: sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C - 1); { UINT32 u32Temp0; // 3f22: add ix, bc u32Temp0 = sg_sZ80Context.z80IX + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80IX = (UINT16) (u32Temp0 & 0xffff); } // 3f24: ld l, (ix+00h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX]); // 3f27: ld h, (ix+01h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 1]); { UINT8 u8Temp0; // 3f2a: dec (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 3f2b: ld l, (ix+02h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x02]); // 3f2e: ld h, (ix+03h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x03]); // 3f31: ld (hl), 88h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x88); // 3f33: ld l, (ix+10h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x10]); // 3f36: ld h, (ix+11h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x11]); { UINT8 u8Temp0; // 3f39: dec (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 3f3a: ld l, (ix+12h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x12]); // 3f3d: ld h, (ix+13h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x13]); // 3f40: ld (hl), 88h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x88); // 3f42: ld l, (ix+20h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x20]); // 3f45: ld h, (ix+21h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x21]); { UINT8 u8Temp0; // 3f48: dec (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 3f49: ld l, (ix+22h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x22]); // 3f4c: ld h, (ix+23h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x23]); // 3f4f: ld (hl), 8bh mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x8b); // 3f51: ld l, (ix+30h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x30]); // 3f54: ld h, (ix+31h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x31]); { UINT8 u8Temp0; // 3f57: dec (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 3f58: ld l, (ix+32h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x32]); // 3f5b: ld h, (ix+33h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x33]); // 3f5e: ld (hl), 82h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x82); // 3f60: ld l, (ix+40h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x40]); // 3f63: ld h, (ix+41h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x41]); { UINT8 u8Temp0; // 3f66: dec (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 3f67: ld l, (ix+42h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x42]); // 3f6a: ld h, (ix+43h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x43]); // 3f6d: ld (hl), 82h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x82); // 3f6f: ld l, (ix+50h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x50]); // 3f72: ld h, (ix+51h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x51]); { UINT8 u8Temp0; // 3f75: dec (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0x0f) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 3f76: ld l, (ix+52h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x52]); // 3f79: ld h, (ix+53h) sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80IX + 0x53]); // 3f7c: ld (hl), 83h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 0x83); // 3f7e: ret goto returnInstruction;; case 0x8001: // 8001: ld hl, 4000h sg_sZ80Context.z80HL = (UINT16) (0x4000); // 8004: call 946ah sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x80; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x07; goto L946a; case 0x8007: // 8007: ld a, (bc) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80BC]); // 8008: ld c, (hl) sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT8 u8Temp0; // 8009: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((u8Temp0 == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); if ((u8Temp0 & 0x0f) == 0) { u8Flags |= 0x10; } else { u8Flags &= 0xef; } if (u8Temp0 == 0x80) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } } // 800a: ret goto returnInstruction;; case 0x800b: // 800b: jp 3e5ch goto L3e5c;; case 0x800e: // 800e: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x80; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0f; goto L0020; case 0x8013: // 8013: jp 3678h goto L3678;; case 0x8018: // 8018: jp 3435h goto L3435;; case 0x801b: // 801b: rst 20h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x80; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x1c; goto L0020; case 0x8020: // 8020: xor a, a sg_sZ80Context.z80A = (UINT8) (0); u8Flags &= 0xef; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 8021: ld (frbonus), a sg_u8mspacman_memory[0x4dd4] = sg_sZ80Context.z80A; // 8024: ret goto returnInstruction;; case 0x8083: { UINT16 u16Temp0; // 8083: add a, c u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 8084: sub a, h u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80H; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 8085: ld c, (hl) sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 8086: ld iy, 0d36h sg_sZ80Context.z80IY = (UINT16) (0x0d36); // 808a: ld e, 0c9h // 808c: jp 869ch goto L869c;; case 0x8090: // 8090: ld c, l sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80L); // 8091: call 9561h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x80; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x94; goto L9561; case 0x8094: // 8094: call 2966h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x80; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x97; goto L2966; case 0x8097: // 8097: ld (0d132h), hl sg_u8mspacman_memory[0xd132] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0xd133] = sg_sZ80Context.z80H; // 809a: ld c, l // 809b: ld hl, 4each sg_sZ80Context.z80HL = (UINT16) (0x4eac); // 809e: set 6, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 0x40); { UINT16 u16Temp0; // 80a0: ex af, af' u16Temp0 = sg_sZ80Context.z80afprime; sg_sZ80Context.z80afprime = (UINT16) (sg_sZ80Context.z80AF); } // 80a1: ld c, (hl) sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 80a2: jp 3469h goto L3469;; case 0x80a5: { UINT16 u16Temp0; UINT8 u8Temp0; // 80a5: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 80a6: ld (080ch), hl // Removed instruction - writes to code @ 0x080c // Removed instruction - writes to code @ 0x080d // 80a9: ld c, l sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80L); // 80aa: ld de, 8094h // 80ad: jp 8818h goto L8818;; // 869c: ld a, (4d09h) L869c: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d09]); // 869f: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); // 86a1: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 86a3: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); // 86a4: ld e, 30h sg_sZ80Context.z80E = (UINT8) (0x30); { UINT16 u16Temp0; // 86a6: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80E ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80E ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 86a7: bit 0, a u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 1) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 86a9: jr nz, 086adh if (((u8Flags & 0x40) >> 6) != 1) { goto L86ad;; } // 86ab: ld a, 37h sg_sZ80Context.z80A = (UINT8) (0x37); // 86ad: ld (4c0ah), a ; mspac sprite number L86ad: sg_u8mspacman_memory[0x4c0a] = sg_sZ80Context.z80A; // 86b0: ret goto returnInstruction;; // 86b1: ld a, (4d08h) L86b1: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d08]); // 86b4: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); // 86b6: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 86b8: ld e, 30h sg_sZ80Context.z80E = (UINT8) (0x30); { UINT16 u16Temp0; // 86ba: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80E ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80E ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 86bb: bit 0, a u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 1) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 86bd: jr nz, 086c1h if (((u8Flags & 0x40) >> 6) != 1) { goto L86c1;; } // 86bf: ld a, 34h sg_sZ80Context.z80A = (UINT8) (0x34); // 86c1: ld (4c0ah), a ; mspac sprite number L86c1: sg_u8mspacman_memory[0x4c0a] = sg_sZ80Context.z80A; // 86c4: ret goto returnInstruction;; // 86c5: ld a, (4d09h) L86c5: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d09]); // 86c8: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); // 86ca: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 86cc: ld e, 0ach sg_sZ80Context.z80E = (UINT8) (0xac); { UINT16 u16Temp0; // 86ce: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80E ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80E ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 86cf: bit 0, a u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 1) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 86d1: jr nz, 086d5h if (((u8Flags & 0x40) >> 6) != 1) { goto L86d5;; } // 86d3: ld a, 35h sg_sZ80Context.z80A = (UINT8) (0x35); // 86d5: ld (4c0ah), a ; mspac sprite number L86d5: sg_u8mspacman_memory[0x4c0a] = sg_sZ80Context.z80A; // 86d8: ret goto returnInstruction;; // 86d9: ld a, (4d08h) L86d9: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d08]); // 86dc: and a, 07h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x07); // 86de: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 86e0: cpl sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A ^ 0xff); // 86e1: ld e, 0f4h sg_sZ80Context.z80E = (UINT8) (0xf4); { UINT16 u16Temp0; // 86e3: add a, e u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80E; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80E ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80E ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 86e4: bit 0, a u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 1) == 0)) ? 0x40 : 0); u8Flags |= 0x10; u8Flags &= 0xfd; // 86e6: jr nz, 086eah if (((u8Flags & 0x40) >> 6) != 1) { goto L86ea;; } // 86e8: ld a, 36h sg_sZ80Context.z80A = (UINT8) (0x36); // 86ea: ld (4c0ah), a ; mspac sprite number L86ea: sg_u8mspacman_memory[0x4c0a] = sg_sZ80Context.z80A; // 86ed: ret goto returnInstruction;; // 86ee: ld a, (4da4h) L86ee: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4da4]); // 86f1: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 86f2: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 86f3: ld a, (frbonus) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd4]); // 86f6: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 86f7: jp z, 8747h if (((u8Flags & 0x40) >> 6) == 1) { goto L8747;; } // 86fa: ld a, (4dd2h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd2]); // 86fd: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 86fe: jp z, 8747h if (((u8Flags & 0x40) >> 6) == 1) { goto L8747;; } // 8701: ld a, (4c41h) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c41]); // 8704: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 8705: ld hl, 8841h sg_sZ80Context.z80HL = (UINT16) (0x8841); // 8708: rst 18h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x87; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x09; goto L0018; case 0x8709: // 8709: ld de, (4dd2h) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[0x4dd2]); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[0x4dd3]); { UINT32 u32Temp0; // 870d: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 870e: ld (4dd2h), hl sg_u8mspacman_memory[0x4dd2] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4dd3] = sg_sZ80Context.z80H; // 8711: ld hl, 4c41h sg_sZ80Context.z80HL = (UINT16) (0x4c41); { UINT8 u8Temp0; // 8714: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 8715: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 8716: and a, 0fh sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x0f); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 8718: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 8719: ld hl, 4c40h sg_sZ80Context.z80HL = (UINT16) (0x4c40); { UINT8 u8Temp0; // 871c: dec (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] - 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u8Flags = (u8Flags & ~0x80) | ((u8Temp0 & 0x80) ? 0x80 : 0); } // 871d: jp m, 87b5h if (((u8Flags & 0x80) >> 7) == 1) { goto L87b5;; } // 8720: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 8721: ld d, a sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80A); // 8722: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 8724: srl a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A >> 1); // 8726: ld hl, 4ebch sg_sZ80Context.z80HL = (UINT16) (0x4ebc); // 8729: set 5, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 0x20); // 872b: ld hl, (4c42h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4c42]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4c43]); // 872e: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x87; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2f; goto L0010; case 0x872f: // 872f: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 8730: ld a, 03h sg_sZ80Context.z80A = (UINT8) (0x03); // 8732: and a, d sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80D); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 8733: jr z, 0873ch if (((u8Flags & 0x40) >> 6) == 1) { goto L873c;; } // 8735: srl c L8735: sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C >> 1); // 8737: srl c sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80C >> 1); // 8739: dec a sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); if ((sg_sZ80Context.z80A & 0x0f) == 0x0f) { } else { u8Flags &= 0xef; } if (sg_sZ80Context.z80A == 0x7f) { u8Flags |= 0x04; } else { u8Flags &= 0xfb; } // 873a: jr nz, 08735h if (((u8Flags & 0x40) >> 6) != 1) { goto L8735;; } // 873c: ld a, 03h L873c: sg_sZ80Context.z80A = (UINT8) (0x03); // 873e: and a, c sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80C); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 873f: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 8740: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 8741: rlca sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); // 8742: rlca u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 0x80) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | (sg_sZ80Context.z80A >> 0x07))); u8Flags &= 0xef; u8Flags &= 0xfd; // 8743: ld (4c41h), a sg_u8mspacman_memory[0x4c41] = sg_sZ80Context.z80A; // 8746: ret goto returnInstruction;; // 8747: ld a, (peleatn) L8747: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e0e]); { UINT16 u16Temp0; // 874a: cp a, 40h u16Temp0 = sg_sZ80Context.z80A - 0x40; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 874c: jp z, 8758h if (((u8Flags & 0x40) >> 6) == 1) { goto L8758;; } { UINT16 u16Temp0; // 874f: cp a, 0b0h u16Temp0 = sg_sZ80Context.z80A - 0xb0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0xb0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0xb0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 8751: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 8752: ld hl, 4e0dh sg_sZ80Context.z80HL = (UINT16) (0x4e0d); // 8755: jp 875bh goto L875b;; // 8758: ld hl, 4e0ch L8758: sg_sZ80Context.z80HL = (UINT16) (0x4e0c); // 875b: ld a, (hl) L875b: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 875c: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 875d: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } { UINT8 u8Temp0; // 875e: inc (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] + 1); u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; } // 875f: ld a, (boardno) ; Load the board # (cherry = 0) // Ms. Pacman Random Fruit Probabilities // (c) 2002 Mark Spaeth // http://rgvac.978.org/files/MsPacFruit.txt sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e13]); { UINT16 u16Temp0; // 8762: cp a, 07h ; Compare it to 7 u16Temp0 = sg_sZ80Context.z80A - 0x07; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 8764: jr c, 08770h ; If less than 7, use board # as fruit if (((u8Flags & 0x01) >> 0) == 1) { goto L8770;; } // 8766: ld b, 07h sg_sZ80Context.z80B = (UINT8) (0x07); { UINT32 u32Temp0; // 8768: ld a, r ; Load the DRAM refresh counter // selector for random fruits // uses r register to get a random number u32Temp0 = sg_s32StartCount - s32CyclesRemaining; sg_sZ80Context.z80r = (UINT32) (sg_sZ80Context.z80r + u32Temp0); sg_sZ80Context.z80clockticks = (UINT32) (sg_sZ80Context.z80clockticks + u32Temp0); sg_s32StartCount = sg_s32StartCount - u32Temp0; sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80r & 0x80) | ((sg_sZ80Context.z80rCounter >> 0x02) & 0x7f))); } // 876a: and a, 1fh ; Mask off the bottom 5 bits sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x1f); { UINT16 u16Temp0; // 876c: sub a, b ; Subtract 7 // Compute ((R % 32) % 7) L876c: u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 876d: jr nc, 0876ch ; If >=0 loop if (((u8Flags & 0x01) >> 0) != 1) { goto L876c;; } { UINT16 u16Temp0; // 876f: add a, b ; Add 7 back u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80B; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 8770: ld hl, 879dh ; Level / fruit data table L8770: sg_sZ80Context.z80HL = (UINT16) (0x879d); // 8773: ld b, a ; 3 * a -> a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 8774: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 8775: add a, b u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80B))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80B ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 8776: rst 10h ; hl + a -> hl, (hl) -> a [table look] sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x87; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x77; goto L0010; case 0x8777: // 8777: ld (frshape), a ; Write 3 fruit data bytes (shape code) sg_u8mspacman_memory[0x4c0c] = sg_sZ80Context.z80A; // 877a: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 877b: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 877c: ld (frcol), a ; Color code sg_u8mspacman_memory[0x4c0d] = sg_sZ80Context.z80A; // 877f: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 8780: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 8781: ld (frbonus), a ; Score table offset sg_u8mspacman_memory[0x4dd4] = sg_sZ80Context.z80A; // 8784: ld hl, 87f8h // select the proper fruit path from the table at 87f8 sg_sZ80Context.z80HL = (UINT16) (0x87f8); // 8787: call 87cdh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x87; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8a; goto L87cd; case 0x878a: // 878a: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 878b: ld e, (hl) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 878c: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 878d: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 878e: ld (4dd2h), de // fruit shape/color/points table // offset 0 1 2 3 4 5 6 7 8 9 a b c d e f sg_u8mspacman_memory[0x4dd2] = sg_sZ80Context.z80E; sg_u8mspacman_memory[0x4dd3] = sg_sZ80Context.z80D; // 8792: ret goto returnInstruction;; { UINT16 u16Temp0; // 8793: cp a, 08h ; if <= 8 // new board increment routine L8793: u16Temp0 = sg_sZ80Context.z80A - 0x08; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x08))) ? 0x10 : 0); u8Flags |= 0x02; } // 8795: jp c, 2bf9h ; return if (((u8Flags & 0x01) >> 0) == 1) { goto L2bf9;; } // 8798: ld a, 07h ; set to 7 sg_sZ80Context.z80A = (UINT8) (0x07); // 879a: jp 2bf9h ; return goto L2bf9;; // 87b5: ld a, (4dd3h) // For reference, the score table is at 0x2b17 L87b5: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4dd3]); { UINT16 u16Temp0; // 87b8: add a, 20h u16Temp0 = sg_sZ80Context.z80A + 0x20; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 87ba: cp a, 40h u16Temp0 = sg_sZ80Context.z80A - 0x40; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 87bc: jr c, 08810h if (((u8Flags & 0x01) >> 0) == 1) { goto L8810;; } // 87be: ld hl, (4c42h) sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[0x4c42]); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[0x4c43]); // 87c1: ld de, 8808h sg_sZ80Context.z80DE = (UINT16) (0x8808); // 87c4: scf u8Flags |= 0x01; // 87c5: ccf u8Flags = (u8Flags & ~0x01) | ((((u8Flags & 0x01) >> 0) ^ 1) ? 0x01 : 0); { UINT32 u32Temp0; // 87c6: sbc hl, de u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80DE - ((u8Flags & 0x01) >> 0)); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80DE) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | (((((sg_sZ80Context.z80DE ^ sg_sZ80Context.z80HL) & (sg_sZ80Context.z80HL ^ u32Temp0) & 0x8000))) ? 0x04 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80HL == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80HL & 0x8000) ? 0x80 : 0); u8Flags |= 0x02; } // 87c8: jr nz, 087edh if (((u8Flags & 0x40) >> 6) != 1) { goto L87ed;; } // 87ca: ld hl, 8800h sg_sZ80Context.z80HL = (UINT16) (0x8800); // 87cd: call 94bdh L87cd: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x87; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd0; goto L94bd; case 0x87d0: // 87d0: ld l, c sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80C); // 87d1: ld h, b sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80B); { UINT32 u32Temp0; // 87d2: ld a, r u32Temp0 = sg_s32StartCount - s32CyclesRemaining; sg_sZ80Context.z80r = (UINT32) (sg_sZ80Context.z80r + u32Temp0); sg_sZ80Context.z80clockticks = (UINT32) (sg_sZ80Context.z80clockticks + u32Temp0); sg_s32StartCount = sg_s32StartCount - u32Temp0; sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80r & 0x80) | ((sg_sZ80Context.z80rCounter >> 0x02) & 0x7f))); } // 87d4: and a, 03h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x03); // 87d6: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); { UINT16 u16Temp0; // 87d7: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 87d8: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 87d9: add a, b u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80B))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80B ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 87da: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x87; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xdb; goto L0010; case 0x87db: // 87db: ld e, a sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 87dc: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 87dd: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 87de: ld (4c42h), de sg_u8mspacman_memory[0x4c42] = sg_sZ80Context.z80E; sg_u8mspacman_memory[0x4c43] = sg_sZ80Context.z80D; // 87e2: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 87e3: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 87e4: ld (4c40h), a L87e4: sg_u8mspacman_memory[0x4c40] = sg_sZ80Context.z80A; // 87e7: ld a, 1fh sg_sZ80Context.z80A = (UINT8) (0x1f); // 87e9: ld (4c41h), a sg_u8mspacman_memory[0x4c41] = sg_sZ80Context.z80A; // 87ec: ret goto returnInstruction;; // 87ed: ld hl, 8808h L87ed: sg_sZ80Context.z80HL = (UINT16) (0x8808); // 87f0: ld (4c42h), hl sg_u8mspacman_memory[0x4c42] = sg_sZ80Context.z80L; sg_u8mspacman_memory[0x4c43] = sg_sZ80Context.z80H; // 87f3: ld a, 1dh sg_sZ80Context.z80A = (UINT8) (0x1d); // 87f5: jp 87e4h goto L87e4;; // 8810: ld a, 00h L8810: sg_sZ80Context.z80A = (UINT8) (0); // 8812: ld (frcol), a sg_u8mspacman_memory[0x4c0d] = sg_sZ80Context.z80A; // 8815: jp 1000h goto L1000;; // 8818: push af L8818: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80A; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = u8Flags; // 8819: ld de, (4dd2h) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[0x4dd2]); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[0x4dd3]); // 881d: ld a, h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80H); { UINT16 u16Temp0; // 881e: sub a, d u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80D; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 881f: add a, 03h u16Temp0 = sg_sZ80Context.z80A + 0x03; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 8821: cp a, 06h u16Temp0 = sg_sZ80Context.z80A - 0x06; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 8823: jr nc, 0883dh if (((u8Flags & 0x01) >> 0) != 1) { goto L883d;; } // 8825: ld a, l sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80L); { UINT16 u16Temp0; // 8826: sub a, e u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 8827: add a, 03h u16Temp0 = sg_sZ80Context.z80A + 0x03; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 8829: cp a, 06h u16Temp0 = sg_sZ80Context.z80A - 0x06; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); } // 882b: jr nc, 0883dh if (((u8Flags & 0x01) >> 0) != 1) { goto L883d;; } // 882d: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 882f: ld (frcol), a sg_u8mspacman_memory[0x4c0d] = sg_sZ80Context.z80A; // 8832: pop af sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); { UINT16 u16Temp0; // 8833: add a, 02h u16Temp0 = sg_sZ80Context.z80A + 0x02; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 8835: ld (frshape), a sg_u8mspacman_memory[0x4c0c] = sg_sZ80Context.z80A; { UINT16 u16Temp0; // 8838: sub a, 02h u16Temp0 = sg_sZ80Context.z80A - 0x02; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x02))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x02 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((sg_sZ80Context.z80A & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 883a: jp 19b2h goto L19b2;; // 883d: pop af L883d: u8Flags = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 883e: jp 19cdh goto L19cd;; // 946a: ld hl, 9474h ; maze table number // select the proper maze L946a: sg_sZ80Context.z80HL = (UINT16) (0x9474); // 946d: call 94bdh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x94; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x70; goto L94bd; case 0x9470: // 9470: ld hl, 4000h sg_sZ80Context.z80HL = (UINT16) (0x4000); // 9473: ret goto returnInstruction;; // 947c: ld hl, 2453h // pellet crossreference routine patch L947c: sg_sZ80Context.z80HL = (UINT16) (0x2453); // 947f: jr 09484h goto L9484;; // 9481: ld hl, 2492h L9481: sg_sZ80Context.z80HL = (UINT16) (0x2492); // 9484: push hl L9484: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 9485: ld hl, 9499h ; select pellet map based on map sg_sZ80Context.z80HL = (UINT16) (0x9499); // 9488: call 94bdh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x94; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x8b; goto L94bd; case 0x948b: // 948b: ld iy, 0000h sg_sZ80Context.z80IY = (UINT16) (0); { UINT32 u32Temp0; // 948f: add iy, bc u32Temp0 = sg_sZ80Context.z80IY + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80IY ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80IY = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 9491: ld hl, 4000h sg_sZ80Context.z80HL = (UINT16) (0x4000); // 9494: ld ix, 4e16h sg_sZ80Context.z80IX = (UINT16) (0x4e16); // 9498: ret goto returnInstruction;; // 94a1: push bc L94a1: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80B; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80C; // 94a2: ld hl, 94b5h ; pellet count table sg_sZ80Context.z80HL = (UINT16) (0x94b5); // 94a5: call 94bdh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x94; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xa8; goto L94bd; case 0x94a8: // 94a8: ld a, (bc) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80BC]); // 94a9: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 94aa: ld a, (peleatn) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e0e]); { UINT16 u16Temp0; // 94ad: cp a, b u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80B; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ sg_sZ80Context.z80B))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80B ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 94ae: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 94af: jp nz, 08ebh ; return to the game loop? if (((u8Flags & 0x40) >> 6) != 1) { goto L08eb;; } // 94b2: jp 08e5h ; return to the clear pellet check goto L08e5;; case 0x94b5: // 94b5: inc l ; number of pellets for board 0 // data for pellet count information sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80L + 1); { UINT16 u16Temp0; // 94b6: adc a, e u16Temp0 = (sg_sZ80Context.z80A + ((u8Flags & 0x01) >> 0) + sg_sZ80Context.z80E); u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT8 u8Temp0; // 94b7: rla ; number of pellets for board 1 u8Temp0 = ((u8Flags & 0x01) >> 0); u8Flags = (u8Flags & ~0x01) | ((sg_sZ80Context.z80A & 0x80) ? 0x01 : 0); sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80A << 1) | u8Temp0)); } { UINT16 u16Temp0; UINT8 u8Temp0; // 94b8: adc a, (hl) ; number of pellets for board 2 u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = (sg_sZ80Context.z80A + ((u8Flags & 0x01) >> 0) + u8Temp0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT32 u32Temp0; // 94b9: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } { UINT16 u16Temp0; // 94ba: sub a, c u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80C; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 94bb: ld sp, hl ; number of pellets for board 3 sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80HL); { UINT16 u16Temp0; // 94bc: sub a, e u16Temp0 = sg_sZ80Context.z80A - sg_sZ80Context.z80E; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 94bd: ld a, (boardno) ; board number // perhaps a routine to calculate variables according // to the current ms-pac maze number? L94bd: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e13]); // 94c0: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; { UINT16 u16Temp0; // 94c1: cp a, 0dh u16Temp0 = sg_sZ80Context.z80A - 0x0d; u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 94c3: jp p, 94d4h if (((u8Flags & 0x80) >> 7) != 1) { goto L94d4;; } // 94c6: ld hl, 94dfh ; map order table L94c6: sg_sZ80Context.z80HL = (UINT16) (0x94df); // 94c9: rst 10h ; a now contains the map number sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x94; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xca; goto L0010; case 0x94ca: // 94ca: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); { UINT16 u16Temp0; // 94cb: add a, a u16Temp0 = sg_sZ80Context.z80A + sg_sZ80Context.z80A; u8Flags = (u8Flags & ~0x04) | ((((sg_sZ80Context.z80A ^ sg_sZ80Context.z80A ^ 0x80) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 94cc: ld c, a sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 94cd: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); { UINT32 u32Temp0; // 94cf: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 94d0: ld c, (hl) // map order table... (order that boards are played) // offset 0 1 2 3 4 5 6 7 8 9 a b c d e f sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 94d1: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 94d2: ld b, (hl) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 94d3: ret goto returnInstruction;; { UINT16 u16Temp0; // 94d4: sub a, 0dh L94d4: u16Temp0 = sg_sZ80Context.z80A - 0x0d; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 94d6: sub a, 08h L94d6: u16Temp0 = sg_sZ80Context.z80A - 0x08; sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 94d8: jp p, 94d6h if (((u8Flags & 0x80) >> 7) != 1) { goto L94d6;; } { UINT16 u16Temp0; // 94db: add a, 0dh u16Temp0 = sg_sZ80Context.z80A + 0x0d; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 94dd: jr 094c6h goto L94c6;; // 94ec: ld hl, 951ch // draw routine for the ms-pac power pellets L94ec: sg_sZ80Context.z80HL = (UINT16) (0x951c); // 94ef: call 94bdh ; retrieve values sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x94; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf2; goto L94bd; case 0x94f2: // 94f2: ld de, brdno2 sg_sZ80Context.z80DE = (UINT16) (0x4e34); // 94f5: ld l, c sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80C); // 94f6: ld h, b ; hl = table offset sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80B); // 94f7: ld c, (hl) L94f7: sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 94f8: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 94f9: ld b, (hl) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 94fa: inc hl ; bc = table loc sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 94fb: ld a, (de) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80DE]); // 94fc: ld (bc), a mspacmanIndirectWrite8(sg_sZ80Context.z80BC, sg_sZ80Context.z80A); // 94fd: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 94fe: ld a, 03h sg_sZ80Context.z80A = (UINT8) (0x03); // 9500: and a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80E); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 9501: jr nz, 094f7h if (((u8Flags & 0x40) >> 6) != 1) { goto L94f7;; } // 9503: ret goto returnInstruction;; // 9504: ld hl, 951ch ; pellet lookup table per map // pellet routine? L9504: sg_sZ80Context.z80HL = (UINT16) (0x951c); // 9507: call 94bdh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x0a; goto L94bd; case 0x950a: // 950a: ld de, brdno2 sg_sZ80Context.z80DE = (UINT16) (0x4e34); // 950d: ld l, c sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80C); // 950e: ld h, b sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80B); // 950f: ld c, (hl) L950f: sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 9510: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 9511: ld b, (hl) sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 9512: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 9513: ld a, (bc) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80BC]); // 9514: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 9515: inc de sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); // 9516: ld a, 03h sg_sZ80Context.z80A = (UINT8) (0x03); // 9518: and a, e sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_sZ80Context.z80E); u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 9519: jr nz, 0950fh if (((u8Flags & 0x40) >> 6) != 1) { goto L950f;; } // 951b: ret goto returnInstruction;; // 9524: push bc L9524: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80B; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80C; // 9525: push de sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80D; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80E; // 9526: ld hl, 951ch ; pellet lookup table sg_sZ80Context.z80HL = (UINT16) (0x951c); // 9529: call 94bdh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x2c; goto L94bd; case 0x952c: // 952c: ld h, b sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80B); // 952d: ld l, c sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80C); // 952e: ld e, (hl) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 952f: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 9530: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 9531: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); sg_sZ80Context.z80DE = (UINT16) (u16Temp0); } // 9532: set 2, h sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80H | 0x04); // 9534: ld a, (447eh) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x447e]); { UINT16 u16Temp0; UINT8 u8Temp0; // 9537: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 9538: jr nz, 0953ch if (((u8Flags & 0x40) >> 6) != 1) { goto L953c;; } // 953a: ld a, 00h sg_sZ80Context.z80A = (UINT8) (0); // 953c: ld (hl), a L953c: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); { UINT16 u16Temp0; // 953d: ex de, hl u16Temp0 = sg_sZ80Context.z80HL; sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80DE); } // 953e: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 953f: ld e, (hl) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 9540: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 9541: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 9542: set 2, d sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80D | 0x04); // 9544: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 9545: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 9546: ld e, (hl) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 9547: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 9548: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 9549: set 2, d sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80D | 0x04); // 954b: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 954c: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 954d: ld e, (hl) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 954e: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 954f: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 9550: set 2, d sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80D | 0x04); // 9552: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 9553: pop de sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 9554: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 9555: ld a, 10h sg_sZ80Context.z80A = (UINT8) (0x10); { UINT16 u16Temp0; UINT8 u8Temp0; // 9557: cp a, (hl) u8Temp0 = sg_u8mspacman_memory[sg_sZ80Context.z80HL]; u16Temp0 = sg_sZ80Context.z80A - u8Temp0; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ u8Temp0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((u8Temp0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 9558: ret goto returnInstruction;; // 9559: ld a, (4d2eh) L9559: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2e]); // 955c: jr 09561h goto L9561;; // 955e: ld a, (4d2fh) L955e: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4d2f]); // 9561: push af // pick a quadrant for the destination of a ghost L9561: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80A; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = u8Flags; // 9562: push bc sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80B; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80C; // 9563: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 9564: ld hl, 9578h ; ghost destination table sg_sZ80Context.z80HL = (UINT16) (0x9578); // 9567: call 94bdh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x6a; goto L94bd; case 0x956a: // 956a: ld l, c sg_sZ80Context.z80L = (UINT8) (sg_sZ80Context.z80C); // 956b: ld h, b sg_sZ80Context.z80H = (UINT8) (sg_sZ80Context.z80B); { UINT32 u32Temp0; // 956c: ld a, r u32Temp0 = sg_s32StartCount - s32CyclesRemaining; sg_sZ80Context.z80r = (UINT32) (sg_sZ80Context.z80r + u32Temp0); sg_sZ80Context.z80clockticks = (UINT32) (sg_sZ80Context.z80clockticks + u32Temp0); sg_s32StartCount = sg_s32StartCount - u32Temp0; sg_sZ80Context.z80A = (UINT8) (((sg_sZ80Context.z80r & 0x80) | ((sg_sZ80Context.z80rCounter >> 0x02) & 0x7f))); } // 956e: and a, 06h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x06); // 9570: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x71; goto L0010; case 0x9571: // 9571: ld e, a L9571: sg_sZ80Context.z80E = (UINT8) (sg_sZ80Context.z80A); // 9572: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 9573: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 9574: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 9575: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 9576: pop af u8Flags = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 9577: ret goto returnInstruction;; // 9580: jp z, 24e1h // maze color code (jp from 24dd) L9580: if (((u8Flags & 0x40) >> 6) == 1) { goto L24e1;; } // 9583: ld a, (gmemode) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e02]); // 9586: and a, a u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 9587: jr z, 09590h if (((u8Flags & 0x40) >> 6) == 1) { goto L9590;; } { UINT16 u16Temp0; // 9589: cp a, 10h u16Temp0 = sg_sZ80Context.z80A - 0x10; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x10))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x10 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 958b: ld a, 01h sg_sZ80Context.z80A = (UINT8) (1); // 958d: jp nz, 24e1h if (((u8Flags & 0x40) >> 6) != 1) { goto L24e1;; } // 9590: ld a, (boardno) L9590: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e13]); { UINT16 u16Temp0; // 9593: cp a, 15h u16Temp0 = sg_sZ80Context.z80A - 0x15; u8Flags = (u8Flags & ~0x04) | ((((0x15 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 9595: jp p, 95a3h if (((u8Flags & 0x80) >> 7) != 1) { goto L95a3;; } // 9598: ld c, a L9598: sg_sZ80Context.z80C = (UINT8) (sg_sZ80Context.z80A); // 9599: ld b, 00h sg_sZ80Context.z80B = (UINT8) (0); // 959b: ld hl, 95aeh ; map color table sg_sZ80Context.z80HL = (UINT16) (0x95ae); { UINT32 u32Temp0; // 959e: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 959f: ld a, (hl) ; a contains the maze color sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 95a0: jp 24e1h // color palette table for the first 21 mazes // offset 0 1 2 3 4 5 6 7 8 9 a b c d e f goto L24e1;; { UINT16 u16Temp0; // 95a3: sub a, 15h L95a3: u16Temp0 = sg_sZ80Context.z80A - 0x15; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 95a5: sub a, 10h L95a5: u16Temp0 = sg_sZ80Context.z80A - 0x10; sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 95a7: jp p, 95a5h if (((u8Flags & 0x80) >> 7) != 1) { goto L95a5;; } { UINT16 u16Temp0; // 95aa: add a, 15h u16Temp0 = sg_sZ80Context.z80A + 0x15; u8Flags = (u8Flags & ~0x04) | ((((0x15 ^ sg_sZ80Context.z80A ^ 0x80) & (0x15 ^ u16Temp0) & 0x80)) ? 0x04 : 0); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); } // 95ac: jr 09598h goto L9598;; // 95c3: ld a, (boardno) ; current board number L95c3: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e13]); { UINT16 u16Temp0; // 95c6: cp a, 03h u16Temp0 = sg_sZ80Context.z80A - 0x03; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x03))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x03 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 95c8: jp p, 2534h if (((u8Flags & 0x80) >> 7) != 1) { goto L2534;; } // 95cb: ld hl, 95dfh ; Unknown table A/B sg_sZ80Context.z80HL = (UINT16) (0x95df); // 95ce: call 94bdh sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xd1; goto L94bd; case 0x95d1: // 95d1: ld hl, 4400h sg_sZ80Context.z80HL = (UINT16) (0x4400); // 95d4: ld a, (bc) L95d4: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80BC]); // 95d5: inc bc sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC + 1); // 95d6: and a, a u8Flags |= 0x10; u8Flags &= 0xfe; u8Flags &= 0xfd; u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((sg_sZ80Context.z80A & 0x80) ? 0x80 : 0); u8Flags = (u8Flags & ~0x04) | (((((((sg_sZ80Context.z80A >> 0x07) & 1) + ((sg_sZ80Context.z80A >> 0x06) & 1) + ((sg_sZ80Context.z80A >> 0x05) & 1) + ((sg_sZ80Context.z80A >> 0x04) & 1) + ((sg_sZ80Context.z80A >> 0x03) & 1) + ((sg_sZ80Context.z80A >> 0x02) & 1) + ((sg_sZ80Context.z80A >> 1) & 1) + ((sg_sZ80Context.z80A >> 0) & 1)) & 1) != 1)) ? 0x04 : 0); // 95d7: jp z, 2534h if (((u8Flags & 0x40) >> 6) == 1) { goto L2534;; } // 95da: rst 10h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xdb; goto L0010; case 0x95db: // 95db: set 6, (hl) mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_u8mspacman_memory[sg_sZ80Context.z80HL] | 0x40); // 95dd: jr 095d4h goto L95d4;; case 0x95df: // 95df: dec a ; unknown Table A // table sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A - 1); { UINT16 u16Temp0; // 95e0: adc a, e u16Temp0 = (sg_sZ80Context.z80A + ((u8Flags & 0x01) >> 0) + sg_sZ80Context.z80E); sg_sZ80Context.z80A = (UINT8) (u16Temp0); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); } // 95e1: jr z, 09571h ; unknown Table B if (((u8Flags & 0x40) >> 6) == 1) { goto L9571;; } case 0x95e3: // 95e3: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); { UINT16 u16Temp0; // 95e4: cp a, 0ah u16Temp0 = sg_sZ80Context.z80A - 0x0a; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x0a))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x0a ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 95e6: call z, 960bh if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xe9; goto L960b; } case 0x95e9: { UINT16 u16Temp0; // 95e9: cp a, 0bh u16Temp0 = sg_sZ80Context.z80A - 0x0b; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 95eb: call z, 95f6h if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xee; goto L95f6; } case 0x95ee: { UINT16 u16Temp0; // 95ee: cp a, 06h u16Temp0 = sg_sZ80Context.z80A - 0x06; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x06))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x06 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 95f0: call z, 963ch if (((u8Flags & 0x40) >> 6) == 1) { sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xf3; goto L963c; } case 0x95f3: // 95f3: jp 2c5eh ; print goto L2c5e;; // 95f6: push bc // draw the midway logo and text for the 'press start' screen L95f6: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80B; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80C; // 95f7: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 95f8: call 9642h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x95; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0xfb; goto L9642; case 0x95fb: // 95fb: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 95fc: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 95fd: ld a, (5080h) ; check in0 // check for start button press sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x5080]); // 9600: and a, 30h sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & 0x30); { UINT16 u16Temp0; // 9602: cp a, 30h u16Temp0 = sg_sZ80Context.z80A - 0x30; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0x30))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0x30 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 9604: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 9605: ret nz if (((u8Flags & 0x40) >> 6) != 1) { goto returnInstruction;; } // 9606: ld a, 20h sg_sZ80Context.z80A = (UINT8) (0x20); // 9608: ld b, 20h sg_sZ80Context.z80B = (UINT8) (0x20); // 960a: ret goto returnInstruction;; // 960b: push bc L960b: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80B; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80C; // 960c: push hl sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80H; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80L; // 960d: ld hl, 9616h sg_sZ80Context.z80HL = (UINT16) (0x9616); // 9610: call 9627h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x96; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x13; goto L9627; case 0x9613: // 9613: pop hl sg_sZ80Context.z80L = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80H = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 9614: pop bc sg_sZ80Context.z80C = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); sg_sZ80Context.z80B = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80SP]); sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP + 1); // 9615: ret goto returnInstruction;; case 0x9618: // 9618: push af sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = sg_sZ80Context.z80A; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = u8Flags; // 9619: ld b, c sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80C); { UINT32 u32Temp0; // 961a: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; } // 961b: ld hl, 4215h sg_sZ80Context.z80HL = (UINT16) (0x4215); { UINT32 u32Temp0; // 961e: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 961f: ld (41f6h), hl MSPacVideoWrite(0x41f6,sg_sZ80Context.z80L); MSPacVideoWrite(0x41f7,sg_sZ80Context.z80H); { UINT32 u32Temp0; // 9622: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x10) | ((((sg_sZ80Context.z80HL ^ u32Temp0 ^ sg_sZ80Context.z80BC) & 0x1000)) ? 0x10 : 0); u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); u8Flags &= 0xfd; } // 9623: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 9624: ld d, 42h sg_sZ80Context.z80D = (UINT8) (0x42); // 9626: rst 38h sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x96; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x27; goto L0038; case 0x9627: // 9627: ld a, (hl) L9627: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); { UINT16 u16Temp0; // 9628: cp a, 0ffh u16Temp0 = sg_sZ80Context.z80A - 0xff; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0xff))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0xff ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 962a: jr z, 0963bh if (((u8Flags & 0x40) >> 6) == 1) { goto L963b;; } // 962c: ld b, a sg_sZ80Context.z80B = (UINT8) (sg_sZ80Context.z80A); // 962d: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 962e: ld a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 962f: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 9630: ld e, (hl) sg_sZ80Context.z80E = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 9631: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 9632: ld d, (hl) sg_sZ80Context.z80D = (UINT8) (sg_u8mspacman_memory[sg_sZ80Context.z80HL]); // 9633: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 9634: ld a, b sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80B); // 9635: set 2, d sg_sZ80Context.z80D = (UINT8) (sg_sZ80Context.z80D | 0x04); // 9637: ld (de), a mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_sZ80Context.z80A); // 9638: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); // 9639: jr 09627h goto L9627;; // 963b: ret L963b: goto returnInstruction;; // 963c: ld a, 00h L963c: sg_sZ80Context.z80A = (UINT8) (0); // 963e: ld (4f00h), a sg_u8mspacman_memory[0x4f00] = sg_sZ80Context.z80A; // 9641: ret goto returnInstruction;; // 9642: rst 28h ; Midway mfg co // dereferencing for title screen logo and text L9642: sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x96; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x43; goto L0028; case 0x9645: // 9645: rst 28h ; 1980/1981 sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x96; sg_sZ80Context.z80SP = (UINT16) (sg_sZ80Context.z80SP - 1); sg_u8mspacman_memory[sg_sZ80Context.z80SP] = 0x46; goto L0028; case 0x9648: // 9648: ld hl, 429ah ; somehow, this also calls the below // draw the Midway logo out to the screen sg_sZ80Context.z80HL = (UINT16) (0x429a); // 964b: ld a, 0bfh // this draws vertical strips, starting with the rightmost sg_sZ80Context.z80A = (UINT8) (0xbf); // 964d: and a, a // 964e: ld de, 001dh sg_sZ80Context.z80DE = (UINT16) (0x1d); // 9651: ld bc, 0400h sg_sZ80Context.z80BC = (UINT16) (0x0400); // 9654: ld (hl), a L9654: mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); { UINT32 u32Temp0; // 9655: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 9656: ld (hl), 01h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 1); { UINT32 u32Temp0; // 9658: sbc hl, bc u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80BC - ((u8Flags & 0x01) >> 0)); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } // 965a: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); { UINT16 u16Temp0; // 965b: sub a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 965d: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); { UINT32 u32Temp0; // 965e: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 965f: ld (hl), 01h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 1); { UINT32 u32Temp0; // 9661: sbc hl, bc u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80BC - ((u8Flags & 0x01) >> 0)); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } // 9663: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); { UINT16 u16Temp0; // 9664: sub a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 9666: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); { UINT32 u32Temp0; // 9667: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 9668: ld (hl), 01h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 1); { UINT32 u32Temp0; // 966a: sbc hl, bc u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80BC - ((u8Flags & 0x01) >> 0)); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } // 966c: inc hl sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); { UINT16 u16Temp0; // 966d: sub a, 04h u16Temp0 = sg_sZ80Context.z80A - 0x04; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } // 966f: ld (hl), a mspacmanIndirectWrite8(sg_sZ80Context.z80HL, sg_sZ80Context.z80A); { UINT32 u32Temp0; // 9670: add hl, bc u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80BC; u8Flags = (u8Flags & ~0x01) | ((u32Temp0 & 0x00010000) ? 0x01 : 0); sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } // 9671: ld (hl), 01h mspacmanIndirectWrite8(sg_sZ80Context.z80HL, 1); { UINT32 u32Temp0; // 9673: sbc hl, bc u32Temp0 = (sg_sZ80Context.z80HL - sg_sZ80Context.z80BC - ((u8Flags & 0x01) >> 0)); sg_sZ80Context.z80HL = (UINT16) (u32Temp0); } { UINT32 u32Temp0; // 9675: add hl, de u32Temp0 = sg_sZ80Context.z80HL + sg_sZ80Context.z80DE; sg_sZ80Context.z80HL = (UINT16) (u32Temp0 & 0xffff); } { UINT16 u16Temp0; // 9676: add a, 0bh u16Temp0 = sg_sZ80Context.z80A + 0x0b; sg_sZ80Context.z80A = (UINT8) (u16Temp0); } { UINT16 u16Temp0; // 9678: cp a, 0bbh u16Temp0 = sg_sZ80Context.z80A - 0xbb; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0xbb))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0xbb ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 967a: jr nz, 09654h if (((u8Flags & 0x40) >> 6) != 1) { goto L9654;; } // 967c: ret goto returnInstruction;; // 9797: ld a, (4f00h) L9797: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4f00]); { UINT16 u16Temp0; // 979a: cp a, 00h u16Temp0 = sg_sZ80Context.z80A; u8Flags = (u8Flags & ~0x01) | ((u16Temp0 & 0x0100) ? 0x01 : 0); u8Flags = (u8Flags & ~0x10) | (((0x10 & (sg_sZ80Context.z80A ^ u16Temp0 ^ 0))) ? 0x10 : 0); u8Flags = (u8Flags & ~0x04) | ((((0 ^ sg_sZ80Context.z80A) & (sg_sZ80Context.z80A ^ u16Temp0) & 0x80)) ? 0x04 : 0); u8Flags |= 0x02; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); u8Flags = (u8Flags & ~0x80) | ((u16Temp0 & 0x80) ? 0x80 : 0); } // 979c: jr z, 097a9h if (((u8Flags & 0x40) >> 6) == 1) { goto L97a9;; } // 979e: ld de, 4c02h sg_sZ80Context.z80DE = (UINT16) (0x4c02); // 97a1: ld hl, 4f50h sg_sZ80Context.z80HL = (UINT16) (0x4f50); // 97a4: ld bc, 000ch sg_sZ80Context.z80BC = (UINT16) (0x0c); // 97a7: ldir UniqueLabel15: mspacmanIndirectWrite8(sg_sZ80Context.z80DE, sg_u8mspacman_memory[sg_sZ80Context.z80HL]); sg_sZ80Context.z80HL = (UINT16) (sg_sZ80Context.z80HL + 1); sg_sZ80Context.z80DE = (UINT16) (sg_sZ80Context.z80DE + 1); sg_sZ80Context.z80BC = (UINT16) (sg_sZ80Context.z80BC - 1); if (sg_sZ80Context.z80BC != 0) { goto UniqueLabel15;; } u8Flags &= 0xef; u8Flags &= 0xfd; if (sg_sZ80Context.z80BC == 0) { u8Flags &= 0xfb; } else { u8Flags |= 0x04; } // 97a9: ld a, (4e09h) L97a9: sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4e09]); // 97ac: ld hl, cabtype sg_sZ80Context.z80HL = (UINT16) (0x4e72); // 97af: and a, (hl) sg_sZ80Context.z80A = (UINT8) (sg_sZ80Context.z80A & sg_u8mspacman_memory[sg_sZ80Context.z80HL]); u8Flags = (u8Flags & ~0x40) | ((sg_sZ80Context.z80A == 0) ? 0x40 : 0); // 97b0: jr z, 097beh if (((u8Flags & 0x40) >> 6) == 1) { goto L97be;; } // 97b2: ld a, (4c0ah) ; mspac sprite number sg_sZ80Context.z80A = (UINT8) (sg_u8mspacman_memory[0x4c0a]); { UINT16 u16Temp0; // 97b5: cp a, 3fh u16Temp0 = sg_sZ80Context.z80A - 0x3f; u8Flags = (u8Flags & ~0x40) | ((((u16Temp0 & 0xff) == 0)) ? 0x40 : 0); } // 97b7: jr nz, 097beh if (((u8Flags & 0x40) >> 6) != 1) { goto L97be;; } // 97b9: ld a, 0ffh sg_sZ80Context.z80A = (UINT8) (0xff); // 97bb: ld (4c0ah), a ; mspac sprite number sg_u8mspacman_memory[0x4c0a] = sg_sZ80Context.z80A; // 97be: ld hl, 9685h L97be: sg_sZ80Context.z80HL = (UINT16) (0x9685); // 97c1: jp 2cc4h goto L2cc4;; default: /* Invalid/unsupported instruction*/ return(sg_sZ80Context.z80pc); } Exit234b: sg_sZ80Context.z80pc = 0x234b; goto adjustTimingCounter; Exit2cbd: sg_sZ80Context.z80pc = 0x2cbd; goto adjustTimingCounter; Exit34de: sg_sZ80Context.z80pc = 0x34de; goto adjustTimingCounter; adjustTimingCounter: sg_sZ80Context.z80clockticks += (UINT32) (sg_s32StartCount - s32CyclesRemaining); sg_sZ80Context.z80rCounter += (UINT32) (sg_s32StartCount - s32CyclesRemaining); sg_sZ80Context.z80F = u8Flags; return(0); returnButExit: sg_sZ80Context.z80pc = sg_u8mspacman_memory[sg_sZ80Context.z80SP++]; sg_sZ80Context.z80pc |= ((UINT16) sg_u8mspacman_memory[sg_sZ80Context.z80SP++] << 8); goto adjustTimingCounter; }