
262 CHAPTER 10 ADL++: Object-Oriented Specification
What follows the ModR/M byte, if anything,is indicated by the ModR/M byte. Thus,
each byte in the instr uction provides a hint as to what comes next.
Again,the simplest way to approach this problem is to enumerate every possible
variation of an instruction as if it is a separate instruction,and then use simple over-
loading to distinguish different instructions,just like functions in C++. For example,
the
mov instruction overloaded for Displacement and Base addressing modes:
mov reg32 disp emit opcode=0x89 mod='00'b regop=reg32 rm='100'b disp ...
mov reg32 base emit opcode=0x89 mod='00'b regop=reg32 ...