0% found this document useful (0 votes)
33 views4 pages

MP Lab Programs

The document contains programs to: 1. Find the 2's complement of a 16-bit number by negating the ax register. 2. Check if a given number is even or odd by shifting the number and checking the carry flag. 3. Convert a binary number to gray code by rotating the bits and XORing with the original value.

Uploaded by

Bhanu Kodali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views4 pages

MP Lab Programs

The document contains programs to: 1. Find the 2's complement of a 16-bit number by negating the ax register. 2. Check if a given number is even or odd by shifting the number and checking the carry flag. 3. Convert a binary number to gray code by rotating the bits and XORing with the original value.

Uploaded by

Bhanu Kodali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Date: 2’s complement of 16bit number Exp.

No:4(a)

Aim: - To write an 8086 Assembly Language Program to find 2’s complement of a given
16bit number.
Program: .model small
.data
a dw 1234H
.code
mov ax, @data
mov ds, ax
mov ax, a
neg ax
end

Output:

Result:

1
Date: CHECK GIVEN NUMBER IS EVEN OR ODD Exp.No:4(b)

Aim: - To write an 8086 Assembly Language Program to check given number is even or odd
Program: ASSUME CS:CODE,DS:DATA
DATA SEGMENT
MSG DB 10,13,’ENTER A NUMBER = $’
MSG1 DB 10,13,’NUMBER IS EVEN $’
MSG2 DB 10,13,’NUMBER IS ODD $’
DATA ENDS
CODE SEGMENT
START:MOV BX,DATA
MOV DS,BX
LEA SI,MSG
CALL PRINT
MOV AH,01H
INT 21H
SAR AL,01
JC ODD
LEA SI,MSG1
CALL PRINT
JMP TERMINATE
ODD:LEA SI,MSG2
CALL PRINT
TERMINATE:MOV AH,4CH
INT 21H
PRINT PROC
MOV DX,SI
MOV AH,09H
INT 21H
RET
PRINT ENDP
CODE ENDS
END START

Output:

Result:

2
Date: BINARY TO GRAY CODE CONEVERSION Exp.No:4(c)

Aim: - To write an 8086 Assembly Language Program to convert binary to gray code
Program: ASSUME CS:CODE,DS:DATA
DATA SEGMENT
ORG 1100H
DATA ENDS
CODE SEGMENT
START:ORG 1000H
MOV SI,1101H
MOV AL,[SI]
MOB BL,AL
CLC
RCR AL,I
XOR BL,AL
MOV [SI+1]],BL
INT 03H
CODE ENDS
END START

Output:

Result:

3
Date: BINARY TO GRAY CODE CONEVERSION Exp.No:4(c)

Aim: - To write an 8086 Assembly Language Program to convert binary to gray code
Program: ASSUME CS:CODE,DS:DATA
DATA SEGMENT
ORG 1100H
DATA ENDS
CODE SEGMENT
START:ORG 1000H
MOV SI,1101H
MOV AL,[SI]
MOB BL,AL
CLC
RCR AL,I
XOR BL,AL
MOV [SI+1]],BL
INT 03H
CODE ENDS
END START

Output:

Result:

You might also like