Commit Graph

15 Commits

Author SHA1 Message Date
232b73aad8 chore: Rename Operand -> ImmediateOperand 2025-06-05 10:08:35 +09:00
0893969f4e chore: whole swoop of enhanced documentation 2025-05-28 09:41:40 +09:00
322a276617 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.
2025-05-27 11:13:16 +09:00
74e936ab76 chore: replace all panic's with proper error propagation 2025-05-25 15:45:09 +09:00
058afeb7ba chore: split up some structs and add comments 2025-05-20 18:59:09 +09:00
38a2782cc6 ft: implement group3a/b instructions 2025-05-14 11:46:09 +09:00
04493b1179 ft: implement more mnemonics 2025-05-14 11:28:07 +09:00
b5c178ea61 chore: remove Immediate from Immediate::{Word, Byte, Operand}
It's already clear that its an Immediate value
without the prefix.
2025-05-14 10:40:52 +09:00
6908fb3c69 chore: use lower letters for disasm output 2025-05-13 14:20:25 +09:00
4443f84297 chore: dedup u8/u16 byte/word immediate type 2025-05-13 12:44:00 +09:00
27b39ee94a fix: correctly parse word instead of byte for GPR 2025-05-13 12:35:58 +09:00
47a002cd79 chore: add macros for ModRM GPR Instruction parsing 2025-05-13 12:23:33 +09:00
c71ddb4419 fix: rename OperandSize to OperandWidth 2025-05-13 12:17:25 +09:00
a25e0a3890 ft: fixed modrm target calculation
While implementing some more mnemonics and testing
them, it was clear that modrm parsing was wrong.
Now reg to reg and immediates, together with
GPR1 interpretation should work as expected.

GPR1 interpretation can currently not be merged
into the modrm function, as with the current
abstraction the REG needs to select the correct
mnemonic, for which we need to also know the second
operand, which will only be parsed afterwards.
But this will be incorporated at some point, this
just marks the first working state.
2025-05-13 12:07:22 +09:00
51b28b3bac ft: introduce modrm macro for leaner matching
All instructions which use a modrm instruction
for memory reads from or into a register can
make use of this macro
2025-05-12 19:53:25 +09:00