Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/08/00 11:31
Read: times


 
#1155 - RE: convert from hexa to decimal
Try this:

Input: low value of integer in r0
high value of integer in r1

output: calls the sub wrchar
to output the ascii char in acc
you must write it yourself

i also have a 32bit decimal converter if you are interested

DEC_INT:

clr psw.5
mov r2,#16
mov r3,#39
acall Check
jz PI1
add a,#030h
lcall wrchar
setb psw.5

PI1: mov r2,#232
mov r3,#3
acall Check
jnz PI2
jnb psw.5,PI3

PI2: add a,#030h
lcall wrchar
setb psw.5

PI3: mov r2,#100
mov r3,#0
acall Check
jnz PI4
jnb psw.5,PI5

PI4: add a,#030h
lcall wrchar
setb psw.5

PI5: mov a,r0
mov b,#10
div ab
jnz PI6
jnb psw.5,PI7

PI6: add a,#030h
lcall wrchar

PI7: mov a,b
add a,#030h
lcall wrchar
ret



Check:
mov r4,#255
clr c

CH0: inc r4
mov a,r0
subb a,r2
mov r0,a
mov a,r1
subb a,r3
mov r1,a
jnc CH0
mov a,r0
add a,r2
mov r0,a
mov a,r1
addc a,r3
mov r1,a
mov a,r4
ret




List of 4 messages in thread
TopicAuthorDate
convert from hexa to decimal            01/01/70 00:00      
RE: convert from hexa to decimal            01/01/70 00:00      
RE: convert from hexa to decimal            01/01/70 00:00      
RE: convert from hexa to decimal            01/01/70 00:00      

Back to Subject List