   .zext _string1
   .zext _value
   
; --------------------------------------------------------------
; convert unsigned word to hex ascii
; value in _VALUE
; return in _STRING1
; --------------------------------------------------------------
utoh:
   lda   _value+1
   jsr   utob
   ldy   #2
   lda   _value
   .byte $2C            ;; makes a BIT

; --------------------------------------------------------------
; convert unsigned byte to hex ascii
; value in A
; return in _STRING1
; --------------------------------------------------------------
utob
   ldy   #0
:utob:
   pha
   iny
   jsr   :cnv
   dey
   pla
   lsr   a
   lsr   a
   lsr   a
   lsr   a
:cnv
   and   #$F
   tax
   clc
   lda   _hextable,x
   sta   (_string1),y
   rts


_hextable:
   .byte "0123456789ABCDEF"

