From 3350c34a74844e21ea69077e01efff3bae64bdcd Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 23 Mar 2021 17:31:08 -0700 Subject: . --- html/linux/tui.mu.html | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 html/linux/tui.mu.html (limited to 'html/linux/tui.mu.html') diff --git a/html/linux/tui.mu.html b/html/linux/tui.mu.html new file mode 100644 index 00000000..b15448ea --- /dev/null +++ b/html/linux/tui.mu.html @@ -0,0 +1,96 @@ + + + + +Mu - linux/tui.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/main/linux/tui.mu +
+ 1 # Test some primitives for text-mode.
+ 2 #
+ 3 # To run:
+ 4 #   $ ./translate tui.mu
+ 5 #   $ ./a.elf
+ 6 
+ 7 fn main -> _/ebx: int {
+ 8   var nrows/eax: int <- copy 0
+ 9   var ncols/ecx: int <- copy 0
+10   nrows, ncols <- screen-size 0
+11   enable-screen-grid-mode
+12   move-cursor 0/screen, 5/row, 0x22/col
+13   start-color 0/screen, 1/fg, 0x7a/bg
+14   start-blinking 0/screen
+15   print-string 0/screen, "Hello world!"
+16   reset-formatting 0/screen
+17   move-cursor 0/screen, 6/row, 0x22/col
+18   print-string 0/screen, "tty dimensions: "
+19   print-int32-hex 0/screen, nrows
+20   print-string 0/screen, " rows, "
+21   print-int32-hex 0/screen, ncols
+22   print-string 0/screen, " rows\n"
+23 
+24   print-string 0/screen, "press a key to see its code: "
+25   enable-keyboard-immediate-mode
+26   var x/eax: grapheme <- read-key-from-real-keyboard
+27   enable-keyboard-type-mode
+28   enable-screen-type-mode
+29   print-string 0/screen, "You pressed "
+30   var x-int/eax: int <- copy x
+31   print-int32-hex 0/screen, x-int
+32   print-string 0/screen, "\n"
+33   return 0
+34 }
+
+ + + -- cgit 1.4.1-2-gfad0