sc68fordevelopers  2.2.1
srdef68.h
Go to the documentation of this file.
1 
19 /* Copyright (C) 1998-2001 Ben(jamin) Gerard */
20 
21 #ifndef _SRDEF68_H_
22 #define _SRDEF68_H_
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
32 #define SR_C_BIT 0
33 #define SR_V_BIT 1
34 #define SR_Z_BIT 2
35 #define SR_N_BIT 3
36 #define SR_X_BIT 4
37 #define SR_IPL_BIT 8
38 #define SR_S_BIT 13
39 #define SR_T_BIT 15
41 #define SR_C (1<<SR_C_BIT)
42 #define SR_V (1<<SR_V_BIT)
43 #define SR_Z (1<<SR_Z_BIT)
44 #define SR_N (1<<SR_N_BIT)
45 #define SR_X (1<<SR_X_BIT)
46 #define SR_S (1<<SR_S_BIT)
47 #define SR_T (1<<SR_T_BIT)
56 #define IS_CS(sr) ((sr)&SR_C)
57 #define IS_CC(sr) (!IS_CS(sr))
58 
59 #define IS_EQ(sr) ((sr)&SR_Z)
60 #define IS_NE(sr) (!IS_EQ(sr))
61 
62 #define IS_VS(sr) ((sr)&SR_V)
63 #define IS_VC(sr) (!IS_VS(sr))
64 
65 #define IS_MI(sr) ((sr)&SR_N)
66 #define IS_PL(sr) (!IS_MI(sr))
67 
68 #define IS_LS(sr) ((sr)&(SR_C|SR_Z))
69 #define IS_LT(sr) (((sr)^((sr)>>2))&SR_V)
70 #define IS_LE(sr) (IS_LT(sr)|IS_EQ(sr))
71 
72 #define IS_GE(sr) (!IS_LT(sr))
73 #define IS_GT(sr) (!IS_LE(sr))
74 #define IS_HI(sr) (!IS_LS(sr))
75 
76 #define IS_T(sr) 1
77 #define IS_F(sr) 0
78 
87 #define MOVESR(SR,SRC) (SR) = \
88  ( ((SR)&~(SR_Z|SR_N|SR_V|SR_C)) | \
89  (((SRC)==0)<<SR_Z_BIT ) | (( (SRC)<0)<<SR_N_BIT ) )
90 
92 #define GET_CCR(SR) ((u8)(SR))
93 
95 #define SET_CCR(SR,CCR) (SR) = (((SR)&0xFF00) | (CCR))
96 
98 #define GET_IPL(n) (((n)>>SR_IPL)&7)
99 
101 #define SET_IPL(sr,n) (sr) = (((sr)&(7<<SR_IPL_BIT)) | ((n)<<SR_IPL_BIT)))
102 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* #ifndef _SRDEF68_H_ */