Mic CT-2
Mic CT-2
2 marks questions
3.write and ALE to find out largest number the given array
Ans:
DATA SEGMENT
ARRAY DB 10H,24H,02H,05H,17H
LARGEST DB 00H
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
MOV DS,DX
MOV CX,04H
MOV SI ,OFFSET
UP: INC SI
CMP AL,[SI]
JNC NEXT
MOV AL,[SI]
NEXT: DEC CX
JNZ UP
MOV LARGEST,AL
MOV AX,4C00H
INT 21H
CODE ENDS
END START
4.What is the use of REP instruction & also explain string related instruction?
Ans:
REP: REP is a prefix which is written before one of the string instructions. It will cause During length
counter CX to be decremented and the string instruction to be repeated until CX becomes 0.
Two more prefix.
REPE/REPZ: Repeat if Equal /Repeat if Zero. It will cause string instructions to be repeated as long as the
compared bytesor words Are equal and CX≠0. REPNE/REPNZ: Repeat if not equal/Repeat if not zero. It
repeats the strings instructions as long as compared bytes or words are notequalAnd CX≠0.
Example: REP MOVSB
5.Write any two difference between NEAR and FAR procedure
DATA ENDS
EXTRA SEGMENT
BLOCK2 DW?
EXTRA ENDS
CODE SEGMENT
MOV DS, AX
MOV ES, AX
MOV CX,000AH
REPNZ MOVSW
MOV AX,4C00H
INT 21H
CODE ENDS
END START
ADD AL, BL
RET SUM
ENDP
DATA SEGMENT
NUM1 DB 10H
NUM2 DB 20H
NUM3 DB 30H
NUM4 DB 40H
RESULT DB?
DATA ENDS
CODE SEGMENT
MOV DS, AX
CALL SUM
MOV CL, AL
CALL SUM
MUL CL
MOV RESULT, AX
MOV AH,4CH
INT 21H
CODE ENDS
END START
DATA SEGMENT
DATA ENDS
CODE SEGMENT
MOV DS, DX
MOV CL,0FH
ADD DI,0FH
MOV [DI], AL
INC SI
DEC DI
LOOP UP
INT 21H
CODE ENDS
END START
DATA SEGMENT
DATA ENDS
CODE SEGMENT
MOV DS, DX
MOV BL,0AH
JC Down
LOOP step
DEC BL
JNZ step1
CODE ENDS
END START
S.
MACRO PROCEDURE
No.
Macro definition contains a set of Procedure contains a set of instructions
01. instruction to support modular which can be called repetitively which can
programming. perform a specific task.
It is used for small set of instructions mostly It is used for large set of instructions mostly
02.
less than ten instructions. more than ten instructions.
In case of macro memory requirement is In case of procedure memory requirement
03.
high. is less.
CALL and RET instruction/statements are CALL and RET instruction/statements are
04.
not required in macro. required in procedure.