www.brackeen.com
VGA must be a valid buffer or portion of memory. You might have to typecast it as well.
Code:
typedef unsigned char BYTE;
BYTE far *VGA=(BYTE far *)MK_FP(0xa000,0);
memset(VGA,0,length);
BYTE far *buffer=new BYTE[64000L];
memset(buffer,0,64000L);
or
Code:
...
void CLS(BYTE far *buffer,BYTE color)
{
unsigned int buf=FP_SEG(buffer);
asm {
cld //just to be sure
mov ax,buf
mov es,ax
mov cx,32000d
mov al,color
mov ah,color
rep stosw
}
}
int main(void)
{
asm {
mov ax,13h
int 10h
}
BYTE far *Screen=(BYTE far *)MK_FP(0xa000,0);
CLS(Screen,0);
return(0);
}
Don't use geninterrupt() as it can leave the registers in unpredictable states. You are better off either using inline asm for interrupts or using the versatile int86() and int86x() functions.
My function places x amount of words into the buffer instead of bytes which is a bit faster. If this were 32-bit you could use stosd which would be roughly twice as fast as this code.