0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-20 16:18:37 +03:00

Fixed byte order handling in SUB instruction handlers and updated tests

Implemented SUB r32, r/m32 instruction handlers and tests

Added comprehensive tests for Push/Pop, Xchg, Sub instructions and enhanced segment override tests
This commit is contained in:
bird_egop
2025-04-13 14:25:27 +03:00
parent 44c73321ea
commit 2c85192d13
9 changed files with 959 additions and 3 deletions

View File

@ -73,7 +73,16 @@ public class SubImmFromRm32Handler : InstructionHandler
return false;
}
uint imm32 = BitConverter.ToUInt32(CodeBuffer, position);
// Read the immediate value in little-endian format and convert to big-endian for display
byte b0 = CodeBuffer[position];
byte b1 = CodeBuffer[position + 1];
byte b2 = CodeBuffer[position + 2];
byte b3 = CodeBuffer[position + 3];
// Convert from little-endian to big-endian for display
uint imm32 = (uint)((b3 << 24) | (b2 << 16) | (b1 << 8) | b0);
// Advance the position
Decoder.SetPosition(position + 4);
// Set the operands