Machine Language

Reference: Computer Systems, Chapters 3, 4.

A machine language program is a binary sequence, that is, a sequence of ones and zeros, that the machine interprets according to its von Neumann cycle as in Figure 4.31 of the text. Therefore, to write a machine language program is to write a sequence of ones and zeros. Fortunately, the Pep/8 loader permits you to use the hexadecimal abbreviation for binary, as Section 3.4 explains.

Topics: Writing a machine language program, The Run Object option.

Writing a machine language program

Writing a machine language program is a three-step process.

Step 1.

With this Pep/8 application, you write the machine language program in hexadecimal in the Object Code pane. The following figure shows the object program from Figure 4.41 of the text.

fig0441

A hexadecimal program must follow precise formatting rules. Each hex number representing a byte must contain exactly two characters. Each character must be in 0..9, A..F, or a..f and must be followed by exactly one space. There must be no leading spaces at the beginning of a line and no trailing spaces at the end of a line. The last two characters in the file must be lowercase zz, which is used as the terminating sentinel by the loader.

Step 2.

After writing the machine language program, load it by selecting Build -> Load from the menu.

load

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

loadsucceeded

Step 3.

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

execute

With this program, the output appears in the output pane.

fig0441output

Scroll to topics.

The Run Object option

The two steps — Load, Execute — are combined in the single option called Run Object. You can initiate a run by selecting Build->Run Object from the menu.

runobject

Scroll to topics.