Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialLewis Brooks
719 Points(Machine code) I am having a difficult time understanding the breakdown of machine code.
I am having a difficult time understanding the rate/process machine code works in?
1 Answer
Ken Alger
Treehouse TeacherLewis;
This is a great question! Machine code is written in a language that the computer can understand and process quickly and efficiently. Higher level languages like Python, Ruby, JavaScript, Java, etc. must go through a "translation" process of some sort for the computer to actually understand that print("Hello World")
, which is readable to us in Python, prints something to the screen. In machine code it would translate into something like:
b8 21 0a 00 00 #moving "!\n" into eax
a3 0c 10 00 06 #moving eax into first memory location
b8 6f 72 6c 64 #moving "orld" into eax
a3 08 10 00 06 #moving eax into next memory location
b8 6f 2c 20 57 #moving "o, W" into eax
a3 04 10 00 06 #moving eax into next memory location
b8 48 65 6c 6c #moving "Hell" into eax
a3 00 10 00 06 #moving eax into next memory location
b9 00 10 00 06 #moving pointer to start of memory location into ecx
ba 10 00 00 00 #moving string size into edx
bb 01 00 00 00 #moving "stdout" number to ebx
b8 04 00 00 00 #moving "print out" syscall number to eax
cd 80 #calling the linux kernel to execute our print to stdout
b8 01 00 00 00 #moving "sys_exit" call number to eax
cd 80 #executing it via linux sys_call
Hardly as easy to read, write, and process as a human. :-)
That's it at a high level. Post back though if you have further questions.
Ken