#define TEST_BIT(b, offset) (1 & ((b) >> (offset)))#define SET_BIT(b, offset) ((b) |= (1 << (offset)))#define RESET_BIT(b, offset) ((b) &= (~(1 << (offset))))//将BCD码变为十进制,如将0x23变为23//注意:高四位和低四位均不能大于9#define BCD_TO_DECIMAL(bcd) ((BYTE)((((BYTE)(bcd)) >> 4) * 10 + (((BYTE)(bcd)) & 0x0f)))#define DECIMAL_TO_BCD(decimal) ((BYTE)(((((BYTE)(decimal)) / 10) << 4) | ((BYTE)(decimal)) % 10))#define NOP() _nop_()#define BYTE_ROTATE_LEFT(b, n) _crol_(b, n)#define BYTE_ROTATE_RIGHT(b, n) _cror_(b, n) #define WORD_ROTATE_LEFT(w, n) _irol_(w, n)#define WORD_ROTATE_RIGHT(w, n) _iror_(w, n) #define DWORD_ROTATE_LEFT(dw, n) _lrol_(dw, n)#define DWORD_ROTATE_RIGHT(dw, n) _lror_(dw, n)#define ENABLE_ALL_INTERRUPTS() (EA = 1)#define DISABLE_ALL_INTERRUPTS() (EA = 0)#endif
|