The Museum of HP Calculators

HP Forum Archive 11

[ Return to Index | Top of Index ]

Compile LEX with HPTOOLS
Message #1 Posted by Alain (Canada) on 28 Feb 2003, 9:22 a.m.

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
Message #2 Posted by EX-PPC member on 28 Feb 2003, 9:39 a.m.,
in response to message #1 by Alain (Canada)

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
Message #3 Posted by Raymond Del Tondo (Germany) on 28 Feb 2003, 10:03 a.m.,
in response to message #2 by EX-PPC member

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
Message #4 Posted by Alain (Canada) on 28 Feb 2003, 1:26 p.m.,
in response to message #2 by EX-PPC member

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
Message #5 Posted by Alain (Canada) on 28 Feb 2003, 5:26 p.m.,
in response to message #4 by Alain (Canada)

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
Message #6 Posted by Raymond Del Tondo (Germany) on 28 Feb 2003, 7:00 p.m.,
in response to message #5 by Alain (Canada)

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
Message #7 Posted by Alain (Canada) on 28 Feb 2003, 8:20 p.m.,
in response to message #6 by Raymond Del Tondo (Germany)

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


[ Return to Index | Top of Index ]

Go back to the main exhibit hall