x48 -- HP48 CPU emulator ======================== This is x48, an HP48 CPU emulator. This is the second ALPHA release. I post it to the net, because I would like to get some response to my efforts. At present the code is a mess, I need to do some cleanup... Though many features are implemented, lots are missing. What's new: - X11 interface - Start off RealTime support - SHUTDN implemented - Keyboard support NOTE (from EM48 README by Paul Fox) =================================== This emulator is capable of providing a faithful replication of the HP48. In order to do so, it requires a copy of the ROM software from YOUR calculator. In order to avoid breaking copyright laws, and upsetting HP, you MUST BE THE PROUD OWNER OF AN HP48 before running this program. Of course you can run this program without a copy of the ROM software in order to write trivial machine code programs but you will not be able to access any of the calculator functionality. Instructions on how to download a copy of the ROM are provided later in this document. THANKS ====== I must thank Joe Ervin for his article on keyboard handling. I would also like to thank Alonzo Gariepy for his contribution to the world on how the HP28/HP48 works. I would sincerely like to thank HP for bringing the world a device so complicated yet useable and useful. Keep up the good work all you guys! I also must thank Paul Fox, Author of EM48, for his work on his emulator, the source code was a great help for solving some problems, specially the memory bank switching. Thanks Paul. HACKERS PLEA ============ I will continue to work on this product and support it where I have the time, and would therefore appreciate any patches or bug fixes, etc which any of you make so that I can keep control of the software. Information in the form of loose english, context diffs, or suggestions are welcome so that we can all make this product a little better. Also, I am very interested in merging a debugger (maybe the one from EM48) into my emulator. I believe this would make x48 a very useful tool for the gcc - saturn project. I need more information on how the registers are used in RPL and, for the gcc project, in the gcc code. INSTALLATION ============ The current version of x48 is still ALPHA, and the Makefile is not very smart about different operating systems. I improved handling of differences in Solaris, SunOS, and Linux. Things are not perfect, anyway. What you might want to do is to look at the Makefile and at the file serial.c. Serial.c tries to open a serial line on '/dev/ttyS7' on my machine, or '/dev/ttya' on SUNs. You probably want to change that. Please don't change the '/dev/pty*' stuff, unless knowing what you're doing. Try 'make'. This should give you 'x48' and 'dump2rom'. HOW TO DOWNLOAD A COPY OF THE ROM ================================= The emulator works by executing an image of the HP48s ROM. In order to run the emulator you must have a version of your ROM on the system. To get a memory dump you need to do the following: - Connect your HP-48 to your Computer. - Start `kermit` on your computer, type: log session This will capture the output from the HP-48 to a file called session.log. - Connect the kermit to your serial line by typing 'connect' on your computer. - Enter the memory scanner on the HP by pressing ON, then D, then releasing the keys. Press '<==' (Backspace). Press 'ENTER'. Press '/' Your HP-48 should show something like 00000:2369B108DADF1008 in the first line of the display. - Dump the memory: Press 'SPC'. This will dump 0x10000 nibbles of ROM. Repeat pressing 'SPC' until all 0x80000 nibbles are done. - Escape from your kermit connection (usually 'Ctrl-\' followed by 'C') and type `quit` on your Computer. You should now have a memory dump in the file 'session.log'. Run the command: `dump2rom session.log` This will convert your dump into a rom file readable by the emulator called 'rom.dump' USING THE EMULATOR ================== Go into the directory, where your ROM-dump resides. On the first start the emulator will look for a file called 'rom.dump' in the current directory. It will start running at the addr 00000. This will result in the question 'Try to recover memory?' Answer 'NO'. To use the emulator, click your mouse at the buttons on the emulator. You have to press the button down long enough, so the HP-48 will considder it a keypress. Well, this should work. To do something like ON-D, or ON-A-F, one would use the middle mouse button to press ON, then the middle mouse button to press A. These keys should stay depressed. Now use the left mouse button to press F. This should release all three keys and yield the desired results. You can check your ROM dump by pressing ON-E. This enters the selftest off the HP-48. If it says IROM OK after some time, your ROM CRC has been calculated correctly. The emulator has 32K RAM and two 128K RAM cards, both read/write. To access all memory you have to do: 1 MERGE 2 MERGE When you hit the 'quit' button of the window frame (under ol(v)wm), the emulator saves its state, RAM, ROM, and the ports to files in the directory '$HOME/.hp48/', so the next time it is started, all your stuff should be still there. If the emulator gets messed up, or crashes, kill it from a unix-shell. This will NOT save the stuff, so the next time started, you should have the same state as before the crash. KEYBOARD SUPPORT ================ I have added simple keyboard support: The keys 'A' - 'Z', '0' - '9', '+', '-', '*', '/', 'RETURN', '.', 'SPACE', 'DELETE', and 'BACKSPACE' are mapped to the according keys on the HP-48's keyboard. The SHIFT keys give you the Orange and Blue shifts. 'ALT' gives you the `alpha' key, and 'ESC' the `ON' key. The keys 'F1' - 'F2' also access the menu labels on the HP. The cursor keys give you the HP-48 keys 'K', 'P', 'Q', and 'R'. Note that the key 'A' doesn't give you the letter "A" on the HP, but the button in Row 1, Column 1 on the HP keyboard. The function executed depends on the Shift State of the HP. To do something like 'ON-A-F', press and hold `ESC', then press and hold `A', then press `F' and release all buttons. TALKING TO THE OUTSIDE WORLD ============================ When started the emulator prints two lines similar to: wire connection on /dev/ptyp2 IR connection on /dev/ttyS7 If you have a backup off your real HP-48 on your computer, you could restore it using kermit: On the emulator enter the IO menu, hit SETUP, configure to wire, binary, 9600, none, 1, 3. 'wire' is the local computer connection, 'IR' talks to the serial line off your computer. This is strange, but the other way around it does not work, yet. Go to the IO menu again. Hit SERVER. The emulator says: Awaiting Server Command On your computer take an unused xterm, go to the directory where you keep your backups, and start kermit. Configure the line: set line /dev/ttyp2 This should be the pseudo terminal connected to your emulator. The number must be the same the emulator reported at startup. At the kermit prompt type: 'send backup18.08.1994', or however your backup was called. There should be communication going. After the transfer you should have a VAR 'backup18.08.1994'. Hit the menu key for it. It says BackupHOMEDIR. Type RESTORE. That's all. Talking to the serial line, to e.g. another real HP-48 works the same, just configure the IO to IR. BUGS ==== The LCD driver currently does NOT implement the bit offset hardware for performing fast scrolling when in graphics mode. The timers are slightly missing some Seconds, but are close to REAL_TIME. Lots of guesses in the devices section of the emulator. I could realy use the 'SATURN HARDWARE SPECIFICATION' from HP. If anyone has access to it, send a copy, or tell me where to get it. ACCESS TO THE AUTHOR ==================== Please send any bug reports, context-diffs or suggestions to ecd@dressler.de Eddie C. Dost 61, Rue de la Chapelle 4850 Moresnet-Chapelle Belgium Have Fun.