Post Reply 
Hand Held Products 71M/M eprom carrier question
09-08-2020, 05:32 PM
Post: #20
RE: Hand Held Products 71M/M eprom carrier question
(09-08-2020 11:50 AM)coitboy2000 Wrote:  
(06-13-2020 11:25 PM)cmurillo Wrote:  I did not find the messages right away, but I did figure what the required format is; nibbles must be swapped _and_ negated, so that a nibble sequence like

B3DDDDDEE4642513

must be written as a sequence of bytes in the EPROM as

C4 22 22 12 B1 B9 AD CE

carlos.

What is the easiest way to flip each bit ?
I can manage to invert the bits in a hex editor but flipping/reversing each bit seems to be a challenge.

Since no math is involved, a simple sed script work well
Code:
h;                      # save to hold area
s/[^:]*://;             # remove ':' offsets
s/  .*$//;              # remove text area
s/ //g;                 # remove whitespaces
s/\(.\)\(.\)/ \2\1/g;   # swap hex digits
y/0123456789ABCDEFabcdef/FEDCBA9876543210543210/;    # flip bits
x; G;
s/:[^\n]*\n/:/;         # add back offsets

> echo 0:B3DDDDDEE4642513 | sed -f swap_flip.sed
0: C4 22 22 12 B1 B9 AD CE

Or, convert the whole file, like this:

> xxd raw.1 | sed -f swap_flip.sed | xxd -r > raw.2
> xxd raw.1
0000000: b3dd ddde e464 2513             .....d%.
> xxd raw.2
0000000: c422 2212 b1b9 adce             ."".....
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Hand Held Products 71M/M eprom carrier question - Albert Chan - 09-08-2020 05:32 PM



User(s) browsing this thread: