diff --git a/X86Disassembler/X86/InstructionDecoder.cs b/X86Disassembler/X86/InstructionDecoder.cs index ef4112a..846dee4 100644 --- a/X86Disassembler/X86/InstructionDecoder.cs +++ b/X86Disassembler/X86/InstructionDecoder.cs @@ -227,6 +227,33 @@ public class InstructionDecoder { return _prefixDecoder.HasOperandSizePrefix(); } + + /// + /// Checks if a single byte can be read from the current position + /// + /// True if there is at least one byte available to read + public bool CanReadByte() + { + return _position < _length; + } + + /// + /// Checks if a 16-bit unsigned short (2 bytes) can be read from the current position + /// + /// True if there are at least two bytes available to read + public bool CanReadUShort() + { + return _position + 1 < _length; + } + + /// + /// Checks if a 32-bit unsigned integer (4 bytes) can be read from the current position + /// + /// True if there are at least four bytes available to read + public bool CanReadUInt() + { + return _position + 3 < _length; + } /// /// Reads a byte from the buffer and advances the position