1 # example program: managing the display using 'screen' objects
 2 
 3 # The zero screen below means 'use the real screen'. Tests can also use fake
 4 # screens.
 5 def main [
 6   open-console
 7   clear-screen 0/screen  # non-scrolling app
 8   10:char <- copy 97/a
 9   print 0/screen, 10:char/a, 1/red, 2/green
10   1:num/raw, 2:num/raw <- cursor-position 0/screen
11   wait-for-event 0/console
12   clear-screen 0/screen
13   move-cursor 0/screen, 0/row, 4/column
14   10:char <- copy 98/b
15   print 0/screen, 10:char
16   wait-for-event 0/console
17   move-cursor 0/screen, 0/row, 0/column
18   clear-line 0/screen
19   wait-for-event 0/console
20   cursor-down 0/screen
21   wait-for-event 0/console
22   cursor-right 0/screen
23   wait-for-event 0/console
24   cursor-left 0/screen
25   wait-for-event 0/console
26   cursor-up 0/screen
27   wait-for-event 0/console
28   close-console
29 ]