[comp.sys.handhelds] HP48 Customized Messages

ftg0673@tamsun.tamu.edu (Rick Grevelle) (05/02/91)

Several months ago Wickes posted a tongue-in-cheek library to which he later
referred as the Bart Simpson Library.  Basically it contained every message
array in the 48 which of course had been altered to provide a completely new
set of messages intended to amuse.  In his lecture at the Philadelphia area
user group meeting last year he alluded, as well as illustrated with another
library, that this customized message capability had been done purposefully
to allow the use of other languages.  This article describes the information
necessary to override any or all of the intrinsic message arrays with in the
48.  However, for those individuals who remain too intimidated to delve into
the world of internals, there are still no means provided here by which any
of the error messages can be interjected with the name of a specific program
responsible for generating the error.


Rick Grevelle


			Customizing Message Arrays

=============================================================================


By default, the 48 contains thirteen libraries.  Here is a summary of these:

			Relevant Library Addresses

-----------------------------------------------------------------------------
Number/Address |  Hash Table |  Message Array |  Link Table |  Config Routine
-----------------------------------------------------------------------------
  #0h/#028E3h  |    none     |    #72000h  *  |    none     |    #0BB40h **  
-----------------------------------------------------------------------------
  #1h/#10F14h  |    none     |    #72704h  *  |    none     |    #11086h **  
-----------------------------------------------------------------------------
  #2h/#189E8h  |   #7448Ah * |    #72DCFh  *  |   #22651h   |    #18A01h     
-----------------------------------------------------------------------------
  #3h/#29DB3h  |    none     |    #72F1Eh  *  |    none     |     none       
-----------------------------------------------------------------------------
  #5h/#35504h  |    none     |    #736F9h  *  |    none     |     none       
-----------------------------------------------------------------------------
  #6h/#2C086h  |    none     |    #72FE6h  *  |    none     |     none       
-----------------------------------------------------------------------------
  #Ah/#32F5Eh  |    none     |    #72281h  *  |    none     |     none       
----------------------------------------------------------------------------- 
  #Bh/#0F05Ch  |    none     |    #726A5h  *  |    none     |     none       
-----------------------------------------------------------------------------
  #Ch/#2D340h  |    none     |    #7232Ch  *  |    none     |    #2D359h **   
-----------------------------------------------------------------------------
  #Dh/#0CABEh  |    none     |    #7260Ah  *  |    none     |    #0CAD7h **   
-----------------------------------------------------------------------------
 #19h/#0BE14h  |    none     |     none       |    none     |     none       
-----------------------------------------------------------------------------
 #F0h/#38836h  |    none     |     none       |   #3834Fh   |     none       
-----------------------------------------------------------------------------
#700h/#22DE5h  |   #7247Ch * |     none       |   #22E08h   |    #22EA3h **  
-----------------------------------------------------------------------------

            *  covered ROM address       **  non-auto attaching


Only ten of the thirteen libraries contain message arrays, of which there is
one whose configuration routine is auto attaching.  To override any of these
message arrays the library to which it belongs must first be attached.  Then
the replacement message array, which can be stored in either a library as an
XLIB or a directory as a GLOBAL variable, must be attached via the use of an
unavailable user language command.  The directory which has been provided at
end of this article contains all ten of the 48's message arrays, each stored 
in GLOBAL variables corresponding to library's hexadecimal number.  Routines
used for attaching and detaching these message arrays have been included.

Because most users will not be interested in changing all of the 48's message
arrays, it won't be necessary for those individuals to store and attach every
one of these.  It is for this reason I'm providing the following illustration
which will demonstrate how to attach and override a single message array, and
then return control to the default.  In order to benefit those whose capacity
to program the calculator is limited to user language, the information that's
being presented here is in a format understandable and familiar to all of us.
Others whose programming skills are already advanced will need only a look at
the two routines CUSTOM and DEFAULT after reading this material to understand
their function.

All of the object types not supported by the display routines can be found in
the message array belonging to library #1.  I've always hated those Externals
appearing in the display.  Greater than ninety percent of these are merely an
assortment of the prefixed machine routines of which the SYSTEM RPL is built.
Perhaps if Hewlett-Packard had foreseen the immense popularity of the 48 they
would have taken the time to do things a bit differently.  Because it is most
unlikely any of the objects represented by Externals would be something other
than prefixed machine code, it might be preferable for the display routine to
to use Address instead.  So for the example chosen the message array is going
to be changed such that all Externals will appear as Address.


	o  First, it will most always be desirable to start by altering
	   a copy of the default message array.  This will be much less
	   trouble than constructing an array from scratch.  It's not a
	   major task to recall a copy of any of the ten default arrays
	   to the stack, but to alter an array of strings, two routines  
	   from the HACKIT library, OUT\->, and \->ARR will be needed.

	o  The message arrays for all of the ROM libraries can be found
	   in the 32K bank of ROM that's normally covered by RAM.  It's
	   for this reason that it is often referred to as covered ROM.
	   Recalling objects from this usually inaccessible bank of ROM
	   requires only two steps, and of course the object's address.

	o  Recall a copy of the message array from a library by placing
	   the location of the message array in level one, #72704h, and
           executing \<< #05A03h SYSEVAL #0C612h SYSEVAL \>>.  An array
           of string which is the message array from library #1 will be
	   the result.  Consult the table for the addresses to the rest
	   of the message arrays.                 

	o  Use the OUT\-> command in the HACKIT library for decomposing
	   the array into its sixty-two constituent strings.  It is now
	   possible to edit any of the individual strings, then altering
	   or completely replacing the string.  Make sure you've put the
	   string back in its appropriate position on the stack after it
	   has been altered.  Use \->ARR to recompile the message array
	   of strings.

	o  After the array has been altered, store it in a GLOBAL name,
	   and attach the library from which it came, if it hasn't been
	   done previously.  Note only one out of the ten ROM libraries
	   is auto attaching; all others must be attached.  ATTACH will
	   not work for ROM libraries so place the binary number of the
           library, #1h, in level one, and then execute these SYSEVALs:
	   \<< #05A03h SYSEVAL #07709h SYSEVAL \>>.

	o  Next the array must be identified as the replacement for the
	   default array and attached too.  Again, this will need to be
	   done using SYSEVALs, so once more place the library's binary
	   number in level one, and the GLOBAL in which the replacement
	   message array is stored in level two, and use the following:
	   \<< #05A03h SYSEVAL SWAP RCL #0764Eh SYSEVAL \>>

	o  Nullify the above procedure by detaching the library, and in
	   the case of library #2h, reattach.  To detach put the number 
 	   of the library being detached in level one and execute this:
	   \<< #05A03h SYSEVAL #076AEh SYSEVAL \>>.


The following directory contains all of the 48's default message arrays with
an exception; the string "External" in library #1h was changed to "Address".
The affect of this can be viewed by installing the directory, then recalling
the contents of the CUSTOM variable to the stack, and toggling both commands
CUSTOM and DEFAULT.  The display auto refreshes after each key press so that
the unsupported prefixed machine routines will change back and forth between
External and Address.  Last it should be mentioned that if it's desirable to
convert the directory into a library, it would be advisable to place all the
GLOBAL names containing message arrays in a list in $HIDDEN so that they are
not visible in the library.  GLOBAL names beginning with the letter "A" will
contain message arrays.  Characters following each dot relate the library's
hexadecimal number to the message array contain in the variable.



o  /
 \/
 /\  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o  \



%%HP: T(1)A(D)F(.);
"69A20FF7F2910000003014E244308E92069000C2A201000040000D100094E667
16C696460244164756D100094E66716C69646024596D6561200094E66716C696
460225560756164772000E4F6E6568796374756E6470214C61627D65A0003014
E234308E9209D200C2A2010000710001300024164602051636B656470224C6F6
36B60234865636B6310004596D656F65747F10002556365696675602542727F6
2713000255636569667560224576666562702F46756272757E6D100005162796
479702542727F62732000452716E63766562702641696C65646120000527F647
F636F6C602542727F627B200094E66716C69646023556276756270234D646E2B
100005F627470234C6F63756469100034F6E6E656364796E6763100025564727
970232D2000147716964796E676023556276756270234D646E2510003556E646
96E676029100025563656966796E6760252000F426A656364702449637361627
46564651000051636B656470232920000527F63656373796E6760234F6D6D616
E646F100094E66716C696460294F40514251200094E66716C696460205254505
1425B1000C4F6770224164747562797B100054D60747970235471636B6D00002
5F67702D100094E66716C6964602E416D6568E2003014E224308E920A5000C2A
201000020000D100094E66716C696460255E696479200094E636F6E637963747
56E6470255E6964737960003014E214308E9206A000C2A201000060000F10002
41646027457563737825637927100034F6E6374716E647F3B100094E64756272
75707475646D0000A55627F6F1000359676E60225566756273716C6510005487
472756D657D65B0003014E263308E920E0700C2A2010000E20001200094E6671
6C696460258024416471652000E4F6E6568796374756E6470258441445B20009
4E63757666696369656E64702580244164716D100094E66716C6964602580514
251300094E66716C696460258024416471602C4E482E4567692D200094E66716
C696460258024416471602C4E48203929100094E66716C696460254157200034
57272756E64702561757164796F6E6A3D2000E4F6023657272756E6470256175
7164796F6E6E2D200054E6475627025617E6C202072756373702E4547514000E
416D6560247865602561757164796F6E6C2A007275637370254E445542552000
3556C65636470207C6F6470247970756F100054D60747970236164716C6F6767
100057E646566696E65646D2000E4F6023747164702461647160247F60207C6F
647B1000145747F6373616C696E676D100035F6C66796E6760266F6270213000
E4F6023657272756E6470246164716E20254E6475627D2000461647160207F69
6E647C20207275637370258B2120003556C6563647021602D6F64656C692000E
4F60216C61627D637020756E64696E676E2D200005275637370214C425D40247
F602362756164756B1000E45687470216C61627D6A3320000516374702465756
0216C61627D6A3D10001436B6E6F677C656467656461300054E64756270216C6
1627D6C202072756373702355445130003556C6563647022756075616470296E
64756276716C6920000202020294F2F402375647570702D656E657B100005C6F
6470247970756A302900002222F10000282F46464023534255454E492F100094
E66716C6964602054595055434000E416D656024786560237471647024616471
6C2A007275637370254E44554257500054E6475627026716C657560282A7F6F6
D602F65747A0966602E31392C20207275637370254E44554253200034F607965
6460247F60237471636B6D200087021687963702A7F6F6D60277F2145545F4E2
A0F100087021687963702A7F6F6D6E2A0F100097021687963702A7F6F6D6E2A0
B2000870216E6460297021687963702A7F6F6D6E2A0320009425F277962756A3
02020202020202320001435349494F22696E6162797A302023200026165746A3
0202020202020202020232000071627964797A30202020202020202320003686
5636B63757D60247970756A30232000472716E637C61647560236F64656A3130
0054E647562702D61647279687C202478656E602E45475D17003014E253308E9
20EE000C2A2010000600007200094E66716C69646024496D656E63796F6E6F20
0094E66716C696460214272716970254C656D656E647D10004456C6564796E67
60225F677320004456C6564796E6760234F6C657D6E6F100094E63756274796E
6760225F6775200094E63756274796E6760234F6C657D6E6DF0003014E233308
E9203C000C2A2010000500009200005F63796479667560255E646562766C6F67
792000E4567616479667560255E646562766C6F67751000F467562766C6F6775
200055E646566696E656460225563757C6473200094E66696E69647560225563
757C6472D0003014E223308E920A4100C2A2010000800007200045F6F6026456
770214277657D656E64737720002416460214277657D656E6470245970756920
002416460214277657D656E647026516C657561200055E646566696E6564602E
416D65652000C4143545142574024496371626C656465300094E636F6D607C65
64756A03557265687072756373796F6E63200094D607C69636964702829202F6
66661200094D607C69636964702829202F6E6951003014E213308E9204C600C2
A2010000E3000F2000E4F60225F6F6D60247F602351667560235471636B6F200
03416E67247025446964702E457C6C60234861627E2F200094E66716C6964602
55375627026457E6364796F6E6B2000E4F6023457272756E6470254175716479
6F6E6500001200094E66716C696460235472796E676B1000255616C602E457D6
2656271200034F6D607C6568702E457D62656271100035472796E67691000255
616C6021427271697F100034F6D607C65687021427271697D0000C4963747B10
0074C6F62616C602E416D65691000C4F63616C602E416D656310000527F67627
16D67100014C676562627169636120002496E61627970294E647567656273100
07427160786963611000451676765646D000055E696477100085C4942402E416
D65671000449627563647F6279731000C496262716279711000241636B657075
10006457E6364796F6E63100034F6D6D616E646F10003597374756D6022496E6
16279771000C4F6E67602255616C6D1000C4F6E6760234F6D607C65687D1000C
496E6B6564602142727169771000348616271636475627D000034F64656D1000
C49626271627970244164716310001446462756373750000B2000C4143545023
5451434B4024496371626C6564672000C41435450234D444024496371626C656
46520008414C44502E4F6470214C6C6F6775646F00001427271697D20007527F
6E6760214277657D656E6470234F657E647920003496273657C6162702255666
562756E63656F2000449627563647F6279702E4F6470214C6C6F6775646B2000
E4F6E6D254D607479702449627563647F627979200094E66716C696460244566
696E6964796F6E632000D496373796E67602C4962627162797D100094E66716C
69646020505142532000E4F6E6D2255616C60225563757C6477200055E61626C
6560247F6029437F6C6164756F2000E4F60225F6F6D60247F6023586F6770235
471636B671000751627E696E676A3A011000542727F627A3110000557277656F
3F1000F4574702F66602D456D6F62797F000035471636B691000C41637470235
471636B6F1000C41637470234F6D6D616E6463732000B45697021437379676E6
D656E647371100014C61627D63712000C41637470214277657D656E64737F100
0E416D6560234F6E666C6963647D100034F6D6D616E64602C496E656500003D6
003014E203308E92029200C2A201000001000B200094E63757666696369656E6
4702D456D6F62797B2000449627563647F627970225563657273796F6E6D2000
55E646566696E6564602C4F63616C602E416D656B200055E646566696E656460
285C4942402E416D656D1000D456D6F627970234C65616279100005F67756270
2C4F6374751000751627E696E676A37200094E66716C69646023416274602441
64716F1000F426A65636470294E6025537569200005F6274702E4F6470214671
696C61626C65632000E4F60225F6F6D60296E60205F6274792000F426A656364
702E4F6470296E60205F62747D300014474756D6074796E6760245F602255636
F667562702D456D6F62797130004527970245F602255636F667562702D456D6F
62797F3F2000255607C6163656022514D4C202052756373702F4E4D2000E4F60
2D456D60245F60234F6E66696760214C6C61A200704454641455C44570D9D20F
EF30EA6709FF30EA67030040EA6703004090770D0040EA67012040EA670B2040
EA67035040EA670D5040EA67076040EA67017040EA670B2130A8000603455354
5F4D460D9D20FEF3090770FEF3084E203014E203E46709FF30907709FF3084E2
03014E213E46703004084E203014E223E4670D004090770D004084E203014E23
3E467012040907701204084E203014E253E4670B204090770B204084E203014E
263E467035040907703504084E203014E214E4670D504090770D504084E20301
4E224E467076040907707604084E203014E234E467017040907701704084E203
014E244E4670B21305A65"

frechett@spot.Colorado.EDU (-=Runaway Daemon=-) (05/02/91)

Just want to say thank you.. I have to say that my custom messages 
are going to be a bit less wimpy ;)  After digging through various 
nonsense for a few weeks it is nice to finally come across something 
that I can finally use.. ;)  

	ian

-=Runaway Daemon=-