Post by Payton ByrdPost by dott.PiergiorgioI'm conviced that the obvious tool needed today (some sort of
data2hex, data2bin, data2asm &c.) will be actually useful, but seems
that there's nowhere on the 'Net....
Unixperson to the rescue!
- save as dataify.sh ------- 8< --------
#!/bin/bash
cat $@|\
hexdump -v -e '16/1 "%u " "\n"' |\
sed -e 's/ /,/g' -e 's/,0/,/g' |\
awk 'BEGIN{l=100}{print l" DATA "$1; l++}'
-------- 8< -------- ------- 8< --------
(The sed expression "-e 's/,0/,/g'" can be removed if you like
your zeros.)
$ Bin/dataify.sh binary.bin
100 DATA 255,216,255,225,,230,69,120,105,102,,,73,73,42,
101 DATA 8,,,,5,,18,1,3,,1,,,,1,
102 DATA 0,,49,1,2,,28,,,,74,,,,50,1
103 DATA 2,,20,,,,102,,,,19,2,3,,1,
[..]
I once used a similar trick to a quick&dirty conversion of GIFs into
Apple2 programs: http://kildall.apana.org.au/~cjb/image2applesoft
(result: http://kildall.apana.org.au/~cjb/sj.applesoft)
Post by Payton ByrdCBM Programming Studio does this.
Google Groups also double-spaces quoted text.
--
Chris