Update system to minimum working status
This commit is contained in:
parent
da9283ebd1
commit
96ed9e6785
|
@ -42,7 +42,16 @@ void term_putentryat (char c, uint8_t color, size_t x, size_t y) {
|
||||||
|
|
||||||
void term_putchar(char c) {
|
void term_putchar(char c) {
|
||||||
unsigned char uc = c;
|
unsigned char uc = c;
|
||||||
term_putentryat(uc, current_color, terminal_column, terminal_row);
|
|
||||||
|
switch (uc) {
|
||||||
|
case '\n':
|
||||||
|
terminal_column = 0;
|
||||||
|
terminal_row += 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
term_putentryat(uc, current_color, terminal_column, terminal_row);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(++terminal_column == TERM_WIDTH)
|
if(++terminal_column == TERM_WIDTH)
|
||||||
{
|
{
|
||||||
|
@ -59,6 +68,10 @@ void term_write(const char* data, size_t size) {
|
||||||
term_putchar(data[i]);
|
term_putchar(data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void term_writes(const char* data) {
|
||||||
|
term_write(data, strlen(data));
|
||||||
|
}
|
||||||
|
|
||||||
void puts(const char* string) {
|
void puts(const char* string) {
|
||||||
term_write(string, strlen(string));
|
term_write(string, strlen(string));
|
||||||
term_putchar('\n');
|
term_putchar('\n');
|
||||||
|
|
34
include/arch/i386/vga.h
Executable file
34
include/arch/i386/vga.h
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef ARCH_I386_VGA_H
|
||||||
|
#define ARCH_I386_VGA_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
enum vga_colors {
|
||||||
|
BLACK = 0,
|
||||||
|
BLUE = 1,
|
||||||
|
GREEN = 2,
|
||||||
|
CYAN = 3,
|
||||||
|
RED = 4,
|
||||||
|
MAGENTA = 5,
|
||||||
|
BROWN = 6,
|
||||||
|
LIGHT_GREY = 7,
|
||||||
|
DARK_GREY = 8,
|
||||||
|
LIGHT_BLUE = 9,
|
||||||
|
LIGHT_GREEN = 10,
|
||||||
|
LIGHT_CYAN = 11,
|
||||||
|
LIGHT_RED = 12,
|
||||||
|
LIGHT_MAGENTA = 13,
|
||||||
|
LIGHT_BROWN = 14,
|
||||||
|
WHITE = 15
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline uint8_t vga_color_set(enum vga_colors fg, enum vga_colors bg) {
|
||||||
|
return fg | bg << 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint16_t vga_entry(unsigned char uc, uint8_t color) {
|
||||||
|
return (uint16_t) uc | (uint16_t) color << 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -9,6 +9,7 @@ void screen_initialize(void);
|
||||||
void term_putentryat(char, uint8_t, size_t, size_t);
|
void term_putentryat(char, uint8_t, size_t, size_t);
|
||||||
void term_putchar(char);
|
void term_putchar(char);
|
||||||
void term_write(const char*, size_t);
|
void term_write(const char*, size_t);
|
||||||
|
void term_writes(const char*);
|
||||||
void puts(const char*);
|
void puts(const char*);
|
||||||
void set_cursor(int, int);
|
void set_cursor(int, int);
|
||||||
void term_scroll(void);
|
void term_scroll(void);
|
||||||
|
|
|
@ -7,13 +7,13 @@ int kernel_main(void) {
|
||||||
screen_initialize();
|
screen_initialize();
|
||||||
|
|
||||||
//Print a copyright message.
|
//Print a copyright message.
|
||||||
puts("(c)");
|
term_writes("(c)");
|
||||||
term_setcolor(GREEN);
|
term_setcolor(GREEN);
|
||||||
puts(" Project");
|
term_writes(" Project");
|
||||||
term_setcolor(RED);
|
term_setcolor(RED);
|
||||||
puts("RED");
|
term_writes("RED");
|
||||||
term_setcolor(WHITE);
|
term_setcolor(WHITE);
|
||||||
puts(", 2019\n");
|
term_writes(", 2019\n");
|
||||||
|
|
||||||
for(;;) {}
|
for(;;) {}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include <sys/stat.h>
|
/*#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/fcntl.h>
|
#include <sys/fcntl.h>
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
|
@ -45,3 +45,4 @@ int unlink(char* name);
|
||||||
int wait(int file, char* ptr, int len);
|
int wait(int file, char* ptr, int len);
|
||||||
|
|
||||||
int gettimeofday(struct timeval* p, struct timezone* z);
|
int gettimeofday(struct timeval* p, struct timezone* z);
|
||||||
|
*/
|
20
makefile
20
makefile
|
@ -80,16 +80,16 @@ install-kernel: red.kernel
|
||||||
cp red.kernel $(DESTDIR)$(BOOTDIR)
|
cp red.kernel $(DESTDIR)$(BOOTDIR)
|
||||||
|
|
||||||
gen-iso:
|
gen-iso:
|
||||||
rm -f red.iso \
|
rm -f red.iso
|
||||||
cp red.kernel iso/boot/kernel.elf \
|
cp red.kernel iso/boot/kernel.elf
|
||||||
genisoimage -R\
|
genisoimage -R \
|
||||||
-b boot/grub/stage2_eltorito\
|
-b boot/grub/stage2_eltorito \
|
||||||
-no-emul-boot\
|
-no-emul-boot \
|
||||||
-A ProjectRED\
|
-A ProjectRED \
|
||||||
-input-charset utf8\
|
-input-charset utf8 \
|
||||||
-quiet
|
-quiet \
|
||||||
-boot-info-table\
|
-boot-info-table \
|
||||||
-o red.iso\
|
-o red.iso \
|
||||||
iso
|
iso
|
||||||
|
|
||||||
-include $(OBJS:.o=.d)
|
-include $(OBJS:.o=.d)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user