News: 11 March 2016 - Forum Rules

Author Topic: BNE/BEQ --> BZC/BZS  (Read 2143 times)

Dr. Floppy

  • Restricted Access
  • Hero Member
  • *
  • Posts: 970
  • Make America GREAT Again!
    • View Profile
    • BaddestHacks.net
BNE/BEQ --> BZC/BZS
« on: February 13, 2015, 09:10:25 am »
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

  • Discord Staff
  • Hero Member
  • *****
  • Posts: 3536
    • View Profile
    • Aeon Genesis
Re: BNE/BEQ --> BZC/BZS
« Reply #1 on: February 13, 2015, 12:58:19 pm »
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

  • Hero Member
  • *****
  • Posts: 3357
    • View Profile
Re: BNE/BEQ --> BZC/BZS
« Reply #2 on: February 14, 2015, 01:40:53 pm »
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

  • Restricted Access
  • Hero Member
  • *
  • Posts: 970
  • Make America GREAT Again!
    • View Profile
    • BaddestHacks.net
Re: BNE/BEQ --> BZC/BZS
« Reply #3 on: February 14, 2015, 04:58:21 pm »
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.)