#include <stdio.h>
#include <stdlib.h>

typedef unsigned char Bit8;

#define scmp8(a,b) (a == b ? 0 : ( ((Bit8)(a-b) <= 0x80) ? +1 : -1))

#define scmp8_ge(a,b)  ((Bit8)(a-b) <= 0x80)
#define scmp8_lt(a,b)  ((Bit8)(a-b)  > 0x80)

int main(int argc, char *argv[])
{
   Bit8 a,b;
   int j, cv, last_cv;

   for (;;) {
      printf("\nEnter value for a: ");
      scanf("%d", &a);
      for (last_cv = -2, b = a, j = 0; j <= 256; ++j, ++b) {
         cv = scmp8(a,b);
         if (cv != last_cv) {
            printf("   b=%d, (a-b)=%u, cv=%d, ge=%d, lt=%d\n",
               b, (a-b)&0x0F, cv, scmp8_ge(a,b), scmp8_lt(a,b));
            last_cv = cv;
	    }
         }
      }
   }
