YCPU
YCPU copied to clipboard
Emulator's BTI pattern does not match spec.
https://github.com/ZaneDubya/YCPU/blob/652601eb3a7540d5b1a610346a5b0b43469328b4/Source/Libraries/YpsilonCPU/Emulation/Processor/YCPU.BitPatterns.cs#L63
Suggested fix:
private void BitPatternBTI(ushort operand, out ushort value, out RegGeneral destination) {
destination = (RegGeneral)((operand & 0xE000) >> 13); // bits DEF
RegGeneral source = (RegGeneral)((operand & 0x0F00) >> 8);
bool asRegister = (operand & 0x1000) != 0;
value = asRegister ?
(ushort)(R[(int)source] & 0x000F) :
(ushort)((operand & 0x1E00) >> 9);
}
(ushort)((operand & 0x1E00) >> 9);
-> (ushort)((operand & 0x0F00) >> 8);
(or source
, not sure about the types there)
Rest looks okay.