aboutsummaryrefslogtreecommitdiff
path: root/kernel/output/writer.sats
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/output/writer.sats')
-rw-r--r--kernel/output/writer.sats33
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/output/writer.sats b/kernel/output/writer.sats
new file mode 100644
index 0000000..fd33424
--- /dev/null
+++ b/kernel/output/writer.sats
@@ -0,0 +1,33 @@
+#define BUFFER_HEIGHT 23
+#define BUFFER_WIDTH 80
+#define N BUFFER_HEIGHT * BUFFER_WIDTH
+
+datatype color =
+ | Black
+ | Blue
+ | Green
+ | Cyan
+ | Red
+ | Magenta
+ | Brown
+ | LightGray
+ | DarkGray
+ | LightBlue
+ | LightGreen
+ | LightCyan
+ | LightRed
+ | Pink
+ | Yellow
+ | White
+
+
+typedef screenChar = @{ ascii_character = char, color_code = uint8}
+
+vtypedef buffer = [l : agz] (@[screenChar][N] @ l | ptr l)
+typedef writer = @{position = [a:int | a >= 0 && a < N] int (a), color_code = uint8}
+
+castfn i2u8 {n: nat} (i: int n): uint8 n
+
+fun put_string (str : string) : void
+fun clear_screen() : void
+