Inform2 or similar for 50g
08-14-2017, 08:12 PM
Post: #1
 Vtile Senior Member Posts: 406 Joined: Oct 2015
Inform2 or similar for 50g
Hello,

Is there something like Inform2 (http://www.hpcalc.org/details/1890) for 50g? I have been browsing the hpcalc.org, but have not found similar.

Thx.
08-15-2017, 02:56 AM
Post: #2
 Eric Rechlin Senior Member Posts: 367 Joined: Dec 2013
RE: Inform2 or similar for 50g
I thought this would be a good challenge to port to the 50g. I'm so close, but so far. It seems to be referencing a missing ROMPTR. It was ROMPTR B1 1C on the 48, which corresponds to library 177 command 28. But that must be different on the 49/50, because it's failing for me when I try to run the below code after compiling it.

In case anyone else wants to take a stab at it, my code follows (ready to assemble on Jazz on the 50g, followed by a call to CRLIB).

Code:

%%HP: T(3)A(D)F(.);
DIR
INFORM2
"::
CK5&Dispatch
# 35555
ID x006
# 35155
::
ROT
ONE{}N
UNROT
ID x006
;
;"
x001
"::
CK1
DUPTYPELIST?
NOT?SEMI
DUPLENCOMP
THREE
#<
?SEMI
INNERCOMP
OVER
TRUE
EQUAL
3PICK
FALSE
EQUAL
OR
ITE
::
SWAP
IT
::
DUP
ROLLDROP
#1-
;
SWAP
ITE
DROP
::
#2-
{}N
;
;
{}N
;"
x002
"::
DUP
CARCOMP
DUP
TYPECSTR?
ITE
::
DROP
FALSE
>TCOMP
FALSE
>TCOMP
;
::
DO>STR
SWAP
INNERCOMP
#1+
{}N
FALSE
>TCOMP
TRUE
>TCOMP
;
;"
x003
"::
INNERCOMP
DUP
ZERO
DO
INDEX@
#2+
ROLL
DUPTYPELIST?
ITE
ID x002
::
DUP
DO>STR
SWAP
TRUE
TRUE
FOUR
{}N
;
INDEX@
#2+
UNROLL
LOOP
{}N
;"
x004
"::
INNERCOMP
DUP
ZERO
DO
INDEX@
#2+
ROLL
DUP
FALSE
EQUAL
OVER
TRUE
EQUAL
OR
IT
::
ITE
%1
%0
;
ID x001
INDEX@
#2+
UNROLL
LOOP
{}N
;"
x005
C$1387 :: 3PICK ZERO DO ZERO ID x007 ROLL DUP TAG CHECK %1 EQUAL OVER TAG CHECK %0 EQUAL OR ITE :: TAG CHECK %1 EQUAL ZERO ID x007 UNROLL ONE ID x007 ROLL DROP ZERO ID x007 PICK ONE ID x007 UNROLL FIVE ID x007 ROLL DROP MINUSONE FIVE ID x007 UNROLL SIX ID x007 ROLL DROP MINUSONE SIX ID x007 UNROLL SEVEN ID x007 ROLL DROP THIRTYTWO SEVEN ID x007 UNROLL NINE ID x007 ROLL SIX #MIN NINE ID x007 UNROLL ; :: DUPTYPETAG? ITE :: DUP ' xOBJ> EvalNoCK$ "CHOOSE"
EQUAL
OVER
TYPELIST?
AND
OVER
NULL{}
EQUAL
NOT
AND
ITE
::
ID x003
FOUR
ID x007
UNROLL
THREE
ID x007
ROLLDROP
SEVENTEEN
THREE
ID x007
UNROLL
TWO
ID x007
ROLL
FOUR
ID x007
PICK
CARCOMP
SWAPDROP
TWO
ID x007
UNROLL
ONE
ID x007
ROLL
FOUR
ID x007
PICK
CARCOMP
SWAPDROP
ONE
ID x007
UNROLL
DROP
FIVE
ID x007
ROLLDROP
SEVENTEEN
FIVE
ID x007
UNROLL
SIX
ID x007
ROLLDROP
MINUSONE
SIX
ID x007
UNROLL
SEVEN
ID x007
ROLLDROP
TWELVE
SEVEN
ID x007
UNROLL
;
::
DROP
ZERO
ID x007
UNROLL
;
;
::
ZERO
ID x007
UNROLL
;
;
LOOP
;
x006
"::
'
ROMPTR B1 1C
ROMPTR@
NOT?SEMI
DUP
'
DoInputForm
EQUALPOSCOMP
#1-
ONE
SWAP
SUBCOMP
EVAL
ID x005
'
ROMPTR B1 1C
ROMPTR@
DROP
DUP
'
DoInputForm
EQUALPOSCOMP
OVER
LENCOMP
SUBCOMP
EVAL
DUP
%1
%=
IT
::
SWAP
ID x004
SWAP
;
;"
x007
"::
FIVE
INDEX@
THIRTEEN
#*
#+
#+
;"
$CONFIG ":: # 67B TOSRRP ;"$VISIBLE {
INFORM2 }
$HIDDEN { x001 x002 x003 x004 x005 x006 x007 }$ROMID 1659
\$TITLE
"INFORM/EXTRA - MBW"
END
08-26-2017, 05:55 PM
Post: #3
 Vtile Senior Member Posts: 406 Joined: Oct 2015
RE: Inform2 or similar for 50g
Wow. I would have imagined it would be a few lines of sysRPL and that it is.
08-26-2017, 08:46 PM
Post: #4
 DavidM Senior Member Posts: 847 Joined: Dec 2013
RE: Inform2 or similar for 50g
(08-26-2017 05:55 PM)Vtile Wrote:  Wow. I would have imagined it would be a few lines of sysRPL and that it is.

...and it looks like it's actually even more code. The ROMPTR call Eric references appears to be a wrapper around DoInputForm. INFORM2 pulls that entire routine onto the stack, executes all of it before the DoInputForm call, executes its own subroutine, then executes the remaining part of B1 1C. After that it does some more custom clean-up activity if the result wasn't canceled.

I suppose you could replicate all of that, but then you'd have to trace through the 9 or so other library calls B1 1C makes and replicate them as well (or find their equivalents in the 50g [if they even exist]). And who knows what else those routines call. It could take a while just to figure out what all you had to replicate.

Getting all of that to work successfully would probably be harder than simply learning how to do this in SysRPL on the 50g in the "normal" way.

Seriously, though: I suspect the B1 1C routine doesn't exist on the 50g due to the newer InForm functionality that was added in later O/S revisions. It was apparently never a supported function, and it probably got revised to the point that it wouldn't be usable in this new context if it even still exists at all.

Eric: you'd probably be better off just trying to write your own version instead of retro-fitting INFORM2. It seems rather dependent on those library entries being present.
08-26-2017, 10:20 PM
Post: #5
 Eric Rechlin Senior Member Posts: 367 Joined: Dec 2013
RE: Inform2 or similar for 50g
(08-26-2017 08:46 PM)DavidM Wrote:  Eric: you'd probably be better off just trying to write your own version instead of retro-fitting INFORM2. It seems rather dependent on those library entries being present.

Yeah, after spending about an hour on it I realized it wasn't going to solve itself anytime soon so I gave up. Oh well.
08-26-2017, 10:40 PM
Post: #6
 Software49g Junior Member Posts: 46 Joined: Mar 2014
RE: Inform2 or similar for 50g
Hello Eric,

> It was ROMPTR B1 1C on the 48, which corresponds to library 177 command 28.
Most likely it is
ROMPTR B1 1E
that you are looking for (the internal name is Ck&DoInForm).

However, Ck&DoInForm calls FLASHPTR IfMain instead of DoInputForm. As long as there is no message handling involved it should not matter and as far as I can see (I only had a quick look on it) there is no message handling involved.

I don’t have a machine ready with Jazz on the 50g, so I can not easily try this. But I am pretty sure, that this is the ROMPTR you are looking for and you should give it a try IMHO. (In case it does not work with IfMain than there is also the possibility to modify the code at run time and exchange it to DoInputForm – but you should give it a try first.)

The 49G ROM does indeed contains the whole old DoInputForm engine (GUISLV/GUIMES is entirely built around that) which is Lib # B0 and all its supporting libraries (which are # B1 # B3 # B4 # B5 # B9 # BA # BB # BC # BD # BE # BF).
There is even SX code in the 49G ROM!

IfMain (the newer engine) is totally independent from that (and has different and less message handling than DoInputForm).

However, due to the introduction of the FLASHPTR there was need for adding some ROMPTRs here and there, as not everything is in the same FlashBank.
And generally a FlashPtr call should be faster (and does not need TempOb RAM) than a ROMPTR call (the drawback is, that there is no RAM entry for FlashPtrs whereas there is a RAM entry for ROMPTRs).

In particular two ROMPTR were added to Lib # B1 in the 49G ROM. I did not check in detail which and where and leave this exercise to the reader.

HTH,
Andreas

http://www.software49g.gmxhome.de
 « Next Oldest | Next Newest »

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