CS301 – Fall 2003

Prof. Hartman

Homework #8

Due Wednesday, November 26th by 4:45 pm

 

  1. Assemble (ie, encode) the following short (and non-sensical) routine by hand. You may check your work with the assembler (well, #6 may be tricky), but I expect to see annotated bits in the ModR/M byte if it is needed. (That is, explain in a couple of words why the first two bits are 11, for example). You will probably want to use the handout Encoding instructions from class, along with the NASM documentation.
    1.               pusha
    2.               add  edx, ebx
    3.               mov  dword [0DEADBEEFh], 12
    4.               fmul st3
    5.                rcr  dl,cl
    6.               sar  dword [ebx + eax],2
    7.                leave
    8.                ret

  2. Test the following code on as many architectures as you have access to, and report the average number of clock cycles taken: loops.c timing.asm