45 Program to check number is positive or negative in 8086 Microprocessor

Code:



; Program to check number is positive or not
.MODEL SMALL
.STACK 100H
.DATA
   NUM DB -12H
   RES DB ?

.CODE
    MOV AX , @DATA    ; Initializing Data Segment
    MOV DS , AX

    MOV AL , NUM      ; LOAD NUMBER
    ROL AL , 01       ; ROTATE BY 01

    JC  DN
     MOV RES , 1      ; POSITIVE
     JMP EXIT
  DN:
     MOV RES , 2       ; NEGATIVE

EXIT:
     MOV DL , RES

    MOV AH , 4CH      ; Service routine for exit
    INT 21H
END






Ouput:
Program to check number is positive or not
Previous
Next Post »