Pep/8: Assembly Language Documentation

Assembly Language

Reference: Computer Systems, Chapters 5, 6.

An assembly language program is a sequence of lines, each line containing either an instruction from the Pep/8 instruction set specfied by a mnemonic, or a pseudo-operation, also called a pseudo-op or dot command. The assembly language program must end with the pseudo-op `.END`.

Topics: Writing an assembly language program, Trace tag warnings, The Run Source option.

### Writing an assembly language program

Writing an assembly language program is a four-step process.

#### Step 1.

With this Pep/8 application, you write the assembly language program using the built-in text editor in the Source Code pane. The following figure shows the source program after entering the program from Figure 5.18 of the textbook.

Strict formatting is not required as long as there is one instruction or dot command per line, and at least one space between a mnemonic and an operand specifier. For example, the above program could be entered as follows.

#### Step 2.

After writing the assembly language program, assemble it by selecting Build->Assemble from the menu or clicking on the hammer icon in the tool bar.

If there are no errors in the program a message to that effect will appear at the bottom of the main window.

The translated program will appear in the Object Code pane, and a formatted listing will appear in the Assembler Listing pane.

If there is an error in your program, an error message will appear in the source code pane. The following screenshot shows what would happen if you fail to supply the addressing mode for the `STRO` instruction.

If you would like, you can select Build->Remove Error Messages from the menu to delete the error message. Then, you can correct your error and try to assemble your program again. It is not necessary to remove the error message before correcting your program, as error messages are automatically removed when you reassemble your program.

Once you assemble your program so that a formatted listing appears in the Assembler Listing pane, you can select Edit->Format From Listing from the menu. Your source code will be replaced with the standard formatted source code extracted from the Assembler Listing pane.

#### Step 3.

Load your program by selecting Build -> Load from the menu.

#### Step 4.

To execute the program select Build -> Execute from the menu.

Scroll to topics.

### Trace tag warnings

If your program assembles correctly but there is an error in your trace tags, a trace tag warning is displayed. For example, here is what happens if you make an error in one of the trace tags in the program from Figure 5.26.

Programs with trace tag warnings have assembled correctly and will still run. In the debugger, you can still single step through the program, set break points, and trace memory in the Memory Dump pane. However, the symbolic trace feature that shows the C++ memory model graphically in the Memory Trace pane is disabled until you fix the trace tag error and reassemble your program.

Scroll to topics.

### The Run Source option

The three steps — Assemble, Load, Execute — are combined in the single option called Run Source. You can initiate a run by selecting Build->Run Source from the menu or by clicking on the Run Source icon in the tool bar.

Scroll to topics.