Re: How to create a HP41 ROM image from a set of programs(LONG) Message #8 Posted by David on 10 Dec 2003, 8:58 p.m., in response to message #1 by Miki Mihajlovic
Miki:
If you want to create a "virtual rom" of User Code (sometimes called FOCAL Programs) on a PC for eventual transfer then this is one way.
First you will need several pieces of software
1) HP's SDS II assembler package
2) Warren Furlow's excellent SDK41 assembler package
3) Leo Duran's User Code Utility 1.21 and Ulisse Quadri's User Code Utility GUI (a "front end" for Leo's program)
4) Some kind of test editor
Second I am assuming you have no way to get your program's into the PC without typing.
So, get all the packages installed on the PC and type in the programs. You next need to convert all external references to XROM NUMBERS (XROM,XX,YY).
Next, use the User Code Utility to convert the "text" programs to "dat" format.
Now it gets a little hard. You must manually do what the SDSII program to read mass storage programs automatically does.
You need to edit the DAT file to insure the hex instructions are correct.
For this I'd suggest using Warren's program to decode some of the ROM files with user code to understand their structure. Also, programs in ROM have their bytes coded differently from RAM.
All FOCAL instructions are 3 hex digits in size. In ROM the first digit will be a 1 if the instruction is (a) a single byte instruction or (b) the first byte of a multi-byte instruction.
All ROM FOCAL code ends with a specific code. Check some de-compiled code and you'll see it.
Finally, when you have edited the code use the User Code Utility to convert the DAT to BIN.
Now you can run the bin file through the SDSII programs to produce hex files for building a input file for Warren's SDK programs.
There are some other little problems that pop up:
I suggest building you're programs one by one because you'll need to set entry points for the FAT table for SDKII to assemble. This means you need to know the entry byte for each FOCAL Program...and FOCAL code does not show as anything but lines of hex code when dissambled.
The SDSII programs to build the user code are not really self-referencing. If you are calling other programs (or m-code) within the same ROM you actually cannot build with that XROM number--you must actually build to another XROM number temporarily. For example, if you are creating an XROM 31 and your code calls a routine designated at XROM 31,25 SDSII will not let you build the code as XROM 31. You must temporarily build as say XROM 30 then copy the code into the file you are going to use the SDK41 assembler/linker to create the actual compiled ROM code.
So the path is text->User Code Utility->edit DAT->User Code Utility->SDSII->hex code->Text file of hex code->SDK41 to assemble and link the ROM.
If this sounds confusing--it is. There is a steep learning curve but it is entirly possible. I build 4k worth of FOCAL code into a ROM file while learning to use the v41 emulator and Charles Lee's P41 emulator and later Frank Baquernoeppel's PocketPc emulator.
I have an article I wrote to clarify thinks for myself when I was dealing with learning and implementing this and if you'd like I could dig it out, clean it up and email it to you.
|