ReC98/ReC98.h

40 lines
640 B
C

/* ReC98
* -----
* Main include file
*/
#ifndef REC98_H
#define REC98_H
#include <stddef.h>
#include "platform.h"
#include "pc98.h"
#include "planar.h"
// Macros
// ------
#ifdef __cplusplus
// This is, in fact, the only way to circumvent 16-bit promotion inside
// comparisons between two 8-bit values in C++. I kid you not.
static inline char ring_min() {
return 0;
}
#else
#define ring_min() 0
#endif
#define RING_INC(val, ring_end) \
(val)++; \
if((val) > (ring_end)) { \
(val) = 0; \
}
#define RING_DEC(val, ring_end) \
(val)--; \
if(val < ring_min()) { \
(val) = ring_end; \
}
// ------
#endif /* REC98_H */