aboutsummaryrefslogtreecommitdiff
path: root/kernel/main.dats
diff options
context:
space:
mode:
authorXander <xander@icth.xyz>2023-06-30 21:25:18 +0200
committerXander <xander@icth.xyz>2023-06-30 21:27:18 +0200
commite9b14562b46f230e7208ea3dad8d836f73e8f100 (patch)
tree3cfa4355c7e48e295e4b362e6266936a20b2274b /kernel/main.dats
parent3f846ecba11a66d7679a68c187d4f6e3560af5e6 (diff)
downloadats-os-e9b14562b46f230e7208ea3dad8d836f73e8f100.tar.xz
ats-os-e9b14562b46f230e7208ea3dad8d836f73e8f100.zip
Modulating print
Diffstat (limited to 'kernel/main.dats')
-rw-r--r--kernel/main.dats30
1 files changed, 3 insertions, 27 deletions
diff --git a/kernel/main.dats b/kernel/main.dats
index e7a68f5..bbec179 100644
--- a/kernel/main.dats
+++ b/kernel/main.dats
@@ -1,16 +1,7 @@
#include "share/atspre_staload.hats"
-%{^
- #define get_vram(_) ((void *) 0xB8000 + 1988)
-%}
-
-typedef cell = @{ ch = char, attrib = uint8 }
-
-extern fun get_vram {n: nat} (n : size_t n):<> [l: agz] (@[cell][n] @ l | ptr l) = "mac#"
-
-extern prfun eat_vram {l: agz} {n: int} (pf: @[cell][n] @ l): void
-
-extern castfn uint8_of {n: nat} (i: int n): uint8 n
+staload "kernel/writer.sats"
+dynload "kernel/writer.dats"
fn string_length {n:nat} (str: string (n)) : size_t (n) = let
fun loop {i:nat | i <= n} .<n-i>. (str: string n, i: size_t i): size_t (n) =
@@ -19,19 +10,4 @@ in
loop (str, i2sz(0))
end
-implement main0 () = let
- val hello = "Hello world!"
- val length = string_length hello
- val color_byte = 0x1f
- val (pf_vram | vram) = get_vram(length)
- fun loop {l : agz} {n,i: nat | i <= n} .<n-i>. (pf: !(@[cell][n] @ l) | n : size_t n, i : int i, p : ptr l, str: string (n)) : void =
- if n > i then (
- p->[i] := @{ ch = str[i], attrib = uint8_of color_byte };
- loop(pf | n,i+1,p,str))
- else ()
-
-in
- loop(pf_vram | length, 0, vram, hello);
- let prval () = eat_vram pf_vram in () end
-end
-
+implement main0 () = print_char('X')