summaryrefslogtreecommitdiff
path: root/packages/libndsfpc/examples/graphics/Printing/ansi_console/AnsiConsole.pp
blob: 614fe813e5b03be516a52f2054a396e327c7c467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
program AnsiConsole;

{$mode objfpc}

uses
  ctypes, nds9;

begin

  consoleDemoInit();

  // ansi escape sequence to clear screen and home cursor
  // #27 + [line;columnH
  iprintf(#27 + '[2J');

  // ansi escape sequence to set print co-ordinates
  // #27 + [line;columnH
  iprintf(#27 + '[10;10H' + 'Hello World!');

  // ansi escape sequence to move cursor up
  // #27 + [linesA
  iprintf(#27 + '[10A' + 'Line 0');

  // ansi escape sequence to move cursor left
  // #27 + [columnsD
  iprintf(#27 + '[28D' + 'Column 0');

  // ansi escape sequence to move cursor down
  // #27 + [linesB
  iprintf(#27 + '[19B' + 'Line 19');

  // ansi escape sequence to move cursor right
  // #27 + [columnsC
  iprintf(#27 + '[5C' + 'Column 20');

  while true do
    swiWaitForVBlank();

end.