Examples: Mailbox Numeric Code Operation Comments
Examples: Mailbox Numeric Code Operation Comments
Examples: Mailbox Numeric Code Operation Comments
This software just requests input from the user and then reports the results.The program has been
loaded into RAM, and the numeric codes for the instructions can be seen in the first three memory
regions.
This program (instructions from 901 to 000) is written entirely in digital code. The software accepts
two numbers as input and returns the difference. Note that execution starts with mailbox 00 and
ends with mailbox 07. The disadvantages of programming the LMC using digital code are explored
in more detail below.
Numeric
Mailbox Operation Comments
code
Assembly language is a low-level programming language that uses mnemonics and labels instead
of numeric code. Although LMC uses only a limited set of mnemonics, the convenience of using
mnemonics for each instruction is evident from the assembly language of the same program shown
below - the programmer no longer needs to memorize a set of anonymous codes and can now
program with a set of mnemonic codes that are easier to remember. If the mnemonic is an
instruction that deals with a memory address (either a branch instruction or load/save data), then a
label is used to name the memory address.
INP
STA FIRST
INP
STA SECOND
LDA FIRST
SUB SECOND
OUT
HLT
FIRST DAT
SECOND DAT