(Comp.sys.handhelds) Item: 1873 by frs at rci.dk Author: Frank Ochoa Subj: Make Library on HP48sx and m-code tools Date: Fri Feb 01 1991 16:08 [Note: The library is TOOLS.LIB; the original directory is TOOLS. -jkh-] This is a Toolbox for m-code made by our member Frank. You can't reach him from the unix net directly, but you can write to me or contact our BBS in Denmark (lot of HP28/48 stuff). Friedrich Schroeder (Sysop, PPC - Denmark - BBS FIDO node 2:234/52 +45 42 52 66 00; 2400 8N1) Internet : frs@rci.dk TOOLS :System utilites This is a brief discription of the programs in TOOLS.DIR. If you want an explanation of how the programs work try hacking it first. I might not have the time to explain how they work. Some of these programs kan be made more compact, faster or even obsolete. I do not have a PC so its not very often that I see what's in the BBS. 1. 'DMEM' - Display memory. The contents of memory is displayed in hexadecimal format. This program creates a variable 'Dmem' in the current directory unless it already exists upwards in the directory path. keys: right,left increment/decrement address by one down,up increment/decrement address by #10h +,- increment/decrement address by #100h *,/ increment/decrement address by #1000h backspace, DEL increment/decrement address by #10000h EEX,NEG page up/page down ------------------------------- o -------------------------------- NOTE: The built in monitor, started by pressing and releasing ON and D keys at the same time and thereafter pressing the backspace key, can be an invalueable tool for correcting corrupted ram code. Built in ram (#70000h thru #7FFFFh) is displayed starting at #F0000h. Here is a discription of what the keys do. keys: +,- increment/decrement address by one *,/ increment/decrement address by #100h up,down increment/decrement address by #1000h 0-9,A-F poke hex character and increment address by one (only ram memory can be changed) ENTER display memory starting at address #100h NEG display memory starting at address #F000Ah (true address #7000Ah) EEX show memory starting at address #80000h (PORT 1) DEL show memory starting at address #C0000h (PORT 2) INV show memory starting at address #F0A94h (true address #70A94h) ------------------------------- o ------------------------------- 2. 'DECOM48' - Decompile object 3. 'ASM48' - Assemble string These two programs are almost the same as Wickes' ASCII Encoding and Decoding programs ( ->ASC & <-ASC ). The only deference is that a CRC checksum and newline character ,#Ah, is not used in these programs. DECOM48 will decompile any object, including rom objects, in level one. ASM48 will assemble a string containing five or more characters but does not check whether the resulting object makes sence. Care should be taken when using ASM48 because a memory loss can result. Be sure to BACK up memory before using this program!!! 4. 'DNL' - Delet newline character from string (CHR 10) This program will take a string, which was decompiled with ->ASC, and remove all newline characters so that the string can be compiled with ASM48. 5. 'XLIBS' - Get LIBRARY information This program will take a library's ID number in level one, real or binary, and find the memory location of the objects that make up the library. Try it - you'll like it. 6. '->LIB' - Make library This program takes a directory name in level one and makes a library object from the contents of that directory. The source directory must be a subdirectory of the current directory. The source directory must not contain subdirectories. The source directory will be purged and the new library will be stored with the directory's name. The source directory may contain some of the following reserved variables. $ROMID The library's ID number - (Real or Binary). This variable must be in the source directory. It is recomended that only numbers in the range 769 thru 1791 be used. Numbers greater than 1791 can cause a memory loss. $TITLE A string containing the name of the library. If this variable is missing then the name of the directory will be used. A null string, "", can be used to mean that no name is to be given. $MESSAGE An Array of String type object which has user defined ERROR messages. For example #6FF01 DOERR displays the first error message of Library 1791 (#6FFh). See the program 'S->ARRAY' and 'AR->STR' for information about creating array of strings. If this variable is missing then no error messages are created. Note: This is different from what is required from HP's MS-DOS "USERLIB.EXE" program for the PC. USERLIB's $MESSAGE is a list of name variables that contain the error message strings. USERLIB creates an Array of String from this list of names. $HIDDEN A list of names that are not to be shown in the library menu. The objects stored under these names are included in the library. $VISIBLE A list of names that will be shown in the library menu. Note: $HIDDEN has priority over $VISIBLE. That means that if both $HIDDEN and $VISIBLE are present in the directory only $HIDDEN will be used. $VARS A list of names that are not to be converted to XLIB names within objects in the library. For example if there exist an object stored under 'xxx' but this same name is also used within a program for a different object, then the name 'xxx' is not changed to a XLIB name. The object stored under 'xxx' is included in the library. If you do not want an object stored in this directory to be included in the library then it should be purged. There might not be enough memory to create the library. Note: This is not in accordance with "USERLIB.EXE". USERLIB does not include stored objects into the library whose names are in the $VARS list. $CONFIG A program executed at 'configuration time'. For example << 1791 ATTACH >>. If you do not want $CONFIG to be shown in the library menu then $CONFIG should be included in the $HIDDEN list. Three other variables are: $T1, $T2, and $T3. These three variables are used by ->LIB for internal purposes. If you have more than 32k ram memory then you can recall TOOLS.DIR and store it under another name. Put the name in level one and press ->LIB. About 4 minutes later you'll have Library 1791. 7. 'EXTRACT' - Extract objects from libraries 8. 'XTRACT' - Subroutine used by EXTRACT EXTRACT takes a list that contains either an XLIB name or two real numbers. The two numbers are ordered [ object number, LIB.ID ]. For example [ 10, 1791 ] is identical to [ XLIB 1791 10 ]. EXTRACT creates a directory 'TMPDIR' where the extracted objects are stored. If there does not exist a name for the extracted object then a name indicating the ID number and object number is created. For example 'L1791.10' would replace XLIB 1791 10. With this program it was possible to recover a directory that was converted to a library with ->LIB before being backed up. 9. 'S->ARRAY' - string to Array of String object S->ARRAY takes a list of strings from level one and converts it to an Array of String. All objects in the list are first converted to strings before they are attached to the array. Array of Strings are used mainly for library error messages. Array of Strings cannot be edited. 10. 'AR->STR' - Array of String object to string AR->STR takes an Array of Strings from level one and converts it to a list of strings. This way you can reedit the list and thereafter converted back to an Array of String. 11. 'RVRS' - Reverse a string RVRS takes a string from level one and reverses the characters so that the first character becomes the last character and the last becomes the first. This is all done in machine code so it is very fast. 12. 'CRC' - Checksum ( Cyclic Redundancy Check ) CRC takes a string (created by using DECOM48) and finds a checksum. This again is done in machine code. If this string is compiled using ASM48 and thereafter pressing BYTES it would give the same checksum. 13. 'F&R' - Find and Replace F&R takes three strings from the stack. It takes the string in level 2, finds its occurence in the string in level 3 and replaces it with the string from level 1. It repeats the search until all occurrences of string from level 2 are replaced by the string in level 1. F&R is a subroutine of programs ->LIB and DNL. 14. 'DFL' - Delete from List DFL takes 2 lists form the stack. If any of contents of both list are the same then it is deleted from the list in level 2. This program is a subroutine of ->LIB. The rest of the programs were developed by others and I am very greatful to them for making them public. These programs can be found in the BBS with documentation. 15. 'SYSRCL' - Recall object to stack 16. 'FIND' - Find object in memory 17. 'PEEK' - Return values from memory 18. 'POKE' - Place values in memory 19. '->PRG' - Combine objects into a program 20. 'PRG->' - Separate a program into it components There are no warranties of any kind. Use at your own risk. From: Date: 25 Jan 1991 Frank Ochoa Poul La Cours Vej 25, 1th 8660 Skanderborg Denmark