Really fix the bbo/bbz instructions.
authorMichael Meissner <gnu@the-meissners.org>
Thu, 8 May 1997 23:04:22 +0000 (23:04 +0000)
committerMichael Meissner <gnu@the-meissners.org>
Thu, 8 May 1997 23:04:22 +0000 (23:04 +0000)
sim/tic80/ChangeLog
sim/tic80/insns

index 33d6b1b3ba2cd29e73a591283f9e02fdab49bcef..b1f9d09703c16d8addc210b09285ecec7b50b946 100644 (file)
@@ -3,7 +3,8 @@ Thu May  8 11:57:47 1997  Michael Meissner  <meissner@cygnus.com>
        * insns (jsr,bsr): For non-allulled calls, set r31 so that the
        return address does not reexecute the instruction in the delay
        slot.
-       (bbo,bbz): Reverse bit number.
+       (bbo,bbz): Complement bit number to reverse the one's complement
+       that the assembler is required to do.
 
        * misc.c (tic80_trace_*): Change format slightly to accomidate
        real large decimal values.
index 65278338f20ed2e6725383c24753049615d313c6..c1a4467967dce176bc462e30fa79358568e34d0e 100644 (file)
@@ -107,7 +107,8 @@ void::function::do_and:signed32 *rDest, signed32 Source1, signed32 Source2
 instruction_address::function::do_bbo:instruction_address nia, int bitnum, unsigned32 source, int annul, unsigned32 offset
        int jump_p;
        unsigned32 target = cia.ip + 4 * offset;
-       if (MASKED32 (source, 32 - bitnum, 32 - bitnum))
+       bitnum = (~ bitnum) & 0x1f;
+       if (MASKED32 (source, bitnum, bitnum))
          {
            if (annul)
              nia.ip = -1;
@@ -131,7 +132,8 @@ instruction_address::function::do_bbo:instruction_address nia, int bitnum, unsig
 instruction_address::function::do_bbz:instruction_address nia, int bitnum, unsigned32 source, int annul, unsigned32 offset
        int jump_p;
        unsigned32 target = cia.ip + 4 * offset;
-       if (!MASKED32 (source, 32 - bitnum, 32 - bitnum))
+       bitnum = (~ bitnum) & 0x1f;
+       if (!MASKED32 (source, bitnum, bitnum))
          {
            if (annul)
              nia.ip = -1;