Jake-S@cup.portal.com (Jake G Schwartz) (03/04/90)
An HP48SX Stack Display Utility For Up To Ten Levels The HP48SX calculator LCD display contains 64 by 131 pixels and is pro- moted as being an 8-line display. However, in very few instances do eight lines of information actually appear at any one time. (The Matrix Writer application mode is one of the exceptions.) In general, we see two status lines, four stack lines plus a single menu key line, totalling seven. Occasionally, it would be useful to be able to utilize the entire display to show the stack when there are greater than four levels of depth; and the extensive graphics capability of the HP48 allows us to do just that. In graphics mode, we may write text from objects in the stack at any specified coordinates in the graphics picture and in any of three text sizes. Size 3 corresponds to the large 5 by 9 characters which are used in the normal stack display; size 2 is the familiar 5 by 7 size of the characters found in the HP28 display and also used to show HP48 error messages and prompts at the top of the LCD; and size 1 represents the 3 by 5 characters which appear in the line-1 menu labels. For stacks of 8 levels or less, stack values in the graphics display may be nicely displayed using the size-2 characters. If the stack contains 9 levels or more, size-1 characters will allow up to 10 rows of the stack to be shown at once. The following stack-view program STKV allows viewing up to ten levels of the stack simultaneously in the graphics picture. The original display mode, plot parameters, RPN stack values and graphics picture are all preserved. To run the program, press the STKV key in the VAR menu. After a few seconds the stack is displayed up to 10 levels. The system remains halted until ATTN is pressed, after which the program resumes to restore the original PPAR and PICT. Each line of the stack is labelled with its level number followed by a colon. These level identifiers are generated inside the main loop via the CHR function, which converts a character number to the corresponding string character. The value 48 becomes a zero, 49 a one, etc. As a result, the line 10 identifier (generated by doing 58 CHR in the loop) turns out to be a colon, but is left alone to save precious execution time. Jake Schwartz Program listing: ---------------- STKV 351 bytes, checksum #D7C2h << PICT RCL PPAR -> pict ppar ; Save original PICT and PPAR << PICT PURGE ; Purge original graphics picture 1 32 XRNG 1 64 YRNG ; Set new X and Y ranges for stack 1 DEPTH 1 - 10 MIN DUP ; Determine current stack height IF 8 > ; If greater than 8,text row height THEN 6 1 ; is 6 and text size is 1 ELSE 8 2 ; Otherwise, text row height is 8 END -> rowht tsize ; and text size is 2 << FOR I PICT 1 I rowht * ; Loop for the no. of stack levels: R->C I 48 + CHR ; Build stack level identifier ":" + ; Attach a colon to identifier tsize ->GROB GOR ; Add identifier to picture PICT rowht 2 / I rowht * R->C ; Compute coordinates, I 2 + PICK ; Get stack value, tsize ->GROB GOR ; And add to picture NEXT ; End loop { } PVIEW ; Turn on GRAPHICS, halt until ATTN ppar 'PPAR' STO pict PICT STO ; Restore original PPAR and picture >> >> >>