Original text(via Lobsters)
| # source:http://geocities.com/SiliconValley/heights/7052/opcode.txt | |
|---|---|
| From: [email protected] (Mark Hopkins) | |
| Newsgroups: alt.lang.asm | |
| Subject: A Summary of the 80486 Opcodes and Instructions | |
| (1) The 80x86 is an Octal Machine | |
| This is a follow-up and revision of an article posted in alt.lang.asm on | |
| 7-5-92 concerning the 80x86 instruction encoding. | |
| The only proper way to understand 80x86 coding is to realize that ALL 80x86 | |
| OPCODES ARE CODED IN OCTAL. A byte has 3 octal digits, ranging from 000 to | |
| 377. In fact, each octal group (000-077, 100-177, etc.) tends to encode a | |
| specific variety of operation. All of these are features inherited from the | |
| 8080/8085/Z80. | |
| For some reason absolutely everybody misses all of this, even the Intel | |
| people who wrote the reference on the 8086 (and even the 8080). The opcode | |
| scheme outlined briefly below is expanded starting in the 80386, but | |
| consistently with the overall scheme here. | |
| As an example to see how this works, the mov instructions in octal are: | |
| 210 xrm mov Eb, Rb | |
| 211 xrm mov Ew, Rw | |
| 212 xrm mov Rb, Eb | |
| 213 xrm mov Rw, Ew | |
| 214 xsm mov Ew, SR | |
| 216 xsm mov SR, Ew | |
| The meanings of the octal digits (x, m, r, s) and their correspondence to the | |
| operands (Eb, Ew, Rb, Rw, SR) are the following: | |
| The digit r (0-7) encodes the register operand as follows: | |
| REGISTER (r): 0 1 2 3 4 5 6 7 | |
| Rb = Byte-sized register AL CL DL BL AH CH DL BH | |
| Rw = Word-sized register AX CX DX BX SP BP SI DI | |
| The segment register digit s (0-7) encodes the segment register as follows: | |
| SEGMENT REGISTER (s): 0 1 2 3 4 5 6 7 |