CS401-Computer Architecture & Assembly Language Programming
Fall 2010 Mid Term Paper
1. The shift logical right operation inserts
2. After the execution of “PUSH AX” statement
3. The extended ASCII has 256 characters
4. The iAPX88 processor supports _____________modes of memory access.
5. In STOS instruction, the implied source will always be in AL or AX
6. The maximum memory, IAPX88 can access is________.
7. The registers IP, SP, BP, SI, DI, and BX all can contain a ________offset.
8. In the “mov ax, 5” 5 is the __________ operand.
9. In MUL instruction if the source operand is a word then it is multiplied by
10. The prevalent and standard format for representation of characters in
11. which bit sets the character “blinking” on the screen?
12.“mov byte [num1], 5” is _________ instruction.
13. ____ can process blocks of data in one go.
14. In string instructions, CX is always
15. STOS transfers a byte or word from register AL or AX to the string element
16. The execution of the instruction “mov word [ES : 0], 0x0741” will print
character “A” on screen, color of the character will be
17. In A4FB:4872 Segment:offset pair the physical address is (both segment
and offset are in hexadecimal): A9822
18. Which of the following operations relating to PUSH is true?
19. If the decimal number “35” is shifted by two bits to left, the new value will
20. Which of the following flags will be affected by MOVSB?
21. Explain the fuction of rotate right (ROR) instruction
The rotate right (ROR) and rotate through carry right (RCR) instructions shift all
the bits toward less significant bit positions, except for the least-significant bit,
which is rotated to the most-significant bit location
22.Why REP prefix is generally not used with LODS instruction?
The lods instruction is unique among the string instructions. We will never use a
repeat prefix with this instruction. Because it copies the byte or word pointed at
by ds:si into the al, ax, or eax register, after which it increments or decrements
the si register by one, two, or four. Repeating this instruction via the repeat prefix
would serve no purpose whatsoever since the accumulator register will be
overwritten each time the lods instruction repeats. At the end of the repeat
operation, the accumulator will contain the last value read from memory.
23.Write all steps of algorithm for printing number 352.
In this technique the first digit printed is the right most one
Divide the number by base (10 in case of decimal)..The remainder after
first division was 3, after second division was 5 and after the third division
• The remainder is its right most digit
• Convert the digit to its ASCII representation
• Save this digit on stack
• If the quotient is non-zero repeat the whole process to get the next
digit, otherwise stop.
• Pop digits one by one and print on screen left to right. Stack is a Last In First Out
structure so if 3, 5, and 2 are pushed on it, 2, 5, and 3 will come
out in this order.
24. What are the result after performing the instruction (each carry 1
1. and ax,bx
2. or ax,bx
3. xor ax,bx
Given that ax = 00110011 and bx = 00010001
25. Describe Local Variables?
A local variable is valid within the statement block in which it is defined and
within any nested statement blocks, unless you redefine the variable within the
Local variables should be created when the subroutine is called and discarded
afterwards. So that the spaced used by them can be reused for the local variables
of another subroutine. They only have meaning inside the subroutine and no
meaning outside it.
It is important role of the stack to create local variables that are only needed
while the subroutine is in execution and not afterwards. They should not take
permanent space like global variables.
The most convenient place to store these variables is the stack. We need some
special manipulation of the stack for this task. We need to produce a gap in the
stack for our variables.
Are valid only for the duration of the SPL routine
Are reset to their initial values or to a value the user passes to the routine, each
time the routine is executed
Cannot have default values
26. Explain the complete operation of Interrupt when it is generated.
Interrupt is the result of an INT instruction (software interrupt) or it is generated
by an external hardware which passes the interrupt number by a different
mechanism. The currently executing instruction is completed, the current value of
FLAGS is pushed on the stack, then the current code segment is pushed, then the
offset of the next instruction is pushed. After this it automatically clears the trap
flag and the interrupt flag to disallow further interrupts until the current routine
finishes. After this it loads the word at nx4 in IP and the word at nx4+2 in CS if
interrupt n was generated. As soon as these values are loaded in CS and IP
execution goes to the start of the interrupt handler. When the handler finishes its
work it uses the IRET instruction to return to the caller. IRET pops IP, then CS, and
then FLAGS. The original value of IF and TF is restored which re-enables further