News for hackers. Stuff that matters.
Re:Little Man Computer by RichWalton on Monday June 22, 2015 @06:35AM (#9757361)
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

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

Re:Little Man Computer by cbd1984 on Monday June 22, 2015 @07:31AM (#9757552)
> 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

Re:Little Man Computer by RichWalton on Monday June 22, 2015 @07:44AM (#9757585)
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.

Re:Little Man Computer by MarcScott on Monday June 22, 2015 @02:53AM (#9756609)
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...

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.

Re:Little Man Computer by tux3 on Monday June 22, 2015 @07:29AM (#9757546)
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!
Re:Little Man Computer by sebastianavina on Monday June 22, 2015 @12:27AM (#9756153)
great simulator
Re:Little Man Computer by GolfyMcG on Monday June 22, 2015 @01:16AM (#9756282)
Could anyone ELI5?
Re:Little Man Computer by userbinator on Monday June 22, 2015 @01:30AM (#9756342)
Re:Little Man Computer by kovek on Monday June 22, 2015 @01:25AM (#9756325)
I clicked on SELECT on the bottom to select a program: max. Then, I clicked RUN. After the LMC did its work, I wrote a number in the INPUT box and pressed Enter. After the LMC did its work again, I wrote another number in the INPUT box and pressed Enter again. After the LMC did its work, the greatest number was displayed in the OUTPUT box.
Re:Little Man Computer by GolfyMcG on Thursday July 02, 2015 @08:48AM (#9818453)
Just wanted to say thank you for replying!