PRIME NUMBER CHECKING 8086 PROGRAM
AIM : TO CHECK WHETHER A GIVEN NUMBER IS PRIME OR NOT (8086 PROGRAM)
PROGRAM :
INPUT OUTPUT
[1300] : 0004 [1302] : 0000
[1300] : 0005 [1302] : 0001
RESULT
8086 PROGRAM TO CHECK WHETHER A GIVEN NUMBER IS PRIME OR NOT HAS BEEN EXECUTED SUCCESSFULLY AND OUTPUT IS VERIFIED.
AIM : TO CHECK WHETHER A GIVEN NUMBER IS PRIME OR NOT (8086 PROGRAM)
PROGRAM :
ADDRESS | LABEL | MNEMONICS | DESCRIPTION |
---|---|---|---|
1000 | MOV BX,0002 | MOVE 0002 INTO BX | |
1004 | MOV MOV AX,[1300] | MOVE THE CONTENT OF 1300 TO AX | |
1008 | MOV DX,0001 | MOVE 0001 INTO DX | |
100C | CMP AX,0002 | COMPARE AX WITH 2 | |
1010 | JZ L2 | JUMP TO L2 IF ZERO | |
1012 | L1 | MOV DX,0000 | INITIALIZE DX WITH ZERO |
1016 | DIV BX | DIVIDE AX WITH BX | |
1018 | CMP DX,0000 | COMPARE DX WITH 0000 | |
101C | JZ L3 | JUMP TO L3 IF ZERO | |
101E | MOV AX,[1300] | MOVE CONTENT OF 1300 TO AX | |
1022 | INC BX | INCREMENT BX | |
1023 | CMP AX,BX | COMPARE AX WITH BX | |
1025 | JNZ L1 | JUMP TO L1 IF NOT ZERO | |
1027 | L2 | MOV [1302],0001 | MOVE 0001 TO 1302 |
102C | L3 | MOV [1302],DX | MOVE DX TO 1302 |
1030 | HLT | STOP |
INPUT OUTPUT
[1300] : 0004 [1302] : 0000
[1300] : 0005 [1302] : 0001
RESULT
8086 PROGRAM TO CHECK WHETHER A GIVEN NUMBER IS PRIME OR NOT HAS BEEN EXECUTED SUCCESSFULLY AND OUTPUT IS VERIFIED.
great
ReplyDelete