Assembly Language Programming - Exam #1

Write all answers on the answer sheets provided. You may refer to the ASCII chart included with the exam sheet and to the list of commands given in class.

  1. (2 pts each) Briefly define each of the following terms:
    1. program counter
    2. RAM
    3. register

  2. (4 pts) List the steps of the fetch-execute cycle.

  3. (4 pts) Name two reasons why a person might want to learn assembly language programming.

  4. (3 pts each) Show how each of the values below would be represented in the computer. Write your answers in binary.
    1. the character `<'
    2. the 8-bit integer 77
    3. the 8-bit integer -20
    4. the single-precision float 30.375

  5. (3 pts each) Interpret each of the hexadecimal values below as instructed:
    1. $0x40$ as a character
    2. $0xFE2F$ as a 16-bit signed integer

  6. (3 pts each) Give the 64-, 32-,16-, and 8-bit names of each of the following registers.
    1. rcx
    2. r10

  7. (16 pts) Suppose the following declarations are placed in memory at the address $0x228$. Show the address and contents of each byte generated by the following declarations. Write all answers in hexadecimal.
      section .data
      a:     db     2
      b:     db    -1
      c:     db    "Fun",0xA,0
      d:     dd    30.375           ; Hint see problem above ...
      e:     db    80,0x4F
      f:     dd    0x524557

  8. (4 pts) Given the memory configuration of problem 7, what would the following move command accomplish? (Be specific about exactly what and how much gets moved where). mov eax,[a]

  9. (6 pts) Suppose that labels a, b, and c mark locations in memory where 32-bit signed integers are stored. Write the x86 assembly language commands that will perform the following actions:
    if (a < b && a < c)
       a= 0;
       b= c;
       a= c;

  10. (10 pts) The skeleton program below provides the IO macros and gives structure for an assembly language program. [frame=single,label=skeleton.asm,fontsize=]notes/skeleton.asm Show what declarations and assembly language statements you would add to this skeleton program to use a loop to produce a list of all powers of $2^n$ where $n=0,1, \ldots\ 30$. The output should display $n$ followed by a space followed by $2^n$ followed by a newline character for each of the 31 displayed values.

  11. (4 pts) What commands would you type to compile, link, and run the modified program you created in problem 10?

Quick Links