about summary refs log tree commit diff stats
path: root/apps/tui.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-05-27 01:41:35 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-27 01:41:35 -0700
commit415354264b0fb9d8914fb8edf219b84aa7a1e1d1 (patch)
tree23aac394f60e23d8d6eac6ac77b9011a00a5c5d9 /apps/tui.mu
parent9511ff5cd7aeef4ccf501920e6969d2b15ecf2d5 (diff)
downloadmu-415354264b0fb9d8914fb8edf219b84aa7a1e1d1.tar.gz
6410 - primitives for raw keyboard input
Diffstat (limited to 'apps/tui.mu')
-rw-r--r--apps/tui.mu29
1 files changed, 29 insertions, 0 deletions
diff --git a/apps/tui.mu b/apps/tui.mu
new file mode 100644
index 00000000..e2f97609
--- /dev/null
+++ b/apps/tui.mu
@@ -0,0 +1,29 @@
+# test some primitives for text-mode 
+
+fn main -> exit-status/ebx: int {
+  var nrows/eax: int <- copy 0
+  var ncols/ecx: int <- copy 0
+  nrows, ncols <- screen-size
+  enable-screen-grid-mode
+  move-cursor 5, 35
+  start-color 1, 0x7a
+  start-blinking
+  print-string "Hello world!"
+  reset-formatting
+  move-cursor 6, 35
+  print-string "tty dimensions: "
+  print-int32-to-screen nrows
+  print-string " rows, "
+  print-int32-to-screen ncols
+  print-string " rows\n"
+
+  print-string "press a key to see its code: "
+  enable-keyboard-immediate-mode
+  var x/eax: byte <- read-key
+  enable-keyboard-type-mode
+  enable-screen-type-mode
+  print-string "You pressed "
+  print-int32-to-screen x
+  print-string "\n"
+  exit-status <- copy 0
+}