Solved

Print hexadecimal in Assembly

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

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…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

635 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