LC-3 Introduction

  1. Introduction
  2. Loading Programs
  3. Pseudo Code

Welcome to the LC-3 (little computer 3) section of my website. Within this area of the website, I plan to type some useful information about programming in LC-3. My goal here is not to explain the architecture itself, but rather explain how to code in lc3. Maybe later I will add information pertaining to the underlying operations.

The information throughout this guide comes from this source: Amazon Link

We will be using the PennSim LC-3 simulator from the University of Pennsylvania. A guide on how to install and use PennSim can be found here: PennSim

After installation, when you go to run PennSim you should end up with a window that looks like this:
lc3 window
Figure 1-1: PennSim Program.

The window you see in figure 1-1 is where you will assemble, load and run your code.
  1. Here is where you will type commands and I will refer to it as the command line. There is a list of commands given in the link above and we will go over some later.

  2. This section shows the values of important registers. Very useful for debugging. We will cover as much as needed to program for each register. More information can found in the linked reference at the beginning of the introduction.

  3. This is the graphics display. We will talk about this when we begin to use it. In short, we can change the color of each pixel to create images.

  4. This is the text output and input interface. I generally refer to this as the terminal. We will get more acquainted with this a little later.

  5. This area will show your actual program, loaded into memory. It can also show you where at in the code the program currently is. This is powerful for debugging as you can use it to step through the code. AKA run the Program one step at a time.

Take some time to familarize yourself with the simulator. In general, to run a user-made script, you have to (not necessarily in this order):
  1. Create an assembly file with a text editor
  2. Load the operating system
  3. Assemble the assembly file
  4. Load the assembly file
  5. Click "Continue" (see figure 1-1)
  6. Interact with the program
So we will unpack these six steps in the next section, where we will go over writing assembly files and how to load them into PennSim. In doing so we will also cover how to load in the required operating system.

Next Section: Loading Programs