Vous êtes sur la page 1sur 13

8 Looking for IT Jobs visit www.joblelo.com and register Now..

7 Looking for IT Jobs visit www.joblelo.com and register Now..

6 Looking for IT Jobs visit www.joblelo.com and register Now..

5 Looking for IT Jobs visit www.joblelo.com and register Now..

4 Looking for IT Jobs visit www.joblelo.com and register Now..

1 Looking for IT Jobs visit www.joblelo.com and register Now..

2 Looking for IT Jobs visit www.joblelo.com and register Now..

3 Looking for IT Jobs visit www.joblelo.com and register Now..

9 Looking for IT Jobs visit www.joblelo.com and register Now..

4) (a). Write a program in 8086 assembly Language (with proper comments) to count the

number of those alphabets that are same as well as are at the same position in two
different strings. For example, in case the strings are: "ABCDEFGHIJ" and
"BDCDABCDEF", this count is 2, as the 3rd and 4th positions in both the strings
contains C and D, respectively. You may assume that both the strings are available in
the memory and are of length 10. Make suitable assumptions, if any.

DATA SEGMENT
STR1 DB ABCDEFGHIJ
STR2 DB BDCDABCDEF
CNT DB 0H
MSG1 DB 10,13,FISRT STRING IN MEMORY IS : $
MSG2 DB 10,13,SECOND STRING IN MEMORY IS : $
MSG3 DB 10,13,COUNT OF SAME POSITION EQUAL CHAR(S) IS : $
DATA ENDS
DISPLAY MACRO MSG
MOV AH,9
LEA DX,MSG
INT 21H
ENDM
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX
DISPLAY MSG1
DISPLAY STR1
DISPLAY MSG2
DISPLAY STR2
LEA SI,STR1
LEA DI,STR2
MOV CX,10
CHECK:
MOV AL,[SI]
CMP [DI],AL

10 Looking for IT Jobs visit www.joblelo.com and register Now..

JNE NOTEQU
INC CNT
NOTEQU: INC SI
INC DI
LOOP CHECK
DISPLAY MSG3
MOV DL,CNT
ADD DL,30H
MOV AH,2
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START

(b) Write a program in 8086 assembly language to convert a four digit packed BCD
number into equivalent ASCII digits. The packed BCD number may be assumed to be
stored in memory. Your program should print the four ASCII digits.
DATA SEGMENT
BCD DW 1234H
ASCII DB 5 DUP ($)
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV AX,BCD
MOV BH,AH
MOV BL,AL
AND AH,0F0H
AND BH,0FH
AND AL,0F0H
AND BL,0FH
MOV CL,04H
ROL AH,CL
MOV CL,04H
ROL AL,CL
ADD AX,3030H
ADD BX,3030H

11 Looking for IT Jobs visit www.joblelo.com and register Now..

LEA SI,ASCII
MOV [SI],AH
INC SI
MOV [SI],BH
INC SI
MOV [SI],AL
INC SI
MOV [SI],BL
INC SI
LEA DX,ASCII
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START

(c) Write a simple near procedure in 8086 assembly language that receives one 16 bit
number as parameter value on the stack from the main module. It returns 0 if the
upper byte of the number is 0, else returns 1. Make suitable assumptions, if any.

DATA SEGMENT
MSG DB BIT RETURNED IS : $
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV BX,0FFFH
LEA DX,MSG
MOV AH,9
INT 21H
PUSH BX
CALL CHECK

12 Looking for IT Jobs visit www.joblelo.com and register Now..

ADD DL,30H
MOV AH,2
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
CHECK PROC NEAR
POP AX
POP BX
AND BH,11110000B
MOV CL,4
ROL BH,CL
CMP BH,0
JE SKIP
MOV DL,1
JMP DONE
SKIP:
MOV DL,0
DONE:
PUSH AX
RET
CHECK ENDP
END START

13 Looking for IT Jobs visit www.joblelo.com and register Now..

Vous aimerez peut-être aussi