COSC 201: Computer Organization

Lab 1: ARMv8 Assembly Introduction

Purpose
Learn about basic ARMv8 assembly instructions and how the general purpose registers are used by assembly language.
Method
Read a simple assembly program and analyze how register values are changed by it. Modify the same assembly code to do a different arithmetic operation.
Preparation
Read sections 2.1-2.3 from the text
Files to use
prog1.s , chkprog1.c
What to Hand In
Modified prog1???.s, lab1???.txt, prog2???.s, chkprog2???.c

  1. Open prog1.s in a text editor and read it. Annotate prog1.s by indicating the values in each register under the headings given. If the value is unknown, indicate with a "?" Rename your modified file to be prog1???.s, where ??? is replaced by your last name and first initial. For example progr1NevisonC.s.
  2. Open chkprog1.c in a text editor and read it. This is a c program that calls prog1.s when the two are compiled together. How do you suppose the result of prog1.s is communicated to chkprog1.c? How do you suppose control moves from prog1.s back to chkprog1.c after it is done? What must happen when prog1.s is called for this to work? Write your answers into a text file, lab1???.txt
  3. Write you own simple assembly program, named prog2???.s, that computes the expression (8 + 9) - (3 + 11).Write a heading similar to the one given in prog1.s, but changing the name, date, etc. appropriately. Load each constant into a different register (X9, X10, X11, X12) using the mov instruction in the same way it is used in prog1.s. Put the result into the appropriate register, so that it could be found by a calling program, analogous to chkprog1.c. Write such a calling program, naming it chkprog2???.c.
  4. Turn in your work by emailing a zip file containing your four files: name this zip file lab1-???, where ??? is your lastname and first initial, i.e. lab1-NevisonC.zip.