Little Man Computer (LMC) Explained: Branching, Compilation and Assembly

  Рет қаралды 5,855

Coding Coach

Coding Coach

Күн бұрын

Пікірлер: 36
@CodingCoach
@CodingCoach 4 жыл бұрын
Try creating your own little man computer branching algorithm that solves a common computing problem. If you want to be really adventurous, try creating a loop or recursion of some sort. This will be a topic I will cover in a future video and you will get to check you work against it!
@roxannelai7803
@roxannelai7803 4 жыл бұрын
I watched the video about iteration, branching and labels and wanted to try my hand at the countdown problem. I am not sure that this is the right way to go about it (the video only had around 6 steps), but I tried my best! So, here is my try at the countdown problem with both the assembler and LMC instructions: 00 INP /901 01 STA A /312 02 loop LDA A /512 03 OUT /902 04 SUB one /113 05 STA A /312 06 BRZ endIt /708 07 BR(A) loop /602 08 endIt LDA A /512 09 SUB A /112 10 OUT /902 11 HLT /000 12 A DAT 13 one DAT
@CodingCoach
@CodingCoach 4 жыл бұрын
Roxanne this looks very good! Couple of things I noticed: 1. Lines 4 and 9 use the SUB assembler but have an add op code! (this was an error I made in this video that i noted in with text on the screen, 1 = add, 2 = sub) so i believe both lines should have had a 213 and 212 respectively. Running the program with an input value of 3 I get: 3 2 1 0
@roxannelai1514
@roxannelai1514 4 жыл бұрын
@@CodingCoach Thank you! And okay got it, I must have missed the text on the screen. It is definitely not the most concise, but as you said, at least it works!
@davegraham7550
@davegraham7550 4 жыл бұрын
LMC should be used everywhere in the world.
@davegraham7550
@davegraham7550 4 жыл бұрын
Teaching to ngabere language speakers in Panama today. Mostly learner in one session.
@CodingCoach
@CodingCoach 4 жыл бұрын
LMC is an amazing way to break down how the ISA works, I love using it as a starting point! Enjoy the lesson!
@davegraham7550
@davegraham7550 4 жыл бұрын
Works well going between any languages. Digital and language learning are a natural match.
@davegraham7550
@davegraham7550 4 жыл бұрын
From as soon as people are learning to speak and write..
@davegraham7550
@davegraham7550 4 жыл бұрын
All people can understand computing, a small set of simple actions done at very high speed. Programming via programming languages can come later and is far less fundamental than understanding the digital engine analagious in many ways to a combustion engine. A repeating cycle and that is all it can do.
@erim1434
@erim1434 3 жыл бұрын
This was very helpful, thank you!
@CodingCoach
@CodingCoach 3 жыл бұрын
Glad it was helpful!
@jaygobeasty4162
@jaygobeasty4162 4 жыл бұрын
great video, can't fid anything like this on the internet
@CodingCoach
@CodingCoach 4 жыл бұрын
glad you liked it!
@nataliejohn376
@nataliejohn376 3 жыл бұрын
Shouldn't step 5 be 213 bcs it's substract? But u put 113. Am I misunderstanding this or did u do a mistake there?
@CodingCoach
@CodingCoach 3 жыл бұрын
yes you are correct! I had added a note in the description and I think I added subtitles although I understand most people don't have the on. KZbin does not seem to let me edit the video after I've posted it at least not when I did it.
@nataliejohn376
@nataliejohn376 3 жыл бұрын
@@CodingCoach aaa I see. But overall, the video made me understand more about LMC. Online classes make it really hard for me to understand so I really am grateful to you 😁
@alessandramancas416
@alessandramancas416 2 жыл бұрын
Thank you this was so helpful!!
@pranavsuthar923
@pranavsuthar923 3 жыл бұрын
ahh that window reflectiom :)
@vedbhanushali608
@vedbhanushali608 3 жыл бұрын
thank you sir.
@CodingCoach
@CodingCoach 3 жыл бұрын
Most welcome
@gailenkelly5481
@gailenkelly5481 3 жыл бұрын
How would you just output a number, say 1, using a branch for only if the first input is greater than the second number? Can you specify the output instead of BRP or BRZ?
@CodingCoach
@CodingCoach 3 жыл бұрын
If you input 2 numbers and then subtract the first from the second and the result is negative you know the first number was bigger then the second (remember you have to store the first) so.. 00 INP // lets say input is 5 01 STA 10 02 INP // lets say input is 3 03 SUB 10 // would be 3 - 5 (since 3 is still in the acc) so choosing a BRP would work for your question since anything 0 or greater would indicate a larger second input. If it does not branch the first number was bigger something like.. 04 BRP 07 05 LDA 11 // we will put a 1 here 06 OUT 07 HLT 10 DAT 11 001 I think if understood your question correctly this would work.
@gailenkelly5481
@gailenkelly5481 3 жыл бұрын
@@CodingCoach Ok, I assumed what you just wrote except I got stuck after the branch instruction. Thank you!
@nadirberrachedi4347
@nadirberrachedi4347 3 жыл бұрын
Hi there i am trying to create a program which displays the highest number. I tried to follow your tutorial but got a bit stuck. the program is always outputing the first number. Do you know what the problem is? INP STA num1 INP STA num2 SUB num1 BRP pos pos LDA num2 LDA num1 OUT BRA exit exit HLT num1 DAT num2 DAT
@CodingCoach
@CodingCoach 3 жыл бұрын
your branch will always end up in the same place
@nadirberrachedi4347
@nadirberrachedi4347 3 жыл бұрын
@@CodingCoach what does that mean?
@CodingCoach
@CodingCoach 3 жыл бұрын
Pay attention to what is said @1:37
@nadirberrachedi4347
@nadirberrachedi4347 3 жыл бұрын
@@CodingCoach thank you
Жездуха 42-серия
29:26
Million Show
Рет қаралды 2,6 МЛН
Their Boat Engine Fell Off
0:13
Newsflare
Рет қаралды 15 МЛН
4. Assembly Language & Computer Architecture
1:17:35
MIT OpenCourseWare
Рет қаралды 733 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 400 М.
Little Man Computer Explained: Introduction to LMC
11:51
Coding Coach
Рет қаралды 6 М.
How to Write LMC Assembly Code Programs
17:53
MrBrownCS
Рет қаралды 106
How computer processors run conditions and loops
17:03
Core Dumped
Рет қаралды 174 М.
Assembly Basics: The Language Behind the Hardware
12:55
WhiteboardDoodles
Рет қаралды 37 М.
Little Man Computer: 1. Introduction
20:09
Computer Science Lessons
Рет қаралды 40 М.
Жездуха 42-серия
29:26
Million Show
Рет қаралды 2,6 МЛН