|Re: HP-41 Plotter Module "PLOTBC" prgm. error|
Message #3 Posted by Ellis Easley on 16 Apr 2003, 12:46 p.m.,
in response to message #1 by Donald Leonard
I have no experience with the Plotter ROM or the PLOTBC program, but I have been studying the manual on the Museum CD-ROM. On page 117 there is a series of example bar code plots which result when PLOTBC is given the keystrokes on the preceding pages. The example of a program bar code plot includes the program title but not the number of registers. The utility program bar codes starting on page 195 have both titles and number of registers that look like they were typeset and not plotted along with the barcode. Please excuse me if this was obvious to you, and the patch you remember was an enhancement to PLOTBC and not just a fix.
I also studied the program listing starting on page 169 to see the two LABEL instructions you noted after LBL 12. Below, I have added comments to a few lines with my underestanding of the operation:
121 LBL 12
122 FS? 09 "If flag 09 set, does not print title. Otherwise, prints title and moves to next row."
124 CLA empty alpha for first LABEL function
127 CLX x=0
128 LORG 0 same as 1 for label origin, lower left of text
129 ACOS puts 90 in x (degree mode set for sure?)
130 LDIR label direction 90 degrees plots text perpendicular to bottom edge - like portrait mode on landscape mode plotter
131 LABEL alpha is empty for this one
132 ARCL Z program name was on stack in z? put in alpha
133 LABEL this one plots the program name
135 GTO c
How could the program determine the number of registers needed? As I understand it, the actual program bar code is plotted by a ROM function which is passed the program name, the row of bar code to plot, and the number of bytes to plot on the row. I guess the ROM routine calculates the starting byte for the row assuming all rows before this row had the same number of bytes. After plotting a row which is not the last row, the ROM routine increments the row number by 1. After the ROM routine has plotted the last row of the program, it returns the row number zero. So the PLOTBC program isn't dealing with the program bytes at all, it is just asking the ROM to plot bytes until they run out. The program could multiply the number of bytes per row by the number of rows that were plotted (until the ROM returned 0) but that wouldn't be exact because of the uncertainty of the number of bytes in the last row, and the total wouldn't be available until after all the plotting was finished.
I'm still learning the 41 - I see the 41CX has a function RCLPTA that returns the number of bytes in the program whose name is in alpha. That number divided by 7 and rounded up would be the number of registers. The text "PROGRAM REGISTERS NEEDED" is 24 characters alone, which is the size of the alpha register, so you would have to use LABEL twice, once for the words and then again for the number. And getting the number from X into the alpha register would be a pain. You would have to use CLA to clear alpha, then extract the digits one at a time, add 48 to convert each digit from 0-9 to ASCII, then use XTOA to append the ASCII character to alpha, then use LABEL to plot the characters of the number. To be exactly like the book, you would need to put ASCII ":" and a space in alpha before the digits.
Well, that shows how much I know - ARCL X can be used to put a text version of the number in X into alpha. The first time I read that page, I understood it to mean that only ASCII data stored in a register could be ARCLed. There is a routine (LBL 00) in the XBC program, which supports PLOTBC, that appends the number in X to alpha after using a loop with the FIX function to suppress trailing (insignificant)zeros but I don't think you can call that label in XBC from PLOTBC. However, since the number of registers is a whole number, you could just FIX 0 and then ARCL X.
It will be necessary to take steps to position the pen to plot the "Registers" line and then to plot the first line of program bar code.
If I had all the hardware I'd try this to see if it really works!
So the answer to your question is, no, I don't have the patch, but maybe my ramblings will help you to modify the program.
I meant to look in the PPC Journal CD-ROMs to see if the patch is there, it might well be.
Today's program was brought to you by the functions RCLPTA and ARCL.