in English suomeksi Exercises

Computer Organization I, HT 2

  1. Using the ttk-91 symbolic assembly languge, write a program, that does the same as the C program
            int x=8, y=4, z=1700;  /* variables x, y, z */
            main () {             /* main program */
                y = 4;
                x = 852 - z /y +7;
                if (x < 40) {
                    y = x - 34;
                    }
                else {
                    y = x / y + 400000;
                    z = 23;
                    }
                printf ( "%d %d %d \n", x, y, z)  /* print x, y, z */
            }

    Check your program by compiling and executing it with Titokone.

  2. [2 htp] Using the ttk-91 symbolic assembly languge, write a program, that

    1. Allocates space for a 8-entry array Tbl[8]
    2. At execution time initializes array Tbl so that Tbl[i] = 2*i;
    3. Reads a value for variable k from the keyboard
    4. Prints the value of array element Tbl[k]
    5. Computes the sum of values in array Tbl
    6. Prints this sum

    Check your program by compiling and executing it with Titokone.

  3. Memory reference modes.
    Assume that for each instruction below the starting point is the state given in of slide 18 ("TTK-91 muistin osoitusmoodit"). For each instruction, please give the effective address and either the modified register contents or the address and the contents of the modified memory location. If some instructions are not legal, give explanation for it.
    1. LOAD R4, 200
    2. LOAD R3, One(R1)
    3. LOAD R3, =One(R1)
    4. STORE R0, One(R1)
    5. STORE R2, @9(R3)
    6. LOAD R0, @R1
    7. LOAD R1, @(R1)
    8. STORE R1, @(R1)
    9. STORE R0, R1
    10. STORE R2, =One
  4. [2 htp] Design and implement one working practice practice problem. The question in your practice problem is "Why do I study Comp Org I?". Come up with at least 4 different answers with their explanations.

    The goal of this problem is to learn on how to implement practice problems, and so the answers and their explanations are not so important. This gives room for creative humor.
 

Teemu Kerola