If you are optimizing for size (which can be a fun exercise) there are other ways of iterating through "arrays" of bytes such as the various string instructions (though these tend to be slower on modern processors because they are microcoded). register specification portion of modrm would change to specify ecx. If we were moving into ecx, the modrm byte would be 0C because a the 3-bit byte following specifying the data source, and then 8B specifying everything in the 's. to mov the value into eax as well as that there will be a sib (scale/index/base) where the first 8B is the opcode for this version of mov, 04 is the modrm byte saying eax = rbx where rbx points to the base of an array of dwords An example where eax, rbx, and rcx are registers: ![]() ![]() In x86 you have powerful addressing modes (the different ways you can calculate a memory address) which are normally encoded with modrm and sib bytes after the opcode. In asm you tend to lose the benefit of arrays being a type. If you know how to construct data structures in C, it's pretty straightforward to construct them in assembly language.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |