Pep/8: Writing Programs Documentation

Writing Programs

Pep/8 is a virtual machine for writing machine language and assembly language programs. It is designed to be used with the textbook, Computer Systems, J. Stanley Warford, Fourth edition, Jones and Bartlett, Publishers, 2010. The goal of the book is to teach the fundamentals of the classic von Neumann machine. You should use the Pep/8 system in conjunction with the textbook to write machine language and assembly language programs.

Topics: Viewing panels, Input and output, Endless loops, File extensions.

### Viewing panels

The Pep/8 system has three panels — the code panel, the CPU panel, and the memory dump panel. You can change which of these panels is visible by making the appropriate selection from the View menu or clicking the corresponding icon on the tool bar.

When you click in one of the panes inside a panel it becomes the active pane, which is indicated by the blue color of its label at the top of the pane. If you double click on the label the pane will expand to its maximum height. The following screenshot shows the label at the top of the Source Code pane in the code panel.

Scroll to topics.

### Input and output

The top part of the CPU panel shows the content of the Pep/8 central processing unit. The bottom part of the panel shows the input and output of your machine language or assembly language program. The Pep/8 system supports both batch and interactive I/O, which you can select by clicking the appropriate tab.

When you execute in batch mode, you must enter the input in the Input pane before you run your program. The output will appear in the Output pane as the program executes.

Your program executes in interactive mode when you select the Terminal I/O tab. In this mode, executing an input statement in your program will make the program pause and wait for you to enter the input in the Input/Output pane. The executing program accepts your input and continues executing when you press the enter or return key.

Scroll to topics.

### Endless loops

If you execute a program with an endless loop, you can interrupt it by pressing <command>+`.` on a Mac or <control>+`.` on a Windows computer. Or, you can select Build->Interrupt Execution from the menu. Either of these actions will pause execution of the program, allow you to use the debugging tools, and, if you wish, continue execution of your program.

Alternatively, you can terminate execution of your program by selecting Build->Stop Debugging from the menu or clicking the Stop icon in the tool bar.

Scroll to topics.

### File extensions

The Pep/8 system uses the following file extensions:

`.pep` is the file extension for source code programs.
`.pepo` is the file extension for object code programs.
`.pepl` is the file extension for the formatted program listing.

All these files are text files that you can modify with your favorite text editor or word processor outside the Pep/8 application. When you open a `.pep` file, it opens in the Source Code pane. When you open a `.pepo` file, it opens in the Object Code pane. Although you can save a `.pepl` file, there is no facility for inputting it into the Pep/8 application.

Scroll to topics.