|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 ![]() |
|
#2
|
||||
|
||||
|
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 Short • Understanding the C/C++ Preprocessor Taming Python • A 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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > ASM: printing out HEX value |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|