Updated: 2003-09-23 11:45

LMC Status Lights / Flags

The text is unclear on how the various Skip instructions know whether the result in the Calculator is negative, zero, or positive.

For the purposes of this course, we define three status flags (or lights): Negative, Zero, and Positive.  (Positive includes zero.)  The Skip instructions work based on the settings of the lights, not on the value of the number currently in the Calculator.  (This has to be so, since the author claims that the LMC doesn't have negative numbers, so the number in the Calulator is never negative!)

These lights are set only after an arithmetic operation (i.e. ADD or SUB) and stay set until the next arithmetic operation.  Moving numbers into or out of the Calculator does not affect the lights.

Negative Results vs. Negative Numbers

The text is inconsistent in its use of "negative" numbers in the Little Man Computer.  On the one hand, the author states that negative numbers are not possible; on the other hand, subtraction of a larger number from a smaller permits a "Skip If Negative" condition to occur and the author talks about negative results.

For the purposes of this course, we define that the "Negative" light comes on only after we subtract a larger number from a smaller.  The fact that the light is on does not mean that the number in the Calculator is "negative"; it simply means that the last SUBTRACT operation subtracted a larger number from a smaller.

The Negative light is always cleared after an ADD, even if the ADD causes an overflow.  (In a real computer, adding two large two's complement numbers may cause overflow and the result to be negative.  That doesn't happen with the LMC, since the LMC doesn't handle negative numbers.)

 Web Author: Ian! D. Allen idallen@idallen.ca      Updated: 2003-09-23 11:45 Support free and non-commercial Internet. This site works best in Any Browser, a campaign for non-specific WWW. This work is licensed under a Creative Commons License.