summaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
authorBenji Dial <Benji3.141@gmail.com>2020-11-08 11:11:49 -0500
committerBenji Dial <Benji3.141@gmail.com>2020-11-08 11:11:49 -0500
commit21491514b3642a321ce65f2a07428f63c4d9feb5 (patch)
treecf2384926e9d8e4cb0dcf2c9babd37fc7809c5da /src/kernel
parent594aeeb09bc24de7064eb1bddf6e86c1a134838e (diff)
downloadportland-os-21491514b3642a321ce65f2a07428f63c4d9feb5.tar.gz
manual viewer, "swap colors" system call
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/idt.c3
-rw-r--r--src/kernel/isrs.asm2
-rw-r--r--src/kernel/vga.c5
-rw-r--r--src/kernel/vga.h1
4 files changed, 9 insertions, 2 deletions
diff --git a/src/kernel/idt.c b/src/kernel/idt.c
index 1b8e548..ebeea17 100644
--- a/src/kernel/idt.c
+++ b/src/kernel/idt.c
@@ -120,7 +120,8 @@ void const *syscall_table[] = {
&vga_print_at,
&sc_count_of_dir,
&vga_blank,
- &vga_set_color
+ &vga_set_color,
+ &vga_swap_color
};
//these aren't really void ()'s, but gcc complains if we take an address of a void, so we give it a type
diff --git a/src/kernel/isrs.asm b/src/kernel/isrs.asm
index e7573ae..472bb40 100644
--- a/src/kernel/isrs.asm
+++ b/src/kernel/isrs.asm
@@ -23,7 +23,7 @@ extern on_kbd_isr
extern make_sure_tasks
extern exception_halt
-n_syscalls equ 0xf
+n_syscalls equ 0x10
;section .bss
;_debug_is_start_task resb 1
diff --git a/src/kernel/vga.c b/src/kernel/vga.c
index 42da312..6ae1588 100644
--- a/src/kernel/vga.c
+++ b/src/kernel/vga.c
@@ -12,6 +12,11 @@ void vga_set_color(uint8_t new_color) {
mask = new_color << 8;
}
+void vga_swap_color(uint16_t pos) {
+ uint8_t *color_byte = (uint8_t *)(VGA_START + (pos >> 8) * VGA_COLUMNS + (pos & 0xff)) + 1;
+ *color_byte = (*color_byte << 4) + (*color_byte >> 4);
+}
+
static void vga_scroll() {
for (uint32_t *i = (uint32_t *)VGA_START; i < (uint32_t *)(VGA_END - VGA_COLUMNS); ++i)
*i = *(i + VGA_COLUMNS / 2);
diff --git a/src/kernel/vga.h b/src/kernel/vga.h
index fa97e11..dd1c906 100644
--- a/src/kernel/vga.h
+++ b/src/kernel/vga.h
@@ -7,5 +7,6 @@ void vga_print_at(uint16_t pos, const char *sz);
void vga_set_color(uint8_t color);
void vga_blank();
void vga_printch(char ch);
+void vga_swap_color(uint16_t pos);
#endif \ No newline at end of file