How to specify the command prefix field, the command field itself, the addressing mode field?
The machine command generally looks like this: first the prefixes come, each prefix takes 1 byte, then the command field goes - usually takes 1-2 bytes, then the mod r / m byte can go to indicate the addressing mode, then depending on the field values byte mod r / m can go byte sib (scale-index-base), then there can be a numerical offset or an immediate operand.
On this topic, you can read the following:
- "Disassembling Subtleties (Disassembling in the Mind)" by Chris Kaspersky (pdf)
- The book of Pirogov V. "Assembler and disassembly" chapter "Format of commands of the Intel microprocessor"
- For more information you need to read Intel manuals.