200 likes | 404 Views
Converting HP-41 Programs to PDF. Dr. Jackie F. Woldering (2864) – Euclid, OH. How to preserve PPC Journals (1974-1987)? Jake Schwartz had already scanned PPCJ. DVD also contains thousands of other pages. Scanned journals are OK for articles/pictures.
E N D
Converting HP-41 Programs to PDF • Dr. Jackie F. Woldering (2864) – Euclid, OH. • How to preserve PPC Journals (1974-1987)? • Jake Schwartz had already scanned PPCJ. • DVD also contains thousands of other pages. • Scanned journals are OK for articles/pictures. • Scanned programs and bar codes not legible. • What is the best way to save programs & BC? • How can this be presented in a useful format? HHC 2012
“Create your own BC” Single/double width. Single width spacing. Single/single to start. Double/single to stop. Binary groups of four. Calculate checksums. Line labeling/spacing. Reproducing PPC Journal Bar Code • Program Bar Code • Hi-Resolution scan? • Inconsistent/unreliable. • MS Paint – too slow! • Scan and reproduce? • Limited to Journal BC. • BC printing program? • Advanced techniques! HHC 2012
Transferring between HP-41 and PC • Programs reside in HP-41C. How to transfer? • HP-41C/CV/CX & HP-82153A Wand for input. • HP-82160A HP-IL Module necessary for I/O. • HP-82164A HP-IL/RS232 Serial Interface. • Netbook computer with USB or serial interface. • USB to Serial Interface and appropriate drivers. • Windows Hyper Terminal (hypertrm) program. • HP-82183A Extended I/O Module INP/OUTP. HHC 2012
Software for Bar Code Production • “Creating Your Own HP-41 Bar Code” HP 1981. • PRGMBR (pp 17-31) ~825 lines of BASIC code. • Converting to C/C++/Java would be difficult. • Fig. 1, page 8 shows Program Type Bar Code. • 8-bit Checksum, 4-bit Type Indicator (1 or 2). • 4-bit Row Sequence Number (Modulo 16). • 4-bit Count of Leading Broken Function Bytes. • 4-bit Count of Trailing Broken Function Bytes. HHC 2012
Bar Code Headers and Trailers • 24 Bits = 3 Bytes of Header Information / Line. • Up to 13 Bytes of Program Information / Line. • Fig. 6, page 13 shows Bar Code Configuration. • Single and double width bar codes = 0 and 1. • Single width spaces placed between each bar. • Start bars = two single width (0-0) bars. • Stop bars = one double, one single width (1-0). • Maximum of 16 bytes in any one bar code row. HHC 2012
Program Bar Code Header Bytes • Algorithm on page 43 used to find checksum. • Row checksum: 8-bit running end-around carry. • Algorithm on page 49 used to compute header. • Seq. Number = (Row Number – 1) Mod 16. • Leading Broken Function Code Bytes and • Trailing Broken Function Code Bytes counted. • Everything necessary for program bar code. • OUTP performs program to hex translation. HHC 2012
Searching for a Bar Code Program • Perhaps it was best not to “reinvent the wheel”! • Was there already a bar code program online? • Warren Furlow's www.hp41.org site had one! • Leo Duran's HP41UC fulfilled the requirements. • HP41UC converts between user code formats. • HP41UC compiles and decompiles user code. • Generates multiline, labeled program bar code. • As Mario said, “Woohoo! Just what I needed!” HHC 2012
/R = RAW format. Binary form stored in the HP-41C/CV/CX, or in V41 emulator. /D = DAT format. DAT is hex translation of RAW file plus byte count and checksum. DAT same as OUTP. Three HP41UC File Formats • /T = Text Format • Type in a program. • Watch for angle sign, sigma, not equal sign. • Some XROM XX,YY must be entered. • Line numbers are not needed, will be added later by HP41UC. HHC 2012 HHUC 2012
Two HP41UC Bar Code File Formats • /H = Hewlett-Packard PCL format bar code file. • /S = Postscript format bar code output files. • PCL files large, unreadable, difficult to modify. • PS files smaller, easy to add program code/text. • With HP41UC, programs scanned, stored as DAT format, printed as clean PS bar code files. • Programs may also be typed in directly, saved as TXT, converted to RAW, DAT and PS files, for use by HP41C calculators and emulators. HHC 2012
Final Output File Format 1 • Next question: What should be output format? • Readability and usability are most important. • HP41UC /K produces smaller TXT -> RAW file. • HP41UC /N adds line numbers RAW -> TXT. • Separate RAW, DAT, PS bar code is useful, but not convenient to store in 3 different formats. • Adjustments would have to be made to three different files if mistakes or NOPs found later. HHC 2012
Final Output File Format 2 • Word Document or PDF could contain text and bar code, but not direct execution RAW code. • PDF Creator from www.sourceforge.net expects program input in Postscript format. That works! • Printed DAT hexadecimal code is a reasonable substitute for RAW format. Can be copied and pasted into Notepad, converted to a RAW file. • Time to learn more about how to integrate text and hex into a Postscript formatted document! HHC 2012
Mechanics of Postscript 1 • PS pages have line numbers and fonts at top. • %%Page: 1 1 • /Helvetica findfont 14 scalefont setfont • Text lines: position moveto ( TEXT ) show • 86.00 748.00 moveto (HP-41C Line) show • Pages have ending information at bottom. • showpage • %%PageTrailer HHC 2012
Mechanics of Postscript 2 • Each 8-1/2” x 11” Postscript page can have about 70 lines of 10-point Courier font text. • %%Creator, %%DocumentPaperSizes, gsave, located at top of document to begin printing. • Vertical 740.00 at top to 50.00 at bottom and horizontal 50.00 produces 1/2” margins. • grestore %%Trailer %%Pages: XX %%EOF (4 lines at end of document to finish). HHC 2012
Spreadsheet to Convert TXT to PS HHC 2012
HP-41C Normal Function Program by Richard Nelson PPC Journal Volume 6 Number 4 Page 16 July, 1979 01 LBL "NORMAL" ;Standard Normal Distribution Curve 02 X^2 03 -.5 04 * 05 E^X 06 2 07 PI 08 * 09 SQRT 10 1/X 11 * 12 RTN 13 END 001AC000F7004E4F524D414C511C1A15425512724252604285 C0000DD9 26 BYTES Header, Program, DAT, Byte Count HHC 2012
Spreadsheet to Relocate Bar Code HHC 2012
Spreadsheet Index of PDF Programs HHC 2012
Using the Indexed HP-41 Programs • Each completed program has Header, Code, Byte Count, DAT (Hex Dump) and Bar Code. • Programs can be selected from spreadsheet. • Programs in readable form can be studied. • DAT can be copied, pasted, converted to RAW. • Bar code can be printed, entered via wand. • PPC V6N4 to V10N4 done (33/75 Journals). • July, 1979 to May, 1983 630 programs/groups. HHC 2012
Inclusion in the PAHHC CD/DVD • Jake Schwartz plans to incorporate into DVD. • Blue box goes to article, red box to program. • No more trying to read different fonts, various styles of programming, handwritten code, bad or faded bar code, typing, correcting programs. • Programs can be brought to HP-41 via wand, HP-82164A Serial Interface, HP-82973A PC to HP-IL card, PIL box, HP-9114A/B 3.5” diskette and LIFUTIL or run on V41 or other emulators. HHC 2012
A Few Final Thoughts • Sample program PRINT and Wand Byte Table. • Why only HP-41 programs? HP-65/67/97, etc.? • Why not scan the entire PPC Journal via OCR? • M-Code programs & selected bar code tables. • Any volunteers to help with typing/formatting? • V6N4 to V10N4 are on HHUC 2012 flash drive. • More programs made available as time permits. • I hope this will be a useful preservation of code. HHC 2012