Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Home Task : 1

Write an assembly code that will determine whether a number is greater than 5 or equal of less,
and put 0 or 1 or 2 for the conditions in DX.

ASSEMBLY CODE:
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV AX,5H
MOV BX,3H
CMP AX,BX
JG AAA
JE BBB
JL CCC
AAA:

MOV DX,0H
JMP LAST

BBB:

MOV DX,1H
JMP LAST

CCC:

MOV DX,2H
JMP LAST

LAST: INT 3
CODE ENDS
END

Home Task : 2
Subtract 86B1H from 3F42H and store 0 in CX if overflow occurs and 1 if no overflow occurs.

ASSEMBLY CODE:
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV AX,3F42H
MOV BX,86B1H
SUB

AX,BX

JO OVERFLOW
MOV CX,1
JMP LAST

OVERFLOW: MOV CX,0


JMP LAST
LAST: INT 3
CODE

ENDS
END

Home Task : 3
Take 2 arbitrary numbers x and y. If x>1000H perform x+y. If y<1000H perform x-y. If
x>1000H and y<100H perform x = x.

ASSEMBLY CODE:
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV AX,1001H
MOV BX,2002H

CMP AX,1000H
JG

TASK1

CMP BX,1000H
JL TASK3

TASK1:

CMP BX,100H
JL

TASK2

ADD AX,BX
JMP LAST
TASK2:

NOT AX
JMP LAST

TASK3:

SUB AX,BX
JMP LAST

LAST:

INT 3

CODE

ENDS
END

You might also like