All pastes #988193 Raw Edit

Untitled

public c v1 · immutable
#988193 ·published 2008-04-17 11:26 UTC
rendered paste body
unsigned short* videoram = (unsigned short*)0xB8000;int width = 80;int height = 25;void vgacon_init(){}void vgacon_clear(){        memset (videoram, 0, (( width * height) * 2)); /* a VGA character is 16bits wide */}void vgacon_scroll(int lines){        unsigned short size = lines * width;        unsigned short *src = videoram + size;        memcpy (videoram, src, ((width * height) - size)*2); /* a VGA character is 16bits wide */        memset ((unsigned short*)videoram + ((width * height) - size), 0, (size * 2));}void vgacon_putc(unsigned short x, unsigned short y, unsigned short character, unsigned short attributes){        unsigned short* where = videoram + ((width*x)+y);        unsigned attr = attributes << 8;        *where = character | attr;}