diff options
-rw-r--r-- | arch/x86_64/boot/long_mode_init.asm | 3 | ||||
-rw-r--r-- | kernel/main.dats | 3 | ||||
-rw-r--r-- | kernel/writer.dats | 17 | ||||
-rw-r--r-- | kernel/writer.sats | 1 |
4 files changed, 18 insertions, 6 deletions
diff --git a/arch/x86_64/boot/long_mode_init.asm b/arch/x86_64/boot/long_mode_init.asm index c3167f9..22e7fd4 100644 --- a/arch/x86_64/boot/long_mode_init.asm +++ b/arch/x86_64/boot/long_mode_init.asm @@ -14,7 +14,4 @@ long_mode_start: extern main call main - ; print `OKAY` to screen - mov rax, 0x2f592f412f4b2f4f - mov qword [0xb8000], rax hlt diff --git a/kernel/main.dats b/kernel/main.dats index dfbaa49..bbd201a 100644 --- a/kernel/main.dats +++ b/kernel/main.dats @@ -4,6 +4,7 @@ staload "kernel/writer.sats" dynload "kernel/writer.dats" implement main0 () = ( - put_string(" Hello world\n"); + clear_screen(); + put_string("Hello world\n"); put_string("GOEIENDSG\n"); put_string("GOEIENDSG")) diff --git a/kernel/writer.dats b/kernel/writer.dats index cd6f5d7..3e75a90 100644 --- a/kernel/writer.dats +++ b/kernel/writer.dats @@ -51,7 +51,6 @@ staload WRITER = { end } - fun put_char (c : char, writer: &writer) : void = let val buf = get_buffer() val pos = writer.position @@ -62,12 +61,16 @@ in in if (new_pos < N) then writer.position := new_pos + else + clear_screen() end else ( buf.1->[writer.position] := @{ ascii_character = c, color_code = writer.color_code}; if (pos < N - 1) then - writer.position := succ(pos)); + writer.position := succ(pos) + else + clear_screen()); let prval() = eat_buffer buf in () end end @@ -80,3 +83,13 @@ implement put_string (str : string) : void = let prval() = fpf(pf) in end +implement clear_screen() : void = let + val (pf, fpf | p_val) = $WRITER.getref() + fun loop {n : nat | n < N - 1} .<N-n>. (i : int n, wr : &writer) : void = + (put_char('\0', wr); if (i < N - 2) then loop(i+1,wr)) +in + !p_val.position := 0; + loop(0,!p_val); + !p_val.position := 0; + let prval() = fpf(pf) in () end +end diff --git a/kernel/writer.sats b/kernel/writer.sats index 3ccfd7b..65a2ea9 100644 --- a/kernel/writer.sats +++ b/kernel/writer.sats @@ -29,3 +29,4 @@ typedef writer = @{position = [a:int | a >= 0 && a < N] int (a), color_code = u castfn i2u8 {n: nat} (i: int n): uint8 n fun put_string (str : string) : void +fun clear_screen() : void |