Little Man Computer - Commands - Examples - Numeric


This program (instruction 901 to instruction 000) is written just using numeric codes. The program takes two numbers as input and outputs the difference. Notice that execution starts at Mailbox 00 and finishes at Mailbox 07. The disadvantages of this as a way of programming in machine code are discussed below.

Mailbox Numeric code Operation Comments
00 901 INBOX --> ACCUMULATOR INPUT the first number, enter into calculator (erasing whatever was there)
01 308 ACCUMULATOR --> MEMORY STORE the calculator's current value (to prepare for the next step...)
02 901 INBOX --> ACCUMULATOR INPUT the second number, enter into calculator (erasing whatever was there)
03 309 ACCUMULATOR --> MEMORY STORE the calculator's current value (again, to prepare for the next step...)
04 508 MEMORY --> ACCUMULATOR (Now that both INPUT values are STORED in Mailboxes 08 and 09...)

LOAD the first value back into the calculator (erasing whatever was there)

05 209 ACCUMULATOR = ACCUMULATOR - MEMORY SUBTRACT the second number from the calculator's current value (which was just set to the first number)
06 902 ACCUMULATOR --> OUTBOX OUTPUT the calculator's result to t
07 000 (no operation performed) HALT the LMC

Read more about this topic:  Little Man Computer, Commands, Examples

Other articles related to "numeric":

Comparison Of C Sharp And Visual Basic .NET - Language Features - Other Characteristics of C# Not Applicable To Visual Basic .NET
... By default, numeric operations are not checked ... This results in slightly faster code, at the risk that numeric overflows will not be detected ... by checking an option) String concatenation can be performed using the numeric addition token, +, in addition to the string concatenation token ...
Practice Firm - Numeric Simulations
... A numeric simulation can mimic a whole company on a high level or it can be more detailed and mimic specific organizational units or processes ... In a numeric simulation the learner or user makes decisions by pulling levers and dialers as well as through inputting numbers ... Many numeric business simulations include elements of competition against other participants or against computer generated competitors ...
Pseudo-polynomial Time - Generalizing To Non-numeric Problems
... Although the notion of pseudo-polynomial time is used almost exclusively for numeric problems, the concept can be generalized The function m is pseudo-polynomial if m(n) is no greater ... something relevant to the problem.) This makes numeric problems a special case by taking k to be the number of (binary) digits of the input ... between the value of a number and its length is one of encoding if numeric inputs are always encoded in unary, then pseudo-polynomial would coincide with polynomial ...
Cyclic Number - Other Numeric Bases
... Using the above technique, cyclic numbers can be found in other numeric bases ... cyclic numbers (other than trivial single digits) exist in any numeric base which is a perfect square thus there are no cyclic numbers in hexadecimal ...