Removed duplicate code and replaced linux io calls

svn path=/trunk/; revision=1412
This commit is contained in:
Eric Kohl 2000-10-22 01:59:51 +00:00
parent a83fd9fd73
commit 382d5a76c2
2 changed files with 24 additions and 52 deletions

View file

@ -4,7 +4,6 @@
#include <ntos/minmax.h>
#include "vgavideo.h"
#include "../../../../ntoskrnl/include/internal/i386/io.h"
INT abs(INT nm)
{
@ -373,11 +372,11 @@ void BltFromVGA(int x, int y, int w, int h, void *b, int bw)
ASSIGNVP4(x, y, vpP)
ASSIGNMK4(x, y, maskP)
get_masks(x, w);
outb(GRA_I, 0x05); /* read mode 0 */
saved_GC_mode = inb(GRA_D);
outb(GRA_D, 0x00);
outb(GRA_I, 0x04); /* read map select */
saved_GC_rmap = inb(GRA_D);
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05); /* read mode 0 */
saved_GC_mode = READ_PORT_UCHAR((PUCHAR)GRA_D);
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x00);
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x04); /* read map select */
saved_GC_rmap = READ_PORT_UCHAR((PUCHAR)GRA_D);
/* clear buffer */
bp=b;
for (j=h; j>0; j--) {
@ -385,7 +384,7 @@ void BltFromVGA(int x, int y, int w, int h, void *b, int bw)
bp += bw;
}
for (plane=0, plane_mask=1; plane<4; plane++, plane_mask<<=1) {
outb(GRA_D, plane); /* read map select */
WRITE_PORT_UCHAR((PUCHAR)GRA_D, plane); /* read map select */
vpY = vpP;
bpY = b;
for (j=h; j>0; j--) {
@ -436,9 +435,9 @@ void BltFromVGA(int x, int y, int w, int h, void *b, int bw)
}
}
/* reset GC register */
outb(GRA_D, saved_GC_rmap);
outb(GRA_I, 0x05);
outb(GRA_D, saved_GC_mode);
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_rmap);
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05);
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mode);
}
@ -455,16 +454,16 @@ void BltToVGA(int x, int y, int w, int h, void *b, int bw)
ASSIGNVP4(x, y, vpX)
ASSIGNMK4(x, y, mask)
byte_per_line = SCREEN_X >> 3;
outb(GRA_I, 0x05); /* write mode 2 */
saved_GC_mode = inb(GRA_D);
outb(GRA_D, 0x02);
outb(GRA_I, 0x03); /* replace */
saved_GC_fun = inb(GRA_D);
outb(GRA_D, 0x00);
outb(GRA_I, 0x08); /* bit mask */
saved_GC_mask = inb(GRA_D);
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05); /* write mode 2 */
saved_GC_mode = READ_PORT_UCHAR((PUCHAR)GRA_D);
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x02);
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03); /* replace */
saved_GC_fun = READ_PORT_UCHAR((PUCHAR)GRA_D);
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x00);
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x08); /* bit mask */
saved_GC_mask = READ_PORT_UCHAR((PUCHAR)GRA_D);
for (i=w; i>0; i--) {
outb(GRA_D, mask);
WRITE_PORT_UCHAR((PUCHAR)GRA_D, mask);
bp = bpX;
vp = vpX;
for (j=h; j>0; j--) {
@ -479,9 +478,9 @@ void BltToVGA(int x, int y, int w, int h, void *b, int bw)
}
}
/* reset GC register */
outb(GRA_D, saved_GC_mask);
outb(GRA_I, 0x03);
outb(GRA_D, saved_GC_fun);
outb(GRA_I, 0x05);
outb(GRA_D, saved_GC_mode);
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mask);
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03);
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_fun);
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05);
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mode);
}

View file

@ -51,7 +51,7 @@ BOOL VGADDIIntersectRect(PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2);
#define LowByte(w) (*((unsigned char *)&(w) + 0))
#define HighByte(w) (*((unsigned char *)&(w) + 1))
#define ASSIGNVP4(x, y, vp) vp = vidmem /* VBUF */ + (((x) + (y)*SCREEN_X) >> 3);
#define ASSIGNMK4(x, y, mask) mask = 0x80 >> ((x) & 7);
@ -65,30 +65,3 @@ static unsigned char leftMask;
static int byteCounter;
static unsigned char rightMask;
static void
get_masks(int x, int w)
{
register int tmp;
leftMask = rightMask = 0;
byteCounter = w;
/* right margin */
tmp = (x+w) & 7;
if (tmp) {
byteCounter -= tmp;
rightMask = (unsigned char)(0xff00 >> tmp);
}
/* left margin */
tmp = x & 7;
if (tmp) {
byteCounter -= (8 - tmp);
leftMask = (0xff >> tmp);
}
/* too small ? */
if (byteCounter < 0) {
leftMask &= rightMask;
rightMask = 0;
byteCounter = 0;
}
byteCounter /= 8;
}