CS220: Logic Design and Machine Organization In-Class Exercise Assembly 01: Getting Started Objectives • Verify that the assembly language development tools are properly installed. • Develop a better understanding of the relationship between C++ and assembly. Procedure 1. Create a CS220 working directory on your network share. (Alternatively, map a drive to your CSSERVER home directory and create a working directory there.) Create an exer01 subdirectory under the CS220 directory. All of the files created in this exercise should be placed in the exer01 directory. 2. Use WordPad to write a “Hello world!” program in C++. Save the file as a Text Document with filename hello.cpp. 3. Open a MinGW terminal window. Change drives to the drive containing your network share (type the drive letter followed by a colon) and then cd to the exer01 directory (cd CS220/exer01). Compile and run the program to make sure that it works: g++ -o hello hello.cpp hello 4. Compile the program using g++ again, but this time stop the compilation after converting the C++ source code to assembly: g++ -S hello.cpp This should produce an assembly source code file name hello.s. Examine the file using more (more hello.s) or in WordPad. Can you find the beginning of the main routine? Can you find the “Hello world!” string? 5. Assemble and link the hello.s file: as -o hello.o hello.s g++ -o hello hello.o Verify that the new hello executable runs as expected. 6. Use objdump to disassemble both the hello.o object file and the hello executable file (this is named hello.exe under MinGW): objdump -d hello.o | more objdump -d hello.exe | more Notes 1. Similar steps should also work under Linux (and also on a Mac?). 2. Repeat these steps on the computer that you plan to use for homework and projects to verify that all of the tools have been installed correctly.