How to use Little Man Computer

You can write programs and execute them in the Little Man Computer using the instruction set provided. In addition to execution, you also have features like step-into, step-over, breakpoint, etc.

Writing Source Program

You may write the source program in the area titled 'Source Program'. Some of the general rules that must be considered while writing the source program are:

  1. The Instruction should be of the format XX YYY [[*]ZZ];

XX a valid mailbox address between 0 and 99
YYY a valid mnemonic/instruction
ZZ(Optional) only for instructions requiring data
*(Optional) required for indirect addressing mode
  1. There should be ';' in a line if it has some text.

  2. Every thing after a ';' is considered as a comment.

  3. You can have any number of blank lines in your source code.

After typing your source program, you can hit 'Get Opcode' to get the opcodes for the instructions you have typed. The application checks for syntax at this time and displays the error message in the Program Status Field. It also highlights the instruction containing the error.

 

Executing Program

In order to execute the program, you will have to load the source program into the mailboxes first. Once you get the opcodes for the source program you have entered, click on "Load" to load the program into the specified mailboxes. After this step, you can execute the program in one of the three ways:

The program status field displays the status of the program and the instruction executed. The program has to contain the Halt or Coffee Break instruction (700), or it will execute indefinitely until the program ABENDS.

 

Conditions for ABEND

The program will ABEND if it encounters any of the following conditions:

  1. Invalid instruction, i.e any value starting with '0' or uninitialized mailbox location, '---'.

  2. No data in the INPUT box for an input instruction.

  3. Mailbox not initialized for instructions such as Load, Add, & Subtract.

 

Adding Input Data

You can add or remove data to/from the input basket. 

To add data to the input basket, type in the data in the text field below the LMC, that is labelled Input, and press 'Add'.

To remove data from the input basket, just highlight the data in the Input basket that you want to remove, and click on 'Remove'

 

Setting Breakpoints

You can have a breakpoint in your execution. It is considered only when you are executing in burst mode. i. e. if you hit "Execute". You can set the breakpoint at any valid mailbox location, or reset the breakpoint. If a breakpoint is set, the execution will halt at that location. i.e. the location / hand counter points to the mailbox address for which the breakpoint is set

 

Flag Registers

There are three flags that are available. They are overflow, underflow, and zero. Each of these flags are set when they meet a certain condition.

OVERFLOW: This flag is set when the contents of the calculator exceed 999. For e.g. , if after an add operation, the contents of the calculator become 1200, then the overflow flag is set to 1 and the calculator contents are subtracted by 1000.

UNDERFLOW: This flag is set when the contents of the calculator are less than -999. For e.g. , if after a subtract operation, the contents of the calculator become -1200, then the underflow flag is set to 1 and the calculator contents are added by 1000.

ZERO: This flag is set whenever the contents of the calculator becomes equal to 0.

 

Miscellaneous Issues

The program has a wrap-around feature. i.e. if during execution the hand counter exceeds the mailbox number, which is 100, it wraps around to location '0'.

In case of Indirect addressing, only the last two digits are considered for mailbox address. For e.g. consider LDA *15, which loads the contents of mailbox pointed by location 15 into the calculator. If the location 15 contains "*150" or "-150" or "650", only the last two digits, i.e. "50" will be considered, which means that the contents of location 50 will be loaded into the calculator.