diff --git a/ReC98.h b/ReC98.h index a40c3954..3461ab3b 100644 --- a/ReC98.h +++ b/ReC98.h @@ -116,6 +116,13 @@ extern dots8_t *VRAM_PLANE_E; #define VRAM_OFFSET(x, y) ((x) >> 3) + (y << 6) + (y << 4) +#ifdef __cplusplus +static inline unsigned int vram_offset_shift(int x, int y) +{ + return VRAM_OFFSET(x, y); +} +#endif + #define VRAM_CHUNK(plane, offset, bit_count) \ *(dots##bit_count##_t *)(VRAM_PLANE_##plane + offset) diff --git a/th01/hardware/graph.cpp b/th01/hardware/graph.cpp index 46e10871..08cca560 100644 --- a/th01/hardware/graph.cpp +++ b/th01/hardware/graph.cpp @@ -462,7 +462,7 @@ void graph_r_vline(int x, int top, int bottom, int col) egc_copy_rect_1_to_0(x, top, sizeof(pattern) * 8, bottom - top); return; } - vram_row_offset = VRAM_OFFSET(x, top); + vram_row_offset = vram_offset_shift(x, top); pattern = graph_r_pattern >> (x & 7); pattern |= graph_r_pattern << (16 - (x & 7)); @@ -611,7 +611,7 @@ void graph_r_line(int left, int top, int right, int bottom, int col) plot_loop(y_cur, h, y_direction, x_cur, w, 1); } restore_last: - vram_offset = VRAM_OFFSET(x_cur, y_cur) - 1; + vram_offset = vram_offset_shift(x_cur, y_cur) - 1; restore_at(vram_offset); end: if(!graph_r_restore_from_1) {