Skip to main content

Little Minion Computer simulator

Little Minion Computer simulator

Downloads

For Mac OS X: LittleMinionComputer2.0(OSX).dmg. Once the disk image is mounted, drag the LMC application to the Applications folder to install. Whe you first run it, your OS may complain that it is from an unidentified developer: you should be able to right click on the applicaiton, select open and then run it. If not you need to adjust your settings in System Preferences>Security.

For Windows: LittleMinionComputer1.4.1.zip Once the file has downloaded, unzip and run the exe file in the folder. You may get an alert about an unidentified developer, but click through it (if you trust me!).

This has been tested on OSX El Capitan and Sierra and on Windows 7 and 8. Please let me know if you find it works (or does not work!) on other systems.

Documentation: You can download full details in the Little Minion Computer notes, and a helpsheet with the Little Minion’s instruction set. Teachers can request a copy of the notes with answers by emailing me. I have included an example assignment for taking three inputs in any order and determining if they form a Pythagorean triple, as well as a solution, in the downloads.

Little Minion Computer

The Little Minion Computer is a conceptual model of a simple CPU, introduced by Dr. Stuart Madnick of M.I.T. in 1965, under the guise of the Little Man Computer. Although it seems simplistic, in fact the model captures many important features of a real CPU and illustrates these in an accessible way.

The conceit is that inside the CPU is a tiny minion that runs around organising data and performing the calculations. Inside the box of the CPU are:

  • 100 numbered mailboxes
  • A calculator
  • A 2-digit counter
  • An in-tray
  • An out-tray

The mailboxes each have a 2-digit address, so 100 mailboxes is the limit, counting from 00 to 99. Each mailbox contains a slip of paper with 3 digits on it, and can only ever contain a single slip of paper at a time.

The calculator that can only display 3 digits on the screen, and has buttons for numbers 0-9 and + and – . It also has an LED that lights up when a larger number is subtracted from a smaller number. This LED is known as the negative flag.

The 2-digit counter has two buttons: the first button increments the counter by 1, the second (external) button resets the counter to 00.

The input and output trays can each contain stack of slips of paper, each of which has 3-digits on. The user can put slips of paper with 3 digits on in the input tray, to be read when the little minion next looks at his in tray. Likewise the little minion can write 3-digit notes and put them in the out tray, to be read by the user.

The Fetch-Execute cycle

Or what the little minion does…

The little minion starts by looking at the counter for number, which is a mailbox number.
The minion increments the counter, so that next time the minion comes it will be one larger.
The minion goes to the mailbox with the number the minion read on the counter, and reads what is written on the slip of paper in the mailbox, i.e. 3 digits.
The minion takes the appropriate action depending on those digits.
The minion then starts again…

Steps 1-3 are the fetch: the little minion is fetching an instruction. Step 4 is the execute: the little minion does the indicated instruction.

The instructions:

The little minion will read a 3-digit message in the mailbox the minion is sent to, e.g. 5 8 4, which is his instruction. The first digit of the instruction is the operation: 5. The second and third digits give another mailbox number: 84. The operation part is also known as an “operation code” or “op code”, the other two numbers are an address. Op code 5 is load: the little minion goes to the mailbox indicated by the address, copies what is on the slip of paper in the mailbox, then goes to the calculator and enters that number. E.g. if mailbox 84 contained 1 2 3, then when the little minion reads instruction 584, the minion goes to mailbox 84, copies down 123, then goes to the calculator and enters 123.

The instructions can be grouped into categories as follows:

  • Data movement:
    • LOAD – op code 5
    • STORE – op code 3
  • Arithmetic:
    • ADD – op code 1
    • SUBTRACT – op code 2
  • Input/Output:
    • INPUT – op code 901
    • OUTPUT – op code 902
  • Machine/Program control:
    • BRANCH – op code 6
    • BRANCH ON ZERO – op code 7
    • BRANCH ON POSITIVE – op code 8
    • BREAK – op code 0

ADD – op code 1
go to the mailbox address specified, read the 3-digit number at that address, then go to the calculator and add the number to the number already on the calculator.

SUBTRACT – op code 2
go to the mailbox address specified, read the 3-digit number at that address, then go to the calculator and subtract the number from the number already on the calculator. Note: the mailboxes will still contain the same 3-digit messages as before, but the calculator will have changed. If the subtracted number is larger than the value already in the calculator (i.e. the subtraction ends with a negative value), then the negative flag is set/activated and the value in the calculator cannot be trusted to be right.

STORE – op code 3
go to the calculator and note the 3-digit number displayed, then go to mailbox address specified and enter that number on a new slip of paper. Note: the calculator will still contain the same 3-digits as before, but the mailbox will have whatever was there before discarded.

LOAD – op code 5
go to the mailbox address specified, read the 3-digit number at that address, then go to the calculator and enter that number in.

BRANCH – op code 6
set the counter to the 2-digits specified in the address. Note: The next instruction the minion reads is the one in the mailbox address specified.

BRANCH on ZERO – op code 7
go to the calculator and read the 3-digit number. If it is zero, set the counter to the 2-digits specified in the address, otherwise do nothing.

BRANCH on POSITIVE – op code 8
go to the calculator and check the negative flag. If it is not activated, set the counter to the 2-digits specified in the address, otherwise do nothing.

INPUT/OUTPUT – op code 9
INPUT or READ op code 9 address 01
go to the IN tray, read the 3-digit number there, then go to the calculator and enter the number in.
Note: The slip of paper in the IN tray with the 3-digits is removed. If there are several slips in the IN tray, the little minion takes the first one that was put there only, the others remain for future visits.
OUTPUT or PRINT op code 9 address 02
go to the calculator, read the 3-digit number there, then go to the OUT tray and leave a slip of paper with that number on it.

BREAK – op code 0
The little minion stops and has a rest.

For some example programs, and some exercises, see the full details in the Little Minion Computer notes.These notes are based on the description found in the book: The Architecture of Computer Hardware and System Software: An Information Technology Approach, 3rd edition, by Irv Englander.