|
-
Mar 7th, 2001, 12:05 AM
#2
Junior Member
just keep dividing by 10 and saving dx
then add 48 to turn it into a decimal
eg
printnum:
mov ax,filesize
xor cx,cx ;zero counter
mov bx,10 ;decimal
l1:
xor dx,dx ;prepare for division
div bx
inc cx ;+1 digits
add dl,48 ;convert to ascii digit
or ax,ax ;anything left?
push dx ;save digit
jnz l1 ;get next digit
mov di,seg string ;or: push ds pop es etc
mov es,di
mov di,offset string ;es:di = string
cld
l2:
pop ax ;get digit
stosb ;store it in string
loop l2 ;get next one
xor ax,ax OR mov ax,"$" ;terminate string
stosb
ret
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|