Seeing ASCII in .hex file

Go To Last Post
23 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can point out my CRC and Seed values in the .hex file, but I'd like to put the ascii 'CRC' and 'SEED' into the file in a fashion that can be read by Muggles. Any suggestions?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please clarify. All I get on "Muggles" refers to Harry Potter.

If you refer to "an ordinary person", you cannot. Every ASCII character in a hex file is "encoded" into two "ASCIIfied hex" bytes. For example, the number "1" has a hex value of 0x31 and is encoded into the two ASCII characters "3" and "1".

Hex files are not intended to be human readable.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Though the hex values '0x5E' '0xED' '0C' and 'AC' may suffice as an indicator.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Hex files are not intended to be human readable.


Hmmm---

eeprom unsigned int dead = 44510;
eeprom unsigned int beef = 61374;
eeprom unsigned long dead_beef = 4022250974;
...
:0900000004DEADBEEFDEADBEEF83
:00000001FF

It depends on what message you want to convey. :twisted:
Words you can spell in hex:
http://www.idolhands.com/persona...
200 if you use zero as the letter "O"; 100 if you don't.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A text editor I used some time back allowed ASCII to be displayed next to the HEX. The rest of the ASCII was a mess, but the ASCII was clear. It might have been IAR, Code Worrier or something else. I don't see a means of generating such a format with Studio 4. I have put this project together into Studio 6.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That wouldn't have anything to do with a toolchain, per se, but rather with some kind of viewer/editor.

And I wouldn't think it would be on the Intel .HEX directly, but rather a view of a loaded "BIN". There isn't too much magic in it if you care to do your own. Many editors will have a "hex" mode.

I gave an example above of CodeVision code and resulting .EEP file (Intel HEX format). Now try this...

eeprom unsigned int dead = 44510;
eeprom unsigned int beef = 61374;
eeprom unsigned long dead_beef = 4022250974; 
eeprom unsigned char stuff[16] = "Some EEPROM ";

Attachment(s): 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I do believe I'll take the suggestion and just throw a few AA, BB and the like into the file for easy reading. than you all

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Every exe file starts with MZ, the initials of the dude that wrote the exe loader program. The partition table has a 55aa at the end of it. Lots of Magic Numbers like that in the bios. Just make it stand out like F00F or something.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd go with Neil's suggestion:

#include 

unsigned int seed[] = {60766, 60766, 60766, 60766};
unsigned int crc[] = {44044, 44044, 44044, 44044};

int main(void)
{
	while(1);
}

generates:

:100C10000CAC0CAC0CAC0CAC5EED5EED5EED5EEDC8

The "SEED" in there is easier to read than "CRC" - you really have to screw your eyes up for that one though it helps to separate the data;

:10 0C10 00 0CAC 0CAC 0CAC 0CAC 5EED 5EED 5EED 5EED C8

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes. It must have been in IAR. Thank you to all

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If hex files aren't intended for human reading, then why are they in ascii?

I suppose you could train yourself to recognize the hex values for ascii codes.

 

"We trained hard... but it seemed that every time we were beginning to form up into a team, we would be reorganized. I was to learn later in life that we tend to meet any new situation by reorganizing. And a wonderful method it can be of creating the illusion of progress while producing confusion, inefficiency and demoralization." Petronius Arbiter, approx. 2000 years ago.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
Words you can spell in hex:

The link doesn't work for me.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Off-Earth wrote:
A text editor I used some time back allowed ASCII to be displayed next to the HEX. The rest of the ASCII was a mess, but the ASCII was clear. It might have been IAR, Code Worrier or something else. I don't see a means of generating such a format with Studio 4. I have put this project together into Studio 6.

Most device programmers with a GUI can display mixed HEX:Ascii, and most of those work fine with no programmer attached. (ie the SW is free )
Some debuggers allow HEX-load, then the code-mem view can show the same thing.

So you should be able to find a lot of 'viewers' to choose from.

Note also that HEX files are supposed to start with a Colon, so you could try adding comments into the HEX - but check your other tools are ok with such comments.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

larryvc wrote:
theusch wrote:
Words you can spell in hex:
The link doesn't work for me.
It's 18 months old. Thread necromancy by the OP ;)

However, The Wayback Machine has a copy.

I thought 'Why Ruby?'... then I saw the last comment re: grep and sed. Much more my speed ;)

He forgot to make the 's' command to sed global, though... and about case.

Here's my 2 cents:

$ grep "^[A-FOLSa-fols]*$" /usr/share/dict/words | sed 's/oO/0/g;s/lL/1/g;s/sS/5/g' | wc -l
774
$ grep "^[A-FOISa-fois]*$" /usr/share/dict/words | sed 's/oO/0/g;s/iI/1/g;s/sS/5/g' | wc -l
537

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

If hex files aren't intended for human reading, then why are they in ascii?

Because in the ancient past, which both you and I have experience with :wink:, there where e.g. transfer protocols that could not cope with e.g. bytes with vales below 32 w/o distorting them?

I still remember software being distributed by bin2hex'ing it, splitting it up in chunks and posting on e.g. NNTP. Circa 1990?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For a nostalgia trip also read about uuencode :-)

This was done because of character set mangling so the only characters in exchanged emails you could rely on to be the same were the printables within ASCII. So to transfer binary attachments they were converted to uuencoded text and then included in the message. The other end would then de-uuencode to get the passed binary back.

Then someone invented MIME and the rest is history.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
For a nostalgia trip also read about uuencode :-)
Ah, the memories...

OT(+): Anyone remember the Usenet filesystem?

Me neither. I'm not quite that old. However my brother tells me:

Quote:
... disk was expensive and quotas were miserly. A few years before my day, If one lacked space one used UUCP to send oneself one's own files, along a specific path of hosts (a "bang path"). After sending them, one deleted the originals. With a properly selected and reliable bangpath, one could create a one-week delay or longer.
Madness, I said.
Quote:
1) choose a reliable bangpath :-)
2) this was a sort of hail mary play, where you had to delete files in order to make space for something short-lived.

Better some chance of getting your files back than no chance at all...

Madness. Surely not practised by any but the most desperate of computer science undergraduates ;)

Neither he nor I were able to convince Google to confirm this with a couple of minutes of poking around.

Anyone?

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

OT(+): Anyone remember the Usenet filesystem?

The original way to see porn on the internet? Ah yes, halcyon days indeed! (we were all young once).

I seem to remember there was some kind of message size limit which meant a full "picture" had to be split across several messages and newsreaders had a way to reconstitute these things from parts - sadly sometimes the vital bit was missing ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Never heard of stashing files that way, but a week latency was about right. Every day you could get updates about which sites had not yet been reached.

VAX/VMS added a version number to files, so foo.dat;1 foo.dat;2 etc. With all those backup files users tended to run near their disk quota all the time, but when you needed more the purge command would usually provide it.

Sort of like emptying the trash folder today.

.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
sadly sometimes the vital bit was missing ;-)
Enter Parchive, saviour to the USENET file-sharing masses.

dak664 wrote:
VAX/VMS added a version number to files, so foo.dat;1 foo.dat;2 etc. With all those backup files users tended to run near their disk quota all the time, but when you needed more the purge command would usually provide it.
The only programming courses available at my high school (mid 80's) were COBOL and FORTRAN. Our terminal room had something like 8 terminals, 1 hard copy terminal used as a printer, and a 'concentrator' which was a 6809-based embedded system in a box that managed the leased line which connected us to another school about a mile away. A third school had a similar terminal room. We all shared a single VAX-11/750 (or was it a 780?).

I think our file quota was about 1 MB. We also had a cpu-time quota. This discouraged 'poor programming practises' like short compile-run-debug-edit cycles. With so few terminals in such high demand, you were better to follow what you were taught: Think, flowchart, pseudo-code, code, simulate. All on paper. Do this before you ever fire up the editor.

Taught me to think clearly about a problem before jumping in. With today's tools it's all too easy to compile-run-debug-edit your way one semicolon at a time. That's handy (invaluable, really) but it's no substitute for design.

What were we talking about? Hex files! How did we get here? Clearly I need some more structured thinking...

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For Torby -

If you encode hex values as two ASCII characters, then the data is restricted to 16 characters, "0"-"9" and "A" - "F". This allows the use of other characters as framing characters, end-of-line characters, and such that will never be present in the data. For example, hex format uses ":" as the start of line frame character. That character will never be in the data because IF the data contains ":" = 0x3A, it will be "encoded" as "3" and "A".

So, hex format approximately doubles the "file" size (there is other information on each hex line besides data), that is the cost. The benefit is removal of ambiguity.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I think our file quota was about 1 MB. We also had a cpu-time quota. This discouraged 'poor programming practises' like short compile-run-debug-edit cycles.
One university I attended handled this a bit differently. Each batch of cards (1960s) that you presented had to be accompanied by a 'run card'. These cards were sold at the bookstore, on the other side of campus, and they would only sell you one at a time.

Don

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys, you recognize not a mischievous snide remark?

I don't even TRY to read a hex file.

 

"We trained hard... but it seemed that every time we were beginning to form up into a team, we would be reorganized. I was to learn later in life that we tend to meet any new situation by reorganizing. And a wonderful method it can be of creating the illusion of progress while producing confusion, inefficiency and demoralization." Petronius Arbiter, approx. 2000 years ago.