Skip to content

Instantly share code, notes, and snippets.

@skejeton
Created March 28, 2020 09:48
Show Gist options
  • Save skejeton/81e88b5f3ae6eb02ae0b5779a83067fd to your computer and use it in GitHub Desktop.
Save skejeton/81e88b5f3ae6eb02ae0b5779a83067fd to your computer and use it in GitHub Desktop.
void s2_VGADrawBufferI(s2_UInt8 *buffer)
{
for (int c = 0; c < 4; c++)
{
s2_UInt8 colorMask = 1<<c;
s2_OutB(S2_VGAPORT_SEQIP, 0x02);
s2_OutB(S2_VGAPORT_SEQDP, colorMask);
s2_UInt32 v = 0;
s2_UInt32 *loc = 0;
for (s2_UInt32 i = 0; i < (640*480); i++)
{
s2_UInt32 r = (i+1)%32;
if (buffer[i] & colorMask)
{
v |= (1<<r);
}
else
{
v &= ~(1<<r);
}
if (r == 0) {
loc = ((s2_UInt32*)s2_VGALoc)+(i>>5);
*loc = v;
v = 0;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment