// 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); } void egc_copy_region_from_1_to_0(int x, int y, int w, int h) { register int x_end = x; register int x_floor = x_end; int row; int col; int row_p; int bits; int p; x_end += w; x_floor &= 0xFFF0; row_p = VRAM_OFFSET(x_floor, y); 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 = *(int*)(VRAM_PLANE_B + p); graph_accesspage(0); *(int*)(VRAM_PLANE_B + p) = bits; } row_p += 640 / 8; } egc_off(); }