Solved

Print hexadecimal in Assembly

Posted on 2000-03-27
1
1,424 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Pointer in one class to member in another 6 132
C Programming - If Statement 8 84
Raspberry Pi 3 to send text message 9 243
windows 10 pro lost profile. 10 85
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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 and use conditional statements in the C programming language.

738 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