Playback speed
Share post
Share post at current time

Paid episode

The full episode is only available to paid subscribers of Computer, Enhance!

Other Common Instructions

Now that you understand how machine code works, it's easy to extend your knowledge to the majority of the non-SIMD x86/64 instructions you will encounter in practice.

This is the eleventh video in Part 1 of the Performance-Aware Programming series. Please see the Table of Contents to quickly navigate through the rest of the course as it is updated weekly. There is no homework associated with this post.

Hopefully last week's homework demonstrated how our newfound 8086 knowledge lets us understand real assembly language programs. We've only implemented a small subset of the 8086 instruction set, but the truth is, most programs only use a small subset anyway — even on the 8086!

What’s more, because we’ve learned how a few instructions work in detail, we no longer have to build decoding and simulation code to understand assembly language instructions. With the knowledge we already have, we can rapidly add more instructions to our repertoire just by looking at their specs in the manual. Since we know how decoding, registers, the IP, and flags work, all we need to know to understand a new instruction is a quick explanation of what it does and we’ll “get it.”

To that end, what I'd like to do now is give you a brief overview of the remaining x86 instructions that you’re likely to encounter in practice. You won’t have to simulate these for homework, or even learn the details of them right now. I just want to give you some awareness of what they are, and we will learn more about them as we see them later in context.

We already know the add, sub, and cmp arithmetic instructions. In addition to those, there are instructions for multiplication and division — mul, imul, div, and idiv:

The full video is for paid subscribers

Programming Courses
A series of courses on programming topics.
Casey Muratori