;******************************************************************
;Program Title: ASM Programming Assignment #5
;Author: Septimus George
;Date: 10/29/05
;Function: This program will show the hex values entered into Al
;******************************************************************
    jmp main

requirement db 39h

main:   mov ah,00h
        int 16h
        
        mov al,ah
        
        mov Bl, Al                 ;For use in second digit coding
        shr Al, 4                  ;Get the first number
        add Al, 30h                ;To match number in its hex place
        cmp Al, requirement        ;Check if is not a number
        ja alpha1                  ;Go to appropriate section if not
        mov Ah, 0eh                ;Set up interupt for display
        int 10h                    ;purposes only :)
        jmp second                 ;Jump to second digits coding

second: mov Al, Bl                 ;Recieve the number to display
        mov Bh, 0Fh                ;Store 00001111 for AND purpose
        and Al, Bh                 ;To remove the first digit
        add Al, 30h                ;To match number in its hex place
        cmp Al, requirement        ;Check if is not a number
        ja alpha2                  ;Go to appropriate section if not
        mov Ah, 0eh                ;Set up interupt for display
        int 10h                    ;purposes only :)
        jmp third                  ;Jump to second digits coding

third:  mov Al, 68h                ;Display the Hex h
        mov Ah, 0eh
        int 10h    
        jmp main                  ;The only time it should halt

alpha1: add Al, 7h                 ;Add 7h to make it an alphabet
        mov Ah, 0eh
        int 10h
        jmp second                 ;Go back to second number

alpha2: add Al, 7h                 ;Add 7h to make it an alphabet
        mov Ah, 0eh
        int 10h
        jmp third                  ;Go back to second number