;This program compares two numbers 
;A= byte ptr 500h
;B = byte ptr 501h
;output 502h = 1 if a = b
;            = 2 if a > b
;            = 3 if a < b
        mov     al, byte ptr 500h       ;grab input
        mov     bl, byte ptr 501h
        sub     al, bl                  ;sub to set c and z flags
        je      equal                   ;equal!  al=bl -> al-bl=0
        jb      less                    ;less!  al<bl -> al - bl < 0
;otherwise al > bl
        mov     byte ptr 502h, 2
        int     20h
less:   mov     byte ptr 502h, 3
        int     20h
equal:  mov     byte ptr 502h, 1
        int     20h
        end