CSCI 360 | Spring 2014 |
The following questions are taken from the second examination of previous semesters. They will not appear on this semester's second exam, but they are similar to questions which likely will. Be sure to not limit your review to just these questions.
True/False Circle the T or F T F 1 An index register can be specified on an MVI instruction. T F 2 The BCTR instruction always changes the value in the first operand. T F 3 A decimal overflow exception occurs when the multiplicand does not have enough leftmost zeroes in an MP instruction. T F 4 There are no circumstances in which a PACK instruction can cause a data exception (0007). T F 5 The ORG instruction is typically used to alter the value of the location counter. T F 6 The AP and SP instructions can cause fixed point overflow. T F 7 The CLC instruction has two length fields. T F 8 There is no need to set R1 to an initial value prior to ED. T F 9 The ZAP instruction has two length fields, each at most 16. T F 10 The immediate operand of MVI and CLI is written with '=' and is assembled in the literal pool. T F 11 The MVC instruction always moves exactly the number of bytes specified in its length field. T F 12 The branch is always taken when a BAL instruction is executed. T F 13 A decimal divide exception results from a DP instruction when the quotient is too large to fit the space available to hold it. T F 14 Both C-type and X-type constants pad on the right. T F 15 Both PACK and UNPK may be used to swap the digits of a byte. Encoding/Decoding Given the following assembler instruction or object code, encode or decode as requested. OBJECT CODE ASSEMBLER INSTRUCTION _______________________ SRP 23(11,R9),(64-1),1 FD3110102002 ___________________________ _______________________ MVI 5(R1),C'$' _______________________ LM R2,R4,256(R8) Editing Use the given edit patterns and packed decimal field contents to determine the resulting edited field contents after the following EDIT instruction has been executed. Give the complete hexadecimal contents of each byte. The instructions are not cumulative. Assume original contents of each field for each question. ED PATTERN,FLD1 FLD1 PATTERN (PATTERN) EDITED RESULT X'00998D' X'5C20206B20212060' __________________________________ X'00123F' X'402120204B202060' __________________________________ SRP Instruction Use the following contents of FLD1 and the given SRP instructions to determine the complete contents of FLD1 (in hexadecimal) after the execution of the SRP instructions. Specify any error conditions which might occur. FLD1 INSTRUCTION RESULT X'7654321D' SRP FLD1(4),(64-5),5 ___________________________ X'00149C' SRP FLD1(3),3,0 ___________________________ X'0045454C' SRP FLD1(4),(64-1),5 ___________________________ Packed Decimal Given the following field definitions. Perform the indicated packed decimal operations. Give the COMPLETE contents of each BYTE of the receiving field (in hex) after the execution of the instruction. The instructions are not cumulative; Assume original contents of each field for each question. NUM1 DC X'00250C' NUM2 DC X'00100B' NUM3 DC X'00000004005C' NUM4 DC X'100F' NUM5 DC X'0000100C' NUM6 DC X'1A2A3A4A' A. UNPK NUM6(4),NUM4(2) _____________________________ B. ZAP NUM5(4),NUM2(3) _____________________________ C. SP NUM1(3),NUM2(3) _____________________________ D. MP NUM5(4),NUM4(2) _____________________________ E. DP NUM3(6),NUM4(2) _____________________________ F. PACK NUM3(6),NUM6(4) _____________________________ G. CP NUM5(4),NUM4(2) CONDITION CODE = ________ Short Coding 1. Store registers 10 through 4 in storage area RSAVE. (Define RSAVE to be the exact size needed.) 2. Restore all the above registers except 10 and 12. 3. Test the contents of storage locations ONE DS PL7 and TWO DS PL6. Branch to label FOUND if ONE and TWO are not equal. 4. Write a parameter list that will provide a subroutine access to storage areas labelled HAVENOT, CANNOT, and WILLNOT. 5. Write one instruction to change the one-byte value at CHAR to a dollar symbol. 6. Show the EBCDIC result of the following MVC instruction (no partial credit.) MVC SAYING+6(10),SAYING+2 ... SAYING DC CL16'NOVEMBER IS COLD' SAYING C'_______________________________________________' The following short coding questions each assume that VAL1 is: VAL1 DC X'0020551D' Initial value You are to write a single instruction to change VAL1 to the given new value. Your instruction may refer to a literal unless otherwise indicated. You may NOT use ZAP. (The changes are NOT cumulative.) New value Instruction 7. X'1234567D' __________________________________________________ 8. X'04110C1D' __________________________________________________ 9. X'0002056D' __________________________________________________ [Do not reference a literal] 10. X'0020551C' __________________________________________________ [Do not reference a literal. This one is tricky] Long Coding The following is a complete assembly language program. 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 ANY BE WRITTEN IN. MAIN CSECT USING MAIN,15 STM 0,15,MAINSAVE Save all registers * LA 1,BLDPARM Get parameters for BUILD BAL 14,BUILD Go build the table * LA 1,RPTPARM Get parameters for REPORT BAL 14,REPORT Go compute values * LM 0,15,MAINSAVE Restore all registers BR 14 Return to caller * MAINSAVE DS ___________________ Register save area OUTBUF DS CL133 Output buffer ORG OUTBUF Save some space INBUF DS CL80 Input buffer _________________________ Reset to where we were [2 pts] TABLE DS 90F Room for 20 entries TABLEANA DC A(________________) @ of next available entry BLDPARM DC A(TABLE,TABLEANA,INBUF) BUILD parameter list RPTPARM DC A(TABLE,TABLEANA,OUTBUF) REPORT parameter list * * BUILD Subroutine * BUILD STM 0,15,BLDSAVE Save all registers LM 9,11,____________ Get parameters XREAD 0(11),80 Get first record * BLDLOOP _________________________ Check for end of file PACK 0(3,9),0(5,11) Tree ID PACK 3(3,9),9(4,11) Year planted PACK 6(4,9),17(6,11) Original cost PACK 10(4,9),27(6,11) Estimated replacement cost PACK 14(4,9),37(6,11) Actual replacement cost * LA 9,18(,9) Get to next table entry XREAD 0(11),80 Get next record, if any B ___________________ Continue * BLDEOF ST ___________________ Return new TABLEANA [2 pts] LM 0,15,BLDSAVE Restore all registers BR 14 Return to MAIN * BLDSAVE DS ___________________ Register save area * * REPORT Subroutine * REPORT STM 0,15,RPTSAVE Save all registers LM 9,11,____________ Get parameters * RPTLOOP _________________________ Is table finished? [2 pts] BNL RPTDONE Branch if so _________________________ Increment TREECNT by 1 MVC 0(133,11),=CL133' ' Clear print line * _________________________ Get tree ID to PWORK4 [2 pts] DP PWORK4,=P'100' Break into Block Num and Tree Num SP PWORK4(2),=P'100' Eliminate first digit '1' MVC 1(25,11),PATT1 Set header and pattern ED 16(10,11),PWORK4 Get both block and tree numbers * ZAP PWORK4,14(4,9) Get actual cost MVC 30(17,11),HDR2 Set header MVC 47(10,11),COSTPATT Set pattern _________________________ [2 pts] EDMK 47(10,11),PWORK4 Get actual cost S R1,=F'1' Back up MVI 0(1),C'$' Set currency symbol AP TREECOST,__________ Add actual cost to total * XPRNT 0(11),133 Print the line LA 9,18(,9) Get to next table entry B ___________________ Continue * RPTDONE MVI ___________________ Clear the print line, MVC ___________________ including carriage control ZAP PWORK6,TREECOST Get total cost of all trees SRP PWORK6,2,0 Multiply to preserve significance DP PWORK6,TREECNT Get cost per tree SRP PWORK6(4),(64-2),5 Shift back and round MVC 1(23,11),HDR3 Set header MVC 24(10,11),COSTPATT Set pattern _________________________ [2 pts] EDMK 24(10,11),PWORK6 Get printable cost S R1,=F'1' Back up MVI 0(1),C'$' Set currency symbol * XPRNT 0(11),133 Print the line LM 0,15,RPTSAVE Restore registers BR 14 * PATT1 DC CL15'Block / Tree = ' DC XL10'____________________________________________________' * [3 pts for the above. The pattern should display both * the block and tree so that the values appear as * ' nnn nnn ' (without the quotes, of course) ] * HDR2 DC CL17' Original Cost = ' * HDR3 DC CL23' Total cost per tree = ' Fill and msg chars * COSTPATT DC XL10'____________________________________________________' * [3 pts for the above. The pattern should be such that * the result is displayed as $nn,nnn.nn] * RPTSAVE DS 16F Register save area TREECNT DC PL2'0' Number of records processed TREECOST DC PL4'0' Total cost of all trees PWORK4 DS PL4 Work area PWORK6 DS PL6 Work area * _________________________ Always present * END MAIN