/* $20 BRA relative ----- */ INLINE void bra( void ) { UINT8 t; IMMBYTE(t);PC+=SIGNED(t);CHANGE_PC(); /* speed up busy loops */ if (t==0xfe) EAT_CYCLES; }
/* $8d BSR ----- */ INLINE void bsr( void ) { UINT8 t; IMMBYTE(t); PUSHWORD(pPC); PC += SIGNED(t); CHANGE_PC(); /* TS 971002 */ }
int main (void) { unsigned long c; mp_limb_t t[4] = { -1, -1, -1, -1 }; #if defined(__cplusplus) printf ("A C++ compiler is used.\n"); #endif printf ("GMP ..... Library: %-12s Header: %d.%d.%d\n", gmp_version, __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL); printf ("MPFR .... Library: %-12s Header: %s (based on %d.%d.%d)\n", mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR, MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL); #if MPFR_VERSION_MAJOR >= 3 printf ("MPFR features: TLS = %s, decimal = %s", mpfr_buildopt_tls_p () ? "yes" : "no", mpfr_buildopt_decimal_p () ? "yes" : "no"); # if MPFR_VERSION_MAJOR > 3 || MPFR_VERSION_MINOR >= 1 printf (", GMP internals = %s\nMPFR tuning: %s", mpfr_buildopt_gmpinternals_p () ? "yes" : "no", mpfr_buildopt_tune_case ()); # endif printf ("\n"); #endif printf ("MPFR patches: %s\n\n", mpfr_get_patches ()); #ifdef __GMP_CC printf ("__GMP_CC = \"%s\"\n", __GMP_CC); #endif #ifdef __GMP_CFLAGS printf ("__GMP_CFLAGS = \"%s\"\n", __GMP_CFLAGS); #endif printf ("GMP_LIMB_BITS = %d\n", (int) GMP_LIMB_BITS); printf ("GMP_NAIL_BITS = %d\n", (int) GMP_NAIL_BITS); printf ("GMP_NUMB_BITS = %d\n", (int) GMP_NUMB_BITS); printf ("mp_bits_per_limb = %d\n", (int) mp_bits_per_limb); printf ("sizeof(mp_limb_t) = %d\n", (int) sizeof(mp_limb_t)); if (mp_bits_per_limb != GMP_LIMB_BITS) printf ("Warning! mp_bits_per_limb != GMP_LIMB_BITS\n"); if (GMP_LIMB_BITS != sizeof(mp_limb_t) * CHAR_BIT) printf ("Warning! GMP_LIMB_BITS != sizeof(mp_limb_t) * CHAR_BIT\n"); c = mpn_popcount (t, 1); printf ("The GMP library expects %lu bits in a mp_limb_t.\n", c); if (c != GMP_LIMB_BITS) printf ("Warning! This is different from GMP_LIMB_BITS!\n" "Different ABI caused by a GMP library upgrade?\n"); printf ("\n"); printf ("sizeof(mpfr_prec_t) = %d (%s type)\n", (int) sizeof(mpfr_prec_t), SIGNED_STR((mpfr_prec_t) -1)); #if MPFR_VERSION_MAJOR >= 3 printf ("sizeof(mpfr_exp_t) = %d (%s type)\n", (int) sizeof(mpfr_exp_t), SIGNED_STR((mpfr_exp_t) -1)); #endif #ifdef _MPFR_PREC_FORMAT printf ("_MPFR_PREC_FORMAT = %d\n", (int) _MPFR_PREC_FORMAT); #endif /* Note: "long" is sufficient for all current _MPFR_PREC_FORMAT values (1, 2, 3). Thus we do not need to depend on ISO C99 or later. */ printf ("MPFR_PREC_MIN = %ld (%s)\n", (long) MPFR_PREC_MIN, SIGNED (MPFR_PREC_MIN)); printf ("MPFR_PREC_MAX = %ld (%s)\n", (long) MPFR_PREC_MAX, SIGNED (MPFR_PREC_MAX)); #ifdef _MPFR_EXP_FORMAT printf ("_MPFR_EXP_FORMAT = %d\n", (int) _MPFR_EXP_FORMAT); #endif printf ("sizeof(mpfr_t) = %d\n", (int) sizeof(mpfr_t)); failure_test (); return 0; }
INLINE void fetch_effective_address( void ) { UINT8 postbyte = ROP_ARG(PCD); PC++; switch(postbyte) { case 0x00: EA=X; break; case 0x01: EA=X+1; break; case 0x02: EA=X+2; break; case 0x03: EA=X+3; break; case 0x04: EA=X+4; break; case 0x05: EA=X+5; break; case 0x06: EA=X+6; break; case 0x07: EA=X+7; break; case 0x08: EA=X+8; break; case 0x09: EA=X+9; break; case 0x0a: EA=X+10; break; case 0x0b: EA=X+11; break; case 0x0c: EA=X+12; break; case 0x0d: EA=X+13; break; case 0x0e: EA=X+14; break; case 0x0f: EA=X+15; break; case 0x10: EA=X-16; break; case 0x11: EA=X-15; break; case 0x12: EA=X-14; break; case 0x13: EA=X-13; break; case 0x14: EA=X-12; break; case 0x15: EA=X-11; break; case 0x16: EA=X-10; break; case 0x17: EA=X-9; break; case 0x18: EA=X-8; break; case 0x19: EA=X-7; break; case 0x1a: EA=X-6; break; case 0x1b: EA=X-5; break; case 0x1c: EA=X-4; break; case 0x1d: EA=X-3; break; case 0x1e: EA=X-2; break; case 0x1f: EA=X-1; break; case 0x20: EA=Y; break; case 0x21: EA=Y+1; break; case 0x22: EA=Y+2; break; case 0x23: EA=Y+3; break; case 0x24: EA=Y+4; break; case 0x25: EA=Y+5; break; case 0x26: EA=Y+6; break; case 0x27: EA=Y+7; break; case 0x28: EA=Y+8; break; case 0x29: EA=Y+9; break; case 0x2a: EA=Y+10; break; case 0x2b: EA=Y+11; break; case 0x2c: EA=Y+12; break; case 0x2d: EA=Y+13; break; case 0x2e: EA=Y+14; break; case 0x2f: EA=Y+15; break; case 0x30: EA=Y-16; break; case 0x31: EA=Y-15; break; case 0x32: EA=Y-14; break; case 0x33: EA=Y-13; break; case 0x34: EA=Y-12; break; case 0x35: EA=Y-11; break; case 0x36: EA=Y-10; break; case 0x37: EA=Y-9; break; case 0x38: EA=Y-8; break; case 0x39: EA=Y-7; break; case 0x3a: EA=Y-6; break; case 0x3b: EA=Y-5; break; case 0x3c: EA=Y-4; break; case 0x3d: EA=Y-3; break; case 0x3e: EA=Y-2; break; case 0x3f: EA=Y-1; break; case 0x40: EA=U; break; case 0x41: EA=U+1; break; case 0x42: EA=U+2; break; case 0x43: EA=U+3; break; case 0x44: EA=U+4; break; case 0x45: EA=U+5; break; case 0x46: EA=U+6; break; case 0x47: EA=U+7; break; case 0x48: EA=U+8; break; case 0x49: EA=U+9; break; case 0x4a: EA=U+10; break; case 0x4b: EA=U+11; break; case 0x4c: EA=U+12; break; case 0x4d: EA=U+13; break; case 0x4e: EA=U+14; break; case 0x4f: EA=U+15; break; case 0x50: EA=U-16; break; case 0x51: EA=U-15; break; case 0x52: EA=U-14; break; case 0x53: EA=U-13; break; case 0x54: EA=U-12; break; case 0x55: EA=U-11; break; case 0x56: EA=U-10; break; case 0x57: EA=U-9; break; case 0x58: EA=U-8; break; case 0x59: EA=U-7; break; case 0x5a: EA=U-6; break; case 0x5b: EA=U-5; break; case 0x5c: EA=U-4; break; case 0x5d: EA=U-3; break; case 0x5e: EA=U-2; break; case 0x5f: EA=U-1; break; case 0x60: EA=S; break; case 0x61: EA=S+1; break; case 0x62: EA=S+2; break; case 0x63: EA=S+3; break; case 0x64: EA=S+4; break; case 0x65: EA=S+5; break; case 0x66: EA=S+6; break; case 0x67: EA=S+7; break; case 0x68: EA=S+8; break; case 0x69: EA=S+9; break; case 0x6a: EA=S+10; break; case 0x6b: EA=S+11; break; case 0x6c: EA=S+12; break; case 0x6d: EA=S+13; break; case 0x6e: EA=S+14; break; case 0x6f: EA=S+15; break; case 0x70: EA=S-16; break; case 0x71: EA=S-15; break; case 0x72: EA=S-14; break; case 0x73: EA=S-13; break; case 0x74: EA=S-12; break; case 0x75: EA=S-11; break; case 0x76: EA=S-10; break; case 0x77: EA=S-9; break; case 0x78: EA=S-8; break; case 0x79: EA=S-7; break; case 0x7a: EA=S-6; break; case 0x7b: EA=S-5; break; case 0x7c: EA=S-4; break; case 0x7d: EA=S-3; break; case 0x7e: EA=S-2; break; case 0x7f: EA=S-1; break; case 0x80: EA=X; X++; break; case 0x81: EA=X; X+=2; break; case 0x82: X--; EA=X; break; case 0x83: X-=2; EA=X; break; case 0x84: EA=X; break; case 0x85: EA=X+SIGNED(B); break; case 0x86: EA=X+SIGNED(A); break; case 0x87: EA=X+SIGNED(E); break; case 0x88: IMMBYTE(EA); EA=X+SIGNED(EA); break; case 0x89: IMMWORD(ea); EA+=X; break; case 0x8a: EA=X+SIGNED(F); break; case 0x8b: EA=X+D; break; case 0x8c: IMMBYTE(EA); EA=PC+SIGNED(EA); break; case 0x8d: IMMWORD(ea); EA+=PC; break; case 0x8e: EA=X+W; break; case 0x8f: EA=W; break; case 0x90: EA=W; EAD=RM16(EAD); break; case 0x91: EA=X; X+=2; EAD=RM16(EAD); break; case 0x92: IIError(); break; case 0x93: X-=2; EA=X; EAD=RM16(EAD); break; case 0x94: EA=X; EAD=RM16(EAD); break; case 0x95: EA=X+SIGNED(B); EAD=RM16(EAD); break; case 0x96: EA=X+SIGNED(A); EAD=RM16(EAD); break; case 0x97: EA=X+SIGNED(E); EAD=RM16(EAD); break; case 0x98: IMMBYTE(EA); EA=X+SIGNED(EA); EAD=RM16(EAD); break; case 0x99: IMMWORD(ea); EA+=X; EAD=RM16(EAD); break; case 0x9a: EA=X+SIGNED(F); EAD=RM16(EAD); break; case 0x9b: EA=X+D; EAD=RM16(EAD); break; case 0x9c: IMMBYTE(EA); EA=PC+SIGNED(EA); EAD=RM16(EAD); break; case 0x9d: IMMWORD(ea); EA+=PC; EAD=RM16(EAD); break; case 0x9e: EA=X+W; EAD=RM16(EAD); break; case 0x9f: IMMWORD(ea); EAD=RM16(EAD); break; case 0xa0: EA=Y; Y++; break; case 0xa1: EA=Y; Y+=2; break; case 0xa2: Y--; EA=Y; break; case 0xa3: Y-=2; EA=Y; break; case 0xa4: EA=Y; break; case 0xa5: EA=Y+SIGNED(B); break; case 0xa6: EA=Y+SIGNED(A); break; case 0xa7: EA=Y+SIGNED(E); break; case 0xa8: IMMBYTE(EA); EA=Y+SIGNED(EA); break; case 0xa9: IMMWORD(ea); EA+=Y; break; case 0xaa: EA=Y+SIGNED(F); break; case 0xab: EA=Y+D; break; case 0xac: IMMBYTE(EA); EA=PC+SIGNED(EA); break; case 0xad: IMMWORD(ea); EA+=PC; break; case 0xae: EA=Y+W; break; case 0xaf: IMMWORD(ea); EA+=W; break; case 0xb0: IMMWORD(ea); EA+=W; EAD=RM16(EAD); break; case 0xb1: EA=Y; Y+=2; EAD=RM16(EAD); break; case 0xb2: IIError(); break; case 0xb3: Y-=2; EA=Y; EAD=RM16(EAD); break; case 0xb4: EA=Y; EAD=RM16(EAD); break; case 0xb5: EA=Y+SIGNED(B); EAD=RM16(EAD); break; case 0xb6: EA=Y+SIGNED(A); EAD=RM16(EAD); break; case 0xb7: EA=Y+SIGNED(E); EAD=RM16(EAD); break; case 0xb8: IMMBYTE(EA); EA=Y+SIGNED(EA); EAD=RM16(EAD); break; case 0xb9: IMMWORD(ea); EA+=Y; EAD=RM16(EAD); break; case 0xba: EA=Y+SIGNED(F); EAD=RM16(EAD); break; case 0xbb: EA=Y+D; EAD=RM16(EAD); break; case 0xbc: IMMBYTE(EA); EA=PC+SIGNED(EA); EAD=RM16(EAD); break; case 0xbd: IMMWORD(ea); EA+=PC; EAD=RM16(EAD); break; case 0xbe: EA=Y+W; EAD=RM16(EAD); break; case 0xbf: IIError(); break; case 0xc0: EA=U; U++; break; case 0xc1: EA=U; U+=2; break; case 0xc2: U--; EA=U; break; case 0xc3: U-=2; EA=U; break; case 0xc4: EA=U; break; case 0xc5: EA=U+SIGNED(B); break; case 0xc6: EA=U+SIGNED(A); break; case 0xc7: EA=U+SIGNED(E); break; case 0xc8: IMMBYTE(EA); EA=U+SIGNED(EA); break; case 0xc9: IMMWORD(ea); EA+=U; break; case 0xca: EA=U+SIGNED(F); break; case 0xcb: EA=U+D; break; case 0xcc: IMMBYTE(EA); EA=PC+SIGNED(EA); break; case 0xcd: IMMWORD(ea); EA+=PC; break; case 0xce: EA=U+W; break; case 0xcf: EA=W; W+=2; break; case 0xd0: EA=W; W+=2; EAD=RM16(EAD); break; case 0xd1: EA=U; U+=2; EAD=RM16(EAD); break; case 0xd2: IIError(); break; case 0xd3: U-=2; EA=U; EAD=RM16(EAD); break; case 0xd4: EA=U; EAD=RM16(EAD); break; case 0xd5: EA=U+SIGNED(B); EAD=RM16(EAD); break; case 0xd6: EA=U+SIGNED(A); EAD=RM16(EAD); break; case 0xd7: EA=U+SIGNED(E); EAD=RM16(EAD); break; case 0xd8: IMMBYTE(EA); EA=U+SIGNED(EA); EAD=RM16(EAD); break; case 0xd9: IMMWORD(ea); EA+=U; EAD=RM16(EAD); break; case 0xda: EA=U+SIGNED(F); EAD=RM16(EAD); break; case 0xdb: EA=U+D; EAD=RM16(EAD); break; case 0xdc: IMMBYTE(EA); EA=PC+SIGNED(EA); EAD=RM16(EAD); break; case 0xdd: IMMWORD(ea); EA+=PC; EAD=RM16(EAD); break; case 0xde: EA=U+W; EAD=RM16(EAD); break; case 0xdf: IIError(); break; case 0xe0: EA=S; S++; break; case 0xe1: EA=S; S+=2; break; case 0xe2: S--; EA=S; break; case 0xe3: S-=2; EA=S; break; case 0xe4: EA=S; break; case 0xe5: EA=S+SIGNED(B); break; case 0xe6: EA=S+SIGNED(A); break; case 0xe7: EA=S+SIGNED(E); break; case 0xe8: IMMBYTE(EA); EA=S+SIGNED(EA); break; case 0xe9: IMMWORD(ea); EA+=S; break; case 0xea: EA=S+SIGNED(F); break; case 0xeb: EA=S+D; break; case 0xec: IMMBYTE(EA); EA=PC+SIGNED(EA); break; case 0xed: IMMWORD(ea); EA+=PC; break; case 0xee: EA=S+W; break; case 0xef: W-=2; EA=W; break; case 0xf0: W-=2; EA=W; EAD=RM16(EAD); break; case 0xf1: EA=S; S+=2; EAD=RM16(EAD); break; case 0xf2: IIError(); break; case 0xf3: S-=2; EA=S; EAD=RM16(EAD); break; case 0xf4: EA=S; EAD=RM16(EAD); break; case 0xf5: EA=S+SIGNED(B); EAD=RM16(EAD); break; case 0xf6: EA=S+SIGNED(A); EAD=RM16(EAD); break; case 0xf7: EA=S+SIGNED(E); EAD=RM16(EAD); break; case 0xf8: IMMBYTE(EA); EA=S+SIGNED(EA); EAD=RM16(EAD); break; case 0xf9: IMMWORD(ea); EA+=S; EAD=RM16(EAD); break; case 0xfa: EA=S+SIGNED(F); EAD=RM16(EAD); break; case 0xfb: EA=S+D; EAD=RM16(EAD); break; case 0xfc: IMMBYTE(EA); EA=PC+SIGNED(EA); EAD=RM16(EAD); break; case 0xfd: IMMWORD(ea); EA+=PC; EAD=RM16(EAD); break; case 0xfe: EA=S+W; EAD=RM16(EAD); break; case 0xff: IIError(); break; } hd6309_ICount -= index_cycle[postbyte]; }
int main (void) { unsigned long c; mp_limb_t t[4]; int i; /* Casts are for C++ compilers. */ for (i = 0; i < (int) (sizeof (t) / sizeof (mp_limb_t)); i++) t[i] = (mp_limb_t) -1; /**************** Information about the C implementation ****************/ /* This is useful, as this can affect the behavior of MPFR. */ #define COMP "Compiler: " #ifdef __INTEL_COMPILER # ifdef __VERSION__ # define ICCV " [" __VERSION__ "]" # else # define ICCV "" # endif printf (COMP "ICC %d.%d.%d" ICCV "\n", __INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE); #elif (defined(__GNUC__) || defined(__clang__)) && defined(__VERSION__) # ifdef __clang__ # define COMP2 COMP # else # define COMP2 COMP "GCC " # endif printf (COMP2 "%s\n", __VERSION__); #endif #if defined(__STDC__) || defined(__STDC_VERSION__) printf ("C/C++: __STDC__ = " #if defined(__STDC__) MAKE_STR(__STDC__) #else "undef" #endif ", __STDC_VERSION__ = " #if defined(__STDC_VERSION__) MAKE_STR(__STDC_VERSION__) #else "undef" #endif #if defined(__cplusplus) ", C++" #endif "\n"); #endif #if defined(__GNUC__) printf ("GNU compatibility: __GNUC__ = " MAKE_STR(__GNUC__) ", __GNUC_MINOR__ = " #if defined(__GNUC_MINOR__) MAKE_STR(__GNUC_MINOR__) #else "undef" #endif "\n"); #endif #if defined(__ICC) || defined(__INTEL_COMPILER) printf ("Intel compiler: __ICC = " #if defined(__ICC) MAKE_STR(__ICC) #else "undef" #endif ", __INTEL_COMPILER = " #if defined(__INTEL_COMPILER) MAKE_STR(__INTEL_COMPILER) #else "undef" #endif "\n"); #endif #if defined(_WIN32) || defined(_MSC_VER) printf ("MS Windows: _WIN32 = " #if defined(_WIN32) MAKE_STR(_WIN32) #else "undef" #endif ", _MSC_VER = " #if defined(_MSC_VER) MAKE_STR(_MSC_VER) #else "undef" #endif "\n"); #endif #if defined(__GLIBC__) printf ("GNU C library: __GLIBC__ = " MAKE_STR(__GLIBC__) ", __GLIBC_MINOR__ = " #if defined(__GLIBC_MINOR__) MAKE_STR(__GLIBC_MINOR__) #else "undef" #endif "\n"); #endif printf ("\n"); /************************************************************************/ #if defined(__MPIR_VERSION) printf ("MPIR .... Library: %-12s Header: %d.%d.%d\n", mpir_version, __MPIR_VERSION, __MPIR_VERSION_MINOR, __MPIR_VERSION_PATCHLEVEL); #else printf ("GMP ..... Library: %-12s Header: %d.%d.%d\n", gmp_version, __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL); #endif printf ("MPFR .... Library: %-12s Header: %s (based on %d.%d.%d)\n", mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR, MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL); printf ("MPFR features: TLS = %s, decimal = %s", mpfr_buildopt_tls_p () ? "yes" : "no", mpfr_buildopt_decimal_p () ? "yes" : "no"); #if MPFR_VERSION_MAJOR > 3 || MPFR_VERSION_MINOR >= 1 printf (", GMP internals = %s\nMPFR tuning: %s", mpfr_buildopt_gmpinternals_p () ? "yes" : "no", mpfr_buildopt_tune_case ()); #endif /* 3.1 */ printf ("\n"); patches (); printf ("\n"); #ifdef __GMP_CC printf ("__GMP_CC = \"%s\"\n", __GMP_CC); #endif #ifdef __GMP_CFLAGS printf ("__GMP_CFLAGS = \"%s\"\n", __GMP_CFLAGS); #endif printf ("GMP_LIMB_BITS = %d\n", (int) GMP_LIMB_BITS); printf ("GMP_NAIL_BITS = %d\n", (int) GMP_NAIL_BITS); printf ("GMP_NUMB_BITS = %d\n", (int) GMP_NUMB_BITS); printf ("mp_bits_per_limb = %d\n", (int) mp_bits_per_limb); printf ("sizeof(mp_limb_t) = %d\n", (int) sizeof(mp_limb_t)); if (mp_bits_per_limb != GMP_LIMB_BITS) printf ("Warning! mp_bits_per_limb != GMP_LIMB_BITS\n"); if (GMP_LIMB_BITS != sizeof(mp_limb_t) * CHAR_BIT) printf ("Warning! GMP_LIMB_BITS != sizeof(mp_limb_t) * CHAR_BIT\n"); c = mpn_popcount (t, 1); printf ("The GMP library expects %lu bits in a mp_limb_t.\n", c); if (c != GMP_LIMB_BITS) printf ("Warning! This is different from GMP_LIMB_BITS!\n" "Different ABI caused by a GMP library upgrade?\n"); printf ("\n"); printf ("sizeof(mpfr_prec_t) = %d (%s type)\n", (int) sizeof(mpfr_prec_t), SIGNED_STR((mpfr_prec_t) -1)); printf ("sizeof(mpfr_exp_t) = %d (%s type)\n", (int) sizeof(mpfr_exp_t), SIGNED_STR((mpfr_exp_t) -1)); #ifdef _MPFR_PREC_FORMAT printf ("_MPFR_PREC_FORMAT = %d\n", (int) _MPFR_PREC_FORMAT); #endif /* Note: "long" is sufficient for all current _MPFR_PREC_FORMAT values (1, 2, 3). Thus we do not need to depend on ISO C99 or later. */ printf ("MPFR_PREC_MIN = %ld (%s)\n", (long) MPFR_PREC_MIN, SIGNED (MPFR_PREC_MIN)); printf ("MPFR_PREC_MAX = %ld (%s)\n", (long) MPFR_PREC_MAX, SIGNED (MPFR_PREC_MAX)); #ifdef _MPFR_EXP_FORMAT printf ("_MPFR_EXP_FORMAT = %d\n", (int) _MPFR_EXP_FORMAT); #endif printf ("sizeof(mpfr_t) = %d\n", (int) sizeof(mpfr_t)); printf ("sizeof(mpfr_ptr) = %d\n", (int) sizeof(mpfr_ptr)); failure_test (); return 0; }