Solved

Print hexadecimal in Assembly

Posted on 2000-03-27
1
1,389 Views
Last Modified: 2008-03-06
How to print on screen hexadecimal value in Assembly language?

E.g. if BX contains 55FFh how can it be printed on screen like "55FF"?
0
Comment
Question by:serg111
1 Comment
 

Accepted Solution

by:
balakrishnan_t earned 50 total points
ID: 2663079
There is no single command do this....u have to write toutines to do that... i hope u will understand the below given program...compile it and run it...u will get the answer....

Incase if u r not able to understand, make a comment , i can explain u

Program
*******

..model small
..386
..data
..code

Print_Char proc uses Ax
             Mov       Ah,02h
             Int       21h
             Ret
Print_Char  Endp                          

Print_Byte  proc uses Ax  Cx  Dx
             
         Mov       Ah,Al
         And       Ah,0f0h
         Mov       Cx,0004h
         Shr       Ah,Cl
         Cmp       Ah,09h
         Jbe        ll1
         Add       Ah,07h
ll1:     Add       Ah,30h
             Mov       Dl,Ah
             Call      Print_Char
             And       Al,0fh
             Cmp       Al,09h
             Jbe        ll2
             Add       Al,07h
ll2:       Add       Al,30h
             Mov       Dl,Al
             Call      Print_Char
             Ret
Print_Byte Endp            
             
Print_Ax proc  uses  Ax
         Push      Ax
             Mov       Al,Ah
             Call      Print_Byte
             Pop       Ax
             Call      Print_Byte
             Ret
Print_Ax  Endp            

start:
      mov bx,0a9ffh  
      mov ax,bx
      call print_ax
     
      mov  ah,4ch
      int 21h
end start      

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now