system rpl input informs

Upload: roberto-gaeta

Post on 07-Mar-2016

16 views

Category:

Documents


0 download

DESCRIPTION

Programacion rpl para calculadoras Hewlett Packard

TRANSCRIPT

  • HEWLETTPACKARD

    System RPL Input Forms For the HP48G and HP48GX Series Calculator

    Han Duong ([email protected])

  • Acknowledgements

    Much of this documentation is credited to James Donnelly. You can check out his page at: http://www.peak.org/~jimd/calcpage.html. I bought his book An Introduction to HP48 System RPL and Assembley Language Programming and definitely recommend it to anyone who plans to use the HP48 to its fullest capabilities. The examples (and there are lots of them) of system RPL and assembley language are more than enough reasons to get the book. A good deal of the information in this document comes from the above-mentioned book. But since I used mine so much, a lot of the pages are almost torn off (the covers have been lost, and the spine is coming apart =); hence my need to write this document. Thanks also goes to Hewlett Packard for making such a great calculator. Without them, there would be no input forms =). I would also like to thank Chris Tham, [email protected], for his template that I used to make this document. It made things go much faster and more organized. I hope that this document will be usefull to some of you who program in system RPL. Feel free to email me at [email protected] for any comments and suggestions.

    DATES OF REVISIONS

    First Revision July 8, 1998 youre reading it.

    DISCLAIMER: NEITHER HEWLETT PACKARD, JAMES DONNELLY, NOR THE AUTHOR OF THIS DOCUMENT, HAN DUONG, TAKE ANY RESPONSIBILITY FOR WHAT HAPPENS WHEN AS A RESULT OF THE USE ANY OF THE INFORMATION BELOW. WHILE IT IS ONLY THE GOOD INTENTIONS OF THE AUTHOR TO PROVIDE USEFULL AND HELPFUL INFORMATION, IT IS _NOT_ GAURANTEED THAT USING THE INFORMATION BELOW WILL NOT CAUSE ANY DAMAGES SUCH AS LOSS OF MEMORY OR ANY OTHER TYPES OF NEGATIVE RESULTS.

    Error! Utilice la pestaa Inicio para aplicar Title al texto que desea que aparezca aqu. Error! U

  • 1. Introduction

    The input forms used by the HP48 G and GX series calculators use the DoInputForm command that comes built-in with the ROM. Unfortunately, this command was not implemented in the S and SX series, and hence will make any applications that use DoInputForm version dependent. The command is NOT a library commandit is simply a system level command that is actually a secondary. The address of the command in hexidecimal is #199EBh.

    1.1. Features Input forms provide an excellent graphical user interface for users to enter in data that will be processed by the rest of the program. They can be customized to allow as little limitations on what kinds of inputs can passed to the remainder of the program to having full control of what kinds of inputs are allowed and what flags are affected.

    1.2. Speed and Size Since there are so many options that can be implemented, input forms range in size from the very small to fairly large programs. However, due to the limited size of the HP48 screen, it is only possible to create so many labels and fieldsyet leaving enough space for just about any application. When using the system command DoInputForm, you will get a faster rendering of the GUI compared to the built in command INFORM. Even when the forms have many fields and labels, the overall speed of the HP48s creation of the forms is quite fast.

    Error! Utilice la pestaa Inicio para aplicar Title al texto que desea que aparezca aqu. Error! U

  • 2. DoInputForm Parameters

    There are many parameters that get passed to DoInputForm, so it may be good convention to group the parameters into blocks so as to clearly identify which parameter is which. An example of how DoInputForm can be found in the Appendix section. Below are the parameter which must be on the stack at the time when DoInputForm is reached in the runstream:

    Label Specifier 1 * Label Specifiers Label Specifier 2 . . . Label Specifier N Field Specifier 1 * Field Specifiers Field Specifier 2 . . . Field Specifier N Label Count Field Count General Message Handler Title

    2.1. Label Specifiers The label specifiers are groups of parameters which provide the text that normally appear next to each input area. Label specifiers contain the information about each prompt in the input form.

    Label Title Horizontal Position of Label Vertical Position of Label

    The label title is simply a string that will get displayed, in the smallest built-in font, at the coordinate specified by the horizontal and vertical positions. These positions are system binaries which specify the top left corner of the label title relative to the top left corner of the HP48 display. The top left corner of the display has a coordinate value of #0 #0 (two system binaries) and as you move right and down, the coordinates increase in value. The coordinate values are

    Error! Utilice la pestaa Inicio para aplicar Title al texto que desea que aparezca aqu. Error! U

  • equivalent to one less than the number of pixels from the left side and from the top of the HP48 display.

    2.2. Field Specifiers Field specifiers, like the label specifiers, are another group of parameters. Each field specifier contains parameters that tell DoInputForm how the input/data is to be displayed (i.e. the input display format), where to display it, and what dimensions to use for the highlight bar.

    Message Handler Horizontal Position of Field Veritcal Position of Field Field Highlight Height Field Highlight Width Field Type List of Allowed Object Types Decompile Object Help String Choose Field Data (MINUSONE for non-choose fields) Choose Field Decompile Object (MINUSONE for non-choose fields) Reset Value Initial Value

    The message handler can be either DROPFALSE or a secondary. DROPFALSE is the default message handleruse this if you do not want to bother with, nor intend to test/change, the input entered by the user. However, you can use a secondary for the message handler. Just make sure that the secondary gets pushed onto the stack (not evaluated). When using a secondary, both the passed objects (varies depending on the input field type) and the message number (a system binary) is passed to the handler. When the handler is executed, either the correct parameters and TRUE is returned, or the flag FALSE is returned. Below is an example of a typical message handler for a field specifier:

    :: FORTYSIX # case FALSE DUPLEN$ TWENTYTWO #< ITE TRUE DROPFALSE ;

    Note that ONLY message number 46, which checks the object value of a field, is handled here. The horizontal position and vertical position are the pixel coordinates of the highlight bar when it is moved over the field. The coordinate is the top-left corner of the highlight bar, and is in system binary integer form. These values are similar to those in the Label Specifiers. The field height and width height are system binary integers that represent the height and width of the hihglight bar (i.e. the field) in pixels. The height is normally EIGHT. The field type is a system binary that represents the type of field to use. For example, in the PLOT envrionment uses an algebraic field type for the EQ field. The type of field used depends on the bits of the system binary. What each bit represents, I dont know for sure. However, valid system binary integers are: Decimal Value Field Type 1 Text Fields 3 Algebraic Field auto-ALG mode and add tic () marks to editline 12 Choose Field 32 Check Field

    Error! Utilice la pestaa Inicio para aplicar Title al texto que desea que aparezca aqu. Error! U

  • The object types list is a list of system binary integers, where each integer represents the type of objects allowed. These values are the same as those normally used for argument checking. If you are using a choose field or a check field, then use MINUSONE instead of a list of system binary integers. The decompile object can either be secondary that takes an object and returns a string, or a system binary integer. An example of a valid secondary as a decompile object is given below:

    :: DUP MINUSONE EQUAL casedrop NULL$ DUPTYPECSTR? ?SEMI EDITDECOMP$ ;

    If you choose to use a system binary integer, the bits of the integer have different specifications. Bit Value Set Decompile Format 0 No decompileexpect only strings 1 Decompile object to have stack appearance (numeric formats apply) 2 Decompile object to have stack appearance (but uses STD number format) 3 Get first character of the stringexpects a string 4 Get first object in a composite object and decompile it 5 Get second object in a composite object and decompile it If you set bits 4 or 5, then make sure to set one of those between 0 and 3 so that the input form knows how to decompile the extracted object. You may use a combination of set bits. For example, if your program passes a list containing a list of two strings, you might choose to set bits 4 and 0, giving you a system binary integer value of 2 * 2 ^ 4 + 2 * 2 ^ 0 = 17. If you use the GUI.H include file, then this will be taken care of for you. GUI.H normally comes with the HP Tools package. The help string is simply a string that gets displayed just above the menus when the field gets highlighted. These strings might contain messages on how and/or what to enter into the field. The choose field data varies according to what you intend to have as choices. Normally, using a list of strings is sufficient. The choose field decompile object follows the same rules as the field decompile object. The reset value is what gets put into the field when the user presses the RESET menu button. The initial value is what gets displayed at the start of the input form. Make sure that your reset value and initial value are of the same object type listed in your allowed object type list.

    2.3 Label Count This is simply a system binary integer that represents the number of labels there are in the input form. Having no labels is allowed; however it is good convention to have a label for each field, and vice versa, so that the users know what to enter.

    2.4 Field Count The field count is also a system binary integerit represents the number of fields there are in the input form. Again, you may choose to have no fields, or less/more fields than labels. Thus, the field count and label count do not necessarily have to be the same values. Just remember that most often, users do not already know what to enter in. It is possible, however, to use input forms as a message displayer by having only labels (to display any message or text), and no fields since there is nothing to input. This, too, is also allowed by DoInputForm.

    Error! Utilice la pestaa Inicio para aplicar Title al texto que desea que aparezca aqu. Error! U

  • 2.4 Message Handler The message handler for the input form can be DROPFALSE or a secondary pushed onto the stack. For more information about the message handler format (if you intend to use a secondary), please refer the the Appendix.

    2.5 Title The title is simply a string that will be centered at the top of the display. It will be shown in the area normally associated with the first line of the display with middle-sized fonts. If the string is too long, it will be truncated so as to fit within the 131 pixels of the HP48 display.

    Error! Utilice la pestaa Inicio para aplicar Title al texto que desea que aparezca aqu. Error! U

  • Appendix A (Example)

    Below is the source of the input form interface for the VOLUME command from CALC LIB 1.0 The original source was modified so as to be more explicit in some areas. The GUI.H and KEYDEFS.H files are assumed to be included in the compilation of this source.

    Volume Input Form :: * Label Specifiers "EQ1:" COL1 LROW1 "EQ2:" COL1 LROW2 "MIN:" COL1 LROW3 "MAX:" COL9 LROW3 "METHOD" COL17 LROW3 "VAR:" COL1 LROW4 "AXIS:" COL9 LROW4 * Field Specifiers * Equation 1 Field 'DROPFALSE COL4 FROW1 FWIDTH17 FHEIGHT FTYPE_ALGTEXT { OBTYPE_SYMB OBTYPE_REAL OBTYPE_ID } FMT_STD "Enter 1st Bound Equation" OPTDATA_NULL OPTDATA_NULL NOVAL NOVAL * Eqation 2 Field 'DROPFALSE COL4 FROW2 FWIDTH17 FHEIGHT FTYPE_ALGTEXT { OBTYPE_SYMB OBTYPE_REAL OBTYPE_ID } FMT_STD "Enter 2nd Bound Equation" OPTDATA_NULL OPTDATA_NULL NOVAL NOVAL

    Error! Utilice la pestaa Inicio para aplicar Title al texto que desea que aparezca aqu. Error! U

  • * Lower Limit of Integration Field 'DROPFALSE COL4 FROW3 FWIDTH4 FHEIGHT FTYPE_TEXT { OBTYPE_REAL } FMT_STD "Enter Lower Limit" OPTDATA_NULL OPTDATA_NULL NOVAL NOVAL * Upper Limit of Integration Field 'DROPFALSE COL12 FROW3 FWIDTH4 FHEIGHT FTYPE_TEXT { OBTYPE_REAL } FMT_STD "Enter Upper Limit" OPTDATA_NULL OPTDATA_NULL NOVAL NOVAL * Variable of Integration 'DROPFALSE COL4 FROW4 FWIDTH4 FHEIGHT FTYPE_ALGTEXT { OBTYPE_ID } FMT_STD "Enter Var of Integration" OPTDATA_NULL OPTDATA_NULL ' ID X ' ID X * Axis of rotation 'DROPFALSE COL12 FROW4 FWIDTH4 FHEIGHT FTYPE_TEXT { OBTYPE_REAL } FMT_STD "Enter Value of Axis of Rotation" OPTDATA_NULL OPTDATA_NULL NOVAL NOVAL * Type of Integration 'DROPFALSE COL16.5 FROW4 FWIDTH5 FHEIGHT FTYPE_CHOOSE OBTYPE_NA FMT_NONE "Choose Method" { "Shell" "Disc" } FMT_NONE "Disc" "Disc" * Label Count SEVEN * Field Count SEVEN * Message Handler ' :: TWENTYNINE # case FALSE GetFieldVals 15GETLAM TRUE 1LAMBIND ZERO_DO (DO) MINUSONE EQUAL IT :: FALSE 1PUTLAM ; LOOP 1GETABND DUP ?SKIP

    Error! Utilice la pestaa Inicio para aplicar Title al texto que desea que aparezca aqu. Error! U

  • :: "Undefined\0AValue(s)" NINE FIFTEEN GrobAlertIcon MsgBoxMenu DoMsgBox DROP ; TRUE ; "VOLUME BY ROTATION" DoInputForm ;

    Error! Utilice la pestaa Inicio para aplicar Title al texto que desea que aparezca aqu. Error! U

  • Appendix B (Resources)

    Below are websites that have information on programming (USR-RPL, System RPL, and Assembly). Also listed are sites containing files for download for the HP48.

    Websites http://hp48.ml.org

    This is the HP48 Archive and contains many documents on programming, and just as many files containing programs that provide additional commands for programming.

    http://www.emn.fr/eleves/promo94-98/Lime/hp/HP48_BookMarks.html This is the HP48 Bookmarks page which contains even more links to almost all the HP48 sites. Just make sure to search through this page.

    http://hp48.wsjr.com/webring.htm The HP48 Web ring is a collection of HP48 sites linked together by the Webring. Add your page to the ring, or check out the full list of members (each with a brief descriptions).

    The Official HP48 FAQ Dont forget to check the HP48 FAQ for your questions.

    comp.sys.hp48 Join the HP48 newsgroups and read postings on how to program, or post your own questions. If you dont have a newsreader, just check out Deja News at http://www.dejanews.com and browse through the newsgroups using your favorite web browser.

    Error! Utilice la pestaa Inicio para aplicar Title al texto que desea que aparezca aqu. Error! U

    System RPL Input FormsFor the HP48G and HP48GX Series CalculatorHan Duong ([email protected])AcknowledgementsDATES OF REVISIONSFirst Revision July 8, 1998 youre reading it.

    1. Introduction1.1. Features1.2. Speed and Size

    2. DoInputForm Parameters2.1. Label Specifiers2.2. Field Specifiers2.3 Label Count2.4 Field Count2.4 Message Handler2.5 Title

    Appendix A (Example)Volume Input Form

    Appendix B (Resources)WebsitesThe Official HP48 FAQcomp.sys.hp48