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
I made a thing that fills the memory with the sequence of numbers from LEN to 1 and outputs it.
This is surprisingly fun!