console.pp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. program console;
  2. uses
  3. gba;
  4. begin
  5. // the vblank interrupt must be enabled for VBlankIntrWait() to work
  6. // since the default dispatcher handles the bios flags no vblank handler
  7. // is required
  8. irqInit();
  9. irqEnable(IRQ_VBLANK);
  10. // initialise the console
  11. // setting NULL & 0 for the font address & size uses the default font
  12. // The font should be a complete 1bit 8x8 ASCII font
  13. consoleInit( 0, // charbase
  14. 4, // mapbase
  15. 0, // background number
  16. nil, // font
  17. 0, // font size
  18. 15 // 16 color palette
  19. );
  20. // set the screen colors, color 0 is the background color
  21. // the foreground color is index 1 of the selected 16 color palette
  22. BG_COLORS[0] := RGB8(58,110,165);
  23. BG_COLORS[241] := RGB5(31,31,31);
  24. SetMode(MODE_0 or BG0_ON);
  25. // ansi escape sequence to clear screen and home cursor
  26. // /x1b[line;columnH
  27. iprintf(#27'[2J');
  28. // ansi escape sequence to set print co-ordinates
  29. // /x1b[line;columnH
  30. iprintf(#27'[10;10H' + 'Hello World!');
  31. // ansi escape sequence to move cursor up
  32. // /x1b[linesA
  33. iprintf(#27'[10A' + 'Line 0');
  34. // ansi escape sequence to move cursor left
  35. // /x1b[columnsD
  36. iprintf(#27'[28D' + 'Column 0');
  37. // ansi escape sequence to move cursor down
  38. // /x1b[linesB
  39. iprintf(#27'[19B' + 'Line 19');
  40. // ansi escape sequence to move cursor right
  41. // /x1b[columnsC
  42. iprintf(#27'[5C' + 'Column 20');
  43. while true do
  44. VBlankIntrWait();
  45. end.