LMC Negative Flag
Home Up Text Errata Overflow EBCDIC Using DEBUG LMC Negative Flag LMC Control Assembler
Updated:
2003-05-04 01:19

LMC Negative Flag

The text is unclear on how the various Skip instructions know whether the result in the Calculator is negative, zero, or positive.  In fact, the result in the calculator is always positive; there is trickery involved in the setting of the Negative status flag (light).

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 Numbers vs. Negative Operations

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, and doing that set the Negative light.  The operation of subtracting a larger number from a smaller is the only thing that turns on the Negative light.

In our LMC, 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.)

In short - there are no negative numbers in the LMC, only an operation (SUBTRACT) that might turn on the Negative light if a larger number is subtracted from a smaller.

Web Author: Ian! D. Allen idallen@idallen.ca      Updated: 2003-05-04 01:19

Internet Free Zone Level 1 logo Support free and non-commercial Internet.

Any Browser logo This site works best in Any Browser, a campaign for non-specific WWW.

Creative Commons License logo This work is licensed under a Creative Commons License.