In Little Man computer(LMC), the condition Branch on Positive(BRP) includes zero as a positive number( I thought number>0 is positive). I know LMC is a imaginative concept, but I was wondering if any processor (outdated or current ones) uses Branch on positive including zero as positive number?
-
I think you mean BRP. And that's certainly a misnomer, as you noticed: there's negative, zero, and positive, and you can only pick one. – Oct 28 '13 at 23:44
-
But I was looking for microprocessor such as 8086, 8085 to use BRP including zero as positive number – user845405 Oct 28 '13 at 23:46
-
Many processors have branch instructions (or condition codes) to say "zero or positive", often based on two status flag. In 8086, it's either based on carry and zero (for unsigned comparison and subtraction) or [sign](https://en.wikipedia.org/wiki/Sign_flag) and zero (for signed comparison and subtraction). So if you subtracted two signed numbers, and you want to branch when the result is zero or positive, you only need to make sure that the sign flag indicates 'nonnegative' (reset). The `JGE` instruction uses exactly this condition. – Oct 28 '13 at 23:56
3 Answers
BRZ sets instructions to be executed specifically if Branch is Zero, but BRP does count zero as a positive number, so the only way around this is to contradict the BRP instructions with BRZ instructions.

- 129
- 2
- 13
Your question asked about specific processors, and the closest I can come is the PDP-8 SPA – Skip on AC ≥ 0. I can describe the rationale for including zero as a positive number. Virtually all modern computers use two's complement format for integers. That makes the leftmost bit the sign bit. Negative numbers have a one in the sign bit, and positive numbers have a zero in the sign bit. The number zero is represented as all zeros, including the sign bit. So, if branch on positive were implemented on a two's complement computer that tested the sign bit, the number zero would be positive.
Alternatively, when Dr. Madnick designed LMC, and also now, calculators do not display a minus sign with the number zero.
That said, I wish Madnick had called it BNN: branch if not negative.

- 1,463
- 1
- 12
- 25
-
BPL Branch if plus (N=0)
...where N is the negative flag (0 or 1), and so it applies when the tested value is not negative.
-
bpl - branch if pl (positive or zero)
...this includes the 6502:
BPL - Branch if Positive
If the negative flag is clear then add the relative displacement to the program counter to cause a branch to a new location.

- 317,000
- 35
- 244
- 286