sc68fordevelopers
2.2.1
|
00001 00019 /* Copyright (C) 1998-2001 Ben(jamin) Gerard */ 00020 00021 #ifndef _SRDEF68_H_ 00022 #define _SRDEF68_H_ 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00032 #define SR_C_BIT 0 00033 #define SR_V_BIT 1 00034 #define SR_Z_BIT 2 00035 #define SR_N_BIT 3 00036 #define SR_X_BIT 4 00037 #define SR_IPL_BIT 8 00038 #define SR_S_BIT 13 00039 #define SR_T_BIT 15 00041 #define SR_C (1<<SR_C_BIT) 00042 #define SR_V (1<<SR_V_BIT) 00043 #define SR_Z (1<<SR_Z_BIT) 00044 #define SR_N (1<<SR_N_BIT) 00045 #define SR_X (1<<SR_X_BIT) 00046 #define SR_S (1<<SR_S_BIT) 00047 #define SR_T (1<<SR_T_BIT) 00056 #define IS_CS(sr) ((sr)&SR_C) 00057 #define IS_CC(sr) (!IS_CS(sr)) 00058 00059 #define IS_EQ(sr) ((sr)&SR_Z) 00060 #define IS_NE(sr) (!IS_EQ(sr)) 00061 00062 #define IS_VS(sr) ((sr)&SR_V) 00063 #define IS_VC(sr) (!IS_VS(sr)) 00064 00065 #define IS_MI(sr) ((sr)&SR_N) 00066 #define IS_PL(sr) (!IS_MI(sr)) 00067 00068 #define IS_LS(sr) ((sr)&(SR_C|SR_Z)) 00069 #define IS_LT(sr) (((sr)^((sr)>>2))&SR_V) 00070 #define IS_LE(sr) (IS_LT(sr)|IS_EQ(sr)) 00071 00072 #define IS_GE(sr) (!IS_LT(sr)) 00073 #define IS_GT(sr) (!IS_LE(sr)) 00074 #define IS_HI(sr) (!IS_LS(sr)) 00075 00076 #define IS_T(sr) 1 00077 #define IS_F(sr) 0 00078 00087 #define MOVESR(SR,SRC) (SR) = \ 00088 ( ((SR)&~(SR_Z|SR_N|SR_V|SR_C)) | \ 00089 (((SRC)==0)<<SR_Z_BIT ) | (( (SRC)<0)<<SR_N_BIT ) ) 00090 00092 #define GET_CCR(SR) ((u8)(SR)) 00093 00095 #define SET_CCR(SR,CCR) (SR) = (((SR)&0xFF00) | (CCR)) 00096 00098 #define GET_IPL(n) (((n)>>SR_IPL)&7) 00099 00101 #define SET_IPL(sr,n) (sr) = (((sr)&(7<<SR_IPL_BIT)) | ((n)<<SR_IPL_BIT))) 00102 00105 #ifdef __cplusplus 00106 } 00107 #endif 00108 00109 #endif /* #ifndef _SRDEF68_H_ */