The LMC Simulator
An
LMC simulator
that runs under Windows 95/98/2000/XP can be used to test,
demonstrate, and practice machine level programming applicable to the
Little Man Computer.
The simulator used is the Clone of Son of Little Man Computer simulator
(re-)written by DAT2343 student Mark Aleksandrov in 2001.
The simulator contains its own Help screens.
It uses the "extended" LMC instruction set that includes SKNZ and CALL.
Setting and Viewing Mailbox and Input Contents
- Scrolling Displayed Memory - only 10
mailboxes can be displayed at any time. Scroll controls above and
below the mailboxes enable viewing of and access to mailboxes in
blocks of 10.
The "Edit | Edit Instructions" window allows more mailboxes to be
viewed or edited in one long list.
- Modifying Memory Contents - clicking on a
mailbox, or tabbing to a mailbox from the prior mailbox, and
then typing in a new value will change the contents of that
mailbox. You cannot enter more than three digits, so the old
contents of a mailbox must be deleted first.
The "Edit | Edit Instructions" window allows more mailboxes to be
viewed or edited in one long list.
- Input Box -
You can enter numbers onto the bottom of the list in the Input Box
using the Add button or by pushing Enter after typing in each number.
Every time the LMC executes an "IN" instruction, the top value in the
Input Box list is moved to the Calculator and deleted from the top
of the list. The remaining values in the Input Box list shift up,
ready for the next "IN" instruction.
If the LMC encounters an "IN" instruction with an empty Input Box
list, the LMC stops and you must enter some value into the Input Box list
and click "Go" to continue.
Run Controls
- Single Step - this control permits you to
watch the LMC activity one instruction at a time. Note that
execution of the HLT "halt" instruction by the little man has no
effect if you are using single step mode - the LMC will move
to execute the location after the HLT if you keep single-stepping.
- Go - this control permits you to run the
LMC in a continuous fetch/increment/execute mode until a HLT "halt"
occurs either because
the "little man" performed a HLT "halt" instruction or because you
hit the "Halt" control.
- Halt - the intent of this control is to
enable you to interrupt a "run-away" or "infinite loop"
program.
Some infinite loops are hard to interrupt and you may have to
bring up the Windows task manager to kill the runaway simulator!
- Reset - this is not technically a "run
control" since it does not cause the "little man" to do
anything immediately; this control simply sets the program counter
to 00.
You usually need to do this before you re-run a program.
Saving and Loading LMC Programs
- File menu -
Submenus: New, Load, Save, Save As, and Exit
- File | New -
Clears LMC memory.
Does not affect the Input or Output lists or the Counter.
- File | Load -
Opens a dialog window to specify the name of an existing file
of machine code to load into the LMC memory.
Does not affect the Input or Output lists or the Counter.
Remember to Reset the Counter before you execute your loaded program!
- File | Save -
Copies the current contents of all mailboxes back out to the file
you just loaded.
- File | Save As -
Opens a dialog window to specify the new name of a file to
contain the LMC memory (with default extension ".lmc"), and then
copies the contents of all mailboxes to this file.
You may save in "old" format, one 300-digit record with no line breaks,
or in the "new" format of 100 separate lines of 3-digit numbers.
- File | Exit -
Exit the LMC. You are cautioned to save your mailboxes before you exit.
Editing LMC Programs in the Simulator
- Edit | Edit Instructions -
Allows you to edit any mailbox in a long list.
- Edit | Edit Report -
Allows you to edit a partial listing of your program that has
an Assignment Label and the
mnemonics for the opcodes already entered.
You have to fill in the labels, operands, and comments.
- Edit | Terminal -
Allows you to see the LMC output queue in another format.
Credits
The LMC simulator
used is the Clone of Son of Little Man Computer simulator
(re-)written by DAT2343 student Mark Aleksandrov in 2001.
The simulator contains its own Help screens.
It uses the "extended" LMC instruction set that includes SKNZ and CALL.