Saturday, 18 March 2017

8086 Program to check whether the given number is odd or even( input and output specification)

SORTING 8086 PROGRAM

AIM : 8086 PROGRAM TO CHECK WHETHER THE GIVEN NUMBER IS ODD OR EVEN

PROGRAM :


ADDRESS LABEL MNEMONICS DESCRIPTION
1000 MOV AX,[3000] Move the content of 3000 to AX
1004 MOV BX,0002 Move 0002 into BX
1008 DIV BX Divide AX with BX
100C CMP DX,0000 Compare DX with 0000
100E JZ L1 Jump if zero
1010 MOV DX,0001 Move 0001 into DX
1014 L1 MOV [3002],DX Move content of DX to 3002
1018 HLT Stop


INPUT                                          OUTPUT

[3000] : 0005                                    [3002] : 0001                          // If the input given is odd, '1' will get stored at location 3000 else '0'



Input is given as, SW 3000
Then give the input value, 0005
Then execute the program, GO 1000  //1000 is starting address of the program.
Press  INT button on the kit.
Now the output is stored at location 3002, to view the output, SW 3002


RESULT

8086 PROGRAM TO CHECK WHETHER THE GIVEN NUMBER IS ODD OR EVEN HAS BEEN EXECUTED SUCCESSFULLY AND OUTPUT IS VERIFIED

No comments:

Post a Comment