-#include <ddk/ntddvdeo.h>
-#include <ddk/winddi.h>
-#include <ntos/minmax.h>
+#define _WINBASE_
+#define _WINDOWS_H
+#include <stdarg.h>
+#include <windef.h>
+#include <guiddef.h>
+#include <wingdi.h>
+#include <winddi.h>
+#include <winioctl.h>
+#include <ntddvdeo.h>
#include <stdlib.h>
#include "vgavideo.h"
+#define DDKAPI __stdcall
+#define DDKFASTAPI __fastcall
+#define FASTCALL __fastcall
+#define DDKCDECLAPI __cdecl
+
+VOID DDKAPI WRITE_PORT_UCHAR(IN PUCHAR Port, IN UCHAR Value);
+VOID DDKAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value);
+
UCHAR PreCalcReverseByte[256];
int maskbit[640];
int y80[480];
#define READ_REGISTER_UCHAR(p) (*((volatile UCHAR *)(p)))
#define WRITE_REGISTER_UCHAR(p,c) (*((volatile CHAR *)(p))) = (c)
-INT abs(INT nm)
-{
- if(nm<0)
- {
- return nm * -1;
- } else
- {
- return nm;
- }
-}
-
-div_t div(int num, int denom)
-{
- div_t r;
- if (num > 0 && denom < 0) {
- num = -num;
- denom = -denom;
- }
- r.quot = num / denom;
- r.rem = num % denom;
- if (num < 0 && denom > 0)
- {
- if (r.rem > 0)
- {
- r.quot++;
- r.rem -= denom;
- }
- }
- return r;
-}
/*int mod(int num, int denom)
{
case BMF_24BPP:
return 3;
-
+
case BMF_32BPP:
return 4;
for (j = 0; j < 256; j++)
{
- PreCalcReverseByte[j] =
+ PreCalcReverseByte[j] =
(((j >> 0) & 0x1) << 7) |
(((j >> 1) & 0x1) << 6) |
(((j >> 2) & 0x1) << 5) |
UCHAR a;
ULONG pre1;
ULONG orgpre1, orgx, midpre1;
- ULONG ileftpix, imidpix, irightpix;
+ LONG ileftpix, imidpix, irightpix;
orgx = x;
BOOL vgaVLine(INT x, INT y, INT len, UCHAR c)
{
- ULONG offset, i;
+ INT offset, i;
UCHAR a;
offset = xconv[x]+y80[y];
{
ULONG plane;
ULONG left = x >> 3;
- ULONG shift = x - (x & ~0x7);
- UCHAR pixel, nextpixel;
- ULONG rightcount;
- ULONG i, j;
- ULONG stride = w >> 3;
-
+ ULONG shift = x - (x & ~0x7);
+ UCHAR pixel, nextpixel;
+ LONG rightcount;
+ INT i, j;
+ LONG stride = w >> 3;
+
/* Calculate the number of rightmost bytes not in a dword block. */
if (w >= 8)
{
/* Reset the destination. */
for (j = 0; j < h; j++)
{
- memset(b + (j * Dest_lDelta), 0, abs(Dest_lDelta));
+ memset((PVOID)((ULONG_PTR)b + (j * Dest_lDelta)), 0, abs(Dest_lDelta));
}
for (plane = 0; plane < 4; plane++)
{
PUCHAR dest = b;
-
+
/* Select the plane we are reading in this iteration. */
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x04);
WRITE_PORT_UCHAR((PUCHAR)GRA_D, plane);
-
+
for (j = 0; j < h; j++)
{
PULONG destline = (PULONG)dest;
/* Form the data for one plane for an aligned block in the destination. */
pixel = nextpixel;
pixel >>= shift;
-
+
nextpixel = PreCalcReverseByte[READ_REGISTER_UCHAR(src + 1)];
pixel |= (nextpixel << (8 - shift));
/* Form the data for a complete block. */
pixel = nextpixel;
pixel >>= shift;
-
+
nextpixel = PreCalcReverseByte[READ_REGISTER_UCHAR(src + 1)];
pixel |= (nextpixel << (8 - shift));
-
+
row = UnpackPixel[pixel] << plane;
/* Store the data for each pixel in the destination. */
void DIB_BltToVGA(int x, int y, int w, int h, void *b, int Source_lDelta, int StartMod)
{
PBYTE pb, opb = b;
- ULONG i, j;
- ULONG x2 = x + w;
- ULONG y2 = y + h;
+ LONG i, j;
+ LONG x2 = x + w;
+ LONG y2 = y + h;
ULONG offset;
UCHAR a;
int i, j, dib_shift;
bpX = b;
- dib = bdib + y * dibw + (x / 2);
+ dib = (unsigned char *)bdib + y * dibw + (x / 2);
for (i=w; i>0; i--) {
int i, j, dib_shift, dib_and;
bpX = b;
- dib = bdib + y * dibw + (x / 2);
+ dib = (unsigned char *)bdib + y * dibw + (x / 2);
for (i=w; i>0; i--) {