Chapter 7 Type of Source Statements

7.2Program Format

A program is text created to assemble as machine language instructions in order to operate a micropro- cessor. The assembler translates the text into machine language code, while the linker joins that code to make an executable format file.

One line of text is called a source statement. There are five types of source statements, with the type determining how a source statement is written.

Basic program format is shown below.

* Comment statement

 

Write comments as needed

#include

 

#include specifications

#define

 

Define #define identifiers

definitions of constants, macros, globals

Statements to define constants and macros and to

 

 

declare and define globals

section name

section

Declare start of section

.

 

 

.

 

 

.

 

 

program body

 

Machine language instructions, conditional assembly

 

 

directives, macro expansions

.

 

 

.

 

 

.

 

 

end

 

End of program

 

 

 

There are several points to be aware of when writing programs.

Always declare an attribute and link type for a section name the first time it appears in a file.The same section name cannot be set to a different attribute or link type.

The effective scope of a directive coding rule section is until the line preceding the next directive coding rule section

Ignore all text after the directive coding rule instruction.

Program Format 119

Page 131
Image 131
Panasonic MN1030 user manual Program Format