• Aucun résultat trouvé

SOURCE AND OBJECT PROGRAMS

Dans le document TO PROGRAMMING (Page 25-28)

What eventually makes an F8 microprocessor system perform its assigned tasks is a sequence of binary digits, stored in memory and called an object program.

Since the F8 microprocessor accesses memory in 8-bit (or 1-byte) units, the binary digits of an object program are, by convention, collected into 8-bit units which are represented on paper as two hexadecimal digits (each hexadecimal digit is equivalent to four binary digits).

Upon examining the contents of any individual byte of mem-ory, it would be impossibie to determine what the eight binary

3-2

digits contained by the memory byte represented. A memory byte could hold any of the following types of informatiQn:

1) An instruction code which the 3850 CPU is supposed to interpret as an instruction.

2) Binary data which may be unsigned {representing numbers between 0 and 255) or signed (representing numbers between -128 and +127).

3) Data, as in 2) above, which provide specific informa-tion needed by an instrucinforma-tion code as in 1) above.

4) Data which are to be interpreted as representing a character that may be displayed or printed. Character codes are given in Appendix B.

How, then, will an F8 system pick its way through the various types of data which may be found stored in memory?

The program counter register (PCO) which is included in every 3851, 3852 or 3853 device, will at all times contain the ad-dress of the next memory byte whose content is to be inter-preted by the 3850 CPU as an instruction code. When an F8 system is first powered up, the program counter is initialized at zero. Therefore, the contents of the memory byte with ad-dress 0 will be interpreted as the first instruction code to be executed. PCO also addresses data bytes of type 3.

Whenever the content of a memory byte is to be interpreted as data of type 2 or 4, the address of the memory byte is con-tained in the data counter registers (DCO), which are also present on every !3851, 3852 Oi 3853 device.

It is not easy to immediately understand that the 3850 CPU is able to pick its way through object program numeric codes, as stored in memory, by suitably manipulating the prbgram counter and data counter register contents; but fortunately, such understanding is not necessary in order to write F8 pro-grams. In fact, even though microprocessor programs could be created directly as a sequence of hexadecimal digits, the potential for making errors when writing such programs is so overwhelming, that were an alternative method not available, the computer industry would never have gotten off the·

ground. The alternative is to write source programs.

A source program is a program written in a programming language. In the case of the F8, this manual describes what is called an assembly language. A programming language represents data and instruction sequences in a manner which is meaningless to a microprocessor but easily read and understood by a human.

Look at Figure 3-3. Upon first inspection, the part of the figure identified as a source program will not make much sense; the purpose of this manual is to explain how such source pro-grams are written. Nevertheless, it is immediately evident that the source program is potentially much easier to read and understand than the equivalent object program.

The process of converting a source program to an object pro-gram is automatic and is handled by an assembler which is, itself, a computer program. The assembler interprets a source program, character-by-character, then generates an equiv-alent object program in a form that can be loaded into an Fa microprocessor system memory and executed.

BUFA BUFB

EOU EOU ORG

H'0800' H'08AO' H'0100'

SET THE VALUE OF SYMBOL BUFA SET THE VALUE OF SYMBOL BUFB

0100 0101 0102 0103 0104 0105 0106 0107 0108 0109 010A 010B

2A ONE CDI BUFA SET DCO TO BUFA STARTING ADDRESS 08

00

2C TWO XDC DCI

STORE IN DC1 2A THREE

08

BUFB SET DCO TO BUFB STARTING ADDRESS AO

20 FOUR LI H'80' LOAD BUFFER LENGTH INTO ACCUMULATOR 80

51 FIVE LR LM XDC

l,A SAVE BUFFER LENGTH IN SCRATCHPAD BYTE 1 16 LOOP

2C SIX

LOAD CONTENTS OF MEMORY BYTE ADDRESSED BY DCa EXCHANGE DCO AND DC1

( ) 1 ( ) r '

V IV\,.,

010D 010E 010F 0110

17 SEVEN 2C EIGHT XDC

DS BNZ

STORE ACCUMULATOR iN MEMORY BYTE ADDRESSED BY DCO EXCHANGE DCO AND DCl

31 NINE DECREMENT SCRATCHPAD BYTE 1

94 LOOP IF SCRATCHPAD BYTE 1 IS NOT ZERO, RETURN TO LOOP F9

END

L \..

V-A SOURCE PROGRV-AM

The Equivalent Object Program, represented as hexadecimal numbers.

~---Hexadecimal address of memory byte in which object program byte is to be stored.

Fig. 3-3. Source and Object Programs

After the assembler has created the object program equiv-alent of a source program, it will print its results, outputing a program listing. The program listing provides information used to detect errors in a source program.

The rest of this manual explains how source programs are written as follows:

Every line of a source program constitutes one instruction.

In Section 4, the various parts of an instruction are defined.

Section 5 and 6 define two classes of instructions used by the F8 assembly language. The consequences of every exe-cutable instruction's execution are defined.

Section 7 describes how individual instructions are combined in order to create a program. Therefore, the source program in Figure 3-3 will not be meaningful until you have completed reading Section 7.

Section 8 explains how programs should be written to access the various input and output features of the F8 microprocessor system.

In summary, the process of writing an F8 program follows these steps:

1) Using pencil and paper, write a source program.

2) Enter the source program, as text, into the computer system being used to develop F8 object programs.

3) Assemble the source program entered in Step 2, and thus create an object program. This step merely in-volves executing a program called the Assembler, identifying the source program and assigning a name to the object program.

4) If the source program contains illegal steps, they will be identified in Step 3. Treating the source program as text, edit out the errors, then return to Step 3. If there are no errors indicated at the end of Step 3, go on to Step 5.

5) Using appropriate Fairchild provided debugging aids, run the program created in Step 4 in order to find logic errors. If errors are found, correct them in the source program and return to Step 3. When there are no errors, the program is complete.

This manual provides information needed to perform Step 1.

The F8 Timeshare Operating Systems Manual provides information needed for Steps 2 through 5.

During Step 3, the program listing is printed out on a line printer or time share terminal. The program listing shows the source and equivalent object program instructions, as well as additional, optional material that may be specified using as-sembler directives described in Chapter 5. Use the program listing to visually check a program; mark on the program listing all changes that must be made to the source program.

Dans le document TO PROGRAMMING (Page 25-28)

Documents relatifs