I - AREUH Assembler/Linker for the HP71


A: Introduction

The development system for HP71 which we present here is based on an assembler and linker written in C. This system functions at present on several different computers:

  • computers running HP-UX in particular, and Unix systems in general.
  • the Atari 520 and 1040 ST computers under the TOS operating system.
  • an adaptation exists for the HP Vectra and other IBM PC under MS-DOS system.

All our efforts are aimed towards the reduction of times of assembly. See the execution times give in example for more details.

B: Introduction to the assembler

The assembler has two operating modes:

  1. The "complete assembly" mode, which makes it possible to have compatibility with the "thing" (the Forth module assembler). In particular, all the macro-operations for generation of lex or bin files are supported.
  2. The "seperate assembly" mode makes it possible to approach the working conditions of the HP71 development team in Corvallis Oregon by allowing the assembly of seperate modules, combining them later by means of the linker.

C: Advantages and disadvantages

Among the many advantages which this system provides, we can cite:

  • Use of HP's entry points without having to explicitly declare them with EQU.
  • Creation of a cross reference table giving for each symbol the name, the value and the line where it is declared and the lines where it is used.
  • Introduction of new operators into expressions, and the possibility of entering binary values.

The names of the labels now have 12 significant characters.

As for the disadvantages, it lacks pseudo-operations FORTH, WORD and WORDI. And, of course, one needs "a large" computer.

D: Seperate Assembly

Assembly of a file in seperate modules is done in two phases.

All the files (modules) constituting the source should initially be assembled, Then one proceeds to the link step, which gathers these modules into only one file.

If it is ever necessary to modify part of the source text, it is enough to just re-assemble the module containing the modified text, and to redo the link step. The savings in time are enormous.

This modular management also allows a more effective treatment of labels. A module can call a routine written in another module if that label is preceded wih an equals sign ("=") in both modules., This serves the function of declaring an external label (in the calling module) or a public label (in the module where the label is declared) accessible to all. Such public labels are "global" labels.

Along with global labels, the category of local labels is added. These do not have an equals sign in their names. Two or more modules can have labels of this type bearing the same name. This makes it possible to have, for example, several labels named "argerr" in different modules, without causing the least conflict.

This is the same system employed by HP, and described in the IDS volume I (CH 16). Only this system allows the development of large programs in assembler.

II - Differences With The "THING"

A: Mode Selection

The selection of the assembly mode (complete or separate) is determined by the presence of the macro LEX or BIN in the first line of the source file.

B: Upper/lower Case

Except for labels, all op-codes and expressions are understood as well in capital letters as in small letters.

C: Prohibited Macros

In separate assembly, pseudo-operations for generation of LEX or BIN files are prohibited. Thus, LEX, ID, MSG, POLL, ENTRY, TANK, TOKEN, KEY, ENDTXT, BIN and CHAIN are prohibited out of a complete assembly. One thus exerts a more precise control over code generation. In addition, the macro FORTH, WORD and WORDI are prohibited. Only the first use of TITLE is taken into account.

D: Added Macros

First, there is RDSYMB (ReaD SYMBols) It makes it possible to load a file containing entry points without having to wait for link time. For example, in complete assembly, this makes it possible to include the entry points supported by HP ("hp71.ep" file).

Syntax is:


  RDSYMB 

Next, we have conditional assembly. For example, if we have:


	AREUH	EQU	1
		IF	AREUH 
		P=P+1
		RTN
		ELSE
		ASRB
		C+P+1
		ENDIF 

Only code P=P+1 and RTN will be assembled. Conversely, if AREUH had been declared with a zero value, codes ASRB and C+P+1 would have been assembled. This permits simple generation of different versions from the same program (development versions) However take note: there cannot be nesting of such a conditional structure.

E: Added Opcodes

D0=HEX and D1=HEX (present, but not documented in the "thing") work perfectly.

LC(6) and CON(6) (used by HP) are present.

F: Numerical values

Numerical values calculated in expressions, or returned by labels comprise six hexadecimal digits and not five as in the "thing". As in rhe IDS.

On the other hand, the values listed in the symbol tables are only five digits. This limitation relates only to the listing and not to the internal storage. This is in conformity with the listing provided by the IDS assembler, and has been preserved because of acquired practice in reading the addresses of the HP71.

G: Expressions

Expressions can contain labels, the value of the instruction counter (PC), constants and operators. There is no limitation on the level of nesting of brackets.

Labels are now significant to 12 characters.

The symbol ' * ' (in place of operand) represents the value of the instruction counter. In the case of a separate compilation, this value is the real value, taking account of the position of the module in the complete file.

Constants of higher value than six hexadecimal digits are truncated.

ASCII constants are delimited either by apostrophes ('), or by backslashes (\).

A new type of constant is added: binary constants. They must be preceded by a '%' sign, as in: %01110001

Operators: Here is the complete list, in order of decreasing precedence. Operators of equal precedence are evaluated from left to right:

	~ (* 256+) 		^ (power) 
	- (unary minus) 	` (1's complement)
	& (logical and)		! (logical or)
	* (multiplication)	/ (integer division)
	+ (addition) 		- (subtraction)

H: FiLeNd

The FiLeNd label is systematically added at the end of each file or module assembled.Moreover, the global label "= FiLeNd" is added automatically at the end of the file at link time for separate assembly

III - INSTRUCTIONS FOR THE PROGRAMS

The two programs "aas" and "ald" take the same options.

-o
Specify the name of the output file of the assembler or the linker.
-a <filename>
Ask for printing of a listing of assembly or linkage. The listing is placed in the file specified.
-A
Asks for the printing of a listing of assembly or linkage. The listing is displayed on the screen (stdout on Unix systems).
-l <page length>
Specifies the physical length of pages, in numbers of lines. The length of the text will be 6 lines less rthan this length.
-x
Asks for the printing of a cross reference table.
-p
Activates the interactive input of the options previously described. Note that not giving any parameter activates this option implicitly.

For aas, it is then necessary to provide the name of the source file.
For ald, it is necessary to provide the names of all the modules.

By default, the file generated has as the name "lex". The source files have an "as" suffix (extension), and the intermediary files (between the assembler and the linker) have an "ao" suffix. In general, it is not necessary to include these extensions.

IV - EXAMPLES

To assemble the file f1.as (which starts with a LEX macro), and output in "lex":

	aas f1 

Assemble the file f1.as with cross reference listing in the file "list", and output in "lex":


	aas - xalist f1

	aas -x - a list f1 

Same example as previously with a page length of of 66 lines (11" paper):

	aas - xalist -l66 f1

Assemble the file f1.as, with output in "louse", using interactive parameters:

	aas 
	   then enter "f1"
	   then  enter "louse" 
	   then enter [ RETURN ] 

Assemble the files f1.as, f2.as and f3.as which contain the source of a single lex file:

Assembly of the three files:


	aas f1 aas f2 aas f3 

Linking of the files f1, f2 and f3 (fi.ao for i=1..3), with request for a listing and a cross reference table in the file "list", and assembled file name "totolex":

	 ald -xalist -ototolex f1 f2 f3 

Pierre David (PC37, SIG1, CHHU616)
Janick Taillandier (PC246, SIG6, CHHU178)

Translation from the French by Google and Howard Owen <hbo@egbok.com>
Crucial correction of translation errors by J.F. Garnier "Merci beaucoup, Jean-Francois!"