#define SCREEN 0x4c00 #define COLUMNS 240 #define ROWS 128 #define BYTES_PER_ROW (COLUMNS / 8) void scroll_up(int cols, int rows) { int i; for (i = 0; i < rows - 1; i++) { char *dst = SCREEN + (i * BYTES_PER_ROW); memcpy(dst, dst + BYTES_PER_ROW, cols / 8); } } /* example */ scroll_up(160, 100);