Question: 1 Task 1 : Install QEMU Emulator Recall that assembly programs are closely related to the hardware platform they are performed on , so an

1 Task 1: Install QEMU Emulator
Recall that assembly programs are closely related to the hardware platform they are performed on, so an assembly program written in ARM syntax cannot be executed on any other machines. Most of the time, however, we also want to execute ARM assembly on some other machines. In this case, we can install an emulator that can
simulate the hardware execution of ARM machines on any type of machine. This is called cross-compilation. The emulator we are using is called QEMU.
To install QEMU on your virtual machine, type the following in your terminal:
1 $ sudo apt-get install qemu-user
Once you have finished the installation, you need to write the simplest ARM assembly program (the one listed in B.1.1 in textbook), and assemble and execute it. Upon success, there should be nothing printed out no warnings or any type of output. To learn how to assemble, link, and execute an assembly program, read B.2.1 in textbook.
To get credits for attendance, show your CA that you have installed QEMU, and can assemble/link/execute the simplest ARM program. No submission needed.
2 Task 2: Write a Simple Program
One very common thing we do in programming is to print something to the screen. Although printing numerical numbers takes a bit more work, it is relatively much easier to print a string. In this task, you will learn how to declare a string, and how to invoke system call to print the string out. The code listed in B.1.1 in textbook is your
starter code. Please learn how to declare data and load address by reading B.1.3 in textbook before starting this task.
Unlike high-level languages, in assembly, if we want to print a string, we have to declare it first in the .data segment:
1.data
2 msg: .string "Hello World!
"
To print this string out, we need to set several registers to correct values before invoking the system call, because the system needs to retrieve the information about this string from these registers:
Register Content
X0 Destination (for printing, its value is 1)
X1 The address of the string to be printed
X2 The length of the string to be printed
X8 System call number (for printing, its value is 64)
Once these registers are ready, we can invoke the system call by using instruction: SVC 0, and the string will be printed out!
Lastly, to terminate the program successfully, we need the following instructions: 1
1 MOV X0,0
2 MOV X8,93
3 SVC 0
Requirements
Note your code is a complete assembly program (not just a sequence of instructions). It must be able to assemble, link, and execute without error and warnings. When executed, the program must finish without problems;
If your code cannot assemble, you get no credit this is the same to C programs that cannot be compiled;
You must declare the length of the string as a quadword in the .data segment;
You must put comments on every instruction you wrote; no need to comment on labels and directives;
You must put your name and honor code pledge at the top of your code in comments

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!