void cga_write(char const* str) { int16_t* vram_current = CALC_LOCATION; while(str && *str) { if(*str != '\n' && *str != '\r') { switch(*str) { case '\t': { uint16_t x = ALIGN_UP(__cga_x + 1, 8) - __cga_x; __cga_x += x; while(x--) { *vram_current++ = ' ' | __cga_attr; } vram_current = CALC_LOCATION - 1; break; } case '\b': if(__cga_x > 0) --__cga_x; vram_current = CALC_LOCATION; *vram_current = ' ' | __cga_attr; break; default: *vram_current = *str | __cga_attr; ++__cga_x; break; } } if(__cga_x >= CGA_WIDTH || *str == '\n' || *str == '\r') { __cga_x = 0; if(*str != '\r') { ++__cga_y; vram_current = CALC_LOCATION - 1; } } if(__cga_y >= CGA_HEIGHT) { scroll1(); __cga_y = CGA_HEIGHT - 1; vram_current = CALC_LOCATION - 1; } ++str; ++vram_current; } }
int Scroll(void *v) { return scroll1(v, 1); }
/* * Scroll to the next/previous screen */ int scroll(void *v) { return scroll1(v, 0); }