Potatosaurus
Potatosaurus

Reputation: 475

Machine code instruction anatomy

I'm a student studying microcontrollers, and everything is generally fine, however when it came to learning the 32 bit instructions, it was somewhat glossed over. I figured after playing around with machine code it may become a bit more apparent, however I still don't quite understand why it appears so random. Some commands are perfectly normal, such as the register values, and are rather simple to understand. However other commands are fragmented and seemingly randomly distributed throughout the instruction.

What we were taught

Is there a method to the madness, or any particular tricks to figure out which bits in a given instruction belong to which command?

Upvotes: 2

Views: 99

Answers (1)

Thomas Hilbert
Thomas Hilbert

Reputation: 3639

Instructions are meant to be directly processed by a piece of hardware, every bit of the instruction actually setting hardware lines high or low. Obviously the instruction must be constructed in such a way that it configures the hardware to get the job done. And as hardware, especially processors, are expensive to design it makes sense to have the hardware define the format of the instruction.

So every architecture will have its own instruction format. And as was stated in the comments, you will find that format in the reference documents. Other than that I cannot think of anything more to add.

Upvotes: 1

Related Questions