fix: dont interpret padding as instructions

a.out padds the text section with 0-bytes, which where interpreted
as 0x00 0x00 instruction and occasionally as a single 0x00 byte. Add
logic to ignore single 0x00 bytes and to remove dangling 0x00 0x00
instructions at the end of the instruction vec, so only the 'actual'
instructions are presented in the end. Also adjust visibility of
methods, so only the truncated instructions will ever be presented.

Of course, this could remove an actual `0x00 0x00` instruction from the
end, but they would not have any effect on execution anyway.
This commit is contained in:
2025-05-27 11:01:44 +09:00
parent 5c8702fb95
commit 322a276617
5 changed files with 189 additions and 135 deletions

View File

@@ -296,6 +296,8 @@ pub enum Mnemonic {
AAD(Byte),
// MISC
XLAT,
// Not part of 8086:
EOT, // End of Text Section
}
impl fmt::Display for Mnemonic {