NCR 399 Programming Language
Internal operations and certain external functions of the NCR 399 system are programmed in the 399 mnemonic language, using near-English macro instructions designed specifically for accounting applications. The programmer must supply two types of information to the application program — data descriptions and procedural instructions. Data layout and coding worksheets are provided for the completion of this information.
The data layout worksheet is used to define the format of the variables on which all arithmetic and data handling operations are to be performed. This data is stored in memory in the form of numeric or alphanumeric values provided as a part of the application program or as a result of previous operations. Each data field defined by the programmer will have a header associated with it in memory. This header contains information reflecting the format of the data field as specified by the programmer on the data layout worksheet. In addition to field length, data type, decimal position, and sign, such information as print position and paper advance code can be defined to achieve automatic print control.
If the data being defined is to be printed on the serial or line printer, the programmer can specify the column number where printing is to start and the number of lines to advance the paper after printing that data lield Then, when the data field is output to the printer, it will be printed automatically in the specified column and the paper advanced if necessary. This feature is especially advantageous when formatting and printing reports; it saves memory by eliminating unnecessary coding within the program.
The NCR 399 programmer need never be concerned with keeping track of actual data addresses in memory. Meaningful symbolic names are assigned to data fields in the program. Once the programmer assigns these names, he thereafter refers to data by name only; software automatically handles the hardware addressing.
Procedural instructions are entered on the 399 coding worksheet. These instructions: (1) define the functions that must be performed to achieve the end results of the application, and (2) specify the application data that is to be operated on by the interpreter. Instructions, which are variable in length, may contain up 10 three operand addresses.
The 399 language is made up of a comprehensive set of macro-instructions that control forms movement and printing, manipulate data, perform arithmetic functions, process tables, and transfer information to and from the I/O devices. Each macro is a software instruction that, when executed by the interpreter, initiates a series of hardware functions necessary to accomplish the specified task. For instance, when the programmer codes a PUT Serial Printer instruction, the interpreter initiates execution of all those internal functions required to print on a document inserted in the forms handler.
Functions that previously had to be performed manually by the operator now are accomplished under program control, resulting in faster, more efficient operation of the system with less chance of human error. These functions include such operations as positioning the serial printer for typing, rewinding the cassette tape, positioning forms to a specified printline, opening and closing the platen, and ejecting documents.
Simple Input/Output (I/O) instructions handle the normally complex operation of transferring data to and from peripheral units. For instance, to input data from an I/O device such as the card reader, the programmer need only code a GET Card Reader instruction. Issuance of the instruction causes data to be transferred from the card reader to an area in memory defined by the programmer. The instruction performs all necessary translation (from Hollerith card code to ASCII characters) and data formatting. Likewise, to punch a card, the programmer issues a PUT Card Punch instruction, which transfers data from memory to the card punch peripheral. Certain peripherals, such as the line printer, also provide control instructions that perform such functions as paper advance and print positioning.
Because each macro can initiate the performance of many functions, program length and complexity, and programming effort are reduced significantly. The 3-address structure of the language is another powerful feature that minimizes program length. For example, with just one instruction, a programmer can direct the 399 to add the contents of one address to the contents of another address and store the result in a third address.
Variations of the add instruction allow the programmer to:
(1) Add one series of individual consecutive fields to a second series of individual consecutive fields.
Add: A1 to B1 A2 to B2 A3 to B3
(2) Add a series of individual consecutive numeric fields to a single field.
Add: A1 to B A2 to B A3 to B
(3) Add a single numeric field to a series of consecutive fields.
Add: A to B1 A to B2 A to B3
Up to 31 consecutive fields can be affected by one add instruction. The subtract, multiply, divide, and move instructions operate in much the same manner.
The NCR 399 processor controlled both internal operations such as arithmetic, decision making, and data manipulation, and external functions such as typing and forms alignment and movement. Normally, a processor such as that used in the 399 must be programmed at the hardware level, which means that the user either must write lengthy, complex programs or sacrifice a certain degree of flexibility by relying entirely on packaged software provided by the manufacturer. Recognizing the need to ease the user’s programming burden while still providing him with the ability to tailor the system to his own requirements, NCR decided to take an interpretive approach to programming. This approach permits the user to interface with the hardware through the medium of a simple, problem-solving programming language, enabling him to concentrate on the requirements of his system rather than on the intricacies of the equipment.
NCR 399 software was designed specifically to solve accounting problems. It simplifies the programming of even the most difficult applications — payroll, accounts receivable/accounts payable, inventory, financial reporting, utility billing, and so on. The 399 programming language provides clear, concise, near-English macro instructions that describe the steps necessary to accomplish a specified task. These instructions are entered on special 399 programming worksheets and become the application program. As the 399 processor does not recognize near-English instructions, they must be translated into a format that can be interpreted for execution by the processor. This format consists of series of bits; translation to that format is performed by an assembler program.
When an error-free program has been assembled or reassembled on cassette, it is read into memory, and an interpreter is tailored to that particular application by a link loading process. All communication between the user program and the 399 processor is then controlled by the interpreter.
Assembling 399 Programs
Each line coded on the programming worksheets is a source line; all the source lines for a given application constitute the source program. However, the source program is not executable by the processor in this form. It must be converted to a form compatible with the interpreter for execution by the 399 processor. This conversion is performed by the 399 assembler program, which is contained on the Master Software Cassette supplied with every 399 system.
NCR 399 application programs can be assembled directly on the 399 unit or, optionally, on an NCR Century system. The assembly process is controlled through entries on the appropriate assembler specification worksheet.
These parameter sheets are used to supply the assembler with information about the application program and the 399 system on which it will be run, and to request that certain optional functions be performed during the assembly process itself. The worksheets become a part of the source program for input to the assembler. The source program may be punched into cards or it may be input to the assembler through the 399 alphanumeric keyboard directly from the worksheets. The operator is guided through the assembly process by the lights on the status indicator panel, which are used to request and verify his responses, request cassette changes, and indicate errors.
The 399 assembler operates in two phases. The first is a preassembly phase, which validates certain portions of the source input and writes it to cassette in preparation for the next phase. The resultant program on cassette is called the reassembly master. Additionally, this phase calculates memory addresses for use with the associated symbolic reference names assigned by the programmer and builds a table that specifies which interpretive subroutines are to be included in the program.
The second phase reads one source line (one 80-character record) at a time, condenses it into a series of bits that indicate to the interpreter which routines to execute and on what data fields to operate, and records the assembled program on a cassette. A source program listing is printed on the serial printer as each statement is processed. Any errors encountered during assembly are printed as a notation preceding the erroneous source line.
Reassembly permits corrections, additions, or deletions to a previously assembled program. For instance, a program can be reassembled to correct errors detected during an initial assembly or to include additional logic when peripherals or memory are added to a system. Input to the assembler during the reassembly process includes the reassembly master (the cassette tape output during the first phase of assembly) and only those source lines affected by changes, eliminating the need to enter the entire program a second time. The program is modified by matching source lines, inserting new ones, and deleting old ones where necessary.
Programs can be assembled directly on a 399 system that includes two cassette handlers. If a system has only one cassette handler, NCR will provide, on a temporary basis, a second, plug-in cassette handler to permit program assembly. An NCR Century assembler is also available for assembling 399 programs.
The purpose of the assembly process is to convert an application program into a format that can be used by the 399 interpreter for execution of the program. The assembled program contained on cassette is referred to as an unexecutable object program because it does not yet include the interpreter. To create an executable program, an interpreter must be tailored to that particular application. This is accomplished through a series of software programs called Linking Loader, which were written to the object program cassette during assembly. First, Linking Loader calls into memory the unexecutable object program from its cassette. Next, from the Master Software Cassette it calls into memory the basic interpreter and only those optional interpretives required by the program. The result is a memory-resident executable program.
The actual amount of memory allocated to the interpreter, user program, and data areas depends on application requirements. Once an executable program is built in memory, it can be processed and/or copied to cassette.
The interpreter is the software interface between the 399 language and the minicomputer and its peripherals. It controls all I/O devices and the sequence of program operations, ensuring that the proper routines are executed as necessary. The interpreter can be divided logically into three areas, or subsystems — executive control, internal operations, and I/O operations.
Automatic sequencing of operations within the 399 is performed by executive control, which uses instructions from the application program to perform the setup operations required by internal and I/O related subsystems, to control program sequencing, and to request operator input as required. In addition, the executive provides common routines that may be used by the operating subsystems, determines which operations program is to perform the application instruction, and transfers control accordingly.
The internal operations subsystem includes all those routines associated with arithmetics, data handling, and data formatting, as well as other standard routines designed to minimize the memory requirements of the interpreter.
The I/O operations subsystem performs all operations directly associated with peripheral devices and is responsible for hardware-related error detection and correction.
The interpreter’s normal sequence of operations begins with the executive, which reads and decodes an application instruction. Using the assembled instruction (the series of bits), it searches a table for the address of the designated macro routine. When the instruction is set up, control is transferred to the appropriate routine in the internal operations subsystem. I/O related routines are accessed by the internal operations subsystem as they are needed. Upon completion of all necessary operations, control is returned to the executive, which then reads and decodes the next program instruction.