CS 2011, A Term 1999
Professor Sergio A. Alvarez
HW 6

  1. Write an assembly language procedure named addthreebyref that accepts three singleword integer arguments x, y, z by reference on the stack and returns the sum x + y + z of the arguments in x, again by reference. The procedure addthreebyref should do its own stack clean-up.

  2. A C++ program contains the following call to an external assembly procedure:
       cryptic(x,y,z);
    
    Assume that the parameters x, y, z are short integers that occupy two bytes of memory each. Assume also that x and y are passed by reference, whereas z is passed by value. Standard C naming and calling conventions are assumed to be in effect. The C++ prototype of the assembly procedure is:
       extern "C" void cryptic(int& x, int& y, int z);
    

  3. Consider the Boolean function AtMostTwo(A,B,C,D) that returns TRUE whenever at most two (none, one, or exactly two) of its input variables A,B,C,D are TRUE, and returns FALSE otherwise.

  4. Consider the latch circuit discussed in the lectures, containing two NOR gates, the first having output Q and inputs Q~, R, the second having output Q~ and inputs Q, S.