CSCI 110, Spring 2011

    Home | | Course Schedule | | Assignments | | Lecture Notes

    CSCI 110 Homework 8

    Assembly Language

    Due Tuesday, April 19, at the beginning of class.

    For each of the problems below, use the "assembly language" described in lecture 20, the P88 Machine Assembly Language.

    Problem 1.
    Consider the following assembly language program:

           IN    AX
           COPY  M1, AX
           SUB   AX, M1
           CMP   AX, M1
           JB    LAB1
           OUT   AX
           JMP   LAB2
      LAB1 COPY  AX, M1
           DIV   AX, M1
           OUT   AX
      LAB2 END
      

    a) What is the output of the above program if the input is 4?

     

     

    b) What is the output of the above program if the input is 0?

     

     

    c) Briefly describe how the program works.

     

     

     

     

     

    Problem 2.
    Write an assembly language program that reads two integers and prints their sum.

     

     

     

     

     

     

     

     

    Problem 3.
    Write an assembly language program that reads two integers and prints the larger one.

     

     

     

     

     

     

     

     

    What To Turn In.

    • A printout of this sheet with the answers filled in.
    • Print your name at the top of the cover page and staple it to the top of your solutions.