beautypg.com

Juniper Systems JS600 User Manual

Page 64

background image

Page 7-4 PolyTools Program

PolyTools Programming Guidelines

Before you use PolyTools to develop Polycode programs, review the following
programming guidelines:

Source Code and Object Code
Program files which have not been translated by PolyTran, the Polycode translator
program described later in this section, are called source code files. Source code files usually
end with a .P extension. Program files that have been translated by PolyTran are referred to as
object code files. Use a .PGM extension at the end of object code filenames.

We recommend that you do not use line numbers in source code files. PolyTran
automatically numbers the lines when it converts the source code file to an object code file. If
you use line numbers in your source code files, PolyTran ignores them in the translation
process.

Labels
PolyTools allows you to use a label before a line of code in source code files. It is
possible, therefore, to use labels in jump instructions instead of line numbers, thus
eliminating the need to recalculate the line numbers if lines of code are added or deleted.
Development time is reduced and errors caused by miscalculated line numbers are
eliminated. When PolyTran translates the source code into object code, it replaces all labels
with their equivalent line numbers.

Labels are used to flag sections of code that are repeated in a loop or are accessed from a
different section of the Polycode program. For example, if you had a section of source code you
wished to return to, you could use the label, ‘RETURN: ‘, before the first line of the section. A
jump instruction, such as ‘JNK’, could use the label as a parameter. When PolyTran translates
the source code file, the label is replaced by the actual line number. If code is added or deleted
in the source code file, the source code can be translated again and PolyTran places the new
line number for the JNK parameter into the object code file.

A label is placed at the beginning of the line of code and must be followed by a colon (:). The
label can be 1 to 10 characters long, but cannot be a valid Polycode mnemonic or opcode
instruction. Each source code file can define up to 100 labels.

INCLUDE Instruction
It is possible to have PolyTran insert other programs or files inside the program it is translat-
ing. When you edit your program, use the INCLUDE instruction, followed by the DOS
filename of the program you are including. For example, you could save the format and data
portions of the program as separate files and then have these files inserted as your main