Home Download Musics Developers
API Sources Tools File Format Technicals

srdef68.h

Go to the documentation of this file.
00001 
00012 /* Copyright (C) 1998-2003 Benjamin Gerard */
00013 
00014 #ifndef _SRDEF68_H_
00015 #define _SRDEF68_H_
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00040 #define SR_C_BIT 0    
00041 #define SR_V_BIT 1    
00042 #define SR_Z_BIT 2    
00043 #define SR_N_BIT 3    
00044 #define SR_X_BIT 4    
00045 #define SR_IPL_BIT 8  
00046 #define SR_S_BIT 13   
00047 #define SR_T_BIT 15   
00049 #define SR_C (1<<SR_C_BIT)  
00050 #define SR_V (1<<SR_V_BIT)  
00051 #define SR_Z (1<<SR_Z_BIT)  
00052 #define SR_N (1<<SR_N_BIT)  
00053 #define SR_X (1<<SR_X_BIT)  
00054 #define SR_S (1<<SR_S_BIT)  
00055 #define SR_T (1<<SR_T_BIT)  
00067 #define IS_CS(sr) ((sr)&SR_C)
00068 #define IS_CC(sr) (!IS_CS(sr))
00069 
00070 #define IS_EQ(sr) ((sr)&SR_Z)
00071 #define IS_NE(sr) (!IS_EQ(sr))
00072 
00073 #define IS_VS(sr) ((sr)&SR_V)
00074 #define IS_VC(sr) (!IS_VS(sr))
00075 
00076 #define IS_MI(sr) ((sr)&SR_N)
00077 #define IS_PL(sr) (!IS_MI(sr))
00078 
00079 #define IS_LS(sr) ((sr)&(SR_C|SR_Z))
00080 #define IS_LT(sr) (((sr)^((sr)>>2))&SR_V)
00081 #define IS_LE(sr) (IS_LT(sr)|IS_EQ(sr))
00082 
00083 #define IS_GE(sr) (!IS_LT(sr))
00084 #define IS_GT(sr) (!IS_LE(sr))
00085 #define IS_HI(sr) (!IS_LS(sr))
00086 
00087 #define IS_T(sr)  1
00088 #define IS_F(sr)  0
00089 
00101 #define MOVESR(SR,SRC) (SR) = \
00102         ( ((SR)&~(SR_Z|SR_N|SR_V|SR_C)) | \
00103         (((SRC)==0)<<SR_Z_BIT ) | (( (SRC)<0)<<SR_N_BIT ) )
00104 
00106 #define GET_CCR(SR) ((u8)(SR))
00107 
00109 #define SET_CCR(SR,CCR) (SR) = (((SR)&0xFF00) | (CCR))
00110 
00112 #define GET_IPL(n) (((n)>>SR_IPL)&7)
00113 
00115 #define SET_IPL(sr,n) (sr) = (((sr)&(7<<SR_IPL_BIT)) | ((n)<<SR_IPL_BIT)))
00116 
00123 #ifdef __cplusplus
00124 }
00125 #endif
00126 
00127 #endif /* #ifndef _SRDEF68_H_ */