CSCI 360 Spring 2014

Review Questions for CSCI 360 Exam 1

The following questions are taken from the first examination of previous semesters. They will not appear on this semester's first exam, but they are similar to questions which likely will. Be sure to not limit your review to just these questions.


 Convert the following UNSIGNED numbers:

 DECIMAL                     BINARY                  HEXADECIMAL

  2345              ___________________________    _______________

 ______________           110010011110             _______________

 ______________     ___________________________          235B




 Do the following UNSIGNED integer arithmetic: 

 BINARY       1 0 1 0 1 0 1 0 1 1             1 1 0 1 0 0 0 1 1 0
            + 1 0 1 1 1 0 1 1 1 1           -   1 0 0 0 0 1 1 1 1
            ---------------------           ---------------------



 HEXADECIMAL     8 6 7 B                3 F 0 A 7 D C 0
               + E 8 F 9              - 1 0 C F B A 4 D
               ---------              -----------------




 Do the following FULLWORD (two's complement)
 arithmetic and determine if any overflow occurred and 
 EXPLAIN why or why not:


         5 8 9 A B 8 7 E                        C 8 5 2 9 A C D
       + 4 7 B F 8 7 5 2                      - C 4 8 8 6 B A 6
       -----------------                      -----------------





 Write the correct number in each blank:

    A fullword contains_____bytes.  A fullword contains_____bits.

    RR instruction size =_____bytes.  RX instruc. size =_____bytes.

         A PSW contains ____ bits or ____ bytes or _____ fullwords.

          What is the ANSI print carriage control character for:
          Note: A blank with nothing written in it is NOT an answer!

          a. Top of Page______          b. Single Space______

          c. Double Space______         d. Triple Space______




 Given the following register contents, calculate
 absolute addresses (in Hexadecimal) for the D(B) or
 D(X,B) addresses given below (6 points)

 R0 = 00000040     R1 = F4F4F4F4     R2 = 00000359     R3 = 80012345


 35(0,3) ____________      28(1) ____________   16(2,3) ____________



                   
 Answer the following questions using the PSW AT ABEND
 given below.  Give 'address' answers in hexadecimal.

 PSW AT ABEND    FFC50001  5F000E34

 Contents of memory starting at address (hex) 000E20

 Address     Contents

 000E20      40125802 5012D503 50301231 5872F01C 1A5500CC 47B0F010


 1.  What is the address of the instruction
     WOULD HAVE BEEN EXECUTED NEXT
     had the program not ABENDed
     on the current Instruction?  ___________________________

 2.  What is the length (in bytes) of the
     instruction that caused the ABEND? ___________________________


 3.  What is the condition code? (Answer with decimal number) ____


 4.  What is the address of the
     instruction that caused the ABEND? __________________________


 5.  What type of program interrupt occurred?

     Number ____________    Name __________________________________



 6.  Write the NEXT instruction that would have been
     executed as the programmer would have written it
     in EXPLICIT assembler language using decimal values.

  
     _________________________________________________________






 Encoding/Decoding. (26 points)  Fill in the blanks on the 
 assembly listing below, using IMPLICIT addresses where possible:

 LOCATION COUNTER   MACHINE                 SOURCE
 VALUE (HEX)        LANGUAGE (HEX)          LANGUAGE

           000000                           EXAM1    CSECT
           000000                                    USING EXAM1,15
           000000   _______________                  L     2,F33 

         ________   _______________                  LA    3,3

         ________   _______________                  MR    2,2

         ________   5020 F034                        _______________

         ________   _______________                  AR    3,3      

         ________   5D20 F02C                        _______________

         ________   47A0 E000                        _______________

         ________   _______________                  BR    14

         ________   _______________         F129     DC    F'129'

           000020   _______________         F33      DC    F'33'

         ________   _______________         AB       DC    2CL3'AB'

         ________   _______________         BC       DC    F'-15'

         ________   _______________         CD       DC    3C''''

         ________   _______________         TOTAL    DS    F'33'

                                            END      EXAM1



 Write assembly instructions to perform the following tasks. 
 (Define any extra storage you reference.)  Inefficient code
 will not receive full credit.  Use literals where possible.

 1.      Quadruple the value in register 2.                           
                              



 2.      Increment the value in register 7 by 5182.




 3.      Initialize register 0 to zero.




 4.      Multiply the contents of register 11 by -99.




 5.      Divide the contents of register 8 (which contains
         32) by the contents of register 6.






 6.      Test the contents of registers 2 and 3.  Branch
         to the label FOUND if the contents of register 2 are
         not equal to the contents of register 3.





 7.      Write the equate statement necessary to equate the
         value 3 with the symbol SAVE.



 
 8.      Save the contents of register 10 into a fullword labelled TRUMP.



 Given the starting values listed for registers and a
 portion of storage, show the complete contents (in hex)
 after execution of the instruction.  Starting values
 apply to each instruction.  Results are NOT cumulative.

 STARTING VALUES (For EACH INSTRUCTION):

   R0 = 00000200    R1 = FF000204    R3 = 0000036C    R4 = FFFFFFFF
   R5 = FFFFFFFF    R6 = 00000004    R7 = 00000064    R8 = 00000004

         ADDRESS  CONTENTS
         000200   F5F5F5F5 0000003C 00000123 00000008

          LR    5,6          R5 = _____________

          LA    1,2(0,3)     R1 = _____________

          L     6,4(6,1)     R6 = _____________

          DR    4,8          R4 = _____________  R5 = _____________

          AR    0,6          R0 = _____________

          MR    4,4          R4 = _____________  R5 = _____________

          LTR   3,4          R3 = _____________

 Write the assembler source code to implement
 the expression below.  Assume that all fields have already
 been correctly defined as fullwords in your storage area.  
 Provide all necessary labels.  Use literals if appropriate.
 Rounding is NOT necessary.

          VALUE = ((NUM4 - NUM3)/2) * NUM2) + NUM4




 The following complete assembly language program reads an unknown 
 number of 80 byte records and calculates the average of the first    
 number found on all records.  Some parts of the program have been
 left out, and you are to fill in each blank with the appropriate
 value. What follows is the complete program: no additional fields
 are available, nor may they be written in.                                                           
 
 CALCUL8  CSECT ,                   Begin program

          USING ________________    Define base register
          SR    3,3                 Initialize sum of card values
          SR    4,4                 Initialize count of valid values
          XREAD CARD,80             Read first record
 *
 LOOP     BC    ____________,EOF    Finished if no more records

          XDECI ________________    Get first number from record

          BC    ________________    B if none found
          AR    3,0                 Else add to total

          A     4,______________     And increment count of numbers
 NEXTCARD XREAD CARD,80             Get next input record

          ______________________    Continue
*
 EOF      LTR   4,______________    Any numbers found?
          BC    B'1000',SAVE        No, save zero

          M     2,______________    Prepare to divide

          DR    2,______________    Get average in R3
          AR    2,2                 Double the remainder
          CR    2,______________    Compare with divisor

          BC    ___________,SAVE    Branch if no rounding needed

          A     3,______________    Else round up
 *
 SAVE     ST    3,AVG               Save for XDUMP

          XDUMP ________________    Display value saved above

          BCR   ________________    Return to caller
 *
          ______________________    (This belongs in every program!)

 CARD     DS    ________________

          DC    ________________

 AVG      DS    ________________
          END   CALCUL8