Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old May 23rd, 2006, 02:58 AM
n000b n000b is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Location: Melbourne, Australia
Posts: 586 n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level)n000b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 38 m 40 sec
Reputation Power: 7
Send a message via ICQ to n000b
ASM: printing out HEX value

Hi,

I have a HEX value stored - how do I print out this HEX value? If I just try to print it out, it prints out the ASCII equivalent (ie 4D prints M but I want it to just print 4D).

It's for the Motorola 68000 processor if that matters.

Thanks

Reply With Quote
  #2  
Old May 23rd, 2006, 01:15 PM
Schol-R-LEA's Avatar
Schol-R-LEA Schol-R-LEA is offline
Commie Mutant Traitor
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Location: The People's Republic of Berkeley
Posts: 1,082 Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 10 h 16 m 50 sec
Reputation Power: 446
This is a fairly common problem, actually. This post covers the general algorithms for binary to ASCII and ASCII to binary conversions; the code is written in Python, but it should be fairly easy to convert it to any language you choose, including M68k assembly.

It should be pointed out that the value you have is a binary value, not a hex value, even though it may have been written in hex in the assembly code or read in as a hex value. What you actually want to do is convert the binary value into a string holding it's hex representation in ASCII text. Keep in mind as well that, depending on how you handle printing the hex value, you will probably need a string buffer large enough to hold the string; for hex values, you need two bytes of characters for each binary byte.
__________________
Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
#define KINSEY (rand() % 7) λ Scheme is the Red Pill
Scheme in ShortUnderstanding the C/C++ Preprocessor
Taming PythonA Highly Opinionated Review of Programming Languages for the Novice, v1.1

FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > ASM: printing out HEX value


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway