Sign in to follow this  
disanti

x86 Instruction Notes

Recommended Posts

I have been looking at The Art of Assembler Language and found the topic: "Encoding x86 instructions". I found a bit of this information incorrect but cannot find a contact for the author of it so I started writing about it myself. If you find mistakes in it, please contact me: johndisanti[NOSPAMPLEASE]@santiproductions.com Here is what I have written so far: http://www.santiproductions.com/site/x86instruction.txt I have used NASM to assemble simple instructions, I then looked at the final file and wrote down the instruction's hex value. Now I have started converting the hex values to binary and finding patterns in them. Thanks, John DiSanti P.S. I know this may seem pointless but I need something to do this Summer so I decided on this.

Share this post


Link to post
Share on other sites
Hmm, interesting. I haven't read that book (?), so I'm not sure what part they got wrong.

Are you making a list of all the opcodes? For a modern CPU, that list looks to be about maybe quarter of all the available opcodes. Plus, there are FPU instructions and things like MMX, SSE, etc.

As for 32-bit mode, indeed most of the opcodes just need a 0xDD in front of them (when running from 16-bit mode). That's a trick I used to use with Borland Pascal's compiler to get it to generate 32-bit code, since its inline assembler wouldn't recognize the new opcodes. However, there are still 32-bit extensions to the original 16-bit set, like opcodes to load values into the global descriptor table and such. I'm a bit fuzzy on that, as I never got too much into doing protected mode assembly.

Share this post


Link to post
Share on other sites
The Art of Assembler Language can be found here:
http://cs.smith.edu/~thiebaut/ArtOfAssembly/artofasm.html

I don't think I would be able to find every opcode! ;) I sure have learned a lot about how a computer works from this though.

Share this post


Link to post
Share on other sites
Sign in to follow this