CSCI 261 Midterm Examination Spring 11 ====================================== Instructor: Dr. Peter Walsh Time: 1:10 -- Maximum Number of Points: 50 Complete all questions in the supplied booklet. All questions refer to our in-class or in-lab coverage of the m68hc11 computer or the SSBC computer. This is a closed book no-notes examination. You must adhere to all programming conventions discussed in class. Q1 [4 points] In your answer booklet, indicate which of the following statements are true and which are false. 1. The SSBC is a 8 bit computer. 2. Computer organization refers to attributes visible to the programmer. 3. pshx has more than one addressing mode. 4. tsy has a 2 byte opcode Q2 [3 points] (a) Convert the following to their IEEE 754 single precision floating point representation. 1. -2.5 (base 10) 2. 12.0 (base 10) Q2 [3 points] (b) Convert the following to their 8 bit 2's complement representation. 1. -32 (base 10) 2. 52 (base 10) Q3 [3 points] (a) Compare and contrast extended, relative and indexed mode of addressing. Q3 [7 points] (b) Derive the machine code (in hex) for the assembly code in signan.s (see handout). Assume the first byte of the program is to be located at address 0x2000. Q4 [10 points] Write an SSBC assembly language program that implements the following to specification: Implement following to specification (on the SSBC): ---=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -- Assumptions -- none -- Behaviour -- main passes an address a (big endian) to the subroutine -- the parameter is passed on the stack -- the subroutine implements the following pseudo code -- *a=*a+2 (increment the value referenced by a by 2) ---=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Q5 [10 points] Consider the assembly code in sigman.s (see handout). The code is written in-line without any subroutines. Restructure the code such that the a function is used to calculate the value of sigma-n. Your solution must have the same behaviour as the code in sigman.s. Q6 [10 points] Develop verification test-cases for the function you implemented from Q5. Use the following skeleton bats.script as your starting point (do not reproduce this skeleton in your answer booklet). include(CewDir/bin/cew.gdb) # Cew for asm Testing Script # Peter Walsh Feb 2001 #------------ gdb/cew Initialization ------------- #set remotebaud 9600 #target buffalo /dev/ttyS0 target sim load midterm.elf set language asm cew_Variables #-------------- Local Assumptions ---------------- #-------------- Local Constants ------------------ #-------------- Local Functions ------------------ #---------------- Test Cases ----------------------- cew_Summary quit