From: Gurveer on
Hi

I was trying to create an old Equation Library Browser program as
described in James Donnelly's book, just a simple program to have a
display like that, not the whole equation library. I was wondering how
to give a line break in between two consecutive options. Say my
options are "ABC" and "DEF", it would display like this:

"ABC"
"DEF"

whereas I wanted it to be displayed as

"ABC"

"DEF".

In order to solve that, I tried giving a line break before "DEF" or
after "ABC" but that did not seem to make any difference. Then I
inserted another element in the list as NULL$ in between those two
which made it to display the way I wanted. Now the problem was as I
would scroll down, it would highlight the empty line as well which
makes sense though. Is there anyway I can get rid of it not being
highlighted as I scroll up or down.

What I thought of at first was to directly introduce the grob as

'ABC

'

which could give me a line break beforehand but the calculator would
just crash as I expected that the item list for the browser has to
have only strings. Then I thought of using the Choose engine instead
of the BRbrowse command. But to no success, as I could not find if the
list parameter can have graphic elements, unfortunately, in Eduardo's
Programming book.

Another idea I came up with was to have a message handler defining the
action to be taken when the arrow key is pressed but the BRbrowse
doesn't allow message handlers to customize the action to be taken on
a keypress (not that I know of).

Upon searching on www.hpcalc.org, I found a document named "gxbrowsr
by Ludwik.

http://www.hpcalc.org/details.php?id=1712

I went through it and learnt somewhat though. In the end, he shows the
decompilation of Choose command (of courese, SysRPL one) where one can
customize the key actions. I did the same thing after I copied the
code from Nosy. But the difference in the two codes(Nosy and Ludwik's)
is that Nosy uses PTRs whereas he uses ROMPTRs and when I recompiled
the code from Nosy and checked again using Nosy, those PTRs are
something else now.

For example: The rompointer used for customization of keypress

ROMPTR 0B3 008

is reflected as PTR 5AE41 in the further decompilation of ROMPTR2
~Choose.

and when I get into it both have the same contents.

But when I recompile PTR 5AE41(just by itself), it's some weird
looking Assembly Code now.

Even if I would replace all the PTRs from ROMPTR2 ~Choose by the
ROMPTRs as mentioned in Ludwik's document, the program won't still run
properly as it would just warmstart as soon as I would try to run it.

So the question is, is there any easier way to have just that simple
line break? I know there's gotta be a way but I'm just totally unable
to figure that out. I looked into quite a few sources but ultimately
everything was futile. Although learnt a lot but not exactly what I
wanted. And still don't understand the behavior of those PTRs, like
how can I get to know what PTR is represented by what ROMPTR and if
there's another way to compile pointers like this. I simply use Emacs
to create these programs and Nosy to kinda get into it.

Any light on this topic would highly appreciated.

Thanks a lot in advance!

Regards,

Gurveer

From: Gurveer on
On Feb 16, 2:10 am, Gurveer <gurveer....(a)gmail.com> wrote:
> Hi
>
> I was trying to create an old Equation Library Browser program as
> described in James Donnelly's book, just a simple program to have a
> display like that, not the whole equation library. I was wondering how
> to give a line break in between two consecutive options. Say my
> options are "ABC" and "DEF", it would display like this:
>
> "ABC"
> "DEF"
>
> whereas I wanted it to be displayed as
>
> "ABC"
>
> "DEF".
>
> In order to solve that, I tried giving a line break before "DEF" or
> after "ABC" but that did not seem to make any difference. Then I
> inserted another element in the list as NULL$ in between those two
> which made it to display the way I wanted. Now the problem was as I
> would scroll down, it would highlight the empty line as well which
> makes sense though. Is there anyway I can get rid of it not being
> highlighted as I scroll up or down.
>
> What I thought of at first was to directly introduce the grob as
>
> 'ABC
>
> '
>
> which could give me a line break beforehand but the calculator would
> just crash as I expected that the item list for the browser has to
> have only strings. Then I thought of using the Choose engine instead
> of the BRbrowse command. But to no success, as I could not find if the
> list parameter can have graphic elements, unfortunately, in Eduardo's
> Programming book.
>
> Another idea I came up with was to have a message handler defining the
> action to be taken when the arrow key is pressed but the BRbrowse
> doesn't allow message handlers to customize the action to be taken on
> a keypress (not that I know of).
>
> Upon searching onwww.hpcalc.org, I found a document named "gxbrowsr
> by Ludwik.
>
> http://www.hpcalc.org/details.php?id=1712
>
> I went through it and learnt somewhat though. In the end, he shows the
> decompilation of Choose command (of courese, SysRPL one) where one can
> customize the key actions. I did the same thing after I copied the
> code from Nosy. But the difference in the two codes(Nosy and Ludwik's)
> is that Nosy uses PTRs whereas he uses ROMPTRs and when I recompiled
> the code from Nosy and checked again using Nosy, those PTRs are
> something else now.
>
> For example: The rompointer used for customization of keypress
>
> ROMPTR 0B3 008
>
> is reflected as PTR 5AE41 in the further decompilation of ROMPTR2
> ~Choose.
>
> and when I get into it both have the same contents.
>
> But when I recompile PTR 5AE41(just by itself), it's some weird
> looking Assembly Code now.
>
> Even if I would replace all the PTRs from ROMPTR2 ~Choose by the
> ROMPTRs as mentioned in Ludwik's document, the program won't still run
> properly as it would just warmstart as soon as I would try to run it.
>
> So the question is, is there any easier way to have just that simple
> line break? I know there's gotta be a way but I'm just totally unable
> to figure that out. I looked into quite a few sources but ultimately
> everything was futile. Although learnt a lot but not exactly what I
> wanted. And still don't understand the behavior of those PTRs, like
> how can I get to know what PTR is represented by what ROMPTR and if
> there's another way to compile pointers like this. I simply use Emacs
> to create these programs and Nosy to kinda get into it.
>
> Any light on this topic would highly appreciated.
>
> Thanks a lot in advance!
>
> Regards,
>
> Gurveer

And yeah, BTW, I have an HP 50g calculator. :-)
From: John H Meyers on
On 2/16/2010 3:10 AM, Gurveer wrote:

> For example: The rompointer used for customization of keypress
> ROMPTR 0B3 008

Library #B3h has essentially the same overall functionality
as the original "GX Browser" for the HP48G[X].

However, some of the originally documented library function numbers
have changed between the HP48G[X] version and the HP49G/50G series version,
as I noticed when making a "99-byte full screen CHOOSE" for both series,
so you should be aware of these differences, to make sure that
you adjust the documentation accordingly for the latter series,
as well as using _only_ the appropriate ROMPTRs in your own code (not PTRs,
because the memory locations you see in Nosy while inspecting ~Choose
require "memory remapping" to become valid, and can not be called directly.

Unless someone has documented the entire new library,
it may take some painstaking tabulation of every ROMPTR B3 nnn
to find the equivalences between the HP48G[X] version
and the HP49G/50G series version, as well as to find out
which PTRs in flash bank 2 correlate with which ROMPTR
(the latter correlation may be dependent on ROM version,
so the only use for correlating these "PTRs" with ROMPTRS
is to understand the internals of this library as you browse it with Nosy,
rather than to ever use the PTRs in your own code).

Here's a further discussion from exactly one year ago:
http://groups.google.com/group/comp.sys.hp48/browse_thread/thread/a3ec171dd606dbb3

[r->] [OFF]
From: Andreas Möller on
Hello,

without major modification you will not be able to do what you want
with the 48GX based browser. You can change the hight of a displayed
line through a message IIRC but its going to be difficult to create
lines where the height is changing. Might be done through message
handling, but it wil be complicated and probably slow.

If you want to start with Ludvik´s explanation you have to modify the
code for the 50G, this is a working code I created once for myself,
but be aware of Flash Page interjumps. The trick is to evaluate the
objects in the correct Flash Page, for this you must use the following
construct:
' PTR <address> FPTR <page> 0
This works, because at every flash page the routine 0 points to EVAL.
(You can use Nosy to verify this.)

By the way: I once decompiled the entire ChooseBox-Engine because I
wanted to modify the HardKey-Handler, I have not checked if this code
still works with the current ROM but it might be a good way to start.
But of course this will make your program bigger ;-)

HTH,
Andreas

Here comes the code from Ludvik, modified so that it works on the 49
series (tested with ROM 2.15):

xNAME Test
::
'DROPFALSE
"Test"
BINT17 ( The ::Converter Parameter, Decompile object: show first
part as Text )
{ { "ABC" } { "DEF" } { "GHI" } { "JKL" } }
BINT1
ExtendedChoose
*ROMPTR Choose
;

* Anfang Choose-Box Definitions
DEFINE BBBrowse ROMPTR 0B3 000
DEFINE BBRecalcOff&Disp? ROMPTR 0B3 019
DEFINE BBReReadPageSize ROMPTR 0B3 023
DEFINE BBReReadHeight ROMPTR 0B3 024
DEFINE BBReReadCoord ROMPTR 0B3 025
DEFINE BBReReadWidth ROMPTR 0B3 026
DEFINE BBRunENTERAction ROMPTR 0B3 028
DEFINE BBRunCancelAction ROMPTR 0B3 029
DEFINE BBChkCurr ROMPTR 0B3 02A
DEFINE BBChkAll ROMPTR 0B3 02B
DEFINE BBUnChkAll ROMPTR 0B3 02C
DEFINE BBCancel ROMPTR 0B3 02D
DEFINE BBDone ROMPTR 0B3 02E
DEFINE BBReDrawBackgr ROMPTR 0B3 02F
DEFINE BBReDrawTitle ROMPTR 0B3 030
DEFINE BBGetTitle ROMPTR 0B3 034
DEFINE BBReDrawLines ROMPTR 0B3 035
DEFINE BBReDrawLine ROMPTR 0B3 036
DEFINE BBReReadMenus ROMPTR 0B3 03D
DEFINE BBReReadNumOfElems ROMPTR 0B3 03E
DEFINE BBGetN ROMPTR 0B3 03F
DEFINE BBIsChecked? ROMPTR 0B3 04B
DEFINE BBPgDown ROMPTR 0B3 059
DEFINE BBPgUp ROMPTR 0B3 05A
DEFINE BBEmpty? ROMPTR 0B3 05B
* Ende Choose-Box Definitions

******** Dies entspricht dem Original-Code des Choose-Box Engine
**********************************************************
******** einige der von mir extrahierten Unterprogramme können ggf.
noch mit den entsprechenden ROMPTR ********************
******** aufgerufen / ersetzt werden um Speicherplatz zu sparen !!!
*******************************************************
NULLNAME ExtendedChoose
* Browser runs as POL, but doesn't allow user to provide the hard
key
* assignments. If you want you're own keys, you have to run modified
* browser. Here is disassembly of ROMPTR 0B3 000:
::
POLSaveUI
ERRSET
::
DUP#0= ( InitOffset == #0?... )
ITE
:: DROPONE TRUE ; ( ...yes, do viewer - no selection )
FALSE ( ...no, do browser - with selection )

MINUSONE
THIRTEEN
NDUPN
DROP
ROMPTR 0B3 057 ( GetDisplayStatus, 3NULLLAM
format ) ( identisch mit 48GX )
FALSE
TWENTYONE
( ROMPTR 0B0 0DB ) ( CACHE 21 NULLLAMs ) ' NULLLAM
CACHE
' ROMPTR 0B3 03B ( Get #ReqNum 61 into
16NULLLAM ) ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
' ROMPTR 0B3 03C ( Get #ReqNum 60 into
14NULLLAM ) ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
' ROMPTR 0B3 03D ( Get #ReqNum 83 into
13NULLLAM ) ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
' ROMPTR 0B3 03E ( Get #ReqNum 62 into
12NULLLAM ) ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
' ROMPTR 0B3 024 ( Get #ReqNum 58 into
7NULLLAM ) ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
' ROMPTR 0B3 023 ( Get #ReqNum 57 into
11NULLLAM ) ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
' ROMPTR 0B3 026 ( Get #ReqNum 59 into
8NULLLAM ) ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
' ROMPTR 0B3 025 ( Get #ReqNum 63 into 9NULLLAM/
10NULLLAM ) ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
ROMPTR 0B3 04A ( Initialize
15NULLLAM ) ( identisch mit 48GX )
' ROMPTR 0B3 027 ( Run #ReqNum
64 ) ( identisch mit 48GX ) ROMPTR@ DROP
FLASHPTR 2 0
' ROMPTR 0B3 039 ( Run #ReqNum
84 ) ( identisch mit 48GX ) ROMPTR@ DROP
FLASHPTR 2 0
' ROMPTR 0B3 022
( Run ::EntryProc ) ( identisch mit 48GX )
ROMPTR@ DROP FLASHPTR 2 0
' :: ' ROMPTR 0B3 001
( AppDisplay ) ( identisch mit 48GX )
ROMPTR@ DROP FLASHPTR 2 0 ;
' :: ' ROMPTR 0B3 008 ( AppKeys, replace this for own
HardKeys ) ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0 ;
TrueTrue ( NonAppKeyOK? + DoStdKeys? )
13GETLAM ( AppMenu )
ONEFALSE ( #AppMenuRow + SuspendOK? )
' 2GETLAM ( ExitCond )
' :: ' ROMPTR 0B0 000
( AppError ) ( identisch mit 48GX )
ROMPTR@ DROP FLASHPTR 2 0 ;
' POLSetUI FLASHPTR 2 0 ( Setup POL )
ClrDAsOK
' POLKeyUI FLASHPTR 2 0 ( Run POL )
' ROMPTR 0B3 03A ( Restore entry
screen ) ( identisch mit 48GX ) ROMPTR@ DROP
FLASHPTR 2 0
ClrDAsOK
3GETLAM ( {}displayStatus )
ROMPTR 0B3 058
( SetDisplayStatus ) ( identisch mit 48GX )
ABND
;
ERRTRAP POLResUI&Err
POLRestoreUI
;
From: Gurveer on
On Feb 16, 4:52 am, Andreas Möller <andreas_moellerNOS...(a)gmx.de>
wrote:
> Hello,
>
> without major modification you will not be able to do what you want
> with the 48GX based browser. You can change the hight of a displayed
> line through a message IIRC but its going to be difficult to create
> lines where the height is changing. Might be done through message
> handling, but it wil be complicated and probably slow.
>
> If you want to start with Ludvik´s explanation you have to modify the
> code for the 50G, this is a working code I created once for myself,
> but be aware of Flash Page interjumps. The trick is to evaluate the
> objects in the correct Flash Page, for this you must use the following
> construct:
> ' PTR <address> FPTR <page> 0
> This works, because at every flash page the routine 0 points to EVAL.
> (You can use Nosy to verify this.)
>
> By the way: I once decompiled the entire ChooseBox-Engine because I
> wanted to modify the HardKey-Handler, I have not checked if this code
> still works with the current ROM but it might be a good way to start.
> But of course this will make your program bigger ;-)
>
> HTH,
> Andreas
>
> Here comes the code from Ludvik, modified so that it works on the 49
> series (tested with ROM 2.15):
>
> xNAME Test
> ::
>   'DROPFALSE
>   "Test"
>   BINT17 ( The ::Converter Parameter, Decompile object: show first
> part as Text )
>   { { "ABC" } { "DEF" } { "GHI" } { "JKL" } }
>   BINT1
>   ExtendedChoose
> *ROMPTR Choose
> ;
>
> * Anfang Choose-Box Definitions
> DEFINE BBBrowse           ROMPTR 0B3 000
> DEFINE BBRecalcOff&Disp?  ROMPTR 0B3 019
> DEFINE BBReReadPageSize   ROMPTR 0B3 023
> DEFINE BBReReadHeight     ROMPTR 0B3 024
> DEFINE BBReReadCoord      ROMPTR 0B3 025
> DEFINE BBReReadWidth      ROMPTR 0B3 026
> DEFINE BBRunENTERAction   ROMPTR 0B3 028
> DEFINE BBRunCancelAction  ROMPTR 0B3 029
> DEFINE BBChkCurr          ROMPTR 0B3 02A
> DEFINE BBChkAll           ROMPTR 0B3 02B
> DEFINE BBUnChkAll         ROMPTR 0B3 02C
> DEFINE BBCancel           ROMPTR 0B3 02D
> DEFINE BBDone             ROMPTR 0B3 02E
> DEFINE BBReDrawBackgr     ROMPTR 0B3 02F
> DEFINE BBReDrawTitle      ROMPTR 0B3 030
> DEFINE BBGetTitle         ROMPTR 0B3 034
> DEFINE BBReDrawLines      ROMPTR 0B3 035
> DEFINE BBReDrawLine       ROMPTR 0B3 036
> DEFINE BBReReadMenus      ROMPTR 0B3 03D
> DEFINE BBReReadNumOfElems ROMPTR 0B3 03E
> DEFINE BBGetN             ROMPTR 0B3 03F
> DEFINE BBIsChecked?       ROMPTR 0B3 04B
> DEFINE BBPgDown           ROMPTR 0B3 059
> DEFINE BBPgUp             ROMPTR 0B3 05A
> DEFINE BBEmpty?           ROMPTR 0B3 05B
> * Ende Choose-Box Definitions
>
> ******** Dies entspricht dem Original-Code des Choose-Box Engine
> **********************************************************
> ******** einige der von mir extrahierten Unterprogramme können ggf.
> noch mit den entsprechenden ROMPTR ********************
> ******** aufgerufen / ersetzt werden um Speicherplatz zu sparen !!!
> *******************************************************
> NULLNAME ExtendedChoose
> *   Browser runs as POL, but doesn't allow user to provide the hard
> key
> *   assignments. If you want you're own keys, you have to run modified
> *   browser. Here is disassembly of ROMPTR 0B3 000:
>    ::
>      POLSaveUI
>      ERRSET
>      ::
>        DUP#0=                 ( InitOffset == #0?... )
>        ITE
>          :: DROPONE TRUE ;    ( ...yes, do viewer - no selection )
>          FALSE                ( ...no, do browser - with selection )
>
>        MINUSONE
>        THIRTEEN
>        NDUPN
>        DROP
>        ROMPTR 0B3 057         ( GetDisplayStatus, 3NULLLAM
> format )      ( identisch mit 48GX )
>        FALSE
>        TWENTYONE
>        ( ROMPTR 0B0 0DB )        ( CACHE 21 NULLLAMs )  ' NULLLAM
> CACHE
>      ' ROMPTR 0B3 03B         ( Get #ReqNum 61 into
> 16NULLLAM )          ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
>      ' ROMPTR 0B3 03C         ( Get #ReqNum 60 into
> 14NULLLAM )          ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
>      ' ROMPTR 0B3 03D         ( Get #ReqNum 83 into
> 13NULLLAM )          ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
>      ' ROMPTR 0B3 03E         ( Get #ReqNum 62 into
> 12NULLLAM )          ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
>      ' ROMPTR 0B3 024         ( Get #ReqNum 58 into
> 7NULLLAM )           ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
>      ' ROMPTR 0B3 023         ( Get #ReqNum 57 into
> 11NULLLAM )          ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
>      ' ROMPTR 0B3 026         ( Get #ReqNum 59 into
> 8NULLLAM )           ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
>      ' ROMPTR 0B3 025         ( Get #ReqNum 63 into 9NULLLAM/
> 10NULLLAM ) ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0
>        ROMPTR 0B3 04A         ( Initialize
> 15NULLLAM )                   ( identisch mit 48GX )
>      ' ROMPTR 0B3 027         ( Run #ReqNum
> 64 )                         ( identisch mit 48GX ) ROMPTR@ DROP
> FLASHPTR 2 0
>      ' ROMPTR 0B3 039         ( Run #ReqNum
> 84 )                         ( identisch mit 48GX ) ROMPTR@ DROP
> FLASHPTR 2 0
>      ' ROMPTR 0B3 022
> ( Run ::EntryProc )                        ( identisch mit 48GX )
> ROMPTR@ DROP FLASHPTR 2 0
>   ' :: ' ROMPTR 0B3 001
> ( AppDisplay )                             ( identisch mit 48GX )
> ROMPTR@ DROP FLASHPTR 2 0 ;
>   ' :: ' ROMPTR 0B3 008       ( AppKeys, replace this for own
> HardKeys ) ( identisch mit 48GX ) ROMPTR@ DROP FLASHPTR 2 0 ;
>        TrueTrue               ( NonAppKeyOK? + DoStdKeys? )
>        13GETLAM               ( AppMenu )
>        ONEFALSE               ( #AppMenuRow + SuspendOK? )
>        ' 2GETLAM              ( ExitCond )
>   ' :: ' ROMPTR 0B0 000
> ( AppError )                               ( identisch mit 48GX )
> ROMPTR@ DROP FLASHPTR 2 0 ;
>      ' POLSetUI FLASHPTR 2 0  ( Setup POL )
>        ClrDAsOK
>      ' POLKeyUI FLASHPTR 2 0  ( Run POL )
>      ' ROMPTR 0B3 03A         ( Restore entry
> screen )                   ( identisch mit 48GX ) ROMPTR@ DROP
> FLASHPTR 2 0
>        ClrDAsOK
>        3GETLAM                ( {}displayStatus )
>        ROMPTR 0B3 058
> ( SetDisplayStatus )                       ( identisch mit 48GX )
>        ABND
>      ;
>      ERRTRAP POLResUI&Err
>      POLRestoreUI
>    ;

This is actually supercool. Thanks it does work. :-)

I have modified the hard key handler and it works almost great now.
(Just need to work for the Up arrow key in the similar manner as I did
the down arrow.) Yeah, it's a little slow though. But doesn't make
much of a difference to me. Quite curious to know if there is a
similar documentation about the ROMPTRs associated with the BRbrowse
command instead of the Choose command. I mean the library E0 (224).

But thanks a lot!

Gurveer