0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-19 07:59:47 +03:00

Added support for OR r8, r/m8 instruction (opcode 0x0A) with tests

This commit is contained in:
bird_egop
2025-04-13 00:23:11 +03:00
parent 7063a4a5a8
commit 3ffaaf0057
4 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,49 @@
namespace X86DisassemblerTests;
using System;
using Xunit;
using X86Disassembler.X86;
/// <summary>
/// Tests for OR instruction handlers
/// </summary>
public class OrInstructionTests
{
/// <summary>
/// Tests the OR r8, r/m8 instruction (0x0A)
/// </summary>
[Fact]
public void TestOrR8Rm8()
{
// Arrange
byte[] code = { 0x0A, 0xC8 }; // OR CL, AL
// Act
Disassembler disassembler = new Disassembler(code, 0x1000);
var instructions = disassembler.Disassemble();
// Assert
Assert.Single(instructions);
Assert.Equal("or", instructions[0].Mnemonic);
Assert.Equal("cl, al", instructions[0].Operands);
}
/// <summary>
/// Tests the OR r8, m8 instruction (0x0A) with memory operand
/// </summary>
[Fact]
public void TestOrR8M8()
{
// Arrange
byte[] code = { 0x0A, 0x00 }; // OR AL, BYTE PTR [EAX]
// Act
Disassembler disassembler = new Disassembler(code, 0x1000);
var instructions = disassembler.Disassemble();
// Assert
Assert.Single(instructions);
Assert.Equal("or", instructions[0].Mnemonic);
Assert.Equal("al, byte ptr [eax]", instructions[0].Operands);
}
}