Solved

Print hexadecimal in Assembly

Posted on 2000-03-27
1
1,410 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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

785 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