Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

print a number

Hello guys,
I need some help i want to know how i can print a number in a register
e.g

mov bx,546

now how i can print 546
i am using masm611
thanks,

PUNJABIAN263




Comments

  • ShmulikShmulik Member Posts: 37
    : Hello guys,
    : I need some help i want to know how i can print a number in a register
    : e.g
    :
    : mov bx,546
    :
    : now how i can print 546
    : i am using masm611
    : thanks,
    :
    : PUNJABIAN263
    :
    :
    :
    :
    :


    [code]
    mov cl,10 ;divide by
    mov ax,123
    again1:
    mov dx,0 ;puting 0 in the high part of the divided number (DX:AX)
    div cx ;DX:AX/cx. ax=dx:ax/cx and dx=dx:ax%cx(modulus)
    add dl, 30h ;adding the '0' char for printing
    mov bx,ax
    mov ah,2 ;print char interupt
    int 21h
    mov ax,bx
    cmp ax,0
    jne again1
    [/code]

    this will print the number upside down... use your mind to continue... ;)
  • blackhorseblackhorse Member Posts: 18
    to print a num needs a small task
    if u have a hex no. u need to find the no of 100s the no of 10s the no of 1s etc. and then u need to display each of the above (ie no.of hundreds etc) in ascii format u need to add 30h for that. refer asii tables 4 that.after finding the ascii of u need to disply each of the no using any int(eg use fn 02 in int 21h)


    eg if no is ffH
    ie,ffh=255
    no of 100s =2,add 30h==>32h--disply this using int 21h
    no of 10s =5,add 30h==>35h--disply this
    no of ones=5,add 30h==>35h--disply this
Sign In or Register to comment.