From: detlef@mwhh.hanse.de (Detlef Mueller)
Newsgroups: comp.sources.hp48
Subject: v01i028:  mtl - Error messages in own libraries v1.0, Part01/01
Keywords: libraries library error message tables
Date: 29 Aug 91 01:50:13 GMT
Followup-To: comp.sys.hp48
Organization: M. Witt

Checksum: 3930115074 (verify with brik -cv)
Submitted-by: Detlef Mueller <detlef@mwhh.hanse.de>
Posting-number: Volume 1, Issue 28
Archive-name: mtl/part01

BEGIN_DOC mtl.doc
Hello, world.

Include messages into a library with the RPL tools ? The manuals give no
answers, so I had to find it out 8-). I think the files are self-explaining.
To install the little demonstration library, process the following steps:
	1) Cut out the listings and put them into the appropriate files
	2) Run MKMSGTST.BAT
	3) Download the resulting file MTL.LIB into your HP48
	4) Recall MTL.LIB onto the stack
	5) Enter the port number (0,1,2) where you want to store it and
	   press STO.
	6) Switch the HP48 off, then on again.
MTL.LIB will now be installed as a library named MSGTST, ID nr. 809.
Try the programs MSG1, MSG2 and MSG3.

'Hope, this is a useful information,
	=-), Detlef.

END_DOC
Files:

--v--MSGTST.S--8<------------------------------------------------------------
BEGIN_SRC msgtst.s
*****************************************************************************
* Modulname:	Message Test
* Modultype:	Library
* Dest.Comp.:	HP48
* Language:	System RPL
* Author:	Detlef Mueller, Nibelungenweg 6, 2000 Hamburg 56, W-Germany
* Interface:	MSG1, MSG2, MSG3
* Description:	Test library message handling
* Edition History :
*	0.000	08-25-1991	DM	Alpha version
*****************************************************************************
    TITLE	Message Test
xROMID		329
    ASSEMBLE
MTROMID	EQU	#329
DOMSG	MACRO	* romid,msgnr	** Macro, to handle msg nr. generation **
	CON(5)	=DOBINT
	CON(5)	($1)*256+($2)		* (ROMID << 8) | msgnr *
DOMSG	ENDM
	NIBASC	/HPHP48-E/	** Binary download header **
    RPL
EXTERNAL	xMSG1		** External definitions **
EXTERNAL	xMSG2
EXTERNAL	xMSG3

*** MTLmsg ******************************************************************
* Description :	Message table
*****************************************************************************
    ASSEMBLE
=MTLmsg
    RPL
ARRY
[
    "Memory Lost !?"
    "Achou .."
    "27B-6, 27B-6 ..."
]
*** MTLcfg ******************************************************************
* Interface :	( --> )
* Description :	Attach this library at system warmstart
*****************************************************************************
    ASSEMBLE
=MTLcfg
    RPL
::
    DOBINT MTROMID XEQSETLIB		( *Autoattach* )
;
*** MSG1 ********************************************************************
* Interface :	( --> )
* Description :	Just generate an error with error message 1
*****************************************************************************
    ASSEMBLE
	CON(1)	8			* Tell parser 'Non algebraic' *
    RPL
xNAME	MSG1
::
    CK0
    ASSEMBLE
	DOMSG	MTROMID,1
    RPL
    ERROROUT
;
*** MSG2 ********************************************************************
* Interface :	( --> )
* Description :	Just generate an error with error message 2
*****************************************************************************
    ASSEMBLE
	CON(1)	8
    RPL
xNAME	MSG2
::
    CK0
    ASSEMBLE
	DOMSG	MTROMID,2
    RPL
    ERROROUT
;
*** MSG3 ********************************************************************
* Interface :	( --> )
* Description :	Just generate an error with error message 3
*****************************************************************************

    ASSEMBLE
	CON(1)	8
    RPL
xNAME	MSG3
::
    CK0
    ASSEMBLE
	DOMSG	MTROMID,3
    RPL
    ERROROUT
;
END_SRC
--^--MSGTST.S--8<------------------------------------------------------------

--v--MSGTST.MN--8<-----------------------------------------------------------
BEGIN_SRC msgtst.mn
TITLE Msg Test Library
OUTPUT mtl.o
LLIST mtl.lr
CONFIGURE MTLcfg
MESSAGE MTLmsg
NAME MSGTST: v0.0,DM'91
ROMPHEAD mtlhead.a
REL msgtst.o
TABLE mtlhash.a
FINISH mtlend.a
END
END_SRC 
--^--MSGTST.MN--8<-----------------------------------------------------------

--v--MTL.M--8<---------------------------------------------------------------
BEGIN_SRC mtl.m
TITLE Msg Tst Library
OUTPUT mtl.lib
OPTION CODE
LLIST mtllib.lr
SUPPRESS XR
SEARCH entries.o
REL mtl.o
CK LIB329 SYSEND329
END_SRC
--^--MTL.M--8<---------------------------------------------------------------

--v--MKMSGTST.BAT--8<--------------------------------------------------------
BEGIN_SRC mkmsgtst.bat
RPLCOMP msgtst.S msgtst.A msgtst.EXT
SASM -e msgtst
MAKEROM msgtst.MN msgtst.M
SASM -e -N mtlHEAD
SASM -e -N mtlHASH
SASM -e -N mtlEND
SLOAD msgtst.M
SLOAD -H mtl.M
END_SRC
--^--MKMSGTST.BAT--8<--------------------------------------------------------
-- 
+-----------------------------------+---------------------------------------+
|        `I'll just nip off         |             Detlef Mueller            |
|         and shoot myself.`        |          detlef@mwhh.hanse.de         |
|  Animal in THGTTG, part II, p.94  |...!uunet!mcsun!unido!mcshh!mwhh!detlef|
+-----------------------------------+---------------------------------------+

