Post Reply 
Strange error in an input form
01-19-2020, 08:00 PM
Post: #1
Strange error in an input form
Hello all,

In a subroutine I get a strange error with regard to an input form. The subroutine in question asks for a name to be entered via the input form. When this is entered and OK is pressed, I get the error message "Bad Argument Type". When I then press OK again, I see a number of Externals and some strings that appear on the screen from the menu or the message handler. The message handler is responsible for the soft menu in this case. I have enclosed the code below. The local variable "LAM cfgl" is declared in the main program, in which this code can be executed. This variable contains a list. I hope someone can help me solve this problem. Sincerely, Karel.
Code:

::
 "Name:"
 BINT2
 BINT32
 'DROPFALSE
 BINT23
 BINT30
 BINT102
 BINT8
 BINT1
 {
    BINT6
 }
 BINT4
 " Enter a name"
 MINUSONE
 DUP
 NULLID
 DUP
 BINT1
 BINT1
 '
 ::
     ID IFMH1
 :
 "NAME YOUR CONFIGURATION'
 FPTR 4 20
 NOT?SEMI
 LAM cfgl
 OVER
 >TCOMP
 '
 LAM cfgl
 STO
 xRCLF
 xRCLKEYS
 TWO{}N
 SWAP
 %3
 %>TAG
 xSTO
;
@

[b]IFMH1:[/b]

::
 BINT15
 #<>
 caseFALSE
 '
 ::
   NoExitAction
   {
       {
          ::
           TakeOver
           5GETLAM
           PTR 63E42
           ITE
           "EDIT"
           NULL$
          :
          ::
           TakeOver
           FPTR 2 B5
           :
       }
       {
           ::
             TakeOver
             5GETLAM
             PTR 63E7E
             ITE
             "CHOOS"
             NULL$
            :
            ::
              TakeOver
              FPTR 2 B6
            :
        }
        {
              ::
               TakeOver
               PTR 63ED8
               ITE
               PTR 63CFC
               NULL$
              ;
              ::
                TakeOver
                FPTR 2 B7
              ;
        }
        {
              "RESET"
              ::
                TakeOver
                FPTR 2 B8
              ;
        }
        {
              "CANCL"
              ::
                TakeOver
                FPTR 2 AF
              ;
        }
        {
              "OK"
              ::
                TakeOver
                FPTR 2 B4
              ;
        }
     }
   ;
 TRUE
;
@

I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2.
Find all posts by this user
Quote this message in a reply
01-20-2020, 01:48 PM
Post: #2
RE: Strange error in an input form
You wrote a message handler for message BINT15, also known as IfMsgOK, which (when handled) expects a TRUE or FALSE specifying whether the OK key press should be ignored. You gave it a menu back instead. Whoops. You're probably looking for IfMsgGetMenu, which is message BINT11.
The main piece of code looks fine otherwise, but the menu does not. It appears you copied bits out of ROMPTR2 ~IfMenuRow1 and ROMPTR2 ~IfMenuRow2 (while dropping an important 5GETLAM too, right after the TakeOver for your third menu key), which is the menu for the old input form engine (DoInputForm). You're starting the new input form engine though (FPTR2 ^IfMain); the two are incompatible.
Try decompiling the ROM at 4:5A8DC, that's the piece of code that builds the new input form engine's menu, including calling the input form's message handler with messages BINT12 (IfMsgGet3KeysMenu) and BINT11 (IfMsgGetMenu). You'll find all the default menu keys somewhere in there, so you can cobble together a menu just like you did with the old engine's keys. I'm not quite sure why you're altering the menu though, because if you only use default key definitions, you could save some effort and leave it untouched.
Find all posts by this user
Quote this message in a reply
01-20-2020, 10:30 PM
Post: #3
RE: Strange error in an input form
(01-20-2020 01:48 PM)3298 Wrote:  You wrote a message handler for message BINT15, also known as IfMsgOK, which (when handled) expects a TRUE or FALSE specifying whether the OK key press should be ignored. You gave it a menu back instead. Whoops. You're probably looking for IfMsgGetMenu, which is message BINT11.
The main piece of code looks fine otherwise, but the menu does not. It appears you copied bits out of ROMPTR2 ~IfMenuRow1 and ROMPTR2 ~IfMenuRow2 (while dropping an important 5GETLAM too, right after the TakeOver for your third menu key), which is the menu for the old input form engine (DoInputForm). You're starting the new input form engine though (FPTR2 ^IfMain); the two are incompatible.
Try decompiling the ROM at 4:5A8DC, that's the piece of code that builds the new input form engine's menu, including calling the input form's message handler with messages BINT12 (IfMsgGet3KeysMenu) and BINT11 (IfMsgGetMenu). You'll find all the default menu keys somewhere in there, so you can cobble together a menu just like you did with the old engine's keys. I'm not quite sure why you're altering the menu though, because if you only use default key definitions, you could save some effort and leave it untouched.

Hi 3298,

Apparently I am not using the correct documentation. I used James Donnelly's book as a reference: "An Introduction to HP 48 System RPL and Assembly Language Programming", March 1, 2009. If I cannot use this reference for the HP-50g, which reference should I use? Is there a similar manual especially for the HP-50g? I hope to hear from you. Sincerely, Karel.

I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2.
Find all posts by this user
Quote this message in a reply
01-20-2020, 10:47 PM
Post: #4
RE: Strange error in an input form
Start with this amazing document:

"Programming in System RPL" - for 49G and derived machines (49g+ and 50g)

https://www.hpcalc.org/details/5142

There are also other SysRPL documents on hpcalc.org, you can use a search to find many of them, based on what you need.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
01-21-2020, 10:34 PM
Post: #5
RE: Strange error in an input form
(01-20-2020 10:47 PM)rprosperi Wrote:  Start with this amazing document:

"Programming in System RPL" - for 49G and derived machines (49g+ and 50g)

https://www.hpcalc.org/details/5142

There are also other SysRPL documents on hpcalc.org, you can use a search to find many of them, based on what you need.

Thank you! Sincerely, Karel.

I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)