[comp.sys.handhelds] Alternate Stack Display

n233dk@tamuts.tamu.edu (Rick Grevelle) (10/12/90)

While it is understandable that many users would like too see HP release more
information about the internals of their calculators, personally I'm rather
ambivalent.  To me, the HP48 is a Rubic's Cube; a puzzle of sorts.  Releasing
limited details about the 48's internals could enhance playing the GAME.
Disclose too much information, and it could possibly ruin most of the fun.

At first this may seem a somewhat strange and selfish attitude, but considering
all of the arguments regarding the alleged unethical publishing practices of HP
employees, it's really not.  Undoubtedly, those individuals who would seriously
limit, or completely prohibit, the flow of this valuable source of information
are unquestionabley moon struck.  Information of this caliber does indeed serve
to enhance the GAME, as well as provide those more serious users with valuable
new tools.

Although I've yet to aquire Mr. Donnelly's Tool Kit, I fully intend to do so.
Judging from the reviews seen here, not only do I feel that the software merits
high praise, but also requires the continuous support of the user community if
we are to see more such software.  After all, individual members of the design
team are not required to publish in order to stay employed.  Mr. Donnelly and
various other design team members who chose to invest their personal time and 
energy towards enhancing the very products they are producing, should be 
commended for their efforts.  

A case and point.  It has now been so long that I can't actually recall exactly
when it was I first purchased Dr. Wickes' book, "HP-28C/S Insights".  Studying
this excellently written document for uncountable hours  enabled to me master
the stack oriented programming language, RPL, utilizing KEY WORD commands and
functions.  While it took Alonzo Gariepy and his Processor Notes to provide me
with the necessary tools to begin Saturn Assembler, it was Wickes' book which
laid the foundation so crucially needed for development of an understanding of
of RPL internally.

Here I have chosen to illustrate the point using an alternate stack display
routine.  It exemplifies RPL programming on an internal level very much in the
manner of HP.  Programs such as this can be easily modified in order to call
user written machine code routines.  An excellent example that utilizes this
technique has already been provided by Dr. Wickes himself when he posted the
encoding schemes ->ASC and ASC->.  Currently, I'm writing almost all of my
routines on this level for the reasons that programs written utilizing KEY
WORDS are often quite slow by comparison, and considerably less challenging.

The routine displays a seven level stack leaving the menu bar intact.  It's
considerably faster than any of the other alternate stack display routines to
date.  Because I've only documented about a thousand SYSEVALs in the 48, there
is obviously a great possiblility the routine could be improved to a point to 
where it would not be recognizable from what appears here.  Documenting new 
SYSEVALs and making improvements to already existing routines such as these 
provides a great deal of pleasure.  Should HP choose to make available to the
public their colossal files documenting the 48's internals, they would in 
essence solve the puzzle and kill the thrill of reverse engineering the 
calculator.

The RPL disassembly is presented in the same style as Eric Toonen's ROM map
listing for the 28S.  Only a brief explanation appears aside each address.
Several of the addresses can NOT be SYSEVALed as they're only availble for use
in routines written in this fashion.  To package up the program I've included
two choices.  The first, CALTD, can be entered via the 48's keybaord and will
in turn create the alternate display program ALTD on the stack.  Make doubly
sure to checksum CALTD before using it to create ALTD.  I'll be glad to answer
any questions.


Rick Grevelle



Alternate Stack Display Routine

02D90	begin_RPL
0403F	short_integer_<8h>
073CE	start_1_to_n-1
07221	current_loop_count
18DBF   short->real
162AC	real->string
15442	string_": "
05193	+_1string2string   
0314C	depth
07221	current_loop_count
03D83	boolean_>_1short2short
03188	dup
619AD	branch_if_true
02D9D	begin RPL
03244	drop
0403F	short_integer_<8h>
07221	current_loop_increment
03DE0	-_1short2short
12429	display_string_131x8_1short2string
07334	next
391EE	freeze_display
0312B	end RPL
61993	branch_if_false
02D9D	begin RPL
032C2	over
15978	->string_1any
05193	+_1string2string
0403F	short_integer_<8h>
07221	current_loop_count
03DE0	-_1short2short
12429	display_string_131x8_1short2string
03140	depth
04035	short_integer_<7h>
624BA	min_1short2short
0339E	rolld_1short2any...nany
07334	next
0400D	short_integer_<3h>
142FB	freeze_display_1short
0312B	end RPL
0312B	end RPL



CALTD
(BYTES: #A1B8h 243.5)

%%HP: T(1)A(D)F(.);
\<<
 # 1073CE0403F02D9Dh
 # 42162AC18DBF0722h
 # 2210314C05193154h
 # 19AD0318803D8307h
 # 403F0324402D9D6h
 # 41242903DE007221h
 # 930312B391EE0733h
 # 978032C202D9D619h
 # 72210403F0519315h
 # 314C1242903DE00h
 # 40339E624BA04035h
 # 2B142FB0400D0733h
 # 312B031h 1 12
   START # 5193h
 SYSEVAL
   NEXT # 4003h
 SYSEVAL # 62B9Ch
 SYSEVAL
\>>


ALTD (Requires ASC->)

%%HP: T(1)A(D)F(.);
"D9D20F3040EC37012270FBD81CA2612445139150C41301227038D3088130DA91
 6D9D2044230F3040122700ED309242143370EE193B213039916D9D202C230879
 5139150F3040122700ED3092421C413053040AB426E933043370D0040BF241B2
 130B2130C5D9"