News:

11 March 2016 - Forum Rules

Main Menu

BNE/BEQ --> BZC/BZS

Started by Dr. Floppy, February 13, 2015, 09:10:25 AM

Previous topic - Next topic

Dr. Floppy

It occurred to me the other day that the Branch on iNEquality & Branch on EQuality commands are more accurately described as Branch on Z-flag Clear & Branch on Z-flag Set (respectively). Anybody know why Peddle/Mensch went with the BNE/BEQ terminology instead of the conceptually-clearer (and cooler looking) BZC/BZS?

Gideon Zhi

If I had to hazard a guess, it'd be that the most common use-case goes something like this:

CMP #$F0
BEQ

How does "Branch if zero clear" make this easier to understand?

FAST6191

Do we have an official/common old assembler listing? Such things are usually the reason for it. I doubt anybody will change it either as it can be a dangerous move to simply change the instruction ordering (instruction, source, destination -> instruction, destination, source sort of thing).

Or if you prefer when was the last time you encountered an instruction set where mov actually moved something rather than copied it.

Dr. Floppy

I suspect that's what was involved with all the Transfer commands (which are more accurately dubbed "Copy" commands).

As for BEQ/BNE, Gideon's probably right. I just got so used to viewing all CMP's as theoretical subtractions and mentally appending "...to zero" to any subsequent BEQ/BNE. This resulted in much confusion a few weeks back when a BNE command was being skipped despite A, X, and Y all containing non-zero values. (Turns out I'd inserted a JMP patch to a special-handling routine elsewhere, the final portion of which was "CMP #26" with just enough space remaining for the JMP-back. The original routine, not having that special handler, used that BNE as a specific test for the contents of A-reg.)