[Maintenance] Move the EGC copy setup function to a separate file

Too bad we still have to bother with renaming the function via #define
in the few cases where an executable contains two or more copies of
this function. We can't just make it `static`, since TH02 MAINE.EXE
actually does far-call it from a different segment (and thus,
translation unit).

Part of P0094, funded by Yanga.
This commit is contained in:
nmlgc 2020-05-23 18:20:56 +02:00
parent 5c77db08ca
commit a7230ba26a
2 changed files with 19 additions and 18 deletions

View File

@ -1,21 +1,4 @@
// Alternate version that sets the value first
#define OUTW2(port, val) __asm { \
mov ax, val; \
mov dx, port; \
out dx, ax; \
}
void pascal egc_start_copy(void)
{
egc_on();
OUTW2(EGC_ACTIVEPLANEREG, 0xFFF0);
OUTW2(EGC_READPLANEREG, 0x00FF);
// EGC_COMPAREREAD | EGC_WS_PATREG | EGC_RL_MEMREAD
OUTW2(EGC_MODE_ROP_REG, 0x3100);
OUTW2(EGC_MASKREG, 0xFFFF);
OUTW2(EGC_ADDRRESSREG, 0);
OUTW2(EGC_BITLENGTHREG, 0xF);
}
#include "th01/hardware/egcscopy.c"
void egc_copy_rect_1_to_0(int x, int y, int w, int h)
{

18
th01/hardware/egcscopy.c Normal file
View File

@ -0,0 +1,18 @@
// Alternate version that sets the value first
#define OUTW2(port, val) __asm { \
mov ax, val; \
mov dx, port; \
out dx, ax; \
}
void pascal egc_start_copy(void)
{
egc_on();
OUTW2(EGC_ACTIVEPLANEREG, 0xFFF0);
OUTW2(EGC_READPLANEREG, 0x00FF);
// EGC_COMPAREREAD | EGC_WS_PATREG | EGC_RL_MEMREAD
OUTW2(EGC_MODE_ROP_REG, 0x3100);
OUTW2(EGC_MASKREG, 0xFFFF);
OUTW2(EGC_ADDRRESSREG, 0);
OUTW2(EGC_BITLENGTHREG, 0xF);
}