Programming HP Calculators/Commands/Graphic Commands

DISPLAY→
Syntax DISPLAY→ : Detail Example DISPLAY→ G1: ERASE:WAIT 2: →DISPLAY G1: FREEZE: Stores the display in GROB G1, clears the screen, waits two seconds, then reloads the display on the screen and pauses. (Effectively useless without other graphic commands).
 * Stores the display in GROB . (Note that the arrow is going out of DISPLAY.)
 * Usually used to generate GROBs on which to perform additional graphic commands.

→DISPLAY
Syntax →DISPLAY : Detail Example See example for DISPLAY→.
 * Sends GROB to the display. (Note that the arrow is going in to DISPLAY.)
 * Usually used to output GROBs to the display after altering them using other graphic commands.

GROBNOT
Syntax GROBNOT : Detail Example ERASE: DISPLAY→ G0: GROBNOT G0: →DISPLAY G0: FREEZE: This program will erase the screen (ie. turn all pixels OFF), then invert the colours (ie. turn all pixels ON), giving you a black screen.
 * Inverts the colors in GROB, that is, switches all ON pixels OFF and vice-versa.
 * Could be used to select buttons, for example, but is generally too slow for this purpose.

MAKEGROB
Syntax MAKEGROB ; : Detail Table detailing pixel patterns created by using different hex digits.
 * Allows you to make a custom grob, pixel-by-pixel using hexadecimal.
 * Much faster than regular drawing commands, so if you have the time to write your GROBs manually, it's strongly recommended. However, it does usually increase the size of the program far more than just using other drawing commands, although this does not affect compile time - so you need to decide which is more important, program size or program speed.
 * Each hexadecimal digit (a number between 0-9, or a letter between A-F) represents a four-digit binary number, which in turn represents four pixels on the screen (where 1 is on and 0 is off). The following table illustrates the pixel on/off sequences produced by each hex digit:
 * The syntax is quite counter-intuitive; the grob name (G0 for example) comes first, followed by a semicolon and a space, then the width and height measurements for the grob, separated by spaces (rather than the usual semicolons). After that, a new line must be created, and the hex-data begins, which is finally ended with the regular :. No newlines must be created whilst typing the hex-data, although the calculator will naturally wrap the data onto the next line anyway.
 * Useful tip: To generate the MAKEGROB code for the entire screen, use other methods to draw the image you desire (eg. SKETCH mode), then press ON+PLOT to save a screenshot to G0. Now, go into HOME view and enter G0, then hit ENTER. Finally, select the text that has just appeared starting with MAKEGROB, and press F5 (COPY), then hit ENTER again. The code is now stored in the Editline program, and you can insert it into any other program by pressing VARS, scrolling down to Programs, selecting Editline, pressing F4 (VALUE), and pressing F6 (OK).
 * Another idea is to crop this grob using SUB to create a sub-GROB, then typing the variable name (eg. G1) for the cropped GROB in HOME view. Use the above procedure to copy this MAKEGROB code into your program, and you will be able to save substantial amounts of space in the program that would otherwise have been taken up by 0s or other erroneous data. If only the calculator had some form of RLE..

Example MAKEGROB G1; 12 12 FFF10810899999910850A999168108FFF:

■■■■■■■■■■■■ ■□□□□□□□□□□■ ■□□□□□□□□□□■ ■□□■■□□■■□□■ ■□□■■□□■■□□■ ■□□□□□□□□□□■ ■□■□□□□□□■□■ ■□□■■□□■■□□■ ■□□□□■■□□□□■ ■□□□□□□□□□□■ ■■■■■■■■■■■■ The above MAKEGROB code translated into the creation of the GROB roughly approximated by the ASCII sketch above.