The "Little Man Computer" Instruction Format
and Instruction Set

Every instruction in the LMC is encoded as a 3 decimal digit number. To know what should be done for any single instruction, the "little man" compares the first digit of whatever Instruction value he is currently remembering with a list of values in an Instruction Set Table and then performs what ever action is indicated in the table next to the matching code. The Instruction Format is:

  1. Operation Code (opcode): the left-most digit indicates the specific type of action or operation the "little man" should perform.
  2. Address Operand Field: the right-most two digits generally refer to a Mailbox number which the "little man" is to use in performing the requested operation; however, for some operations, these two digits may be ignored or may have some other special meaning.

This table contains some "extended" instructions not found in all versions of the LMC simulator.

Fmt Operation Mnem Meaning
1xy LOAD LDA copy value from Mailbox with the supplied Mailbox number (xy) into the Calculator
2xy STORE STO copy value from the Calculator into the Mailbox with the supplied Mailbox number (xy)
3xy ADD ADD add the value in the Mailbox at the supplied Mailbox number to the Calculator; set lights
4xy SUBTRACT SUB subtract the value in the Mailbox at the supplied Mailbox number from the value in the Calculator; set lights
500 INPUT IN copy the value currently in the Input basket to the Calculator
600 OUTPUT OUT copy the value from the Calculator to the Output basket
700 HALT HLT stop processing; sleep until the Reset button rings the bell
800 SKIP_IF_NEG SKN increment the Counter an extra time (skip next instruction) if the Calculator Negative indicator is on
801 SKIP_IF_ZERO SKZ increment the Counter an extra time (skip) if the Calculator Zero indicator is on
802 SKIP_IF_POS SKP increment the Counter an extra time (skip) if the Calculator Positive indicator is on
803 SKIP_NON_ZERO SKNZ increment the Counter an extra time (skip) if the Calculator Zero indicator is *NOT* on [not available in all LMC simulators]
9xy JUMP JMP set the counter to be the value (xy) (jump to this instruction next)
0xy SUBRTN_CALL CALL store 900 + <contents of counter> into Mailbox number (xy-1), then set counter to be value (xy) [not available in all LMC simulators]