Mnemonics and their functions
The Little Man Computer (LMC) is a instructional model of a computer, developed
by Dr Stuart Madnick, it models a simple Von Neumann architecture and can be Mnemonic/Machine code Instruction
programmed in Machine or assembly code.
LDA (0101 xxxxxxx) Load address to ACC.
STA (0011 xxxxxxx) Store ACC to address.
ADD (0001 xxxxxxx) Add address to ACC.
SUB (0010 xxxxxxx) Sub address to ACC.
INP (1001 0000001) Input from keyboard to ACC.
OUT (1001 0000010) Output from ACC to display.
BRA (0110 xxxxxxx) Branch always
BRP (0111 xxxxxxx) Branch if ACC is >=0
BRZ (1000 xxxxxxx) Branch if ACC = 0
DAT (The data) Declares a variable
HLT (00000000000) Ends the Program
The table above shows the mnemonics and their
What does the program do? instructions. Mnemonics are terms that are
either names or symbols used to define or spec-
What are branches used for? On the left side, we have the assembly language code ify a computing function, this is important as it
“BRA” , “BRP” & “BRZ” are which are known as mnemonics (“INP”,STA”). First, doesn't require the programmer to remember
branches, in LMC, branches the program asks for an input and it will store it in vari- the machine code( in binary) so becomes more
are used to set the contents able “A” which could be anywhere in the RAM (on the readable and easier for them.
of the ACC to a given label/ right), this will repeat for variable “B” and “C”. The Opcode and Operand
address. They can be used “LDA” mnemonic loads variable “C” into the Accumula- • The opcode is the part of the binary which
for creating loops or condi- tor located in the CPU, the “OUT” then outputs the
tions. data stored in the ACC which in this case is “C”, it will tells the computer what to do.
repeat this for “B” and “C” and then the program will • The Operand is the part of the binary which
end using the Mnemonic “HLT”. The “DAT” at the tells the computer what to do it to.
bottom basically declares the variables.
In summary, the program asks for 3 inputs then out- ADD: 0001 0010011
puts them in reverse order.
It will add the value stored in memory
address 19 to the ACC.
Label
• If value in ACC is positive, High level language
go to loop (which starts at A language designed to help express the computer program in a way that reflects the problem being
the output mnemonic). solved, high level language programs are far easier to read than low level language as high level language
tends to use more of the English language instead of Mnemonics . Examples include: Python, Java Script
and C#.
Low level language Assembly language
A Language that is very closely A Language that is very closely related to Machine code. This is
related to Machine code. Exam- an example of a low level language, this language uses Mnemon-
ples of low level language: As- ics which are either names or symbols to define or specify a func-
sembly language & Machine tion so this isn’t as understandable as high level language howev-
code. er it is a lot easier than just binary numbers (machine code).
Machine code
A Language which uses binary with a set of all possible instructions made
available by the hardware design of a particular processor, all languages
above this have a translator which translate ultimately translates all
code into machine code.