B79 Archive-name: hp/hp48-faq/part2 Last-modified: 11/06/1994 ********************************************************* HP 48 S/SX/G/GX Frequently Asked Questions List ********************************************************* PART 2 of 4: Hardware, Programs, and Programming: Sections IV - VI Currently Maintained by: Keith Maddock (madd0118@nova.gmi.edu) Originally Compiled by: Darryl Okahata Key: ! =new Q/A + =revised answer PART 2: IV. Questions about cards, data transfers, batteries, hardware ! 4.1 Can I upgrade my S or G to more than 32K ram? ! 4.2 How can I get/build a cable for my HP48? 4.3 Why doesn't the I/R port work farther than a few inches? 4.4 Can my HP48 talk to my HP100LX via Infrared? 4.5 I downloaded a program to my HP, and when I ran it, it put a string on the stack like HPHP48-........ What's wrong? 4.6 Why does XRECV not work sometimes? (GX) 4.7 What do the funny symbols ->, GS+, etc., mean? 4.8 What are the pinouts for the HP 48 serial connector? 4.9 Is there any information on interfacing to the HP 48? 4.10 How can I transfer programs/data from my HP-28S to my HP 48? 4.11 Can I use rechargeable batteries with the HP 48? 4.12 How can I tell, from within a program, if the battery is low? 4.13 My RAM card was plugged into the calculator when I changed the RAM card battery, yet I lost all the information on the card. What happened? 4.14 Why do I get an Invalid card data error when I merge a RAM card? 4.15 I've heard that other manufacturer's RAM cards will work with the HP 48. Is this true? Will it work? 4.16 Why does the HP 48SX display flicker slightly? 4.17 I broke the LCD screen is there an easy way to get another? V. Questions about programs 5.1 Where can I get programs and information for the HP 48SX? 5.2 What are the Goodies Disks and where do I get them? 5.3 How do I get access to the HP Calculator BBS? 5.4 What are files that end with .zip, .Z or .z? 5.5 What is a ship file? 5.6 What is ->ASC or ASC-> and where can I get it? 5.7 What is the HYDE library, and how do I get rid of it? 5.8 What is the Minehunt game, and how do I use it? VI. Questions about programing and advanced user functions 6.1 I've heard the names RPL, Saturn, STAR, Voyager, GL, etc.. What do they mean ! 6.2 Is there a C compiler for the HP48? 6.3 Why do SysRPL programs run faster than UserRPL programs? 6.4 How do I know what library ID number to use for my program? 6.5 What information is there on the internals of the HP 48? 6.6 Are there any viruses for the HP48? 6.7 How do I store fields of variable length string data in a compact, rapidly accessible manner that does not require the overhead of storing strings in lists? 6.8 What is Vectored Enter, and how do I use it? 6.9 What is WSLOG? 6.10 What are SYSEVALs? + 6.11 What are some useful SYSEVALs? 6.12 What are LIBEVALs? 6.13 What are some useful LIBEVALs? 6.14 What is the format of a GROB object? ****************************************************************** IV. Questions about cards, data transfers, batteries, hardware ****************************************************************** 4.1 Can I upgrade my S or G to more than 32K ram? It is possible to do this by opening up the case and adding some memory chips. There is a zipfile containing instructions and schematics available for FTP: cbs.cis.com: /pub/hp48g/uploads/48gs256k.zip WARNING: It is possible to ruin your HP in the process of performing this upgrade. Do not attempt it unless you are adept at working with small electonics. The FAQ maintainer and the authors of the instructions take no responisibility for anything you do to your HP... ****************************************************************** 4.2 How can I get/build a cable for my HP48? Some places that sell the HP48 also sell the cable required for interfacing with a PC. Unfortunately, most don't. For information on how to build your own cable, see appendix H. If you want to buy one, there are a few options. Places like Educalc and ElekTek (see q/a #1.3) sell them for around $20-$25. There are a few netters that make cables for sale also. Contact: Paul Christenson Joel Kolstad Ofer Asif If you live in a larger city, you can look in the Yellow Pages for a listing of HP authorized dealers who either have the cables in stock or can order them in about the same time a ****************************************************************** 4.3 Why doesn't the I/R port work farther than a few inches? It turns out that it is the receiver that is crippled. The transmit range is somewhere around several feet, and some people have actually written programs to make the HP 48 emulate some remote controls (see appendix I for suggested programs). NOTE: There are currently two stories going around as to WHY. I will present both of them in the interest showing all sides of the story, but I personally lean to #1 (due to the source), but people will bet their life on #2.. YMMV (Your Mileage May Vary!) #1 The head of the HP48 design team, Dr. William Wickes himself, alluded during the Chicago Handheld Conference that the IR was intentionally crippled due to the concerns of certain individuals in academia that students could literally 'beam' information from one 48 to another during examinations. (from Rick Grevelle) #2 The reason the ir reception distance is so short is battery capacity. The Infrared Transmitter is semaphore: It is only turned on when it needs to be on, and the transmission protocol is defined to minimize the ON time. The receiver, by contrast, must be on continually when a transmission is in process, or when a transmission is expected. If you set your '48 to Server mode, that receiver is drawing power. If you tweek the control bits to activate the receiver for any other reason, it is drawing power. The intantaneous peak power drawn by the transmitter is much higher than that of the receiver. But in the long run, the receiver will draw more energy from the batteries. Increasing the receiver sensitivity costs even more power. ****************************************************************** 4.4 Can my HP48 talk to my HP100LX via Infrared? Yes, it can, although slowly. Set the HP100LX at 2400 baud, and put it in server mode (under the Kermit Commands menu). THen you can send stuff from your HP48 to your HP100LX ****************************************************************** 4.5 I downloaded a program to my HP, and when I ran it, it put a string on the stack like HPHP48-........ What's wrong? Some versions of kermit distinguish between ASCII and binary files, and so you have to worry about the transfer modes at *BOTH* ends of the connection (the HP 48SX end and the computer end). For example, when receiving ASCII files, Unix kermit must translate CR/LF pairs into LF. If the HP 48SX is transmitting a binary file, but the Unix kermit is expecting ASCII, any CR/LF pairs in the binary file will get translated to LF, corrupting the binary file. Unfortunately, you cannot uncorrupt the corrupted binary file by simply reversing the transfer and expecting kermit to translate LF to CR/LF. This is because the binary file may contain occurrences of LF that were not originally part of a CR/LF sequence. When a binary file gets corrupted, it will display on the stack as a string, starting with the characters HPHP48-, and continuing on with reconverted to binary files right on the HP48. These programs are: FIXIT, by Joe Horn and Mika Heiskanen, or OBJFIX, written by our friends at HP. These are included in appendix F in ASC form (ASC is in appendix A) The major difference between FIXIT and OBJFIX is the way they operate. I have never personally had any problems with either. FIXIT takes the bad HPHP48- string from level 1 of the stack, and replaces it with the correct binary object. OBJFIX takes the name of the variable in which the HPHP48- string is stored from level 1 of the stack, and puts the correct binary object directly in the variable where the bad string was stored. It's up to you which you prefer. I would suggest reading the docs of both (included in appendix F) before using either of them. There is also a quick fix availabe from Dan Kirkland: ----- begin ----- SYSEVAL fix for HPHP48-X!@#$%^&*( by Dan Kirkland, 08 Dec 1993 Here is a simple SYSEVAL program that will return a pointer to the object in those data transfer strings that start with HPHP48- BYTES: # 8FEh 53 << 12 SWAP + # 402Bh SYSEVAL # 62B9Ch SYSEVAL >> That's all! (Simple huh!) Name? Whatever you want!! Works on all 48s (S/SX, G/GX) ----- End -------- ****************************************************************** 4.6 Why does XRECV not work sometimes? (GX) Pre-Rev R. G Series 48's had a bug that would sometimes cause XRECV to fail if there was not twice the amount of room free for the incoming file. FXRECV, a fix for this bug, is available on the Horn 9 disk in the directory hp as FXRECV. There is more info about this bug there as well. ****************************************************************** 4.7 What do the funny symbols ->, GS+, etc., mean? These are the ASCII representation of the special HP 48 graphical characters. See the section Character Translations in the manual for a table of symbols <--> ASCII representations. SX: Chapter 33 (Volume II if 2 volumes) GX: Page 27-16 HP 48G Series User's Guide ****************************************************************** 4.8 What are the pinouts for the HP 48 serial connector? Looking at the pins of the HP 48 (the following diagram is showing the pins on the HP 48, as you look *AT* the calculator): _________ | o o o o | _______/ ^ ^ ^ ^ | | | ------ 4 Signal GND | | -------- 3 RX (input to the HP 48) | 2 TX (output from the HP 48) -- 1 SHIELD Stated another way: HP48 IBM 9 PIN IBM 25 PIN edge -> inward) SHIELD--------- SHIELD------ SHIELD TX (Output)<---2 RX (Input)--3 RX (Input) RX (Input)---->3 TX (Output)>2 TX (Output) SGND-5 GND---------7 GND This information is also on page 27-7 of the G/GX manual. ****************************************************************** 4.9 Is there any information on interfacing to the HP 48? HP has made available an UNSUPPORTED document called the HP 48 I/O Technical Interfacing Guide, which contains information on the wired and serial I/O hardware. Look in the various HP 48 archives for a copy. ****************************************************************** 4.10 How can I transfer programs/data from my HP-28S to my HP 48? You use a program called INPRT, which is avaliable on GD #9. Any previous version will crash the GX. The new version's checksum is #EDF3h, and the old, SX-only version's checksum is #2280h. For each program that you want to transfer, you use the HP 28S to print it to the I/R output; INPRT, running on the HP 48, reads the I/R output of the HP 28S and converts it into a program. ***************************************************************** 4.11 Can I use rechargeable batteries with the HP 48? The Rayovac Renewal batteries have proven themselves to be reliable in the HP48, but there are some problems with ni-cad batteries. You'll have to decide if using rechargeable batteries is worth putting up with the problems: * You'll have to change batteries more often with rechargeable batteries. Alkaline batteries can deliver power for a longer period of time, compared to rechargeable batteries. * Once the low-battery indicator comes on, you'll have to change the rechargeable batteries pretty quickly. With rechargeable batteries, you have only a few minutes before the calculator dies (it's been said that you have up to 15 minutes or so). With alkaline batteries, you have an amount of time that is supposedly measured in hours. * Ni-Cad batteries lose their charge with time, even if you are not using them. Even if a Ni-Cad battery is just sitting unused on a shelf, it slowly loses its charge. Alkaline batteries keep their charge for a very long time. ****************************************************************** 4.12 How can I tell, from within a program, if the battery is low? The following 48 program reports the status of the ALERT annunciator. The ALERT annunciator is activated by alarms or low battery. This program is provided free of charge as is and has no warranty. No one is liable for any consequential damages. Preston %%HP:T(3)A(D)F(.); << RCLF 8 STWS #FFh #0h + #10Bh #6595Ah SYSEVAL #8h AND #0h > SWAP STOF >> ****************************************************************** 4.13 My RAM card was plugged into the calculator when I changed the RAM card battery, yet I lost all the information on the card. What happened? You forgot to turn ON the calculator before changing the battery. The HP only supplies power to the RAM card while the HP is turned on. While the calculator is turned off, no power is supplied by the calculator, and all power comes from the RAM card battery. If you then take out the battery from the RAM card while the calculator is turned OFF, the RAM card has no source of power, and you will lose all of the contents in the RAM card. ****************************************************************** 4.14 Why do I get an Invalid card data error when I merge a RAM card? This message is usually seen when you plug a brand-new RAM card into an HP 48. In this case, this message is normal and is harmless. It just means that there was no (valid) data on the card. GX: This message can appear when a RAM card contains ports you have PINIT softkey. This will initialize all available ram ports. It does not affect data already stored on the card. If you see this message under any other conditions, it could be one of the following: 1. You took the battery out of the RAM card while the card was out of the calculator, therefore erasing the memory. 2. You took the battery out of the RAM card while the card was in the calculator *BUT* the calculator was turned off. Note that the calculator supplies power to the RAM card ONLY when the calculator is turned *ON*. Again the memory on the card is gone. 3. The RAM card battery is dead. 4. There is a problem with either the calculator, the RAM card, or both. If the battery is operational, then try to store something on the card. If you still get the error message, then backup all your info to a computer or another 48, and do a hardware reset. (see #13) ****************************************************************** 4.15 I've heard that other manufacturer's RAM cards will work with the HP 48. Is this true? Will it work? While some cards may work, there is a chance that you may severely damage your HP 48. You should only use cards specifically designed for the HP 48. Naturally, HP sells such cards, and some third parties also make cards that will work in an HP 48. Some cards work with both the S/SX and the G/GX. Some, however only work on the S/SX, or only on the G/GX. Make sure that the card is designed to work for your version before using it. SX: The S/SX can only naturally support up to 128k per port. HP sells 32K and 128K RAM cards. However, TDS, using software bank switches produces 256K and 512K RAM cards. These bank switching cards do not work in the G/GX series. CMT is also a makes 128K cards, which work in all HP 48 calculators. GX: While you cannot use the TDS 256K and 512K cards, Sparcom has come out with 256K and 512K cards for the G/GX only. HP also sells 1MB RAM cards that work for G/GX only. The G/GX is able to accept a 4MB RAM card, but none are on the market at this time. For more info on using non-HP 48 RAM cards in the S/SX series, see appendix B near the end of this file. ****************************************************************** 4.16 Why does the HP 48SX display flicker slightly? Display flicker is usually caused by fluorescent lights. The rapid pulsing of the fluorescent lights (60Hz in the U.S.), which is normally unnoticeable, interacts with the rapid pulsing/scanning of the HP 48 LCD display (64 Hz refresh rate), which is also normally unnoticeable. The 60Hz fluorescent lights alias with the display refresh (64Hz) to produce a 4Hz flicker. It's normal and harmless. Outside the U.S., power is supplied at a 50Hz rate, not 60Hz. This means that the display flickers at a 14Hz rate, which is still noticeable. ****************************************************************** 4.17 I broke the LCD screen is there an easy way to get another? Unfortunately, as far as I am aware, you cannot get a replacement, the cheapest alternative is to send the calc in for standard service at HP, which is slightly cheaper than a new calculator. Opening a 48 is quite difficult anyway. ****************************************************************** V. Questions about programs ****************************************************************** 5.1 Where can I get programs and information for the HP 48SX? See Appendix I for more info. ****************************************************************** 5.2 What are the Goodies Disks and where do I get them? See Appendix 4 of Appendix I for more info. ****************************************************************** 5.3 How do I get access to the HP Calculator BBS? You can access the HP Calculator BBS via a modem (note that this is a long distance call for most people): (503)-750-4448 2400 baud, 8N1 (503)-750-3277 9600 baud, 8N1 For those people who have access to the Internet, you can also access the BBS via telnet to hpcvbbs.cv.hp.com [15.255.72.16]. See Appendix I for more BBS sites. ****************************************************************** 5.4 What are files that end with .zip, .Z or .z? Files that end with .zip are PKZIP archives, which originated in the MSDOS world. One program that can extract the files in .zip archives is the Info Zip unzip program. An MSDOS binary can be found as: Sources for the unzip program can be found as: For binaries for other machines, see the file: Files that end with .Z have been compressed using the Unix compress command. To uncompress these files, you must use the uncompress command on Unix. Files that end with .z have *probably* been compressed using the new gzip compression command. To uncompress these files, you must use either the gunzip or gzip -d command. These commands are not a standard part of Unix, and so you'll probably have to get the sources via anonymous ftp from prep.ai.mit.edu (as /pub/gnu/gzip*). Again, versions are supposedly available for non-Unix platforms. ****************************************************************** 5.5 What is a ship file? In the past, programs for the HP 48 posted on comp.sources.hp48 were posted in the ship format. This format made it easier for the comp.sources.hp48 moderator to distribute programs, but makes it difficult for users to extract and use these programs. Many people still use ship. To extract programs distributed in the ship format, you need the following: 1. A copy of the ship program, compiled for your PC, Macintosh, Amiga, Unix workstation, or whatever. The sources to ship can be found at: cbs.cis.com: /pub/hp48g/dos/unship.zip This zip file also includes the dos executable. Binaries for MSDOS machines, Amigas, and some Unix workstations can be also be found on wuarchive.wustl.edu, in the directory 2. A copy of the latest Info Zip unzip program, or a .ZIP unarchiver that understands the new PKUNZIP V2.04g format. Note that you *CANNOT* use old unzip programs, as old unzip programs do not understand the new compression formats. An MSDOS binary can be found as: Sources for the unzip program can be found as: For binaries for other machines, see the file: Once you have a copy of the ship and unzip programs, you use ship to convert the ship-encoded file into a .ZIP file, and you use the unzip program to extract the HP 48 files from the .ZIP file. ****************************************************************** 5.6 What is ->ASC or ASC-> and where can I get it? These functions were written by William Wickes to facilitate transferring HP 48 binary objects in an ASCII format (useful when HP 48 objects, like libraries, cannot normally be converted into ASCII, unlike program objects, and these functions make it possible to do so. The ->ASC function converts the object in level 1 into an ASCII The ASC-> function converts the string object in level 1 back into an object. A checksum is used to ensure that the decoding is correct. A copy of these programs are given in Appendix A, near the end of this file. ****************************************************************** 5.7 What is the HYDE library, and how do I get rid of it? The HYDE library is a library that changes the messages on your HP48. It works on all versions of the HP48 and is available on Goodies Disc #2. The program (HYDE.TXT) is in the DNICKEL directory needs to be converted with ASC->. The instructions (HYDE.DOC) for the program are in the HORN2 directory. The library is 3679.5 bytes, small enough to keep on your HP48 so you can install it on a friend's when he/she is not looking. :-) Here are a few examples of the changed messages: Invalid Syntax => Makes no sense to me! ____ Error: ____ foul-up: Too few arguements => Gimme some args, man! Empty Stack => The well has run dry! Awaiting server Command => So tell me what to do. Connecting => Anybody out there? To install the library: 1. Download the library to your HP48 2. Go to HOME. 3. Recall the library to the stack and purge the download variable. 4. Press 0, the STO. 5. Put :0:998 on the stack. 6. Type ATTACH 7. Turn your HP48 off, then back on. 8. Push Right-shift then the Library button. 9. Press STRA. 10. Press HYDE. Getting rid of the HYDE library can be fun. Here's how to do it: 1. Go the HOME directory. 2. Press left-shift (orange) LIBRARY. The calculator is now displaying a menu of libraries attached to the HOME directory. 3. Press the menu key that says STRA. You are now accessing the HYDE library. 4. Press the menu key that says JEKY. You have now disabled the HYDE library and restored the old (standard) set of messages. 5. Make sure that a pointer to the library is not on the stack. The easiest way to do this is to clear the stack using CLR. 6. Detach the library using: :0:998 DETACH 7. Purge the library using: :0:998 PURGE When you execute the PURGE, the screen will jump or be messed up for a brief moment. Don't worry about it -- it doesn't hurt. ****************************************************************** 5.8 What is the Minehunt game, and how do I use it? The Minehunt game is a game built in to the G/GX, and included on the HP EQ library card. GX: It is located in the UTILS menu of the left-shift(purple) EQ LIB menu. (Left-Shift {EQ LIB], {UTILS}, {MINEHUNT}). See page 25-14 of the manual for a game explanation and picture. SX: It is located in the UTILS library. You can save a game by pressing the STO button. This creates a variable with the name MHpar. If you are in the directory containing that variable, you will resume your old game when you run MINEHUNT. To select the number of mines for your next game just store a number in a variable, Nmines (it's case sensitive), and you'll get that many mines. If you store a negative number, you'll get the absolute value of that many mines, AND all mines will be visible. You can also move diagonally if you use the numbers as arrows: 1 is down+left, 2 is down, 3 is down+right, 4 is left, 6 is right, 7 is up+left, 8 is up, and 9 is up+right. ****************************************************************** VI. Questions about programming and advanced user functions ****************************************************************** 6.1 I've heard the names RPL, Saturn, STAR, Voyager, GL, etc.. What do they mean? ASAP This is a simple Saturn assembler, written in the Perl language. Chip8, Chip48, Schip, Schip8 This is a machine-code program that was inspired by the chip8 video game interpreter for the RCA CDP1802 microprocessor several years back. Chip8 allows you to write a simple graphics-based video game for the HP 48SX. Among the games written are clones of breakout, pacman, and pong, to name a few (about half?). Chip48, Schip and Schip8 are two different names for an enhanced version of chip8 specifically designed for the HP 48SX. People have written programs to assemble Schip assembly language into a form directly usable by Schip on an HP 48. Schip interpreters are available for both G and S series. HYDE This is the HYDE library, whose only purpose is to change the error messages in the HP 48SX to make it user unfriendly. GL GL (Game Language) is a language for the programmer who wants almost the speed of assembly, but who doesn't want to spend a lot of time and effort to learn all the tricks of assembly programming on the HP48. GL has an assembly-like syntax, and there is an assembler for PC and one for the HP48 itself. Since GL is an interpreter, the GL library (3 KB in size) must be installed on the HP48 to run GL programs. The instruction set is powerful, with sprites and pixel based graphics, scrolling, sound, keyboard control, and more. There are 256 1-byte registers which can be used in pairs as 2-byte words. A GL program can be up to 64 KB in size. GL was inspired by S-CHIP, but it is much better in all aspects. It is suitable for many applications, not only games, that require high speed. Of course it works on both the HP48S/SX and the G/GX. GL is written by Erik Bryntse. ML Machine Language. This is usually used in reference to HP 48 assembly language programming. MLDL Machine Language Development Library. This is a library that allows you to debug machine language programs with only an HP 48. PDL Program Development Link. This is an MSDOS program, sold by Hewlett-Packard, that allows you to write and develop HP 48 applications from your IBM PC clone. Programs are written on your PC, transferred to the HP 48, and tested from your *PC* (and *not* the HP 48). RPL RPL is the name of the language used to program the HP 48 and HP-28 series calculators. RPL stands for Reverse Polish Lisp. described RPL as ROM-based Procedural Language. SASS SASS is a simple Saturn assembler, written in C/yacc (BSD Unix & Bison). It uses Alonzo Gariepy's mnemonics. Saturn Saturn is the internal code name for the processor used in the HP 48, HP-28 series, and many other calculators (just about all HP calculators since the HP 18/28 series). STAR This is the Saturn Macro Assembler (how STAR comes from this, I don't know), an assembler that mostly uses Alonzo Gariepy's mnemonics. It's written in C and runs on many different machines (PCs, Amigas, Unices, etc.). STAR is available via anonymous ftp from ftp.ai.mit.edu in /pub/star-1.04.4.tar.Z. [Note: Rumor has it that this is no longer available at this site. If you know of a more available from various bulletin boards (the HP handhelds forum on CompuServe also has a copy). The latest version is 1.04.4. SWING SWING is a library program that displays a graphical tree structure of the directory hierarchy in your HP 48SX, and allows you to move from directory to directory using the arrow keys (it is supposedly based upon an old PD VMS utility). System RPL This is the name for the custom operating system/language used to program the CPU used in the HP 48 calculator. System RPL is a superset of the normal user RPL commands; in addition to the normal, user-accessible RPL commands, system RPL includes many lower-level functions. System RPL is a language one step higher than assembly language. HP has released a system development toolkit (for the IBM PC) containing a system RPL compiler, assembler, and loader, complete with a couple hundred pages of documentation. This toolkit, while copyrighted, is, for the most part, freely copyable. If you can find a BBS or archive site that has it, you can download all of the system RPL files and documentation. The HP development toolkit only runs on the MS-DOS operating system. Alex Ramos has written a portable system RPL compiler which runs primarily on Unix systems, and can emulate most of the features available on the HP kit. The program is called RPL#+ (in line that reads: send hp48/rpp199c.zip without the quotes, and a daemon program will reply. The program currently runs fine on Sun/OS 4.x, but bugs have been USRLIB USRLIB is a program that takes the contents of an HP 48 directory and turns it into a library object. It currently runs under MSDOS. Voyager Voyager is an interactive disassembler for IBM PC clones that disassembles HP 48SX RPL and machine code. You download a copy of the RAM *and* ROM in your HP 48SX to your PC, and run Voyager. Using Voyager, you can then view the disassembled or unthreaded code. Unfortunately (or fortunately), Voyager uses the HP mnemonics, and not Alonzo Gariepy's mnemonics. Voyager is available from the HP BBS (I think), via anonymous ftp from the HP BBS (hpcvbbs.cv.hp.com [15.255.72.16]), and from various bulletin boards (the HP handhelds forum in CompuServe also has a copy). The latest version is 1.07. ****************************************************************** 6.2 Is there a C compiler for the HP48? Yes. Alex Ramos has written a GNU C back-end for the Saturn processor. Location: ftp.engr.latech.edu:/pub/alex/hp48/ (look around for latest version). ****************************************************************** 6.3 Why do SysRPL programs run faster than UserRPL programs? SysRPL is the built in language, custom designed for the Saturn processor used the HP48 family. UserRPL is a subset of SysRPL. The main reason for the speed difference is the fact that UserRPL commands have built in argument and error checking. In SysRPL, the programmer is responsible for all error checking to avoid memory clears. ****************************************************************** 6.4 How do I know what library ID number to use for my program? [Note: While this document says 48SX, it is also valid for GX] HP 48SX Library ID Numbers Paul Swadener, HP Developer Support. 03 Sep 1993 The HP 48 will become confused if two or more libraries currently in the machine have the same ID numbers. To help third party developer efforts, HP maintains a list of HP 48 Allocated Library ID Numbers. Below are the rules. The penalty suffered from not following these rules is that your library may not work if another library is in the machine with the same number. a. Don't use any number in the range 000h through 300h. These are reserved for HP's use. b. Don't use any number in the range 301h through 5A0h unless you have been assigned that number by HP. These numbers are reserved for developers who are in the business of distributing their software, that is, Independent Software Developers. To apply for the allocation of an ID# contact Paul Swadener, Hewlett-Packard Company, 1000 NE Circle Blvd., Corvallis, OR 97330, fax number 503-750-2192, internet address paul_swadener@hp6400.desk.hp.com. You must be a registered developer and supply the name/nature of your product, and current shipping address and phone/fax/internet add./etc. c. Use a number in the range 5A1h through 600h for experimental work and software. HP does not track the use of these numbers. d. Use a number in the range 601h through 6F6h for your personal applications, those which you will share, if at all, only to a known set of other users for personal uses. HP does not track the use of these numbers. e. Don't use any number in the range 6F7 through 6FF, as these numbers were allocated before the formal allocation process in b. was instituted. f. Don't use any number above 700h. These are also reserved for use by HP. Hope this helps clear up how library numbers work. ----- end ----- ****************************************************************** 6.5 What information is there on the internals of the HP 48? The most important documents are part of the System RPL development tools, a completely unsupported set of IBM PC tools created by HP Corvallis (the creators of the HP 48). The tools, which run on MSDOS machines only, contain documentation on: * System RPL (which includes information on HP 48SX display graphics, keyboard control, etc.). * Saturn assembly language (Saturn is the name of the CPU in the HP 48), including information on a Saturn assembler. * A system RPL compiler. * A Saturn object file linker. The completely unsupported system RPL development tools and documentation are available to customers free of charge to help them in HP 48 application development, subject to certain legal terms, which are given with the tools (they're too long and detailed to give here). You can get a copy in one of the following ways: * Anonymous ftp to hpcvbbs.cv.hp.com [15.255.72.16]. * Get Goodies Disk #4. For info, see Appendix I. ****************************************************************** 6.6 Are there any viruses for the HP48? There are several, and most are French. In the United States, a virus called the Michigan virus erupted a couple of years ago. There is a program on Goodies Disk #8 that checks for the Michigan Virus. Currently, viruses do not pose an appreciable threat on HP48's ****************************************************************** 6.7 How do I store fields of variable length string data in a compact, rapidly accessible manner that does not require the overhead of storing strings in lists? See Appendix E, Compact Data Storage, near the end of this file. ****************************************************************** 6.8 What is Vectored Enter, and how do I use it? [NOTE: This works in the G/GX series as well] The HP 48SX manuals do not document a very powerful feature that we call Vectored ENTER, that allows you in effect to redefine or bypass the command line parser and to have a shot at the stack etc. after the command line has been executed. Keys that execute an automatic ENTER perform a two-step process: 1. The command line is parsed and evaluated. 2. The key definition is executed. When flags -62 and -63 are both set, the system extends this process as follows: 1. The current path is searched for a global variable named *aENTER (here *a is the Greek alpha character--character 140). If present, the command line is entered as a string object and *aENTER is executed. If absent, the command line is parsed and evaluated normally. 2. The key definition is executed. 3. The current path is searched for a global variable named *bENTER (*b is Greek beta--character 223). If present, then a string representing the key definition is put on the stack, and *bENTER is executed. The string is the key definition object's name if it is a command, XLIB name, global or local name, or an empty string for other object types; its primary purpose is to implement things like the TRACE mode on other calcs, where you can print a running record of what you do. A simple example of the use of *aENTER is to create a more convenient binary calculator, where *aENTER slaps a # on the front of the command line so you don't have to bother when entering numbers. ****************************************************************** 6.9 What is WSLOG? It is an undocumented feature which stands for Warm Start LOG. Type in WSLOG in caps, and calc will list the time and cause of the last four warm starts. This feature helps HP tech to fix your baby, in case it crashes. 0 - log cleared by then 1 - low battery condition, auto deep sleep mode invoked to save battery 2 - hardware failed during IR (time out) 3 - run through address 0 4 - system time corrupt 5 - deep sleep mode wake up (alarm?) 6 - unused 7 - CMOS test word in ram was corrupted 8 - abnormality was detected about device config 9 - corrupt alarm list A - unused B - card module pulled C - hardware reset D - system RPL error handler not found in run stream E - corrupt config table F - system RAM card pulled ****************************************************************** 6.10 What are SYSEVALs? SYSEVALs are addresses that point directly to a location in the HP48's ROM. Many SYSEVAL hex strings are System-RPL commands. Because there is no arguement checking, it *VERY* easy to clear your HP48's memory. In the file SYMBOLS.GX, HP designates three types of entries. The first type is supported. This means that a particular entry will work on ALL versions of the HP48 and HP supports the use of this entry. The second type of entry is unsupported. This means that HP does not support the use of this entry and it will not be the same on all versions of the HP48. The third type is unsupported-static. This is an entry to HP does not support the use of, but it is the same for all versions. ****************************************************************** 6.11 What are some useful SYSEVALs? For a complete list of supported entry points, see the file cbs.cis.com: /pub/hp48g/uploads/48entry.txt In System-RPL, different HP object types are refered to by symbols. These symbols are used to construct stack diagrams, which tell the user how to use System-RPL commands. Here are some of the symbols: Symbol Type Example ------ ------- $ string ABCDEFG id Global Name 'A' arry Array [[ 1 2 ] [ 3 4 ]] grob HP48 Graphics Object Graphic 131x64 # Binary Number <1h> symb Symbolic Object 'A^2+B^2' To interpret the stack diagram: Everything on the left of the -> arrow is the input. That needs to be on the stack before executing the syseval. The symbols show you which kinds of data to put on the stack. Once you execute the syseval (see next paragraph), the HP will return the data back that is indicated on the right side of the arrow. To use the following entries, do the following: 1. Make sure (triple check) that the appropriate arguements are on the stack. 2. Push Left-shift /, you should get a # on the command line. 3. Enter the hex string exactly as shown in the hex string column. 4. Put an small case h at the end of the hex string. 5. Press enter. 6. Type SYSEVAL. Hex String Sys-RPL Name Catergory Stack Diagram -- --------- --- 15777 NULLID Supported ( -> '' ) 30794 VERSTRING ( -> HPHP48-? ) 3A328 MakeStdLabel ( $ -> grob ) 3A3EC MakeDirLabel 3A38A MakeBoxLabel 3A44E MakeInvLabel 3A1FC DispMenu.1 ( -> ) 05F42 GARBAGE ( -> ) 41F65 WaitForKey ( -> #KeyCode #Plane ) 353AB SYMB>IDS Unsupported-static ( symb -> list ) 40D25 LockAlpha Supported ( -> ) 40D39 UnlockAlpha 3AA0A 1A/LockA 44C31 DoNewMatrix ( -> arry ) 44FE7 DoOldMatrix ( arry -> arry' T/F ) 1314D TOADISP ( -> ) 13135 TOGDISP 39531 ClrDA1IsStat 130AC RECLAIMDISP 4E347 TURNMENUON 05B15 $>ID ( $ -> id ) 05BE9 ID>$ ( id -> $ ) 3A1E8 DispMenu ( -> ) 39BAD DispStack Unsupported-static ****************************************************************** 6.12 What are LIBEVALs? [This answer was copied from Joe Horn's libeval.doc from GD #9] The G/GX has a new command: LIBEVAL. It's sort of like SYSEVAL, but instead of taking a memory address (which could be ambiguous due to the G/GX's massive need for bank switching), it takes XLIB numbers. It's a back door for us hackers. Unlike the ELSYSEVAL command in the HP Solve Equations Library Card, which only worked for the libraries in that card, LIBEVAL works for *any* library, including the hidden ones in the operating system. CAUTION: LIBEVAL, like SYSEVAL, is both powerful and dangerous. If used with incorrect input(s) and/or in the wrong environment, it can nuke your memory. LIBEVAL takes a single user binary integer of the form #LLLFFFh, where LLL is the library ID (hex), and FFF is the three-digit function number (hex, with leading zeros if necessary). For example, the R->B command is XLIB 2 9. So you can perform a R->B by executing #2009h LIBEVAL. Try it: 10 #2009h LIBEVAL -> #Ah. Using it for named commands is unnecessary, but the G/GX is highly XLIB oriented (again, due to the need for bank switching), and there are many useful and interesting features accessible only thru LIBEVAL. A prime example is the G/GX's inability to programmatically launch the new dialog boxes. Suppose a program needs to print things; it would be awfully nice to be able to throw the I/O PRINT dialog box onto the screen. The User's Guide is no help here, and in fact it would seem impossible to do. But #B4197 LIBEVAL is all it takes! Try it. Cool, huh? ****************************************************************** 6.13 What are some useful LIBEVALs? (GX) Function GX ---+ | Creates an XLIB name from two bints | #7E50h Displays message box with grob | #B1000h CMD last command window | #B2000h CHARS application | #B2001h MODES application input form | #B41C1h flag browser (returns t/f to level 1, just drop it) | #B41CFh MEMORY application (aka variable browser) | #B41D7h SOLVE application choose box | #B4000h solve equation input form | #B4001h solve difeq input form | #B4017h solve polynomial input form | #B402Ch solve linear systems of equations input form | #B4033h solve TVM input form | #B4038h PLOT input form | #B4045h SYMBOLIC application choose box | #B4113h integrate input form | #B4114h differentiate input form | #B4122h Taylor polynomial expansion input form | #B412Bh Isolate a variable input form | #B412Dh solve quadratic input form | #B4130h manipulate expression input form | #B4131h TIME application choose box | #B4137h Set alarm input form | #B4138h Set time and date input form | #B415Bh Alarm browser (aka alarm catalog) | #B416Eh STAT application choose box | #B4175h single-var stat input form | #B4176h frequencies input form | #B417Dh fit data input form | #B417Fh summary stat input form | #B418Fh I/O application choose box | #B4192h Send to HP48 input form | #B4193h Print input form | #B4197h Transfer input form | #B41A8h Get from HP48 (immediate) | #B50FFh recalls the contents of the reserve variable Mpar | #E4012h ****************************************************************** 6.14 What is the format of a GROB object? [NOTE: I received two very good answers to this question, and each cater to a different kind of user, so I will include them both.] ANSWER A: The easy way: --------- First, add pixels to the right-hand edge to make the horizontal dimension a multiple of 8, then separate the object horizontally into groups of four pixels. Suppose, for example, you want to make this into a 22x8 GROB: ---------****--------- --------**--**-------- -------**----**------- ********------******** ********------******** -------**----**------- --------**--**-------- ---------****--------- You would break it up like this: ---- ---- -*** *--- ---- ---- ---- ---- **-- **-- ---- ---- ---- ---* *--- -**- ---- ---- **** **** ---- --** **** **-- **** **** ---- --** **** **-- ---- ---* *--- -**- ---- ---- ---- ---- **-- **-- ---- ---- ---- ---- -*** *--- ---- ---- Notice, I've added two columns of pixels to make it 24x8. Now, each group of four can be represented by a hexadecimal digit. ---- 0 --*- 4 ---* 8 --** C *--- 1 *-*- 5 *--* 9 *-** D -*-- 2 -**- 6 -*-* A -*** E **-- 3 ***- 7 **-* B **** F Now, replace each group of four pixels with its corresponding hexadecimal digit: 00E100 003300 081600 FF0CF3 FF0CF3 081600 003300 00E100. So, your final grob is: GROB 22 8 00E100003300081600FF0CF3FF0CF308160000330000E100 --------- ANSWER B: The technical way: --------- NOTE 1: Every HP object format is described in RPLMAN.DOC, see this file for more info. NOTE 2: All HP objects are (of course) nibble based. When viewing them on the PC, which is byte based, the low order nib is always read and written first. NOTE 3: HP objects begin with a 5 nib prolog which identifies the object type (and other things). This is the prolog for a grob object.. 02B1E pr HP:DOGROB 02B1E @ Graphic prolog (/U GROB) NOTE 4: Every 5 nib sub field of an object, such as prolog, length, etc., is read in reverse order (low nib first). The grob prolog would appear E1B20, or 1E 2B x0 in a hex dump on a PC. The least significant nibble of the next field begins right at the x in x0. NOTE 5: It is customary to always work with HP objects on the PC with the HPHP48-E header (substitute your favorite rom version letter) preceding the prolog. This gives no hassles when downloading via Kermit or Xmodem. PC hex dump of a grob object.. ( remember each 5 nib field is reverse order ) 1_ HPHP48-E 8 byte ascii string with msb off 2_ 5 nib prolog, 02B1E (hex) 3_ 5 nib length field, includes length of body AND length and height fields! does not include 5 nib prolog. So, the total #nibs the grob object takes in HP memory is this number + 5. Important! 4_ 5 nib height field ( yes, it is height then width ) 5_ 5 nib width field 6_ body (described below) The grob object looking at it using command line EDIT on the HP.. GROB < body > The body is exactly the same looking at it on a PC hex dump or on the command line EDIT. Just remember to read low nibble first for hex dump. The grob body --- Because of hardware restrictions, the number of nibs required to represent one horizontal line must be even (byte aligned). So, use this method to calculate the number of nibs in one line.. (pascal example) nibs:= width div 4; if nibs mod 4 <> 0 then nibs:= nibs + 1; if odd(nibs) then nibs:= nibs + 1; Then to get the #nibs in the entire body, multiply it by height. ! Remember, the length field must be this total body length + 15 ! For example, a 131 wide grob requires 34 nibs for one horizontal line, where 5 of the bits are unused. The first nib in the second line begins at nib 35 for this grob, etc. If the grob is 64 lines, then the body is 2176 nibs. Add 5 for the prolog, 5 for the length field, 5 for height, and 5 for width. Total object size (on the HP) is 2196 nibs, or 1098 bytes. The length field should contain 2196 minus 5 for prolog = 2191 (0088F hex) Note that for each nib, the right-most bit is the left-most pixel on the screen. This is nearly always the case for graphic memory. ****************************************************************** END PART 2 OF 4