HP Forums
Compile LEX with HPTOOLS - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: Compile LEX with HPTOOLS (/thread-28725.html)



Compile LEX with HPTOOLS - Alain (Canada) - 02-28-2003

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




Re: Compile LEX with HPTOOLS - Ex-PPC member - 02-28-2003

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.


Re: Compile LEX with HPTOOLS - Raymond Del Tondo - 02-28-2003

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


Raymond


Re: Compile LEX with HPTOOLS - Alain (Canada) - 02-28-2003

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.

Alain


Re: Compile LEX with HPTOOLS - Alain (Canada) - 02-28-2003

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 SB%RAM * ??
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 ??

Alain




Re: Compile LEX with HPTOOLS - Raymond Del Tondo - 02-28-2003

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...

Raymond


Re: Compile LEX with HPTOOLS - Alain (Canada) - 02-28-2003

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.

Alain