PROCEDURE dec_to_hex !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! TPU procedure to act as a decimal-to-hex conversion facility for ! unsigned integers. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! LOCAL the_num , a_digit , a_place , d_index , hex_str , dec_str ; if ( eve$prompt_string ( "" , dec_str , "Enter decimal number: " , "No number entered" ) ) then hex_str := '' ; the_num := int ( dec_str ) ; loop exitif ( the_num = 0 ) ; a_place := the_num - 16 * ( the_num / 16 ) ; if ( a_place < 10 ) then a_digit := str ( a_place ) else if ( a_place = 10 ) then a_digit := 'A' else if ( a_place = 11 ) then a_digit := 'B' else if ( a_place = 12 ) then a_digit := 'C' else if ( a_place = 13 ) then a_digit := 'D' else if ( a_place = 14 ) then a_digit := 'E' else if ( a_place = 15 ) then a_digit := 'F' endif ; endif ; endif ; endif ; endif ; endif ; endif ; hex_str := a_digit + hex_str ; the_num := the_num / 16 ; endloop ; if ( length ( hex_str ) = 0 ) then hex_str := '0' endif ; message ( 'DECIMAL ( ' + dec_str + ' ) == HEX ( ' + hex_str + ' ) ' ) ; endif ; return ; ENDPROCEDURE ;