The document contains 5 questions about assembly language programming. Question 1 has short answer problems about operations on registers including AND, OR, XOR, RCL, RCR, SHRD, SHLD, DIV, IMUL. Question 2 has short programming problems copying bits between registers, conditional jumps, and implementing while loops. Question 3 has problems tracing code segments and predicting register values. Question 4 asks to draw a flowchart for a loop that adds array elements. Question 5 provides a table and asks to write a program that takes a test score and displays the letter grade.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100%(1)100% found this document useful (1 vote)
592 views6 pages
Question # 1. Short Answer Problems (34 Points)
The document contains 5 questions about assembly language programming. Question 1 has short answer problems about operations on registers including AND, OR, XOR, RCL, RCR, SHRD, SHLD, DIV, IMUL. Question 2 has short programming problems copying bits between registers, conditional jumps, and implementing while loops. Question 3 has problems tracing code segments and predicting register values. Question 4 asks to draw a flowchart for a loop that adds array elements. Question 5 provides a table and asks to write a program that takes a test score and displays the letter grade.
d. What are the correct values of the Carry, Zero, and Sign flags after the following instructions execute? (6 points, 3 pts each)
i. mov al, 6 cmp al, 5 ; CF = ZF = SF =
ii. mov al,00110011b test al,2 ; CF = ZF = SF =
Question # 2. Short Programming Problems (25 points)
a. Write a sequence of two instructions that copies bits 0-5 from AL to bits 0-5 in BL. Bits 6-7 in BL should be cleared, and AL should be unchanged. (5pts)
b. Write a sequence of two instructions that copies the integer in bits 4-7 from the AL register into bits 0-3 of the BL register. The upper 4 bits of AL will be cleared, as will the upper 4 bits of BL. . (5pts)
3 c. Code instructions that jump to the label L1 when either bit 2 or 3 is set in the DL register (do not modify DL). (5pts)
d. Write instructions that implement the following pseudo-code using conditional jump instructions. Do not use the .IF directive. Assume that integers are signed. (5pts)
if (eax > ecx ) mov dl, +7 else mov dl, -2
e. Implement the following pseudo-code with assembly language statements without using the .WHILE, the .IF or any other directive. (5pts)
6 Question # 5. Programming (10 points) --- use the back of the page if needed ----
Using the following table as a guide, write a program that asks the user to enter an integer test score between 0 and 100. The program should display the appropriate letter grade:
Score Range Letter Grade 90 to 100 A 80 to 89 B 70 to 79 C 60 to 69 D 0 to 59 F
Hint: You may use the pseudo .IF, .ELSEIF,.ELSE and .ENDIF directives.