Question: a ) Enter this hello world program into a file called hello.c e . g . using the nano text editor ( your tutor will
a Enter this hello world program into a file called hello.c eg using the nano text editor your tutor will show you how To run the program we must first compile it into machine code which the computer understands. Compile the program using the gcc compiler thus gcc hello.c This will produce an executable machine code program in a file called aout You can run this by entering aout at the command prompt.
b Rather than compiling your hello world program directly to binary machine code you can compile it to assembly code so you can view the textual representation of the machine code instructions. You can do that like this: gcc S hello.c The assembly code will be put in a file called hello.s Look at this file eg using nano you should be able to find the text Hello World You can carefully change this text, then convert the assembly file to machine code using gcc hello.s then run the revised machine code using aout as before. Congratulations youve just programmed the computer in its own low level machine code language.
c Look at the assembly code in hello.s identify a machine instruction. Look up the instruction on the internet and find out what it does.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
