Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Commit

Permalink
Allow fbterm scrolling to be re-enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
klange committed May 26, 2021
1 parent 1490175 commit d34245f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions kernel/misc/fbterm.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
*/
#include <kernel/printf.h>
#include <kernel/string.h>
#include <kernel/args.h>

/* Exported cell sizing */
size_t fbterm_width = 0;
size_t fbterm_height = 0;

/* Whether to scroll or wrap when cursor reaches the bottom. */
static int fbterm_scroll = 0;

/* Is this in a header somewhere? */
extern uint8_t * lfb_vid_memory;
extern uint16_t lfb_resolution_x;
Expand Down Expand Up @@ -212,11 +216,13 @@ static void process_char(char ch) {
x = LEFT_PAD;
}
if (y > lfb_resolution_y - char_height) {
y = 0;
/* scroll everything?*/
//y -= char_height;
//memmove(lfb_vid_memory, lfb_vid_memory + sizeof(uint32_t) * lfb_resolution_x * char_height, (lfb_resolution_y - char_height) * lfb_resolution_x * 4);
//memset(lfb_vid_memory + sizeof(uint32_t) * (lfb_resolution_y - char_height) * lfb_resolution_x, 0x05, char_height * lfb_resolution_x * 4);
if (fbterm_scroll) {
y -= char_height;
memmove(lfb_vid_memory, lfb_vid_memory + sizeof(uint32_t) * lfb_resolution_x * char_height, (lfb_resolution_y - char_height) * lfb_resolution_x * 4);
memset(lfb_vid_memory + sizeof(uint32_t) * (lfb_resolution_y - char_height) * lfb_resolution_x, 0x05, char_height * lfb_resolution_x * 4);
} else {
y = 0;
}
}
invert_at(x,y);
}
Expand All @@ -235,6 +241,10 @@ size_t fbterm_write(size_t size, uint8_t *buffer) {
void fbterm_initialize(void) {
memset(lfb_vid_memory, 0x05, lfb_resolution_x * lfb_resolution_y * 4);

if (args_present("fbterm-scroll")) {
fbterm_scroll = 1;
}

fbterm_width = (lfb_resolution_x - LEFT_PAD) / char_width;
fbterm_height = (lfb_resolution_y) / char_height;
previous_writer = printf_output;
Expand Down

0 comments on commit d34245f

Please sign in to comment.