0

I'm told that the condition code register (CCR) contains $0B. And I'm asked if the following branch will occur.

BGT LABEL

I know that this is the Greater Than branch, but I'm not sure what the $0B represents. If I write $0B as $011, that still doesn't help me in anyway, because what I have no idea how to tell if the branch will execute, any ideas? Am I so posed to in someway tell what flags have been set because of the $0B ? If that's the case, how would I know which flags are on, and how would that in turn, help in knowing if the branch executes or not?

user3739406
  • 254
  • 1
  • 3
  • 16

1 Answers1

1

$0B I assume means hex 0B which is binary 0000 1011. Since the low 4 bits of the CCR are NZVC, that means N=1, Z=0, V=1 and C=1.

You also need to know what flags BGT checks. It jumps if Z=0 and N=V. In this case that is true, so the branch will be taken.

Jester
  • 56,577
  • 4
  • 81
  • 125
  • Hmm come to think of it, I'm not sure this is right. I'm looking at my school textbook at the moment at the BGT encoding, and it says 1110. Are you sure this is viable for Motorola 680000 architecture? – user3739406 Oct 27 '15 at 00:06
  • The encoding has nothing to do with what flags the instruction checks. See table 3-19 in the programmer's reference manual. – Jester Oct 27 '15 at 00:59
  • So just to confirm here, if it were BHS Label, it would not run because C = 1? I'm trying to make sure I'm understanding my book correctly, thanks. – user3739406 Oct 27 '15 at 01:00