Вы находитесь на странице: 1из 2

1. If AX = FFFFh and BX = 0001h and execute ADD AX, BX what will be the content of S, P, Z, C and O flag? 2.

5 AX = FFFFh BX = 0001h After ADD AX,BX, AX will contain AX = 1 0000h Then Sign Flag S = 1 Carry Flag C = 1 Parity Flag P = 0 Zero Flag Z = 1 Overflow Flag O = 1 For unsigned Z, P, O, C flag will change.

2. Explain the following statement: Segment offset addressing allows relocation. 2.5 The first 1MB memory is Real memory 1 MB requires 20 bit address segment register is 16bit register, so it cant store the actual address. Each segment is 64 KB & Offset address is 16 bit or 2 byte. So, Actual address = Segment address + Offset address From this solution we can see that for each segment address is constant. If we change the offset address it will point to different location in that segment. So it is said that Segment offset addressing allows relocation.

3. Let AX = 7FFFh and BX = 8000h and you use the following two instructions CMP AX, BX JG TOP Do you think it will jump to the TOP. Explain your answer. 2.5 AX=7FFFh BX=8000h CMP AX, BX; it is a bitwise operation. JG TOP; it will jump to TOP label if AX is greater than BX else will stop loop Explain: As AX is greater than BX to it will jump to TOP label. Write a program in Assembly to read a character and display it 80 times on the next line. 7.5 .MODEL SMALL .DATA .CODE .STARTUP MOV AH, 1 ;for taking input AH should be 1 INT 21H ;Input from keyboard MOV AH, 2 ;for displaying AH should be 2 MOV DL, 0DH ;Carriage return INT 21H ;Go to next line MOV CX, 80 ;Set the value for loop

MOV DL, AL ;Move AL to DL for displaying DSP: INT 21H ;display the charecter LOOP DSP ;loop until CX is zero .EXIT END 1. What are the differences between SMAL and TINY model? 2.5

SMALL: Code segment and data segment both have separate segment and the segment size is one. TINY: Code segment and data segment are in one common segment 2. What are the differences between C flag and O flag? 2.5 Carry Flag: C = 1 if there is a carry out from the msb on addition Or, there is a borrow into the msb on subtraction C = 0 otherwise Overflow Flag: O = 1 if signed overflow occurred O = 0 otherwise 4. Write a sequence of instructions to do the following 8 Put the sum 1 + 2 + 3 + . + 10 in AX

1+2+3+4+5+6+7+8+9+10=AX Code: .MODEL SMALL ,STACK 100H .DATA .CODE MAIN PROC MOV BX,2; Load BX register with one MOV CX,9; Set the loop number MOV AX,1; Load AX initially with one SUM: INC BX; Increase BX register BX=BX+1 ADD AX,BX; Add BX value with AX and store in AX LOOP SUM; Loop sum for CX times MAIN ENDP END MAIN

Вам также может понравиться