##### ##### # # ### # # # # # ## # # # # # # # # # # # #### #### # # # ### # # # # ##### # # # # # # # # # # # # #### # ### A SYSTEM-RPL DEVELOPMENT TOOLKIT FOR THE HP48SX Version 1.12 beta (c) 1993 by Detlef Mueller & Raymond Hellstern CONTENTS ======== 1. Introduction 1.1 Copyrights & Acknoledgements 1.2 The RPL48 Toolkit 1.3 Requirements & Installation Instructions 1.4 Abbreviations 2. <-RPL-> Library 2.1 Overview 2.2 The System-RPL Compiler/Decompiler 2.3 The Saturn Assembler/Disassembler 2.3.1 The Assembler Parameter Field Parser 2.4 The Reference Table 2.5 Command Reference 2.6 Hooks 2.7 Things to Notice 3. <-LIB-> Library 3.1 Overview 3.2 Control Variables 3.3 Command Reference 3.4 Things to Notice Appendix A - Quick Reference Guides A.1 <-RPL-> A.1.1 Commands A.1.2 Flag Usage A.1.3 Error Messages A.2 <-LIB-> A.2.1 Commands A.2.2 Flag Usage A.2.3 Error Messages Appendix B - A ->COD Example Appendix C - Ordering Information 1. Introduction =============== 1.1 Copyrights & Acknowledgements --------------------------------- All files of the RPL48 toolkit are copyrighted (c) by Detlef Mueller and Raymond Hellstern, 1991-1993 - unless otherwise noted. The RPL48 package is distributed in the hope that it will be useful, but RPL48 is provided 'as is,' and is subject to change without notice. D. Mueller and R. Hellstern makes no warranty of any kind with regard to the software or documentation, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. D.Mueller and R.Hellstern shall not be liable for any error or for incidental or consequential damages in connection with the furnishing, performance, or use of this software and documentation. Please excuse all the linguistic errors in this text. English is not our native language. This version of RPL48 is a GiftWare release - you may use it as long as you like - without registration for developing non-commercial software only. Permission to copy the whole, unmodified RPL48 package is granted provided that the copies are not made or distributed for resale (excepting nominal copying fees). If you want to get your own, brand new version and for further information please refer to Appendix C. It should be impossible to crash your HP48 by using RPL48, but no software is bug free and the <-RPL->:4.1 library (serial no. 113) is still a beta release. We would like to thank the following persons for their support: Wlodek Mier-Jedrzejowicz for presenting RPL48 to the world. Rick Grevelle for the HACKIT library, the ->DIR command in the <-LIB-> library, the base of the sys-stack, many suggestions and exiting talks. Mika Heiskanen for beta testing, lots of suggestions, MKROM and DEBUG. Joseph K. Horn for beta testing and suggestions, the `HP 48 Resource Allocation Guideline; Library ID's`, SORTLS and for maintaining the HP48 Goodies Disks. Carlos Ferraro for beta testing. Simone Rapisarda for beta testing and many suggestions. Fatri Mohamed, Romain Desplats, Georg Hoppen for suggestions and beta testing. James H. Cloos, Steve VanDevender, Chris Maksymiak for suggestions. Chris Spell for maintaining the HP48 archive at seq.uncwil.edu and for moderating comp.sources.hp48. W.C.Wickes & HP Corvallis for the HP48 and the RPL tools. D. York for the friendly permission to publish the BNF parser generator example. 1.2 The RPL48 Toolkit --------------------- The RPL48 Toolkit provides more than 50 powerful commands to aid program and library development on a HP48 using system RPL and assembler. It consists of three parts: - Library 1234, <-RPL->:4.1 - Contains a sys-RPL compiler/decompiler and Saturn assembler/disassembler. - Library 1221, <-LIB->:1.7 - Contains a library maker/splitter and many commands for handling libraries and un-/supported objects. - a reference table which contains addresse/name pairs of ROM entry points. The main commands of RPL48 are modelled after the MS-DOS programs RPLCOMP.EXE, SASM.EXE and USRLIB.EXE which are provided by HP in the self extracting archive TOOLS.EXE (available on several ftp sites). This document describes the interface to RPL48; it is not a sys-RPL or Saturn assembler manual. Please refer to RPLMAN.DOC, RPLCOMP.DOC, USRLIB.DOC and SASM.DOC (all contained in TOOLS.EXE) for learning and/or reference purposes. [Note: RPLMAN.DOC etc can be found on Goodies Disk #4. -jkh-] We assume that you are familar with sys-RPL, Saturn assembler and libraries. 1.3 Requirements & Installation Instructions -------------------------------------------- RPL48 runs on ROM version A-E HP48SX; it may run on ROM version J, but it is not tested yet ! The <-RPL-> library it compiled to a fixed address; it MUST be stored in an independent (FREEd) port (1 or 2) - thus it only works on a HP48SX. Because the whole RPL48 kit requires ~60kb of memory (including a reference table made from the latest entries released by HP) it is recommended to store it into a 128k RAM card. The <-LIB-> library is developpt using the standard methods, it can be stored and used in port 0 on a HP48S. For a complete installation of RPL48 it is neccessary that you have plugged in a 128k RAM card (which must have ~60kb free space) in either port 1 or 2 of your HP48SX; the card must be set to R/W. Proceed as follows: - remove any old versions - merge the port - download RPL.TAB, LIB.LIB and RPL.LIB - recall RPL.TAB to the stack, purge RPL.TAB and store it as a backup object named RPL.TAB (case sensitive !) into port 0 (:0:RPL.TAB STO) - recall the two libraries, purge the variables containing the original copies and store the libraries into port 0 (two times 0 STO) - free the port, make sure that :0:1234 is the 1st entry of the list in level 2 for the FREE command ! (you can use 0 PVARS DROP to generate the base list) - power cycle your HP48SX or press [ON]-[C] As mentioned, <-RPL-> is compiled to an absolute address. Its config code takes care of the address the library is stored at. If neccessary, the base addresses of the ports are swapped and an additional warmstart is initiated automatically while executing the first warmstart after installation. If the config code recognizes that it is impossible to change to the correct address (ie. the library is stored in port 0 or not the 1st object of port 1 or 2), the autoattach to the home directory is supressed and no (c)-message and no beep is generated. If the library did not attach itself, make sure it becomes the 1st object of port 1 or 2 and execute a warmstart again. If you have installed a HP41 emulator card, <-RPL-> does not install because the emulator uses a similar scheme to install itself to the same address (it is also an absolute library) -- just remove the card. The <-RPL-> and the <-LIB-> libraries are not self-modifing - you can write protect the card containing the libraries. 1.4 Abbreviations ----------------- LID - library id; a number in the range 0..2047, part of any library, It is used by the HP firmware to identify libraries while resolving commands, messages et c. | - used in stack diagrams for 'or' Abbreviations denoting objects: ob object of any type xlib named or unnamed library command :x:y tagged object - tag x, ob y prg program (secondary) bak backup dir directory alg algebraic lib library libdta library data meta(t) meta object, obn .. ob1 %n, all ob's are of the same type t All other abbreviations are defined in RPLMAN.DOC (eg. %, #). 2. <-RPL-> Library ================== 2.1 Overview ------------ <-RPL-> contains 17 commands, including a sys-RPL compiler (->RPL), a sys-RPL decompiler (RPL->), a Saturn assembler (->COD), a Saturn disassembler (COD->) a RPL.TAB browser (EC) and a medium font sys-stack display (4/5/7). 2.2 The System-RPL Compiler/Decompiler -------------------------------------- The compiler is a simple token based one pass LR compiler and implements a grammatical subset of RPLCOMP.EXE. It accepts string objects containing a token sequence as input. Tokens must be seperated by whitespace (NL,CR,Space, TAB etc.). The output of the decompiler can be used as input for the compiler or (with minor modifications) as input for RPLCOMP.EXE. When ->RPL is compiling a string, it recognizes certain words and generates appropriate code for them. All other words are assumed to be the labels of objects in the runstream and are emitted simply as 5-nibble constants - the reference table (see below) and the assembler symbol table are searched to resolve the appropriate 5-nibble addresses. If an entry can't be found in one of the tables and its 1st chararcter is a 'x', then ->RPL will try to resolve the word without the leading 'x' as a built-in command (e.g. for 'xDROP' the address #1FBD8 is generated). If the current token of ->RPL isn't resolvable as an object, entry or built in, it is passed to the user-RPL compiler palparse. If the result is an ID or prg, an error will be generated. If the token is parsed to a %, it will be converted to a # (eg. "12345" ->RPL --> <3039h> (negative values are mapped to 0 and fractional parts are ignored)); any other valid object is simply added to the runstream (eg. [[1,2][3,4]] (F(.)) inserts a 2*2 array of reals). The following words are recognized by ->RPL or generated by RPL->: LAM DOLAM object whose name is specified by . (1) ID DOIDNT object whose name is specified by . 0-ID isn't supported by ->RPL. (1) TAG DOTAG object whose tag is specified by and whose object is given by . $ "string" DOCSTR object with the contents contained between the quotes. (1) CHR DOCHAR object with the specified character. (1) # # DOBINT object whose body is the number specified in hex. (3) % DOREAL object with the specified floating-point number. %% DOEREL object with the specified floating-point number. The number is parsed with % resolution. C% DOCMP object with the specified floating-point numbers. C%% DOECMP object with the specified floating-point numbers. The numbers are parsed with % resolution. PTR Forces the to be entered as a runstream pointer-obj. ROMPTR DOROMP object with the two 3-digit (maximum) hex numbers. HXS GROB CODE (2) ARRY (2) LNKARRY (2) LIBRARY (2) BACKUP (2) LIBDAT (2) EXT1 (2) EXT2 (2) EXT3 (2) EXT4 (2) Specified object whose body is made from the hex-string. 0-ob's aren't supported by ->RPL. NIBB (2) Adds the binary form of to the runstream, eg. NIBB 7 84E2000 creates a 0-ID. CODE ENDCODE CODE object, the assembler is called to assemble the body. ASSEMBLE RPL The assembler is used to create the inline code. INCLUDE The accessable path is searched for a variable with the name . Its contens must be a compilable string and may contain further INCLUDE statements. The resulting code is inserted at the position of the INCLUDE statement. INCLOB (2) The accessable path is searched for a variable with the name . Its recalled contens is inserted at the position of the INCLOB statement. The following words defines runstream pointer-objects: UNIT DOEXT - Unit start SYMBOL 02AB8 - Symbolic start :: DOCOL - Program start { DOLIST - List start } SEMI - List terminator ; SEMI - Program, UNIT or SYMBOL terminator Text surrounded by ' (' and ') ' is ignored by ->RPL. Before you start compiling own objects, play with the decompiler to get some examples of the syntax definitions, eg. try { + } 1 GET RPL-> to see what '+' does. Note (1) Character substitution is supported via '\xxx' in strings, IDs, LAMs and CHRs using the internal routine which does the tranlsation for TRANSIO, code 3 (see the HP48 manual for a comlete description). You must use '\034' to insert doublequotes (") into strings. RPL-> generates (") within strings, not \034. Note (2) These statements are not compatible to RPLCOMP.EXE. Note (3) ->RPL accepts BINTS in one of the following form: # xxx - allways compiled to BINT objects #xxx - searches the ROM for a BINT with the appropriate value, if found a pointer to is generated instead of a BINT object xxx - real numbers are COERCED and then handled like #xxx 2.3 The Saturn Assembler/Disassembler ------------------------------------- The assembler defines a subset of SASM.EXE written by Nathan Zelle. You can use it 'stand-alone' or in conjunction with the RPL compiler ->RPL. It's a 2-pass assembler. The input string should be plain ASCII (with blanks and/or TAB's) generated on a PC or the HP48 itself. It is 'free format' which means that no coloumn counting is required, except that labels MUST begin in the first coloumn of a line. If a line only consists of a comment, in coloumn 1 MUST be a '*'. Empty lines are skipped. The general line structure is: "