in English suomeksi Exercises

Computer Organization I, HT 3

  1. [2 htp] Complete the program lh_kutsu.k91 (in the example program directory) by implementing subroutine SUBR(X, A, B), which modifies parameter X into the difference of value parameters A and B. Parameter X is given as call-by-reference parameter.

    Check your program by compiling and running it in Titokone.


  2. [2 htp] Data representation.
    1. What is decimal number 43.234 in binary?
    2. What is binary number 101010.1010 in decimal?
    3. What are the 16-bit Big-Endian binary representations of decimal numbers +23 and -75 in following formats:
      1. sign and magnitude
      2. two's complement
      3. one's complement
      4. biased by 32767
    4. What is the IEEE floating point standard representation of decimal number 33.125?
    5. Assume that there are boolean and floating point data types in programming language MyLan. For example, one can use boolean and floating point variables in MyLan programs.

      Now, ttk-91 does not have these data types. Could one build a MyLan compiler, that would allow using MyLan programs in ttk-91 systems. If yes, how? If not, why not?

  3. [2 htp] personner register record type is defined with pseudoinstructions  
    	; record person:        3 integer fields 
    	Id   	EQU  0   ; relative address within record
    	Age     EQU  1
    	Salary  EQU  2
    

    Records Pekka and Jussi have been allocated and initialized from memory, and record Maija has been allocated but not initialized from memory with pseudoinstructions

    	Pekka   DC   3214   ; ID     =  3214
            P1      DC     35   ; AGE    =    35
            P2      DC  12345   ; SALARY = 12345
            Jussi   DC   8888
            J1      DC     54
            J2      DC  14321
            Maija   DS      3   ; initial values not defined


    Example: If R4 points to the beginning of record Pekka, then Pekka's salary is loaded into register R5 with machine instruction  "LOAD   R5, Salary(R4)". Labels P1, P2, J1 and J2 are there because Titokone can not handle DC-instructions without label-fields.

    Write a ttk-91 symbolic assembly language program that

    1. prints out the values of each field in record pointed by register R1, when register has first been initialized to point to Jussi's information with intruction "LOAD   R1, =Jussi".
    2. Sets Maija's id to 6666, age to 32, and salary to the same as Jussi has currently.
    3. Prints the sum of salaries for Pekka, Jussi and Maija.
    4. Finds out and prints the age of the youngest person of these three persons right now.

    Check your program by compiling and executing it with Titokone.

    Use standard method for building and taking apart activation records, when implementing subroutines and functions. Take care, that all work registers (R0-R5) have the same value at the time of subroutine or function return as they were when the subroutine or function call was made.

 

Teemu Kerola