Title: Code for 8086 ALP to check if input number is prime or not.

Description: This 8086 Assembly language program is to check if the user inputted number is prime or not. This program allows user to give the number to test, and the 8086 ALP to check if input number is Prime or not.

8086 ALP to check a input number is Prime or not

.MODEL  SMALL
    .DATA
           VAl1     DB      ?
           NL1      DB      0AH,0DH,'ENTER NO:','$'
           NL2      DB      0AH,0DH,'IT IS NOT PRIME','$'
           NL3      DB      0AH,0DH,'IT IS PRIME','$'

           .CODE
    MAIN    PROC

            MOV AX,@DATA
            MOV DS,AX

            LEA DX,NL1
            MOV AH,09H
            INT 21H
    
            MOV AH,01H
            INT 21H
            SUB AL,30H
            MOV VAL1,AL
            
           MOV AH,00

            MOV CL,2
            DIV CL
            MOV CL,AL

    LBL1:
            MOV AH,00
            MOV AL,VAL1
            DIV CL
            CMP AH,00
            JZ LBL2
            DEC CL
            CMP CL,1
            JNE LBL1
            JMP LBL3
    
    LBL2:
    
            MOV AH,09H
            LEA DX,NL2
            INT 21H
            JMP EXIT    
    
    LBL3:
            MOV AH,09H
            LEA DX,NL3
            INT 21H
    
    EXIT:
            MOV AH,4CH
            INT 21H
    
    MAIN    ENDP
            END     MAIN