; **** main (for testing only) **** mov al,3fh ;print al call h2a hlt ;****************************************** ;name: h2a ; ;Author: Dan Kohn ; ;Date: 11/16/06 ; ;Function: Print a 8 bit hex value to the ; display ; ;ON Call: AL must contain the value to ; display (00-FF) ; ;On Ret: all reg restored to previous value ;****************************************** h2a: push ax push bx mov bl,al ;store original value shr al,4 ;move upper digit to lower nibble call h1a ;and print mov al,bl ;restore original value and al,0fh ;remove upper digit call h1a ;and print pop bx pop ax ret ;****************************************** ;name: H1A ; ;Author: Dan Kohn ; ;Date: 11/16/06 ; ;Function: Print a hex digit to the display ; ;ON Call: AL must contain the digit to ; display (0-F) in the lower nibble ; ;On Ret: all reg restored to previous value ;****************************************** h1a: push ax add al,30h ;add 30h to digit cmp al,3ah ;if char '0'-'9' jl p1 ;jump add al,7 ;if not add 7 to get ;digit 'A' - 'F' p1: mov ah,0eh ;print digit int 10h pop ax ret