From f87b0d4f9e0d889dfe411f14a1e334897d9b4c09 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Thu, 9 Jan 2020 21:17:16 +0100 Subject: [PATCH] [Maintenance] [th01] Don't #define away master.lib's graph_accesspage() macro We will in fact have to use both the function call and the macro version, even within the same translation unit. Part of P0067, funded by Splashman. --- th01/grps2xsc.c | 4 ++-- th01/hardware/egccopyr.c | 4 ++-- th01/hardware/pages.h | 3 --- th01/main_13.c | 4 ++-- th02/maine_05.c | 1 + 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/th01/grps2xsc.c b/th01/grps2xsc.c index fa9329e1..a2b344b5 100644 --- a/th01/grps2xsc.c +++ b/th01/grps2xsc.c @@ -31,7 +31,7 @@ void graph_slow_2xscale_rect_1_to_0(int x0, int y0, int x1, int y1, int w1, int int p1 = row_p1; for(col16 = 0; col16 < w1 / 16; col16++) { int scale_p; - graph_accesspage(1); + graph_accesspage_func(1); px16.B = *(planar16_t*)(VRAM_PLANE_B + p1); px16.R = *(planar16_t*)(VRAM_PLANE_R + p1); px16.G = *(planar16_t*)(VRAM_PLANE_G + p1); @@ -41,7 +41,7 @@ void graph_slow_2xscale_rect_1_to_0(int x0, int y0, int x1, int y1, int w1, int planar32_t dst32; planar32_t px32_nonzero; - graph_accesspage(0); + graph_accesspage_func(0); scale_2x(&px32_nonzero, px16_nonzero); grcg_setcolor_rmw(0); *(planar32_t*)(VRAM_PLANE_B + p0 + scale_p) = px32_nonzero; diff --git a/th01/hardware/egccopyr.c b/th01/hardware/egccopyr.c index e5269ba4..84bc7922 100644 --- a/th01/hardware/egccopyr.c +++ b/th01/hardware/egccopyr.c @@ -33,8 +33,8 @@ void egc_copy_rect_1_to_0(int x, int y, int w, int h) egc_start_copy(); for(row = 0; row < h; row++) { for(col = x_floor, p = row_p; col < x_end; p += 2, col += 16) { - graph_accesspage(1); bits = *(planar16_t*)(VRAM_PLANE_B + p); - graph_accesspage(0); *(planar16_t*)(VRAM_PLANE_B + p) = bits; + graph_accesspage_func(1); bits = *(planar16_t*)(VRAM_PLANE_B + p); + graph_accesspage_func(0); *(planar16_t*)(VRAM_PLANE_B + p) = bits; } row_p += 640 / 8; } diff --git a/th01/hardware/pages.h b/th01/hardware/pages.h index be07b722..2a555536 100644 --- a/th01/hardware/pages.h +++ b/th01/hardware/pages.h @@ -1,6 +1,3 @@ // Also updates [page_back]. void graph_showpage_func(page_t page); - void graph_accesspage_func(int page); -#undef graph_accesspage -#define graph_accesspage graph_accesspage_func diff --git a/th01/main_13.c b/th01/main_13.c index 0f8a7e08..a22e1cb0 100644 --- a/th01/main_13.c +++ b/th01/main_13.c @@ -29,12 +29,12 @@ void graph_copy_hline_mask_1_to_0(int x, int y, char *mask, int w) register int p = VRAM_OFFSET(x, y); for(col = 0; col < w; col++, p++) { if(mask[col]) { - graph_accesspage(1); + graph_accesspage_func(1); px8.B = mask[col] & VRAM_PLANE_B[p]; px8.R = mask[col] & VRAM_PLANE_R[p]; px8.G = mask[col] & VRAM_PLANE_G[p]; px8.E = mask[col] & VRAM_PLANE_E[p]; - graph_accesspage(0); + graph_accesspage_func(0); grcg_setcolor_rmw(0); VRAM_PLANE_B[p] = mask[col]; grcg_off(); diff --git a/th02/maine_05.c b/th02/maine_05.c index 5be76985..3c5009bb 100644 --- a/th02/maine_05.c +++ b/th02/maine_05.c @@ -24,6 +24,7 @@ void pascal near rotrect_draw(int rad, unsigned char angle) grcg_line(x[3], y[3], x[0], y[0]); } +#define graph_accesspage_func graph_accesspage #include "th01\hardware\egccopyr.c" void pascal rotrect_animate(char rot_speed, char start_angle)