2015-02-24 15:17:50 +00:00
|
|
|
/* ReC98
|
|
|
|
* -----
|
2015-03-03 05:47:23 +00:00
|
|
|
* Main include file
|
2015-02-24 15:17:50 +00:00
|
|
|
*/
|
|
|
|
|
2015-03-03 05:47:23 +00:00
|
|
|
#include <master.h>
|
|
|
|
|
2015-03-01 21:52:25 +00:00
|
|
|
// Macros
|
|
|
|
// ------
|
|
|
|
#define CLAMP_INC(val, max) \
|
|
|
|
(val)++; \
|
|
|
|
if((val) > (max)) { \
|
|
|
|
(val) = (max); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define CLAMP_DEC(val, min) \
|
|
|
|
(val)--; \
|
|
|
|
if((val) < (min)) { \
|
|
|
|
(val) = (min); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define RING_INC(val, ring_end) \
|
|
|
|
(val)++; \
|
|
|
|
if((val) > (ring_end)) { \
|
|
|
|
(val) = 0; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define RING_DEC(val, ring_end) \
|
|
|
|
(val)--; \
|
|
|
|
if((val) < 0) { \
|
|
|
|
(val) = ring_end; \
|
|
|
|
}
|
|
|
|
// ------
|
|
|
|
|
2015-03-04 03:28:16 +00:00
|
|
|
#define RES_X 640
|
|
|
|
#define RES_Y 400
|
|
|
|
|
2015-03-01 21:52:25 +00:00
|
|
|
// PC-98 VRAM planes
|
|
|
|
// -----------------
|
2015-02-24 15:17:50 +00:00
|
|
|
typedef enum {
|
|
|
|
PL_B, PL_R, PL_G, PL_E, PL_COUNT
|
|
|
|
} vram_plane_t;
|
|
|
|
|
|
|
|
// Since array subscripts create slightly different assembly in places, we
|
|
|
|
// offer both variants.
|
|
|
|
extern char *VRAM_PLANE[PL_COUNT];
|
|
|
|
extern char *VRAM_PLANE_B;
|
|
|
|
extern char *VRAM_PLANE_G;
|
|
|
|
extern char *VRAM_PLANE_R;
|
|
|
|
extern char *VRAM_PLANE_E;
|
2015-02-24 14:45:38 +00:00
|
|
|
|
|
|
|
// Parenthesizing it like this avoids a signed 16-bit overflow.
|
2015-03-04 03:28:16 +00:00
|
|
|
#define PLANE_SIZE (RES_X * (RES_Y / 8))
|
2015-02-24 14:45:38 +00:00
|
|
|
|
|
|
|
#define PLANE_DWORD_BLIT(dst, src) \
|
|
|
|
for(p = 0; p < PLANE_SIZE; p += 4) { \
|
|
|
|
*(long*)((dst) + p) = *(long*)((src) + p); \
|
|
|
|
}
|
2015-02-25 22:05:20 +00:00
|
|
|
|
|
|
|
#define VRAM_OFFSET(x, y) ((x) >> 3) + (y << 6) + (y << 4)
|
2015-03-01 21:52:25 +00:00
|
|
|
// -----------------
|