protected static Byte GetLinearOffset(LocationInfo src, Byte start) { Byte offset = start; if (src.loc >= Locations.B && src.loc <= Locations.L) { offset += (Byte)src.loc; } else if (src.loc == Locations.HL && src.isMem) { offset += 0x06; } else if (src.loc == Locations.A) { offset += 0x07; } return offset; }
protected static Byte GetBlockOffset(LocationInfo src, Byte start) { Byte offset = start; switch (src.loc) { case Locations.BC: offset += 0x00; break; case Locations.DE: offset += 0x10; break; case Locations.HL: offset += 0x20; break; case Locations.AF: offset += 0x30; break; default: //ERROR break; } return offset; }
protected static void InsertLocationInfo(List<Byte> rom, LocationInfo src) { if (src.isWide) { rom.Add((Byte)(src.val >> 8)); rom.Add((Byte)(src.val & 0xFF)); } else { rom.Add((Byte)src.val); } }
public Instruction() { op = Instructions.ERR_INSTRUCTION; src = new LocationInfo(); dst = new LocationInfo(); }
protected static Byte GetTableOffset(LocationInfo src, LocationInfo dst, Byte start) { Byte offset = offset = GetLinearOffset(dst, (Byte)(start)); if (src.val % 2 != 0) { offset += 0x08; } offset += (Byte)((src.val / 2) * 0x10); return offset; }