summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2014-09-27 12:36:45 -0700
committeriximeow <me@iximeow.net>2014-09-27 12:36:45 -0700
commit61f66209c5c19aef3849a945a411d465fe188908 (patch)
treed90ade1b27cd2f3510b53b84106d7bcdd4072751 /src
parentd5c3d73e7d1ea90cd6e293881bda1a13bd20e3d4 (diff)
Basic vga write functions
currently has bug in pointers contained in bss, unsure why. Build, load, or segments are wrong. leaning towards segments.
Diffstat (limited to 'src')
-rw-r--r--src/kernel/main.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/kernel/main.c b/src/kernel/main.c
index f8e6c6a..d7965e2 100644
--- a/src/kernel/main.c
+++ b/src/kernel/main.c
@@ -1,17 +1,35 @@
__asm__(".code16gcc\n");
-int func() {
- __asm__(
- "mov $0x10, %%cx \n"
- "mov $0x0A, %%ah \n"
- "mov $0x74, %%al \n"
- "int $0x10 \n"
- "mov $42, %%eax \n"
- "ret \n"
- : :
- );
+void vga_graphics_write_at_offset(char, short);
+void vga_graphics_write(char);
+void vga_graphics_write_str(char*);
+
+static short CURSOR_LOC = 0;
+
+void _start() {
+ vga_graphics_write('a');
+ vga_graphics_write('/');
+ vga_graphics_write('b');
+ char foo[] = "hello how are you";
+ vga_graphics_write_str(foo);
+ while(1) { }
+}
+
+void vga_graphics_write_str(char* str) {
+ while(*str) {
+ vga_graphics_write(*str++);
+ }
+}
+
+void vga_graphics_write(char value) {
+ vga_graphics_write_at_offset(value, CURSOR_LOC);
+ CURSOR_LOC += 2;
}
-int _start() {
- return 1;
+void vga_graphics_write_at_offset(char value, short offset) {
+ __asm__(
+ "mov %0, %%al \n"
+ "mov %1, %%di \n"
+ "mov %%al, %%gs:(%%di) \n"
+ : :"r"(value), "r"(offset) : "%ax", "%di");
}