;       SCCSID = @(#)ansidecl.inc       6.1 90/11/16
;       SCCSID = @(#)ansidecl.inc       6.5 90/02/12
; ****************************************************************************
; *                                                                          *
; *                       IBM/Microsoft Confidential                         *
; *                                                                          *
; *                 Copyright (c) IBM Corporation  1987, 1990                *
; *                 Copyright (c) Microsoft Corp.  1987, 1990                *
; *                           All Rights Reserved                            *
; *                                                                          *
; ****************************************************************************
;******************************************************************************
;  Common Data Declarations
;******************************************************************************
;  Change Log
;   J-DB01      Enlarge Modes struct up to 14 byte in order to support
;               In order to Support DBCS video mode.
;                                 by  O.Ichikawa                09/13/89
;******************************************************************************
;  Miscellaneous assembler constants
;

ANSI1           equ     <CTEXT>                                         ;MDLL
ANSIDAT         equ     <OS2CHAR_I>                                     ;MDLL
ANSIGSEG        equ     <OS2CHAR>                                       ;@T52

NULL         EQU     0
OFF          EQU     0
ON           EQU     1            ; defined values for ON and OFF
BUILD        EQU     0
READ         EQU     1            ; defined values for BUILD and READ
QUOTE_1      EQU     27h          ; ' : used in key def sequences
QUOTE_2      EQU     22h          ; " : used in key def sequences
HOME         EQU     0000h        ; cursor HOME position
DUMMY_HANDLE EQU     0000h        ; dummy handle for VIOxxx calls
LEFT_BRACKET EQU     5Bh          ; ASCII code for '[' character
ESCAPE       EQU     1Bh          ; ASCII code for the escape character
ASCII_CR     EQU     0Dh          ; ASCII code for the Carriage Return char
ASCII_BLANK  EQU     20h          ; ASCII code for "BLANK" (space char)
DEF_ATTR     EQU     07h          ; default char cell attribute
KDSEG_SIZE   EQU     256d         ; default size of key definition seg (bytes)
KDSEG_SIZE_W EQU     128d         ; default size of Key Def Seg in Words
PBUFF_SIZE   EQU     256d         ; the size of the parameter buffer
;
;  Terminator characters for interpreting ANSI sequences
;
CUU_TERM     EQU     41h          ; A - "CUrsor Up"
CUD_TERM     EQU     42h          ; B - "CUrsor Down"
CUF_TERM     EQU     43h          ; C - "CUrsor Forward"
CUB_TERM     EQU     44h          ; D - "CUrsor Back"
CUP_TERM     EQU     48h          ; H - "CUrsor Position"
ED_TERM      EQU     4Ah          ; J - "Erase Display"
EL_TERM      EQU     4Bh          ; K - "Erase Line"
CPR_TERM     EQU     52h          ; R - "Cursor Position Report"
HVP_TERM     EQU     66h          ; f - "Horiz. & Vert. Position"
SM_TERM      EQU     68h          ; h - "Set Mode"
RM_TERM      EQU     6Ch          ; l - "Reset Mode"
SGR_TERM     EQU     6Dh          ; m - "Select Graphic Rendition"
DSR_TERM     EQU     6Eh          ; n - "Device Status Report"
KKR_TERM     EQU     70h          ; p - "Keyboard Key Reassignment"
EKR_TERM     EQU     71h          ; q - "Enable/Disable Enhanced Keyboard"
SCP_TERM     EQU     73h          ; s - "Save Cursor Position"
RCP_TERM     EQU     75h          ; u - "Restore Cursor Position"

GetCp           equ     3       ; ordinal number for KBDCALLS.KBDGETCP  ;@T1

tnk     struc                                                           ;@T1
pfnCall  dd     ?               ; pointer to function to call           ;@T1
pfnTnk   dw     ?               ; offset to thunk routine               ;@T1
szModOff dw     ?               ; offset to module name                 ;@T1
hOrdinal dw     ?               ; ordinal number of the entry point     ;@T1
tnk     ends                                                            ;@T1

THUNKDEF    macro   rtn, szMod, hOrd                                    ;@T1
tnk&rtn tnk <ThunkerFarRet, Thunker, szMod, hOrd>                       ;@T1
        public  tnk&rtn                                                 ;@T1
endm                                                                    ;@T1

THUNKCALL   macro   thunkname                                           ;@T1
        THUNK   thunkname                                               ;@T1
        call    tnk&thunkname.pfnCall                                   ;@T1
endm                                                                    ;@T1

THUNK   macro   thunkname                                               ;@T1
        mov     ax,offset tnk&thunkname                                 ;@T1
        call    tnk&thunkname.pfnTnk                                    ;@T1
endm                                                                    ;@T1

CALLTHUNK   macro   thunkname                                           ;@T1
        call    tnk&thunkname.pfnCall                                   ;@T1
endm                                                                    ;@T1

;
;******************************************************************************
;
;   The Modes structure is used as a parameter passed to VioSetMode
;
Modes   STRUC
;J-DB01 sm_length       DW      12      ; length of structure in BYTES
sm_length       DW      14      ; length of structure in BYTES          ;J-DB01
sm_type         DB      ?       ; display type (text or graphics)
sm_color        DB      ?       ; display type (color or mono)
sm_cols         DW      ?       ; number of text columns
sm_rows         DW      ?       ; number of text rows
sm_gcols        DW      ?       ; number of graphic columns (horiz resolution)
sm_grows        DW      ?       ; number of graphic rows (vert resolution)
sm_fmtid        DB      ?       ; format ID (US:0)                      ;J-DB01
sm_attrs        DB      ?       ; number of attributes                  ;J-DB01
Modes   ENDS
;
;******************************************************************************
;
;   The parameter for AnsiKeyDef and AnsiInject is the address [sel-off] of
;   the data block "InputData" that references the following structure:
;
InData  STRUC
In_String       DD    ?         ; [off-sel] address of def string
In_Length       DB    ?         ; number of characters in definition
In_Action       DB    ?         ; action for AnsiKeyDef
In_Char         DW    ?         ; character to define (ignored for AnsiInject)
InData  ENDS
;
;******************************************************************************
;   The KeyDef (linked list) structure is used in AnsiKeyDef:
;
KeyDef  STRUC
DefChar         DW    ?         ; char defined (may be extended ASCII)
DefLen          DB    ?         ; number of characters in definition (1-128)
DefNxt          DW    ?         ; pointer (offset) to next instance (0 if none)
KeyDef  ENDS
;
;******************************************************************************
;  Stack frame structure for PUSHA instruction
;
PUSHA_STACK STRUC

        DI_REG          DW ?
        SI_REG          DW ?
        BP_REG          DW ?
        SP_REG          DW ?    ; Original SP before PUSHA
        BX_REG          DW ?
        DX_REG          DW ?
        CX_REG          DW ?
        AX_REG          DW ?

PUSHA_STACK ENDS
;
;******************************************************************************
;  Stack frame for ANSIINTERP
;
INTERP  STRUC
                        DW ?    ; CS:IP
                        DW ?
        BVSCB_SEL       DW ?    ; BVSCB selector

INTERP  ENDS
;
;******************************************************************************
;  Stack frame for ANSIINJECT and ANSIKEYDEF
;
InputParm STRUC
                        DW ?    ; CS:IP
                        DW ?
        DataBlock       DD ?    ; InputData structure

Inputparm ENDS
;
;******************************************************************************
;   KeyDef record template for each codepage:
;
Kd_Rec  STRUC
bvs_KdSegSize           DW 0
bvs_KdFreeBytes         DW 0
bvs_KdLastDef           DW 0
Kd_Rec  ENDS
