Add IAssembler seam (Assemble(text, origin)) with StubAssembler default backend. StubAssembler provides EmitU8/EmitU32/EmitU64 little-endian byte emitters (zero dep, no FASM). Assemble throws NotSupportedException on StubAssembler (text assembly deferred to IcedAssembler, Phase 8). 7 new tests: EmitU8, EmitU32 x2, EmitU64 x2, IS-A check, Assemble throws. All passing (total: 64).
18 lines
658 B
C#
18 lines
658 B
C#
namespace WhiteMagic.Assembly;
|
|
|
|
/// <summary>
|
|
/// Abstraction over an x86/x64 assembler. The default <see cref="StubAssembler"/>
|
|
/// hand-emits calling-convention trampolines (no parsing, zero dep). An optional
|
|
/// <see cref="IcedAssembler"/> (Phase 8) handles arbitrary mnemonics via the Iced
|
|
/// library.
|
|
/// </summary>
|
|
public interface IAssembler
|
|
{
|
|
/// <summary>
|
|
/// Assembles text mnemonics into machine code.
|
|
/// </summary>
|
|
/// <param name="assemblyText">The assembly text (Intel syntax).</param>
|
|
/// <param name="origin">The base address for relative encodings.</param>
|
|
byte[] Assemble(string assemblyText, ulong origin = 0);
|
|
}
|