HP Forums

Full Version: Compile LEX with HPTOOLS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

In an earlier thread in this forum, someone mentioned the existence of a possibly very interesting LEX called “RPNLEX”. So I searched my hard disk an found only the source file: “No problem, I have HPTOOLS, I will just compile it – piece of cake!” I told myself. Well, after a little bit of experimentation, I found three possible problems :

1) HPTOOLS doesn’t recognise the “LEX “ opcode, although in the source file, there is a constant called “LEX”. ;
2) If I get to the point of being able to compile the source, I get a object code. Is there an additional step to make it look like a LEX or is the object code a LEX file ?
3) Once I have the LEX on my hard disk, how do I send it to my HP9114 floppy drive not knowing the correct FILE IMPLEMENTATION. Is there . Is there program that calculate the file implementation ?

I’m sure this is all newbie stuff… oh well…

BTW I found a compiled verion of RPNLEX but I still want to know.


Alain wrote:

"1) HPTOOLS doesn’t recognise the “LEX “ opcode, although in the source file, there is a constant called “LEX”."

I think I can shed some line on this point. "LEX" isn't a valid CPU opcode, it's a pseudo-opcode only recognized by the Assembler program in the FORTH/Assembler ROM. The Assembler recognizes this pseudo-opcode and emits the actual opcodes needed to create a LEX file. Other pseudo-opcodes which would be equally problematic are "FORTH" (to create primitive FORTH words in assembly) and "BIN" (to create binary BASIC subprograms). Those pseudo-opcodes are included as a very convenient feature to save the user from having to insert the real opcodes by hand.

You would need to consult documentation in order to see what the Assembler program does with the "LEX" pseudo-opcode, i.e.: how does it process it and what opcode stream does it emit to the object code file. I guess it probably creates a properly filled header for the resulting LEX file, as well as a number of data structures/tables needed to interface the native operating system to the LEX file (keywords, polls, error messages, etc), and pointers to them.

Another thing to notice:

If you use the HPTools for creating HP-71 binary files,
be sure to use level 0 instructions only.

For more info: SASM.DOC


Regarding the support of the 'LEX' pseudo opcode, the Forth/Assembler Rom manual says :


LEX 'name'

Assemble a new LEX file called 'name'. This pseudo-op must be the first line in the source file. The LEX file will have the correct header. The initial data for this file is defined by the ID, MSG, and POLL pseudo-ops, wich must be present in that order.


It seems that the LEX pseudo-op does two actions, 1) gives the generated file the 'name' name. 2) Generate proper 'header' for that file.

I will have a look a the IDS manual to see if it gives more details.


After a check in the IDS vol. 1, a possible description of what does the 'LEX' pseudo-ops is to construct the following structure as a file header :

RDSYMB TI%EQU * Equal sign for before the title ??
NIBASC \'name'\ * Then lex file name
CON(4) =lLEX * The lex file type
NIBHEX 00 * Flags ??
NIBHEX xxxx * Time (File attribute ??)
NIBHEX xxxxxx * Date (File attribute ??)
REL(5) EOF (label)* File Length

Anybody can confirm or comment ??


I'm not sure, but weren't the file formats of (LEX, BIN, FTH) documented in the Assembler ROM manual?
I have one, but it's packed away very deep,
so no chance to look yet...


I finally compiled the RPNLEX with AREUH compiler wich support the 'LEX' pseudo-ops. The object file is a lex file. I'm still missing the tool to get the 'File Implementation' information from the object file. Any idea ?

p.s. The LEX file header is described in the IDS volume 1.