creo q esto deveria ayudarte con tu problema..
Codigo:
;****************************************************************
; Signed 16-bit to ASCII converter. Enter with number in hi/lo.
; returns with ASCII equivelent at . The first char will
; be sign: "-" or " ". The latter is easily changed to "+".
; Leading spaces are not supressed. Uses program 65 words.
toascii movlw ascii ; setup a pointer
movwf fsr
btfss hi,7 ; negative number?
goto skpneg ; no
comf hi ; negate the number
comf lo
incf lo
btfsc status,z
incf hi
movlw "-" ; provide a negative sign
goto minus
skpneg movlw " " ; blank "sign" for positive
minus movwf indf ; store sign
incf fsr ; fill ascii buffer with ("0"-1)
movlw "0"-1
movwf indf
incf fsr
movwf indf
incf fsr
movwf indf
incf fsr
movwf indf
movlw ascii+1 ; do the subtractions
movwf fsr
dodigit 10000
dodigit 1000
dodigit 100
dodigit 10
movf lo,w ; ls byte is already correct
addlw "0" ; convert to ascii
movwf indf
return ; done
; Subtract the number in shi/slo from hi/lo until the result
; is negative, incrementing the ascii equivelent each time.
dosub incf indf ; increment ASCII character
movf slo,w ; subtract current power of 10
subwf lo,f
movf shi,w
btfss STATUS,C
addlw 1
subwf hi,f
btfsc STATUS,C ; any carry?
goto dosub ; no, keep subtracting
movf slo,w ; reverse the last subtraction
addwf lo,f
movf shi,w
btfsc STATUS,C
addlw 1
addwf hi,f
incf fsr ; step to next ASCII position
return
Saludos!