feature: black screen with scrolling is better, it also uses the full screen length
This commit is contained in:
parent
dda9c8a1ef
commit
77928aca4b
@ -2,8 +2,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define FONT_SIZE 13
|
||||
|
||||
struct font {
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
|
@ -5,10 +5,11 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define VGA_WIDTH 80
|
||||
#define VGA_HEIGHT 25
|
||||
#define SCREEN_WIDTH 1024
|
||||
#define SCREEN_HEIGHT 768
|
||||
#define FONT_SIZE 13
|
||||
#define VGA_WIDTH (SCREEN_WIDTH / FONT_SIZE)
|
||||
#define VGA_HEIGHT (SCREEN_HEIGHT / FONT_SIZE)
|
||||
#define TERM_COUNT 10
|
||||
|
||||
struct screen {
|
||||
@ -51,6 +52,7 @@ int terminal_writestring(const char *data);
|
||||
int terminal_writelong(long number);
|
||||
void terminal_set_screen(int pos);
|
||||
void terminal_clear(void);
|
||||
void terminal_refresh(void);
|
||||
struct key_event terminal_getkey(void);
|
||||
void update_cursor(void);
|
||||
void move_cursor(int direction);
|
||||
|
@ -33,8 +33,7 @@ static void init_vbe(multiboot_info_t *mbd_virt)
|
||||
{
|
||||
const uint32_t framebuffer_size =
|
||||
mbd_virt->framebuffer_height * mbd_virt->framebuffer_pitch;
|
||||
uint32_t i = 0;
|
||||
for (; i < CEIL(framebuffer_size, PAGE_SIZE); i++) {
|
||||
for (uint32_t i = 0; i < CEIL(framebuffer_size, PAGE_SIZE); i++) {
|
||||
vbe_page_table[i % 1024] =
|
||||
((mbd_virt->framebuffer_addr + i * PAGE_SIZE) & PAGE_MASK) |
|
||||
INIT_FLAGS;
|
||||
|
@ -3,11 +3,13 @@
|
||||
#include "alloc.h"
|
||||
#include "commands.h"
|
||||
#include "ctype.h"
|
||||
#include "font.h"
|
||||
#include "kprintf.h"
|
||||
#include "shell.h"
|
||||
#include "string.h"
|
||||
#include "terminal.h"
|
||||
#include "utils.h"
|
||||
#include "vbe.h"
|
||||
|
||||
#define BORDER "==========================================================="
|
||||
#define HEADER "Welcome to bozOShell - Available Commands"
|
||||
@ -34,6 +36,7 @@ const struct shell_command cmds[] = {
|
||||
#define NB_CMDS ARRAY_SIZE(cmds)
|
||||
|
||||
extern struct screen *screen;
|
||||
extern struct icon *terminal_bg;
|
||||
extern int line_status;
|
||||
|
||||
void help_cmd(char *arg)
|
||||
@ -74,6 +77,9 @@ void auto_complete(void)
|
||||
kprintf("%c", screen->line[i]);
|
||||
}
|
||||
}
|
||||
void terminal_putentryat(struct font node, uint32_t fg_color, uint32_t bg_color,
|
||||
size_t x, size_t y);
|
||||
struct font get_font_node(int c);
|
||||
|
||||
static char *get_line(void)
|
||||
{
|
||||
@ -93,7 +99,7 @@ static char *get_line(void)
|
||||
continue;
|
||||
buf[--i] = '\0';
|
||||
move_cursor(LEFT);
|
||||
terminal_putchar(' ');
|
||||
/* terminal_refresh(); */
|
||||
move_cursor(LEFT);
|
||||
} else if (ev.scan_code == KEY_TAB && i) {
|
||||
auto_complete();
|
||||
|
@ -18,6 +18,11 @@
|
||||
static struct screen screens[TERM_COUNT];
|
||||
struct screen *screen = &screens[0];
|
||||
struct font *current_font = eating_pasta_regular_13_font;
|
||||
struct icon *terminal_bg = &image_icon;
|
||||
|
||||
static struct font get_font_node(int c);
|
||||
static void terminal_scroll(void);
|
||||
static void terminal_new_line(void);
|
||||
|
||||
void terminal_initialize(void)
|
||||
{
|
||||
@ -26,8 +31,6 @@ void terminal_initialize(void)
|
||||
screens[i].column = 0;
|
||||
screens[i].default_color = 0xffffff;
|
||||
screens[i].fg_color = screens[i].default_color;
|
||||
/* memcpy(screens[i].buffer, TERM_BUF, sizeof(screen->buffer));
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,21 +79,11 @@ uint8_t terminal_get_char(int x, int y)
|
||||
void terminal_putentryat(struct font node, uint32_t fg_color, uint32_t bg_color,
|
||||
size_t x, size_t y)
|
||||
{
|
||||
if (node.width == 1 && node.height == 1) {
|
||||
return;
|
||||
}
|
||||
char *glyph = node.bitmap;
|
||||
for (size_t cy = 0; cy < node.height; cy++) {
|
||||
for (size_t cx = 0; cx < node.width; cx++) {
|
||||
if (glyph[cy * node.width + cx] == '#')
|
||||
put_pixel(fg_color, x + cx, y + cy);
|
||||
/* put_pixel((glyph[cy * node.width +
|
||||
* cx] == '#') ? fg_color */
|
||||
/* : bg_color, */
|
||||
/* x + cx, y + cy); */
|
||||
/* else if (bg_color) */
|
||||
/* put_pixel(bg_color, x + cx, y + cy);
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -100,10 +93,22 @@ static struct font get_font_node(int c)
|
||||
return current_font[c];
|
||||
}
|
||||
|
||||
/* void terminal_refresh(void) */
|
||||
/* { */
|
||||
/* memset(display.buff, 0, display.height * display.pitch); */
|
||||
/* for (size_t i = 0; i < VGA_WIDTH * VGA_HEIGHT; i++) { */
|
||||
/* const uint32_t x = (i % VGA_WIDTH) * FONT_SIZE; */
|
||||
/* const uint32_t y = (i / VGA_WIDTH) * FONT_SIZE; */
|
||||
/* terminal_putentryat(get_font_node(screen->buffer[i]), */
|
||||
/* screen->fg_color, screen->bg_color, x, y);
|
||||
*/
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
static void terminal_scroll(void)
|
||||
{
|
||||
screen->row--;
|
||||
draw_icon(0, 0, &image_icon);
|
||||
memset(display.buff, 0, display.height * display.pitch);
|
||||
for (size_t i = 0; i < VGA_WIDTH * (VGA_HEIGHT - 1); i++) {
|
||||
const uint32_t x = (i % VGA_WIDTH) * FONT_SIZE;
|
||||
const uint32_t y = (i / VGA_WIDTH) * FONT_SIZE;
|
||||
@ -111,9 +116,6 @@ static void terminal_scroll(void)
|
||||
terminal_putentryat(get_font_node(screen->buffer[i]),
|
||||
screen->fg_color, screen->bg_color, x, y);
|
||||
}
|
||||
/* for (size_t i = 0; i < VGA_WIDTH; i++) */
|
||||
/* terminal_putentryat(get_font_node(' '), 0, 0, i * FONT_SIZE, */
|
||||
/* (VGA_HEIGHT - 1) * FONT_SIZE); */
|
||||
}
|
||||
|
||||
static void terminal_new_line(void)
|
||||
@ -153,7 +155,7 @@ void terminal_change_default_color(uint32_t color)
|
||||
void terminal_change_default_fg_color(uint32_t fg_color)
|
||||
{
|
||||
terminal_set_fg_color(fg_color);
|
||||
terminal_change_default_color(screen->fg_color);
|
||||
/* terminal_change_default_color(screen->fg_color); */
|
||||
}
|
||||
|
||||
void terminal_clear(void)
|
||||
|
Loading…
Reference in New Issue
Block a user