Amunits: console and conunit, fixed alignment and fixes from 3.9 SDK

git-svn-id: trunk@43812 -
This commit is contained in:
marcus 2019-12-30 10:45:31 +00:00
parent 4dc84b2a78
commit 25c11a94c4
2 changed files with 124 additions and 148 deletions

View File

@ -18,112 +18,103 @@
To call the two routines defined below, you'll need to set To call the two routines defined below, you'll need to set
ConsoleBase to an appropriate value. ConsoleBase to an appropriate value.
Added the define use_amiga_smartlink.
13 Jan 2003.
nils.sjoholm@mailbox.swipnet.se Nils Sjoholm nils.sjoholm@mailbox.swipnet.se Nils Sjoholm
} }
unit console; unit console;
INTERFACE interface
uses exec, inputevent, keymap;
uses
exec, inputevent, keymap;
const const
{***** Console commands *****} {***** Console commands *****}
CD_ASKKEYMAP = CMD_NONSTD + 0;
CD_ASKKEYMAP = CMD_NONSTD + 0; CD_SETKEYMAP = CMD_NONSTD + 1;
CD_SETKEYMAP = CMD_NONSTD + 1; CD_ASKDEFAULTKEYMAP = CMD_NONSTD + 2;
CD_ASKDEFAULTKEYMAP = CMD_NONSTD + 2; CD_SETDEFAULTKEYMAP = CMD_NONSTD + 3;
CD_SETDEFAULTKEYMAP = CMD_NONSTD + 3;
{***** SGR parameters *****} {***** SGR parameters *****}
SGR_PRIMARY = 0; SGR_PRIMARY = 0;
SGR_BOLD = 1; SGR_BOLD = 1;
SGR_ITALIC = 3; SGR_ITALIC = 3;
SGR_UNDERSCORE = 4; SGR_UNDERSCORE = 4;
SGR_NEGATIVE = 7; SGR_NEGATIVE = 7;
SGR_NORMAL = 22; { default foreground color, not bold } SGR_NORMAL = 22; // default foreground color, not bold
SGR_NOTITALIC = 23; SGR_NOTITALIC = 23;
SGR_NOTUNDERSCORE = 24; SGR_NOTUNDERSCORE = 24;
SGR_POSITIVE = 27; SGR_POSITIVE = 27;
{ these names refer to the ANSI standard, not the implementation } { these names refer to the ANSI standard, not the implementation }
SGR_BLACK = 30; SGR_BLACK = 30;
SGR_RED = 31; SGR_RED = 31;
SGR_GREEN = 32; SGR_GREEN = 32;
SGR_YELLOW = 33; SGR_YELLOW = 33;
SGR_BLUE = 34; SGR_BLUE = 34;
SGR_MAGENTA = 35; SGR_MAGENTA = 35;
SGR_CYAN = 36; SGR_CYAN = 36;
SGR_WHITE = 37; SGR_WHITE = 37;
SGR_DEFAULT = 39; SGR_DEFAULT = 39;
SGR_BLACKBG = 40; SGR_BLACKBG = 40;
SGR_REDBG = 41; SGR_REDBG = 41;
SGR_GREENBG = 42; SGR_GREENBG = 42;
SGR_YELLOWBG = 43; SGR_YELLOWBG = 43;
SGR_BLUEBG = 44; SGR_BLUEBG = 44;
SGR_MAGENTABG = 45; SGR_MAGENTABG = 45;
SGR_CYANBG = 46; SGR_CYANBG = 46;
SGR_WHITEBG = 47; SGR_WHITEBG = 47;
SGR_DEFAULTBG = 49; SGR_DEFAULTBG = 49;
{ these names refer to the implementation, they are the preferred } { these names refer to the implementation, they are the preferred }
{ names for use with the Amiga console device. } { names for use with the Amiga console device. }
SGR_CLR0 = 30; SGR_CLR0 = 30;
SGR_CLR1 = 31; SGR_CLR1 = 31;
SGR_CLR2 = 32; SGR_CLR2 = 32;
SGR_CLR3 = 33; SGR_CLR3 = 33;
SGR_CLR4 = 34; SGR_CLR4 = 34;
SGR_CLR5 = 35; SGR_CLR5 = 35;
SGR_CLR6 = 36; SGR_CLR6 = 36;
SGR_CLR7 = 37; 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;
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 parameters *****}
DSR_CPR = 6;
DSR_CPR = 6;
{***** CTC parameters *****} {***** CTC parameters *****}
CTC_HSETTAB = 0;
CTC_HSETTAB = 0; CTC_HCLRTAB = 2;
CTC_HCLRTAB = 2; CTC_HCLRTABSALL = 5;
CTC_HCLRTABSALL = 5;
{***** TBC parameters *****} {***** TBC parameters *****}
TBC_HCLRTAB = 0;
TBC_HCLRTAB = 0; TBC_HCLRTABSALL = 3;
TBC_HCLRTABSALL = 3;
{***** SM and RM parameters *****} {***** SM and RM parameters *****}
M_LNM = 20; // linefeed newline mode
M_ASM = '>1'; // auto scroll mode
M_AWM = '?7'; // auto wrap mode
M_LNM = 20; { linefeed newline mode } var
M_ASM = '>1'; { auto scroll mode } ConsoleDevice: PDevice = nil;
M_AWM = '?7'; { auto wrap mode }
VAR ConsoleDevice : pDevice; function CDInputHandler(Events: PInputEvent location 'a0'; ConsoleDev: PLibrary location 'a1'): PInputEvent; syscall ConsoleDevice 042;
function RawKeyConvert(Events: PInputEvent location 'a0'; Buffer: PCHAR location 'a1'; Length: LongInt location 'd1'; KeyMap: PKeyMap location 'a2'): LongInt; syscall ConsoleDevice 048;
FUNCTION CDInputHandler(events : pInputEvent location 'a0'; consoleDev : pLibrary location 'a1') : pInputEvent; syscall ConsoleDevice 042; implementation
FUNCTION RawKeyConvert(events : pInputEvent location 'a0'; buffer : pCHAR location 'a1'; length : LONGINT location 'd1'; keyMap : pKeyMap location 'a2') : LONGINT; syscall ConsoleDevice 048;
IMPLEMENTATION end.
END. (* UNIT CONSOLE *)

View File

@ -13,97 +13,82 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************} **********************************************************************}
{
History:
Changed integer > smallint.
09 Feb 2003.
}
unit conunit; unit conunit;
INTERFACE interface
uses exec, console, keymap, inputevent; uses
exec, console, keymap, inputevent, intuition, agraphics;
const const
{ ---- console unit numbers for OpenDevice() } { ---- console unit numbers for OpenDevice() }
CONU_LIBRARY = -1; { no unit, just fill in IO_DEVICE field } CONU_LIBRARY = -1; // no unit, just fill in IO_DEVICE field
CONU_STANDARD = 0; { standard unmapped console } CONU_STANDARD = 0; // standard unmapped console
{ ---- New unit numbers for OpenDevice() - (V36) } { ---- New unit numbers for OpenDevice() - (V36) }
CONU_CHARMAP = 1; // bind character map to console
CONU_CHARMAP = 1; { bind character map to console } CONU_SNIPMAP = 3; // bind character map w/ snip to console
CONU_SNIPMAP = 3; { bind character map w/ snip to console }
{ ---- New flag defines for OpenDevice() - (V37) } { ---- New flag defines for OpenDevice() - (V37) }
CONFLAG_DEFAULT = 0;
CONFLAG_NODRAW_ON_NEWSIZE = 1;
CONFLAG_DEFAULT = 0; PMB_ASM = M_LNM + 1; // internal storage bit for AS flag
CONFLAG_NODRAW_ON_NEWSIZE = 1; PMB_AWM = PMB_ASM + 1; // internal storage bit for AW flag
MAXTABS = 80;
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 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;
pConUnit = ^tConUnit; { ---- read/write variables (writes must must be protected) }
tConUnit = record { ---- storage for AskKeyMap and SetKeyMap }
cu_MP : tMsgPort; cu_KeyMapStruct: TKeyMap;
{ ---- read only variables } { ---- tab stops }
cu_Window : Pointer; { (WindowPtr) intuition window bound to this unit } cu_TabStops: array[0..MAXTABS - 1] of Word; // 0 at start, 0xFFFF at end of list
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) } // ---- console rastport attributes
{ ---- storage for AskKeyMap and SetKeyMap } 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;
cu_KeyMapStruct : tKeyMap; { ---- 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;
{ ---- tab stops } implementation
cu_TabStops : Array [0..MAXTABS-1] of Word;
{ 0 at start, -1 at end of list }
{ ---- console rastport attributes }
cu_Mask : Shortint;
cu_FgPen : Shortint;
cu_BgPen : Shortint;
cu_AOLPen : Shortint;
cu_DrawMode : Shortint;
cu_AreaPtSz : Shortint;
cu_AreaPtrn : Pointer; { cursor area pattern }
cu_Minterms : Array [0..7] of Byte; { console minterms }
cu_Font : Pointer; { (TextFontPtr) }
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. end.