;       SCCSID = @(#)bksxxx.inc 6.2 92/01/10
; ****************************************************************************
; *                                                                          *
; *                       IBM/Microsoft Confidential                         *
; *                                                                          *
; *                 Copyright (c) IBM Corporation  1987, 1990                *
; *                 Copyright (c) Microsoft Corp.  1987, 1990                *
; *                           All Rights Reserved                            *
; *                                                                          *
; ****************************************************************************
        PAGE    60,132
;       TITLE   BKSXXX.INC - BKS equate and structure file

;******************************************************************************
;*******   C H A N G E       H I S T O R Y   **********************************
;
;       86/12/01  TPL   Added variables to Get & Set codepage structure for
;                       reserved parameter validation.
;
;       87/01/05  JMP   Changed reserved words: WAIT,  INS,  ENTER to:
;                                               WAIT_, INS_, ENTER_
;@T52   90/01/15  TPL   DCR 704 work
;D1140  04-30-90  THG  DCR 1140 changes, make use of new 'm' bit in
;                      KEYBOARD.DCP table headers.  Also changed Check_CntryID
;                      to be table-driven w.r.t. 'i' and 'm' bits
;                      'i' = MULTI_LAYOUT   'm' = DEFAULT_LAYOUT
;D1546  01-19-92  GDW  DCR 1546 to allow the dynamic processing of the
;                      layout length that was previously hardcoded.
;******************************************************************************
;
        CSEG    EQU     <CTEXT>                                         ;MDLL
        ICSEG   EQU     <CTEXT>                                         ;MDLL
        IDSEG   EQU     <OS2CHAR_I>                                     ;MDLL
        GDSEG   EQU     <OS2CHAR>                                       ;MDLL

;$$#I000
        PEEK    EQU     0       ;***nb inverted for Shield ***
        READ_   EQU     1       ;***nb inverted for Shield ***
        NO_WAIT EQU     0       ;***nb inverted for Shield ***
        WAIT_FOR_IP EQU 1       ;***nb inverted for Shield *** ;@@DTF
        ASCII   EQU     4
        BINARY  EQU     8
;$$#END

        INTERIM_CHAR      EQU 10000000b ;for DBCS enablement
        INTERIM_CHAR_MASK EQU 11000000b ;

        ZERO            EQU     0
        NULL            EQU     0
        NORMAL          EQU     0
        COOKED          EQU     0
        RAW             EQU     80H
        EXTENDED        EQU     0
        REPLACE         EQU     0
        WAIT_           EQU     0
        OFF             EQU     0
        ON              EQU     1
        INSERT          EQU     1
        NOWAIT          EQU     1
        GRAPHICS        EQU     1
        ERASE           EQU     1
        READ            EQU     1
        CURSOR          EQU     2
        SHIFTON         EQU     3
        HOME            EQU     71
        ENDD            EQU     79
        CURSORLEFT      EQU     75
        CURSORRIGHT     EQU     77
        INS_            EQU     82
        DEL             EQU     7FH
        CTRLHOME        EQU     119
        CTRLEND         EQU     117
        BKSPACE         EQU     8
        ENTER_          EQU     13
        TABCHAR         EQU     09
        ESCCHAR         EQU     27
        MAXLENGTH       EQU     255
        BLANK           EQU     ' '
        OVRFLOW         EQU     -1
        CR              EQU     0DH
        LF              EQU     0AH
        SHIFT_ON        EQU     100H    ; SHIFT REPORT BIT ON
        COOKED_ON       EQU     8       ; COOK MODE BIT ON
        RAW_ON          EQU     4       ; RAW MODE BIT ON
        ECHO_OFF        EQU     2       ; ECHO OFF BIT
        ECHO_ON         EQU     1       ; ECHO ON BIT
        CTRL_PRTSC      EQU     7200H   ; Extended ASCII code for Ctrl_Prtsc
        KEYBOARD        EQU     04      ; Category code for Keyboard
        FREE            EQU     -1      ; Logical bond available
        NORMAL_CODEPAGE EQU     0

        FC_CHARIN       EQU 00H         ;KBD API function codes
        FC_PEEK         EQU 01H         ;
        FC_FLUSHBUFFER  EQU 02H         ;
        FC_GETSTATUS    EQU 03H         ;
        FC_SETSTATUS    EQU 04H         ;
        FC_STRINGIN     EQU 05H         ;
        FC_OPEN         EQU 06H         ;
        FC_CLOSE        EQU 07H         ;
        FC_GETFOCUS     EQU 08H         ;
        FC_FREEFOCUS    EQU 09H         ;
        FC_GETCP        EQU 0AH         ;
        FC_SETCP        EQU 0BH         ;
        FC_XLATE        EQU 0CH         ;
        FC_SETCUSTXT    EQU 0DH         ;
        FC_REGISTER     EQU 0EH         ;
        FC_DEREGISTER   EQU 0FH         ;
        FC_GETHWID      EQU 10H         ;

;***********Codepage Support************;
        INITIALIZED     EQU     1       ; Codepage initailized
       CODEPAGE_SUPPORT EQU     2       ; Codepage support available
       XLATE_TABLE_SIZE EQU     4096    ; Translate table work area     ;D1546
        TABLE_SIZE      EQU     1251    ; Translate table size          ;D1546
        AVAILABLE       EQU     1       ; Translate table available
        CUSTOM_ON       EQU     1       ; Custom codepage ON
        CUSTOM_OFF      EQU     0FEH    ; Custom codepage OFF
        DEFAULT_CP      EQU     1       ; Country default layout        ;D1140
        LAYERED_CP      EQU     2       ;                               ;BIDI
        SECOND_LAYER    EQU     4       ;                               ;BIDI
        DEFAULT_LAYOUT  EQU     8       ;                               ;D1140
        FOCUS_ON        EQU     80H     ; Turn focus ON
        FOCUS_OFF       EQU     7FH     ; Turn focus OFF
;***********Codepage Support************;

CHAR_DATA_REC   STRUC

        C_Code          db      ?       ; ASCII code
        S_Code          db      ?       ; Scan code
        Status_Flag     db      ?       ; Status flag

CHAR_DATA_REC   ENDS


PUSHA_STACK STRUC
;
;       Stack frame structure for PUSHA instruction
;
        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


KBD_STATUS      STRUC
;
;       Get/Set Status Template
;
        S_LENGTH        dw      ?
        S_MASK          dw      ?
        S_TA_CHAR       dw      ?
        S_STATUS        db      ?
        S_NLS_STATUS    db      ?
        S_SHIFT_STATE   dw      ?

KBD_STATUS      ENDS

ENTRYSTK STRUC
;
;       Stack Frame Snap Shot for BKSMAIN
;
                        dd      ?       ; Return address of KBDROUT (far)
                        dw      ?       ; save area for caller's DS
                        dw      ?       ; KBDxxx return address (near)
        FunctionNum     dw      ?       ; FunctionNum argument passed to
                                        ;   BKSMAIN by KBDROUT
                        dd      ?       ; Return address of original caller
        KBD_Handle      dw      ?       ; Start of input parameters:
                                        ;   function dependent

ENTRYSTK ENDS


GCHRSTK STRUC
;
;       Stack Frame Snap Shot for GetCharIn
;
                        dd      ?       ; Return address of KBDROUT (far)
                        dw      ?       ; save area for caller's DS
                        dw      ?       ; KBDxxx return address (near)
                        dw      ?       ; FunctionNum argument passed to
                                        ;   BKSMAIN by KBDROUT
                        dd      ?       ; Return address of original caller
                        dw      ?       ; Device Handle parameter
        IoWait          dw      ?       ; Wait/no wait indicator
        CharDataAdr     dd      ?       ; Address of data buffer structure

GCHRSTK ENDS


PCHRSTK STRUC
;
;       Stack Frame Snap Shot for PeekAtIt
;
                        dd      ?       ; Return address of KBDROUT (far)
                        dw      ?       ; save area for caller's DS
                        dw      ?       ; KBDxxx return address (near)
                        dw      ?       ; FunctionNum argument passed to
                                        ;   BKSMAIN by KBDROUT
                        dd      ?       ; Return address of original caller
                        dw      ?       ; Device Handle parameter
        PCharDataAdr    dd      ?       ; Address of data buffer structure

PCHRSTK ENDS


STATSTK STRUC
;
;       Stack Frame Snap Shot for GetStatus and SetStatus
;
                        dd      ?       ; Return address of KBDROUT (far)
                        dw      ?       ; save area for caller's DS
                        dw      ?       ; KBDxxx return address (near)
                        dw      ?       ; FunctionNum argument passed to
                                        ;   BKSMAIN by KBDROUT
                        dd      ?       ; Return address of original caller
                        dw      ?       ; Device Handle parameter
        StatBufO        dd      ?       ; Address of where keyboard status
                                        ;   structure

STATSTK ENDS


STRGSTK STRUC
;
;       Stack Frame Snap Short for GetStringIn
;
                        dd      ?       ; Return address of KBDROUT (far)
                        dw      ?       ; save area for caller's DS
                        dw      ?       ; KBDxxx return address (near)
                        dw      ?       ; FunctionNum argument passed to
                                        ;   BKSMAIN by KBDROUT
                        dd      ?       ; Return address of original caller
                        dw      ?       ; Device Handle parameter
                        dw      ?       ; Wait/no wait indicator
        CharLengthO     dd      ?       ; @ of buffer length
        CharBufferO     dd      ?       ; @ of string buffer

STRGSTK ENDS


OPENSTK STRUC
;
;       Stack Frame Snap Shot for HandleOpen
;
                        dd      ?       ; Return address of KBDROUT (far)
                        dw      ?       ; save area for caller's DS
                        dw      ?       ; KBDxxx return address (near)
                        dw      ?       ; FunctionNum argument passed to
                                        ;   BKSMAIN by KBDROUT
                        dd      ?       ; Return address of original caller
        Handle_Off      dw      ?       ; Keyboard handle to be returned
        Handle_Sel      dw      ?

OPENSTK ENDS


SETCP   STRUC
;
;       Stack Frame Snap Shot for SetCodepage
;
                        dd      ?       ; Return address of KBDROUT (far)
                        dw      ?       ; save area for caller's DS
                        dw      ?       ; KBDxxx return address (near)
                        dw      ?       ; FunctionNum argument passed to
                                        ;   BKSMAIN by KBDROUT
                        dd      ?       ; Return address of original caller
                        dw      ?       ; Device Handle parameter
        CodePageID      dw      ?       ; Codepage ID
        SetCP_Reserved  dw      ?       ; Reserved word

SETCP   ENDS


GETCP   STRUC
;
;       Stack Frame Snap Shot for GetCodepage
;
                        dd      ?       ; Return address of KBDROUT (far)
                        dw      ?       ; save area for caller's DS
                        dw      ?       ; KBDxxx return address (near)
                        dw      ?       ; FunctionNum argument passed to
                                        ;   BKSMAIN by KBDROUT
                        dd      ?       ; Return address of original caller
                        dw      ?       ; Device Handle parameter
        CodePageAdr     dd      ?       ; Codepage ID address
        GetCP_ReservedL dw      ?       ; Reserved DWord
        GetCP_ReservedH dw      ?

GETCP   ENDS


XLATE   STRUC
;
;       Stack Frame Snap Shot for Translate
;
                        dd      ?       ; Return address of KBDROUT (far)
                        dw      ?       ; save area for caller's DS
                        dw      ?       ; KBDxxx return address (near)
                        dw      ?       ; FunctionNum argument passed to
                                        ;   BKSMAIN by KBDROUT
                        dd      ?       ; Return address of original caller
                        dw      ?       ; Device Handle parameter
        XlateRecOff     dw      ?       ; Translate record address
        XlateRecSel     dw      ?

XLATE   ENDS


CUSTCP  STRUC
;
;       Stack Frame Snap Shot for SetCustCP
;
                        dd      ?       ; Return address of KBDROUT (far)
                        dw      ?       ; save area for caller's DS
                        dw      ?       ; KBDxxx return address (near)
                        dw      ?       ; FunctionNum argument passed to
                                        ;   BKSMAIN by KBDROUT
                        dd      ?       ; Return address of original caller
                        dw      ?       ; Device Handle parameter
        XlateTblAddr    dd      ?       ; Custom translate table address

CUSTCP  ENDS

Xtable_Xheader STRUC                                                    ;D1546
                                                                        ;D1546
        XTableID                dw      ?       ; Code Page ID          ;D1546
        XTableFlags1            dw      ?       ; Flags Word 1          ;D1546
        XTableFlags2            dw      ?       ; Flags Word 2          ;D1546
        XTableKbdType           dw      ?       ; Keyboard AT or PS/2   ;D1546
        XTableKbdSubType        dw      ?       ; Keyboard sub type     ;D1546
        XTableLen               dw      ?       ; Translate Table Length;D1546
                                                                        ;D1546
Xtable_Xheader ENDS                                                     ;D1546

Xlate_Tbl STRUC
        ;
        ;  Translation table processing buffer template
        ;
                                                ; LOCAL VARIABLES:
        Dir_Ptr_Location_Low    dw      ?       ;   File pointer location
        Dir_Ptr_Location_High   dw      ?       ;
        Default_Loaded          dw      ?       ;   Return code for defaults
        BytesRead               dw      ?       ;   # of bytes read
        Keyboard_Type           dw      ?       ;   Keyboard type
                                                ;     00 - AT
                                                ;     01 - Enhanced
                                dd      ?       ;     Reserved
        Num_of_Dir              dw      ?       ;   # of directries in
                                                ;     translation table
        Dir_Size                dw      ?       ;   Size of each directory
                                                ; DIRECTORY ENTRY:
        CountryID               dw      ?       ;   Country code ID
                                db 6 dup (0)    ;   Country ID subtype
        XlateTblID              dw      ?       ;   Codepage ID
        KbdType                 dw      ?       ;   Keyboard type
        Xlate_Tbl_Offset_Low    dw      ?       ;   Translation table offset
        Xlate_Tbl_Offset_Hi     dw      ?       ;
        Flags                   db      ?       ;   00000001 - default keyboard
                                                ;              for this country
        MULTI_LAYOUT            db      0       ; Multiple layouts       ;D1140

Xlate_Tbl ENDS


FilePtr_Array STRUC
        ;
        ;  Being used to hold the Xlate_Tbl_Offset for each codepage ID
        ;  prepared by the system, one rocord per codepage ID.  These
        ;  records are included into the allocation of the work buffer
        ;  for translation processing.  It resides between Xlate_Tbl
        ;  and the translation table buffer.
        ;
        ;  Note:  FilePtr_Array[0] record is being used to hold the
        ;         country default translete table file pointer.
        ;
        Xlate_Flag              db      ?       ; xxxxxxx0 - translate table
                                                ;            not available
                                                ; xxxxxxx1 - translate table
                                                ;            available
        Xlate_Table_Offset_L    dw      ?       ; File pointer to a
        Xlate_Table_Offset_H    dw      ?       ;   translate table

FilePtr_Array ENDS

