nuclear@0: #include nuclear@0: #include "vid.h" nuclear@0: nuclear@0: static uint16_t *vmem = (uint16_t*)0xb8000; nuclear@0: nuclear@1: void clear_scr(int color) nuclear@0: { nuclear@0: memset(vmem, 0, WIDTH * HEIGHT * 2); nuclear@0: } nuclear@0: nuclear@1: void set_char(char c, int x, int y, int fg, int bg) nuclear@0: { nuclear@1: uint16_t attr = (fg & 0xf) | ((bg & 7) << 4); nuclear@1: vmem[y * WIDTH + x] = (uint16_t)c | (attr << 8); nuclear@0: } nuclear@0: nuclear@1: void scroll_scr(void) nuclear@0: { nuclear@1: /* copy the second up to last text line, one line back, then nuclear@1: * clear the last line. nuclear@1: */ nuclear@1: memmove(vmem, vmem + WIDTH, WIDTH * (HEIGHT - 1) * 2); nuclear@1: memset(vmem + WIDTH * (HEIGHT -1), 0, WIDTH * 2); nuclear@0: }