;program finds out whether a byte is prime or not  
;
        mov     al, byte ptr 300h
        mov     bl, 2                   ;possible divisor

outr:   mov     cl, 0                   ;multiples of possible divisor


innr:   add     cl, bl                  ;get next multiple
        jc      next
        cmp     cl, al                  ;compare to see if divisor found!
        je      nonprime                ;not a prime num - divisor found!!
        jb      innr
next:   add     bl, 1                   ;add 1 in case 2 -> 3
        cmp     bl, 3                   ;did we have 2 ->3 case?
        je      outr
        add     bl, 1
        cmp     bl, 15
        jbe     outr                    ;15 is int sqrt of 255
;Wow!  Tried all possibilities , therefore it must be prime
        mov     byte ptr 301h, 0
        int     20h
nonprime: mov   byte ptr 301h, bl       ;smallest divisor
        int     20h
        end