I was wondering this because I have found that some instructions, on the machine code level, are too large if taken a step down from hex to 0s and 1s.

On Motorola 68000 I found that some instructions need multiple parts, and/or need to actually have three instructions because the data can't all fit(such as writing a string).

But I decided to make this really simple with the x86 instruction pusha.

pusha is 0x60 in hexadecimal, which is not even one byte: 1100 000.

WILL x86 will parse this (assuming I write this in an executable directly) without adding an extra zero to make it two bytes?

Basically, I have noticed some issues with transferring hexadecimal to bin, so I was wondering, once again ... is hexadecimal always 1:1 correlated with binary, or is some modding needed sometimes(such as with those regarding size)?

  • I have found this link to be helpful in regards to explaining x86 encoding - c-jump.com/CIS77/CPU/x86/lecture.html#X77_0010_real_encoding
    – alexanderh
    Jan 25, 2014 at 22:53
  • 1
    "which is not even one byte: 1100 0000" (You missed an extra 0.) How many bytes do you believe it is, then? Two (2 pairs of 0s and 1s)? Four, since the hex form is 0x60? 9: 6 0s, 2 1s, and including the space?
    – Jongware
    Jan 26, 2014 at 2:40

1 Answer 1


This is always a 1:1 ratio. 0x60 is a byte 0110 0000 always. Its very beneficial to understand that everything just comes back to binary. The rest is all just representations. There is no difference between 'A', 0x41, and 0b01000000. You will have to put the leading zero infront of your example, although compilers could assume, that i'm not sure of) but there is a large difference better 0b01100000 (PUSHA) and 0b1110000 (LOOPNZ).

For x86, it might be interesting for you to look at the op code encoding a table can be found here

In terms of machine code, the op code deems how many more bytes are needed to complete an instruction. This is one of the differences between a RISC (e.g. ARM) and CISC (e.g. x86) architectures. RISC instructions sets use a fixed instruction length, where as CISC instruction sets have variable instruction lengths.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.