Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!ub!acsu.buffalo.edu From: cloos@acsu.buffalo.edu (James H. Cloos) Newsgroups: comp.sys.handhelds Subject: Using bin2asc (HP48SX) Message-ID: <68702@eerie.acsu.Buffalo.EDU> Date: 4 Apr 91 00:05:33 GMT Sender: news@acsu.Buffalo.EDU Organization: State University of New York @ Buffalo Lines: 48 Nntp-Posting-Host: lictor.acsu.buffalo.edu Last night I came up with a method of using the bin2asc program with files that are an odd number of nybbles long. As some of you will remember, it was shown that this doesn't work too well because the program assumes that there is an extra nybble of info at the end of the file; this disrupts the calculation of the crc, thus making the generated ASC file unuseable. However, the following can alleviate this problem: After running the bin file thru bin2asc, save it under a different name. Now run asc2bin on the generated ASC file. Compare the orriginal bin file with the newly generated bin file, and determine if there are any differences near the end of the file. Utilities such as `cat -v` Emacs and diff are useful for this. (Remember that the header can also be different, specifically in the 8th byte of the file.) If the orriginal and newly generated bin files match everwhere other than (possibly) the 8th byte, you are done. Otherwise, edit the ASC file, and replace the last five (5) characters of hex data with four (4) zeros, or some other bogus data, but be sure you have replaced 5 nybbles with 4. Now run asc2bin on the file again, and note what crc it calculated. Reverse the order of that 4 digit hex number, and replace the bogus 4 nybbles you had earlier added to the ASC file with those four. The ASC file should now be accurate. Run it thru bin2asc again and compare as before, the only difference that you should find (if any at all) in in the 8th byte. You can now post, type in, or otherwise use the generated and edited ASC file with confidence. Also, if you know what kind of object the binary is, you may be able to determine from looking at the last line of the ASC file whether you need to edit it. For instance, if it is a program, algebraic, unit, library_data or list, the last 5 nybbles of the actual object will be `B2130' and if there is an extra `0' between that and the 4-nybble crc you know immediately that you'll have to edit it. Delete that extra 0 and use asc2bin to determine the actual crc, and put that crc into the file. Do now, though, that if the binary is a library, there will be the library'y internal crc immediately before ASC's crc. So, now that we know how to correct for odd-nybble long binaries in the bin2asc side, has anyone compiled it for messy-dos and/or AmigaDos and/or MacOS? The users of those systems eagerly await such executables. ;^) Happy converting! -JimC -- James H. Cloos, Jr. Phone: +1 716 673-1250 cloos@ACSU.Buffalo.EDU Snail: PersonalZipCode: 14048-0772, USA cloos@ub.UUCP Quote: <>