home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!hp-cv!hp-pcd!hpcvra!rnews!hpcvbbs!akcs.joehorn
- From: akcs.joehorn@hpcvbbs.cv.hp.com (Joseph K. Horn)
- Newsgroups: comp.sys.hp48
- Subject: Re: Needed ASC De/Compressor
- Message-ID: <2b01faf3.2123.1comp.sys.hp48.1@hpcvbbs.cv.hp.com>
- Date: 12 Nov 92 06:40:02 GMT
- Article-I.D.: hpcvbbs.2b01faf3.2123.1comp.sys.hp48.1
- References: <dwellman.0e2q@amiganet.chi.il.us>
- Lines: 137
-
-
- ASCII Encoding HP 48SX Objects
- by Bill Wickes
-
- Sending an HP 48SX object via electronic mail can be difficult if the
- object does not have an ASCII form, such as is the case for library
- objects. There are various encoding schemes available on different
- computer systems, but these require that the sender and receiver have
- similar computers, or at least compatible encode/decode schemes. The
- programs listed below perform the encoding and decoding on the HP 48SX
- itself, which has the advantage of being completely independent of any
- computer.
-
- The programs are nominally called \->ASC and ASC\->. The former takes
- an object from the stack and converts it to a string, in which each
- nibble of the object and its checksum is converted to a character 0-9 or
- A-F. (The object must be in RAM, otherwise a "ROM Object" error is
- returned.) For sake of easy inclusion in email letters, the string is
- broken up by linefeed characters after every 64 characters.
-
- ASC\-> is the inverse of \->ASC: it takes a string created by \->ASC and
- converts it back into an object. When you transmit the encoded strings,
- be sure not to change the string; ASC\-> uses the checksum encoded in
- the string to verify that the decoding is correct. An "Invalid String"
- error is returned if the result object does not match the original
- object encoded by \->ASC. When you upload a string to your computer,
- use HP 48 translate mode 3 so that the HP 48 will convert any CR/LF's
- back to LF's when the string is later downloaded.
-
- Two versions of ASC\-> are included here. The first (P1) is in HP 48
- user language, using SYSEVALs to execute system objects. P2 is a string
- that the setup program uses P1 to decode into an executable ASC\->
- --then P1 is discarded. The second version is more compact than the
- first, and also uneditable and therefore safer (but it can't be
- transmitted in ASCII form, which helps to make the point of this
- exercise).
-
- Here are the programs, contained in a directory:
-
- (start)
- %%HP: T(3)A(D)F(.);
- DIR
- P1 @ ASC\-> Version 1.
- \<<
- IF DUP TYPE 2 \=/
- THEN "Not A String" DOERR
- END RCWS \-> ws
- \<< 16 STWS
- #0 NEWOB SWAP DUP SIZE
- IF DUP 4 <
- THEN DROP SWAP DROP "Invalid String" DOERR
- END
- DUP 65 / IP - 4 - # 18CEAh SYSEVAL
- "" OVER # 61C1Ch SYSEVAL
- SWAP # 6641F8000AF02DCCh
- # 130480679BF8CC0h # 518Ah SYSEVAL
- # 19610313418D7EA4h # 518Ah SYSEVAL
- # 7134147114103123h # 518Ah SYSEVAL
- # 5F6A971131607414h # 518Ah SYSEVAL
- # 12EA1717EA3F130Ch # 518Ah SYSEVAL
- # 280826B3012808F4h # 518Ah SYSEVAL
- # 6B7028080BEE9091h # 518Ah SYSEVAL
- # BE5DC1710610C512h # 518Ah SYSEVAL
- # 705D00003431A078h # 518Ah SYSEVAL
- # 3D8FA26058961431h # 518Ah SYSEVAL
- # 312B0514h # 518Ah SYSEVAL
- # 18F23h SYSEVAL
- DUP BYTES DROP 4 ROLL
- IF ==
- THEN SWAP DROP
- ELSE DROP "Invalid String" DOERR
- END ws STWS
- \>>
- \>>
-
- P2 @ ASC\-> Version 2. To be converted by ASC\-> version 1.
-
- "D9D20D29512BF81D0040D9D20E4A209000000007566074726636508813011920
- 140007FE30B9F060ED3071040CA1304EC3039916D9D2085230B9F06C2A201200
- 094E66716C696460235472796E676933A1B21300ED30FD5502C230C1C1632230
- CCD20FA0008F14660CC8FB97608403104AE7D814313016913213014117414317
- 414706131179A6F5C031F3AE7171AE214F8082103B6280821909EEB0808207B6
- 215C0160171CD5EB870A13430000D50713416985062AF8D341508813044950B9
- F06BBF06EFC36B9F0644230C2A201200094E66716C696460235472796E676933
- A1B2130B21300373"
-
- P3 @\->ASC. To be converted by ASC\->.
- "D9D20D2951881304495032230FD5502C230A752688130ADB467FE30322306AC3
- 0CB916E0E30CBD30F6E30C1C1632230CCD20DC0008F14660CC8FB97608403104
- AE7D8143130169174147061741431311534AC6B4415141534946908D9B026155
- 4A6F53131F3AE731A014C161AE215F08082103A6280821939EEC08082170A621
- 4C161170CD56B870A18503430000D5071351796A9F8D2D02639916D9D2085230
- C2A209100025F4D402F426A6563647933A1B2130A2116B213033C0"
-
- SETUP @Automatic setup program
- \<< P2 P1 'ASC\->' STO
- P3 ASC\-> '\->ASC' STO
- { P1 P2 P3 SETUP } PURGE
- \>>
-
- END
- (end)
-
- Installation instructions:
-
- 1. Edit the above text between (start) and (end) into a text file named
- CONV (for example). Be sure that you leave the strings exactly as
- entered above, with no extra spaces or other invisible characters at the
- beginnings or ends of the lines.
- 2. Set the HP 48SX into ASCII transfer mode.
- 3. Using Kermit, download CONV text file to the 48, verify its checksum
- (6C8Ah).
- 4. Execute CONV to make it the current directory.
- 5. Execute SETUP.
- 6. The directory CONV now contains ASC\-> and \->ASC, ready to use.
-
- To archive the decoded versions of ASC\-> and \->ASC back on your
- computer, be sure to set the HP 48SX in binary transfer mode before
- uploading.
-
- Disclaimers:
-
- * Use the programs at your own risk. Any time you delve into the
- SYSEVAL world, there are increased dangers. Archive your 48 memory
- before experimenting with these programs! Also, verify the checksums of
- objects defined above to make sure they have been downloaded correctly,
- before executing ASC\->.
-
- * I will not answer questions about how the programs work. This is not
- because of any great secrecy, but rather because it's hard to give any
- answer that doesn't lead to more questions, and more, and more...
-
- * 48 hackers are welcome to mine any nuggets they can from the programs,
- and from the fact that \->ASC is a convenient way to decompile an
- object.
-
- Bill Wickes
-