

Little Man Computer - signa11
http://peterhigginson.co.uk/LMC/

======
RichWalton
This is a nice implementation.

I made something similar [1], based on the Post Room Computer [2].

Basically it is a two address (operand) modification of the LMC. It was used
to as a teaching tool for undergrad students at my local university.

It's a bit more fully featured - It supports absolute and register based
address modes, macros, programs spanning multiple files. The computer is
accessible via command line or using the in-built Java Swing UI.

If anyone is bored and wanted to run it, heres a sample program:

    
    
      ;; A simple multiplication program
    
      INP :x:		; Input value and store at location :x:
      INP :y:		; Input value and store at location :y:
      MOV :result: :x:	; Copy the value at :x: into :result:
    
      ; Multiplication loop
      :loop:		
    	  SUB :y: :one:	; Substract 1 from the the value at :y:
    	  JMP EQZ :end:	; If result of subtraction was 0, stop looping
    	  ADD :result: :x:	; Add the value at :x: to the result
    	
      ; If the program reaches this stage multiplication is not complete
      ; So jump back to start of loop
      JMP LWY :loop:
    
      :end:		; Label to exit the loop
      OUT :result:	; Output the result
      HLT		; Stop execution
    
      ; Data Stores
      :x: (0)
      :y: (0)
      :result: (0)
      :one: (1)
    

[1] [https://github.com/Richard-Walton/The-Post-Room-
Computer](https://github.com/Richard-Walton/The-Post-Room-Computer)

[2] [http://eprints.hud.ac.uk/2518/](http://eprints.hud.ac.uk/2518/)

~~~
cbd1984
> Post Room Computer

Given that your link spells this "Postroom Computer" and is British, I'm
guessing it has to do with mail (as in, the post; as in, what there is none of
on Sundays) as opposed to any of the work of Emil Post, who formalized
computation similarly to, independently of, but less famously than, Turing.

[https://en.wikipedia.org/wiki/Emil_Leon_Post](https://en.wikipedia.org/wiki/Emil_Leon_Post)

~~~
RichWalton
Yes, correct :).

In the "Post Room Computer" analogy, the little man works in a post (mail)
room.

The mailboxes are memory, in/out trays are IO, etc etc.

------
MarcScott
This is a great simulation.

I've used it with 12 and 13 year olds to help explain how a computer works -
[https://www.bournetocode.com/projects/8-CS-
Computers/pages/6...](https://www.bournetocode.com/projects/8-CS-
Computers/pages/6_Lesson.html)

Peter is a very helpful guy as well. He sent me his files so I could host the
simulation and avoid problems with cross-site scripting. He even made
alterations to make it easier to control the LMC using opcodes rather than
Assembly.

------
tux3
It's interesting working with this kind of limited instruction set.

I made a thing that fills the memory with the sequence of numbers from LEN to
1 and outputs it.

    
    
              BRA START
      DEST    DAT 60 // Where to start writing
      LEN     DAT 40 // Size of the sequence
      UNIT    DAT 1
      START   LDA DEST
              ADD STOREI
              STA STOREI
      LOOP    LDA LEN
      STOREI  STA 0 // Self modifying code be here
              OUT
              SUB UNIT
              BRZ END // Halt after writing last number
              STA LEN
              LDA STOREI
              ADD UNIT
              STA STOREI
              BRA LOOP
      END     HLT
    

This is surprisingly fun!

------
sebastianavina
great simulator

------
GolfyMcG
Could anyone ELI5?

~~~
userbinator
[https://en.wikipedia.org/wiki/Little_man_computer](https://en.wikipedia.org/wiki/Little_man_computer)

