diff options
author | marcus <marcus@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2019-12-30 14:32:32 +0000 |
---|---|---|
committer | marcus <marcus@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2019-12-30 14:32:32 +0000 |
commit | 11804e10226f79b0fca526b598584532c118fc47 (patch) | |
tree | b0d3dbfe1090130018b6a2e6fc042d6dcd30853f /packages/os4units | |
parent | f4910880a7cbd9f1ea621c939740ea456e2afef3 (diff) | |
download | fpc-11804e10226f79b0fca526b598584532c118fc47.tar.gz |
AROS, OS4, MorphOS: Console, ConUnit added, Crt first Version
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@43815 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/os4units')
-rw-r--r-- | packages/os4units/fpmake.pp | 2 | ||||
-rw-r--r-- | packages/os4units/src/console.pas | 125 | ||||
-rw-r--r-- | packages/os4units/src/conunit.pas | 94 |
3 files changed, 221 insertions, 0 deletions
diff --git a/packages/os4units/fpmake.pp b/packages/os4units/fpmake.pp index 1d7719fb25..97b4b14433 100644 --- a/packages/os4units/fpmake.pp +++ b/packages/os4units/fpmake.pp @@ -53,6 +53,8 @@ begin T:=P.Targets.AddUnit('locale.pas'); T:=P.Targets.AddUnit('datatypes.pas'); T:=P.Targets.AddUnit('serial.pas'); + T:=P.Targets.AddUnit('console.pas'); + T:=P.Targets.AddUnit('conunit.pas'); {$ifndef ALLPACKAGES} Run; diff --git a/packages/os4units/src/console.pas b/packages/os4units/src/console.pas new file mode 100644 index 0000000000..b9182856e3 --- /dev/null +++ b/packages/os4units/src/console.pas @@ -0,0 +1,125 @@ +{ + This file is part of the Free Pascal run time library. + + A file in Amiga system run time library. + Copyright (c) 1998-2003 by Nils Sjoholm + member of the Amiga RTL development team. + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +{ + To call the two routines defined below, you'll need to set + ConsoleBase to an appropriate value. + + nils.sjoholm@mailbox.swipnet.se Nils Sjoholm +} + +unit console; + +interface + +uses + exec, inputevent, keymap; + +const + +{***** Console commands *****} + CD_ASKKEYMAP = CMD_NONSTD + 0; + CD_SETKEYMAP = CMD_NONSTD + 1; + CD_ASKDEFAULTKEYMAP = CMD_NONSTD + 2; + CD_SETDEFAULTKEYMAP = CMD_NONSTD + 3; + +{***** SGR parameters *****} + + SGR_PRIMARY = 0; + SGR_BOLD = 1; + SGR_ITALIC = 3; + SGR_UNDERSCORE = 4; + SGR_NEGATIVE = 7; + + SGR_NORMAL = 22; // default foreground color, not bold + SGR_NOTITALIC = 23; + SGR_NOTUNDERSCORE = 24; + SGR_POSITIVE = 27; + +{ these names refer to the ANSI standard, not the implementation } + + SGR_BLACK = 30; + SGR_RED = 31; + SGR_GREEN = 32; + SGR_YELLOW = 33; + SGR_BLUE = 34; + SGR_MAGENTA = 35; + SGR_CYAN = 36; + SGR_WHITE = 37; + SGR_DEFAULT = 39; + + SGR_BLACKBG = 40; + SGR_REDBG = 41; + SGR_GREENBG = 42; + SGR_YELLOWBG = 43; + SGR_BLUEBG = 44; + SGR_MAGENTABG = 45; + SGR_CYANBG = 46; + SGR_WHITEBG = 47; + SGR_DEFAULTBG = 49; + +{ these names refer to the implementation, they are the preferred } +{ names for use with the Amiga console device. } + + SGR_CLR0 = 30; + SGR_CLR1 = 31; + SGR_CLR2 = 32; + SGR_CLR3 = 33; + SGR_CLR4 = 34; + SGR_CLR5 = 35; + SGR_CLR6 = 36; + SGR_CLR7 = 37; + + SGR_CLR0BG = 40; + SGR_CLR1BG = 41; + SGR_CLR2BG = 42; + SGR_CLR3BG = 43; + SGR_CLR4BG = 44; + SGR_CLR5BG = 45; + SGR_CLR6BG = 46; + SGR_CLR7BG = 47; + +{***** DSR parameters *****} + DSR_CPR = 6; + +{***** CTC parameters *****} + CTC_HSETTAB = 0; + CTC_HCLRTAB = 2; + CTC_HCLRTABSALL = 5; + +{***** TBC parameters *****} + TBC_HCLRTAB = 0; + TBC_HCLRTABSALL = 3; + +{***** SM and RM parameters *****} + M_LNM = 20; // linefeed newline mode + M_ASM = '>1'; // auto scroll mode + M_AWM = '?7'; // auto wrap mode + +var + ConsoleDevice: PDevice = nil; + IConsoleDevice: Pointer = nil; + +function CDInputHandler(Events: PInputEvent; ConsoleDev: PLibrary): PInputEvent; syscall IConsoleDevice 76; +function RawKeyConvert(Events: PInputEvent; Buffer: PChar; Length: LongInt; KeyMap: PKeyMap): LongInt; syscall IConsoleDevice 80; +function GetConSnip(): APTR; syscall ConsoleDevice 9; +function SetConSnip(Param: APTR): LongInt; syscall ConsoleDevice 10; +procedure AddConSnipHook(Hook: PHook); syscall ConsoleDevice 11; +procedure RemConSnipHook(Hook: PHook); syscall ConsoleDevice 12; + +implementation + +end. diff --git a/packages/os4units/src/conunit.pas b/packages/os4units/src/conunit.pas new file mode 100644 index 0000000000..e27f7716fd --- /dev/null +++ b/packages/os4units/src/conunit.pas @@ -0,0 +1,94 @@ +{ + This file is part of the Free Pascal run time library. + + A file in Amiga system run time library. + Copyright (c) 1998 by Nils Sjoholm + member of the Amiga RTL development team. + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +unit conunit; + +interface + +uses + exec, console, keymap, inputevent, intuition, agraphics; + +const +{ ---- console unit numbers for OpenDevice() } + CONU_LIBRARY = -1; // no unit, just fill in IO_DEVICE field + CONU_STANDARD = 0; // standard unmapped console + +{ ---- New unit numbers for OpenDevice() - (V36) } + CONU_CHARMAP = 1; // bind character map to console + CONU_SNIPMAP = 3; // bind character map w/ snip to console + +{ ---- New flag defines for OpenDevice() - (V37) } + CONFLAG_DEFAULT = 0; + CONFLAG_NODRAW_ON_NEWSIZE = 1; + + PMB_ASM = M_LNM + 1; // internal storage bit for AS flag + PMB_AWM = PMB_ASM + 1; // internal storage bit for AW flag + MAXTABS = 80; + + +type + {$PACKRECORDS 2} + PConUnit = ^TConUnit; + TConUnit = record + cu_MP: TMsgPort; + { ---- read only variables } + cu_Window: PWindow; // Intuition window bound to this unit + cu_XCP: SmallInt; // character position + cu_YCP: SmallInt; + cu_XMax: SmallInt; // max character position + cu_YMax: SmallInt; + cu_XRSize: SmallInt; // character raster size + cu_YRSize: SmallInt; + cu_XROrigin: SmallInt; // raster origin + cu_YROrigin: SmallInt; + cu_XRExtant: SmallInt; // raster maxima + cu_YRExtant: SmallInt; + cu_XMinShrink: SmallInt; // smallest area intact from resize process + cu_YMinShrink: SmallInt; + cu_XCCP: SmallInt; // cursor position + cu_YCCP: SmallInt; + + { ---- read/write variables (writes must must be protected) } + { ---- storage for AskKeyMap and SetKeyMap } + cu_KeyMapStruct: TKeyMap; + { ---- tab stops } + cu_TabStops: array[0..MAXTABS - 1] of Word; // 0 at start, 0xFFFF at end of list + + // ---- console rastport attributes + cu_Mask: ShortInt; + cu_FgPen: ShortInt; + cu_BgPen: ShortInt; + cu_AOLPen: ShortInt; + cu_DrawMode: ShortInt; + cu_Obsolete1: ShortInt; // was cu_AreaPtSz -- not used in V36 + cu_Obsolete2: APTR; // was cu_AreaPtrn -- not used in V36 + cu_Minterms: array[0..7] of Byte; // console minterms + cu_Font: PTextFont; + cu_AlgoStyle: Byte; + cu_TxFlags: Byte; + cu_TxHeight: Word; + cu_TxWidth: Word; + cu_TxBaseline: Word; + cu_TxSpacing: Word; + + { ---- console MODES and RAW EVENTS switches } + cu_Modes: array[0..(PMB_AWM + 7) div 8 - 1] of Byte; // one bit per mode + cu_RawEvents: array[0..(IECLASS_MAX + 7) div 8 - 1] of Byte; + end; + +implementation + +end. |