console.pas 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. {
  2. This file is part of the Free Pascal run time library.
  3. A file in Amiga system run time library.
  4. Copyright (c) 1998-2003 by Nils Sjoholm
  5. member of the Amiga RTL development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {
  13. To call the two routines defined below, you'll need to set
  14. ConsoleBase to an appropriate value.
  15. [email protected] Nils Sjoholm
  16. }
  17. unit console;
  18. interface
  19. uses
  20. exec, inputevent, keymap;
  21. const
  22. {***** Console commands *****}
  23. CD_ASKKEYMAP = CMD_NONSTD + 0;
  24. CD_SETKEYMAP = CMD_NONSTD + 1;
  25. CD_ASKDEFAULTKEYMAP = CMD_NONSTD + 2;
  26. CD_SETDEFAULTKEYMAP = CMD_NONSTD + 3;
  27. {***** SGR parameters *****}
  28. SGR_PRIMARY = 0;
  29. SGR_BOLD = 1;
  30. SGR_ITALIC = 3;
  31. SGR_UNDERSCORE = 4;
  32. SGR_NEGATIVE = 7;
  33. SGR_NORMAL = 22; // default foreground color, not bold
  34. SGR_NOTITALIC = 23;
  35. SGR_NOTUNDERSCORE = 24;
  36. SGR_POSITIVE = 27;
  37. { these names refer to the ANSI standard, not the implementation }
  38. SGR_BLACK = 30;
  39. SGR_RED = 31;
  40. SGR_GREEN = 32;
  41. SGR_YELLOW = 33;
  42. SGR_BLUE = 34;
  43. SGR_MAGENTA = 35;
  44. SGR_CYAN = 36;
  45. SGR_WHITE = 37;
  46. SGR_DEFAULT = 39;
  47. SGR_BLACKBG = 40;
  48. SGR_REDBG = 41;
  49. SGR_GREENBG = 42;
  50. SGR_YELLOWBG = 43;
  51. SGR_BLUEBG = 44;
  52. SGR_MAGENTABG = 45;
  53. SGR_CYANBG = 46;
  54. SGR_WHITEBG = 47;
  55. SGR_DEFAULTBG = 49;
  56. { these names refer to the implementation, they are the preferred }
  57. { names for use with the Amiga console device. }
  58. SGR_CLR0 = 30;
  59. SGR_CLR1 = 31;
  60. SGR_CLR2 = 32;
  61. SGR_CLR3 = 33;
  62. SGR_CLR4 = 34;
  63. SGR_CLR5 = 35;
  64. SGR_CLR6 = 36;
  65. SGR_CLR7 = 37;
  66. SGR_CLR0BG = 40;
  67. SGR_CLR1BG = 41;
  68. SGR_CLR2BG = 42;
  69. SGR_CLR3BG = 43;
  70. SGR_CLR4BG = 44;
  71. SGR_CLR5BG = 45;
  72. SGR_CLR6BG = 46;
  73. SGR_CLR7BG = 47;
  74. {***** DSR parameters *****}
  75. DSR_CPR = 6;
  76. {***** CTC parameters *****}
  77. CTC_HSETTAB = 0;
  78. CTC_HCLRTAB = 2;
  79. CTC_HCLRTABSALL = 5;
  80. {***** TBC parameters *****}
  81. TBC_HCLRTAB = 0;
  82. TBC_HCLRTABSALL = 3;
  83. {***** SM and RM parameters *****}
  84. M_LNM = 20; // linefeed newline mode
  85. M_ASM = '>1'; // auto scroll mode
  86. M_AWM = '?7'; // auto wrap mode
  87. var
  88. ConsoleDevice: PDevice = nil;
  89. function CDInputHandler(Events: PInputEvent location 'a0'; ConsoleDev: PLibrary location 'a1'): PInputEvent; syscall ConsoleDevice 42;
  90. function RawKeyConvert(Events: PInputEvent location 'a0'; Buffer: PChar location 'a1'; Length: LongInt location 'd1'; KeyMap: PKeyMap location 'a2'): LongInt; syscall ConsoleDevice 48;
  91. implementation
  92. end.