Newsgroups: comp.sources.hp48
From: DANIEL COHEN-LAROQUE <COHEN_LA@eldi.epfl.ch>
Subject:  v07i019:  inx.dcl - Decompiling addresses v1.0, Part01/01
Message-ID: <1992Oct6.184730.13013@seq.uncwil.edu>
Date: Tue, 6 Oct 1992 18:47:30 GMT
Approved: spell@seq.uncwil.edu

Checksum: 1925698838 (verify with brik -cv)
Submitted-by: DANIEL COHEN-LAROQUE <COHEN_LA@eldi.epfl.ch>
Posting-number: Volume 7, Issue 19
Archive-name: inx.dcl

BEGIN_DOC inx.doc
   Hello FortyEighters!

This routine should be usefull (not to mention indispensable)
for thoses who had the good idea to install the excellent RPL2.2 library.

Imagine you decide to decompile a routine (i.e. ?ATTNQUIT):
So you push "?ATTNQUIT" in the stack and use the ->Addr command from
the RPL2.2 lib. You should get # 4243Eh. Step by step, it is possible
to decompile the routine using the DACDR command from the same library 
but this is often annoying. So, test 'inx' :
Execute 'inx' with # 4243Eh in level 2 and the real 1 in level 2, 
you should obtain: (don't care about the level 2, it will be explained later)

"::
NoAttn?Semi
ATTNFLGCLR
FLUSHKEYS
ABORT
;
"

But this is not all that inx can do, here is a less obvious example:
let's decompile the e^x routine! The address is # 1B905h.

"::
CK1&Dispatch
ONE
%EXP
TWO
C%EXP
TEN
PTR 550DF
;"

      (obtained by :2: #1B905h :1: 1)

As you see, the last command is a pointer (PTR 550DF) which says 
nothing very clearly. But instead of searching what is hidden behind 
this address, try this :2: #1B905h :1: 2  and execute 'inx'

"::
CK1&Dispatch
ONE
%EXP
TWO
C%EXP
TEN
::
cknumdsptch1
PTR 552D8
xEXP
;
;"
Yeah, the pointer has been replaced by the pointee. In fact, inx recursively
decompiles an address each time it encounters the word PTR and the second
parameter (in level 2) stands for the depth (which is shown by the number
preceeding the command, see the display).
(i.e. the address PTR 552D8 (above) would has been replaced if you'd tried
:2: #1B905h :1: 3 )


Traveling around the hp-rom is the best exercise to learn sys-rpl!
Change the name inside the program if you don't like 'inx'...

Many thanks to :
   1) Detlef Mueller for his rpl2.2 library.
   2) Bill Levenson who let me know this great tool.

Give me comments, suggestions about the soft (or even my poor English!) to :

--:
Daniel COHEN_LAROQUE                        Address :  Les Pommeraies
Swiss Federal Institute of Technology                  74160 ARCHAMPS
Communication Sciences                                 FRANCE
           ----><----       
"Notre nature est dans le mouvement,        Tel (F) :  (+33) 50.43.71.67
 le repos entier est la mort."              Tel (CH):  (+41-21) 801.60.15
                 Blaise Pascal                Email :  cohen_la@eldi.epfl.ch

P.S. For those who are interested in a soft to view long strings (and others
possibilities), I will release a new version (2.1) of my 'Scrn' soon.
END_DOC

BEGIN_ASC inx.asc
%%HP: T(3)A(R)F(.);
"D9D20D9F81119201B000D9D20C4130D0040D9E36D9D209C2A2FEF3059230B213
0D9D2059230FEF3032230B213047A20D6E20108703D43D6E2040C6D61687B213
00D470F55A3C2A20B1000445636F6D60796C696E67652456EE250B842195D262
A17029E202D4100CAF06D9D20881307104095236C2A20B000005452579B30D6E
201087D6E2040C6D61687178A2AEC36D9D2012040940403375033456B5250731
41D6E20108726205D6E2040C6D61687CAF0684E203094E485B213088130D2756
EFC36D9D20B7B34B2130881301B456C5746EFC36D9D207E316E0E300F516B213
0B213088130D6E2010878162288041B94217E3166AC30A217019136A6F367E31
66AC308C1707947044230B2130FEF30D9D20C2A20D5000445636F6D6070254E6
479627560225F6574796E656A055371676560202A323A33286873702A313A352
C6566784051B2130B21302CF9"
END_ASC

BYTES: #9FC2h 330.5

BEGIN_UU inx.uue
begin 644 inx
M2%!(4#0X+46=+=#Y&!$I$`L`G2W`%`,-0-#I8YTMD"PJ[S]0*0,K,=#9`I4R
M\/X#(S*P$@-T*M#F`@%X,$W3Y@($;&UA>"LQ`$T'7Z7#H@(;`$!4-O;6!I?&
MEN9V5D)E[E*P2!)9+28:!Y(N($T!P/I@G2V`&`,70)`E8RPJL```4%12ESO0
MY@(!>&TN0,#6%H87ARKJ/-;9`B%`D`0$,U<P0V5;4G`3%&TN$(`G)E!M+D#`
MUA:&Q_I@2"XPD.2$M1(#B#'0<F7^/-;9`GL[M!(#B#$02V5<1^;/8YTM<#YA
M#CX`7V$K,;`2`X@QT.8"`7@8)H((%)LD<3YAICR@$@>1,:;V8^<39LH#R'%P
M20=$,K`2`^\_T-D"+"K0!0!$96-O;7`@16YT:7)E(%)O=71I;F4*57-A9V4@
8(#HR.B-H>',@.C$Z)6QE=DA0L1(#*S$`
`
end
sum -r/size 43109/488 section (from "begin" to "end")
sum -r/size 34178/339 entire input file
END_UU
