réplica de
https://github.com/Arnau478/quark.git
synced 2024-11-23 12:58:07 +01:00
VGA scroll
This commit is contained in:
pare
a59ad4dea1
commit
8a45392447
S'han modificat 3 arxius amb 21 adicions i 1 eliminacions
|
@ -1,5 +1,6 @@
|
|||
#include "vga.h"
|
||||
#include "../arch/i686/io.h"
|
||||
#include "../lib/memory.h"
|
||||
|
||||
static uint8_t current_color = VGA_COLOR_DEFAULT;
|
||||
|
||||
|
@ -62,7 +63,17 @@ int vga_print_char(char c, int x, int y){
|
|||
offset++;
|
||||
}
|
||||
|
||||
// TODO: Scroll
|
||||
if(offset >= VGA_WIDTH * VGA_HEIGHT){ // Overflow, must scroll
|
||||
for(int i = 1; i < VGA_HEIGHT; i++){
|
||||
memcpy(VGA_WIDTH*i*2 + VGA_MEMORY, VGA_WIDTH*(i-1)*2 + VGA_MEMORY, VGA_WIDTH*2);
|
||||
}
|
||||
char *last_line = VGA_WIDTH*(VGA_HEIGHT-1)*2 + VGA_MEMORY;
|
||||
for(int i = 0; i < VGA_WIDTH*2; i++){
|
||||
last_line[i] = 0;
|
||||
}
|
||||
|
||||
offset -= VGA_WIDTH;
|
||||
}
|
||||
|
||||
vga_set_cursor(offset);
|
||||
return offset;
|
||||
|
|
|
@ -19,3 +19,9 @@ void *kcalloc(size_t count, size_t size){
|
|||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void memcpy(uint8_t *source, uint8_t *dest, size_t count){
|
||||
for(size_t i = 0; i < count; i++){
|
||||
dest[i] = source[i];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define ALLOC_START (void *)0x1000
|
||||
|
||||
void *kmalloc(size_t size);
|
||||
// TODO: void kfree(void *ptr);
|
||||
void *kcalloc(size_t count, size_t size);
|
||||
|
||||
void memcpy(uint8_t *source, uint8_t *dest, size_t count);
|
||||
|
|
Loading…
Referencia en una nova incidència