;       SCCSID = @(#)vioequ.inc 6.3 92/02/29
;# SCCSID = @(#)vioequ.inc      6.3 92/02/29
; ****************************************************************************
; *                                                                          *
; *                       IBM/Microsoft Confidential                         *
; *                                                                          *
; *                 Copyright (c) IBM Corporation  1987, 1990                *
; *                 Copyright (c) Microsoft Corp.  1987, 1990                *
; *                           All Rights Reserved                            *
; *                                                                          *
; ****************************************************************************
;******************************************************************************
;*******   C H A N G E       H I S T O R Y   **********************************
;******************************************************************************
;$Z6= add EQUs for new System Trace parameter support
;     06-10-87
;$Z7= add new strucs for mmPREPARMS and POSTPARMS
;     05-15-87
;$Z8= Allow new VIO calls during popups
;     12-12-86
;$Z9= Add EQUs for new 1.10 API
;     11-18-86
;%A0= Use FS RAM sems instead of system sems.
;     07-30-87
;THGxxx= Since AVD module name now limited to 8 bytes, store in SGDATA record
;        ??-??-88
;MMIO= Implement Memory-Mapped I/O performance trace hooks
;      11-03-88
;P3839= initCP called on SG's first VIO call (set video CP to process CP)
;       11-14-88 (1.2 PTM 2502)
;@T8  = 08/17/89 TPL, Compress registration mask for BVS, PTR B707524
;D549 = 11/03/89 WKB, CJJ DCR 549 changes
;D811 = 11/30/89 MS,  DCR811
;@T52 = 01/15/90 TPL, DCR 704 work
;@B50 = 03/21/90 WKB, Transparent popup over diff cp disallowed, B711349
;@T14 = 03/28/90 TPL, Remove duplication of functions
;@B50f= 04/19/90 TPL, @B50 fix, B712601
;@T73 = 07/27/90 TPL, Code/data reduction/optimization and swap tune
;@C47 = 02/07/91 CJJ, B717383 Add and fix MMIO hooks.
;D549f= 02/26/92 TPL, B733601 DCR 549 regression

cseg                 equ  <CTEXT>                                       ;MDLL
instance             equ  <OS2CHAR_I>                                   ;MDLL
common               equ  <OS2CHAR>                                     ;MDLL


include smrsgcb.inc                 ;inc file for SGCB                  ;D549

mmPREregister         equ  6C01H     ;PRE-performance trace MMIO hooks
mmPREgetbuf           equ  6C02H     ;
mmPREgetcurpos        equ  6C03H     ;
mmPREgetcurtype       equ  6C04H     ;
mmPREgetmode          equ  6C05H     ;
mmPREgetphysbuf       equ  6C06H     ;
mmPREreadcellstr      equ  6C07H     ;
mmPREreadcharstr      equ  6C08H     ;
mmPREscrolldn         equ  6C09H     ;
mmPREscrollup         equ  6C0AH     ;
mmPREscrolllf         equ  6C0BH     ;
mmPREscrollrt         equ  6C0CH     ;
mmPREsetcurpos        equ  6C0DH     ;
mmPREsetcurtype       equ  6C0EH     ;
mmPREsetmode          equ  6C0FH     ;
mmPREshowbuf          equ  6C10H     ;
mmPREwrtcellstr       equ  6C11H     ;
mmPREwrtcharstr       equ  6C12H     ;
mmPREwrtcharstratt    equ  6C13H     ;
mmPREwrtnattr         equ  6C14H     ;
mmPREwrtncell         equ  6C15H     ;
mmPREwrtnchar         equ  6C16H     ;
mmPREwrttty           equ  6C17H     ;
mmPREsetansi          equ  6C18H     ;
mmPREgetansi          equ  6C19H     ;
mmPREmodewait         equ  6C1AH     ;
mmPREsavredrawwait    equ  6C1BH     ;
mmPREsavredrawundo    equ  6C1CH     ;
mmPREscrlock          equ  6C1DH     ;
mmPREscrunlock        equ  6C1EH     ;
mmPREmodeundo         equ  6C1FH     ;
mmPREgetfont          equ  6C20H     ;
mmPREgetconfig        equ  6C21H     ;
mmPREpopup            equ  6C22H     ;
mmPREendpopup         equ  6C23H     ;
mmPREderegister       equ  6C24H     ;
mmPREprtsc            equ  6C25H     ;
mmPREprtsctoggle      equ  6C26H     ;
mmPREsetcp            equ  6C27H     ;
mmPREgetcp            equ  6C28H     ;
mmPREsetfont          equ  6C29H     ;
mmPREgetstate         equ  6C2AH     ;
mmPREsetstate         equ  6C2BH     ;
mmPREglobalreg        equ  6C33H     ;                                   ;@C47

mmPOSTregister        equ  6C81H     ;POST-performance trace MMIO hooks
mmPOSTgetbuf          equ  6C82H     ;
mmPOSTgetcurpos       equ  6C83H     ;
mmPOSTgetcurtype      equ  6C84H     ;
mmPOSTgetmode         equ  6C85H     ;
mmPOSTgetphysbuf      equ  6C86H     ;
mmPOSTreadcellstr     equ  6C87H     ;
mmPOSTreadcharstr     equ  6C88H     ;
mmPOSTscrolldn        equ  6C89H     ;
mmPOSTscrollup        equ  6C8AH     ;
mmPOSTscrolllf        equ  6C8BH     ;
mmPOSTscrollrt        equ  6C8CH     ;
mmPOSTsetcurpos       equ  6C8DH     ;
mmPOSTsetcurtype      equ  6C8EH     ;
mmPOSTsetmode         equ  6C8FH     ;
mmPOSTshowbuf         equ  6C90H     ;
mmPOSTwrtcellstr      equ  6C91H     ;
mmPOSTwrtcharstr      equ  6C92H     ;
mmPOSTwrtcharstratt   equ  6C93H     ;
mmPOSTwrtnattr        equ  6C94H     ;
mmPOSTwrtncell        equ  6C95H     ;
mmPOSTwrtnchar        equ  6C96H     ;
mmPOSTwrttty          equ  6C97H     ;
mmPOSTsetansi         equ  6C98H     ;
mmPOSTgetansi         equ  6C99H     ;
mmPOSTmodewait        equ  6C9AH     ;
mmPOSTsavredrawwait   equ  6C9BH     ;
mmPOSTsavredrawundo   equ  6C9CH     ;
mmPOSTscrlock         equ  6C9DH     ;
mmPOSTscrunlock       equ  6C9EH     ;
mmPOSTmodeundo        equ  6C9FH     ;
mmPOSTgetfont         equ  6CA0H     ;
mmPOSTgetconfig       equ  6CA1H     ;
mmPOSTpopup           equ  6CA2H     ;
mmPOSTendpopup        equ  6CA3H     ;
mmPOSTderegister      equ  6CA4H     ;
mmPOSTprtsc           equ  6CA5H     ;
mmPOSTprtsctoggle     equ  6CA6H     ;
mmPOSTsetcp           equ  6CA7H     ;
mmPOSTgetcp           equ  6CA8H     ;
mmPOSTsetfont         equ  6CA9H     ;
mmPOSTgetstate        equ  6CAAH     ;
mmPOSTsetstate        equ  6CABH     ;
mmPOSTglobalreg       equ  6CB3H     ;                                   ;@C47

preregister        equ  01H     ;pre-invocation system trace
prederegister      equ  24H     ;minor codes
pregetphysbuf      equ  06H     ;
pregetbuf          equ  02H     ;
preshowbuf         equ  10H     ;
pregetcurpos       equ  03H     ;
pregetcurtype      equ  04H     ;
pregetmode         equ  05H     ;
presetcurpos       equ  0DH     ;
presetcurtype      equ  0EH     ;
presetmode         equ  0FH     ;
prereadcharstr     equ  08H     ;
prereadcellstr     equ  07H     ;
prewrtnchar        equ  16H     ;
prewrtnattr        equ  14H     ;
prewrtncell        equ  15H     ;
prewrtcharstr      equ  12H     ;
prewrtcharstratt   equ  13H     ;
prewrtcellstr      equ  11H     ;
prewrttty          equ  17H     ;
prescrollup        equ  0AH     ;
prescrolldn        equ  09H     ;
prescrolllf        equ  0BH     ;
prescrollrt        equ  0CH     ;
presetansi         equ  18H     ;
pregetansi         equ  19H     ;
preprtsc           equ  25H     ;
prescrlock         equ  1DH     ;
prescrunlock       equ  1EH     ;
presavredrawwait   equ  1BH     ;
presavredrawundo   equ  1CH     ;
prepopup           equ  22H     ;
preendpopup        equ  23H     ;
preprtsctoggle     equ  26H     ;
premodewait        equ  1AH     ;
premodeundo        equ  1FH     ;
pregetfont         equ  20H     ;
pregetconfig       equ  21H     ;
presetcp           equ  27H     ;                                       ;$Z9I
pregetcp           equ  28H     ;                                       ;$Z9I
presetfont         equ  29H     ;                                       ;$Z9I
pregetstate        equ  2AH     ;                                       ;$Z9I
presetstate        equ  2BH     ;                                       ;$Z9I
precheckchartype   equ  2CH     ;  PAL check number against preglobalreg
precreateca        equ  2DH     ;
pregetcastate      equ  2EH     ;
presetcastate      equ  2FH     ;
predestroyca       equ  30H     ;
preglobalreg       equ  2CH     ;                                       ;1.2

postregister       equ  081H    ;post-invocation system trace
postderegister     equ  0A4H    ;minor codes
postgetphysbuf     equ  086H    ;
postgetbuf         equ  082H    ;
postshowbuf        equ  090H    ;
postgetcurpos      equ  083H    ;
postgetcurtype     equ  084H    ;
postgetmode        equ  085H    ;
postsetcurpos      equ  08DH    ;
postsetcurtype     equ  08EH    ;
postsetmode        equ  08FH    ;
postreadcharstr    equ  088H    ;
postreadcellstr    equ  087H    ;
postwrtnchar       equ  096H    ;
postwrtnattr       equ  094H    ;
postwrtncell       equ  095H    ;
postwrtcharstr     equ  092H    ;
postwrtcharstratt  equ  093H    ;
postwrtcellstr     equ  091H    ;
postwrttty         equ  097H    ;
postscrollup       equ  08AH    ;
postscrolldn       equ  089H    ;
postscrolllf       equ  08BH    ;
postscrollrt       equ  08CH    ;
postsetansi        equ  098H    ;
postgetansi        equ  099H    ;
postprtsc          equ  0A5H    ;
postscrlock        equ  09DH    ;
postscrunlock      equ  09EH    ;
postsavredrawwait  equ  09BH    ;
postsavredrawundo  equ  09CH    ;
postpopup          equ  0A2H    ;
postendpopup       equ  0A3H    ;
postprtsctoggle    equ  0A6H    ;
postmodewait       equ  09AH    ;
postmodeundo       equ  09FH    ;
postgetfont        equ  0A0H    ;
postgetconfig      equ  0A1H    ;
postsetcp          equ  0A7H    ;                                       ;$Z9I
postgetcp          equ  0A8H    ;                                       ;$Z9I
postsetfont        equ  0A9H    ;                                       ;$Z9I
postgetstate       equ  0AAH    ;                                       ;$Z9I
postsetstate       equ  0ABH    ;                                       ;$Z9I
postcheckchartype  equ  0ACH    ;   PAL check against postglobalreg
postcreateca       equ  0ADH    ;
postgetcastate     equ  0AEH    ;
postsetcastate     equ  0AFH    ;
postdestroyca      equ  0B0H    ;
postglobalreg      equ  0ACH    ;                                       ;1.2

pre_len_register        equ 16  ;number of bytes of System Trace        ;$Z6I
pre_len_deregister      equ 00  ;  Pre-invocation parameters            ;$Z6I
pre_len_getphysbuf      equ 14  ;                                       ;$Z6I
pre_len_getbuf          equ 10  ;                                       ;$Z6I
pre_len_showbuf         equ 06  ;                                       ;$Z6I
pre_len_getcurpos       equ 10  ;                                       ;$Z6I
pre_len_getcurtype      equ 06  ;                                       ;$Z6I
pre_len_getmode         equ 06  ;                                       ;$Z6I
pre_len_setcurpos       equ 06  ;                                       ;$Z6I
pre_len_setcurtype      equ 06  ;                                       ;$Z6I
pre_len_setmode         equ 06  ;                                       ;$Z6I
pre_len_readcharstr     equ 14  ;                                       ;$Z6I
pre_len_readcellstr     equ 14  ;                                       ;$Z6I
pre_len_wrtnchar        equ 13  ;                                       ;$Z6I
pre_len_wrtnattr        equ 13  ;                                       ;$Z6I
pre_len_wrtncell        equ 14  ;                                       ;$Z6I
pre_len_wrtcharstr      equ 12  ;                                       ;$Z6I
pre_len_wrtcharstratt   equ 17  ;                                       ;$Z6I
pre_len_wrtcellstr      equ 12  ;                                       ;$Z6I
pre_len_wrttty          equ 08  ;                                       ;$Z6I
pre_len_scrollup        equ 16  ;                                       ;$Z6I
pre_len_scrolldn        equ 16  ;                                       ;$Z6I
pre_len_scrolllf        equ 16  ;                                       ;$Z6I
pre_len_scrollrt        equ 16  ;                                       ;$Z6I
pre_len_setansi         equ 04  ;                                       ;$Z6I
pre_len_getansi         equ 06  ;                                       ;$Z6I
pre_len_prtsc           equ 02  ;                                       ;$Z6I
pre_len_scrlock         equ 08  ;                                       ;$Z6I
pre_len_scrunlock       equ 02  ;                                       ;$Z6I
pre_len_savredrawwait   equ 08  ;                                       ;$Z6I
pre_len_savredrawundo   equ 06  ;                                       ;$Z6I
pre_len_popup           equ 08  ;                                       ;$Z6I
pre_len_endpopup        equ 02  ;                                       ;$Z6I
pre_len_prtsctoggle     equ 02  ;                                       ;$Z6I
pre_len_modewait        equ 08  ;                                       ;$Z6I
pre_len_modeundo        equ 06  ;                                       ;$Z6I
pre_len_getfont         equ 08  ;                                       ;$Z6I
pre_len_getconfig       equ 08  ;                                       ;$Z6I
pre_len_setcp           equ 06  ;                                       ;$Z6I
pre_len_getcp           equ 08  ;                                       ;$Z6I
pre_len_setfont         equ 08  ;                                       ;$Z6I
pre_len_getstate        equ 08  ;                                       ;$Z6I
pre_len_setstate        equ 08  ;                                       ;$Z6I
pre_len_checkchartype   equ 10  ;
pre_len_createca        equ 10  ;
pre_len_getcastate      equ 08  ;
pre_len_setcastate      equ 06  ;
pre_len_destroyca       equ 04  ;
pre_len_globalreg       equ 00  ;                                       ;1.2

post_len_register       equ 02  ;number of bytes of System Trace        ;$Z6I
post_len_deregister     equ 02  ;  Post-invocation parameters           ;$Z6I
post_len_getphysbuf     equ 04  ;                                       ;$Z6I
post_len_getbuf         equ 10  ;                                       ;$Z6I
post_len_showbuf        equ 04  ;                                       ;$Z6I
post_len_getcurpos      equ 04  ;                                       ;$Z6I
post_len_getcurtype     equ 04  ;                                       ;$Z6I
post_len_getmode        equ 04  ;                                       ;$Z6I
post_len_setcurpos      equ 04  ;                                       ;$Z6I
post_len_setcurtype     equ 04  ;                                       ;$Z6I
post_len_setmode        equ 04  ;                                       ;$Z6I
post_len_readcharstr    equ 06  ;                                       ;$Z6I
post_len_readcellstr    equ 06  ;                                       ;$Z6I
post_len_wrtnchar       equ 04  ;                                       ;$Z6I
post_len_wrtnattr       equ 04  ;                                       ;$Z6I
post_len_wrtncell       equ 04  ;                                       ;$Z6I
post_len_wrtcharstr     equ 04  ;                                       ;$Z6I
post_len_wrtcharstratt  equ 04  ;                                       ;$Z6I
post_len_wrtcellstr     equ 04  ;                                       ;$Z6I
post_len_wrttty         equ 04  ;                                       ;$Z6I
post_len_scrollup       equ 04  ;                                       ;$Z6I
post_len_scrolldn       equ 04  ;                                       ;$Z6I
post_len_scrolllf       equ 04  ;                                       ;$Z6I
post_len_scrollrt       equ 04  ;                                       ;$Z6I
post_len_setansi        equ 04  ;                                       ;$Z6I
post_len_getansi        equ 06  ;                                       ;$Z6I
post_len_prtsc          equ 04  ;                                       ;$Z6I
post_len_scrlock        equ 05  ;                                       ;$Z6I
post_len_scrunlock      equ 04  ;                                       ;$Z6I
post_len_savredrawwait  equ 04  ;                                       ;$Z6I
post_len_savredrawundo  equ 02  ;                                       ;$Z6I
post_len_popup          equ 04  ;                                       ;$Z6I
post_len_endpopup       equ 04  ;                                       ;$Z6I
post_len_prtsctoggle    equ 04  ;                                       ;$Z6I
post_len_modewait       equ 04  ;                                       ;$Z6I
post_len_modeundo       equ 02  ;                                       ;$Z6I
post_len_getfont        equ 04  ;                                       ;$Z6I
post_len_getconfig      equ 12  ;                                       ;$Z6I
post_len_setcp          equ 04  ;                                       ;$Z6I
post_len_getcp          equ 06  ;                                       ;$Z6I
post_len_setfont        equ 04  ;                                       ;$Z6I
post_len_getstate       equ 04  ;                                       ;$Z6I
post_len_setstate       equ 04  ;                                       ;$Z6I
post_len_checkchartype  equ 02  ;number of bytes of System Trace
post_len_createca       equ 02  ;  Post-invocation parameters
post_len_getcastate     equ 02  ;
post_len_setcastate     equ 02  ;
post_len_destroyca      equ 02  ;
post_len_globalreg      equ 00  ;                                       ;1.2

fc_getphysbuf      equ  000H    ;00
fc_getbuf          equ  001H    ;01
fc_showbuf         equ  002H    ;02
fc_getcurpos       equ  003H    ;03
fc_getcurtype      equ  004H    ;04
fc_getmode         equ  005H    ;05
fc_setcurpos       equ  006H    ;06
fc_setcurtype      equ  007H    ;07
fc_setmode         equ  008H    ;08
fc_readcharstr     equ  009H    ;09
fc_readcellstr     equ  00AH    ;10
fc_wrtnchar        equ  00BH    ;11
fc_wrtnattr        equ  00CH    ;12
fc_wrtncell        equ  00DH    ;13
fc_wrtcharstr      equ  00EH    ;14
fc_wrtcharstratt   equ  00FH    ;15
fc_wrtcellstr      equ  010H    ;16
fc_wrttty          equ  011H    ;17
fc_scrollup        equ  012H    ;18
fc_scrolldn        equ  013H    ;19
fc_scrolllf        equ  014H    ;20
fc_scrollrt        equ  015H    ;21
fc_setansi         equ  016H    ;22
fc_getansi         equ  017H    ;23
fc_prtsc           equ  018H    ;24
fc_scrlock         equ  019H    ;25
fc_scrunlock       equ  01AH    ;26
fc_savredrawwait   equ  01BH    ;27
fc_savredrawundo   equ  01CH    ;28
fc_popup           equ  01DH    ;29
fc_endpopup        equ  01EH    ;30
fc_prtsctoggle     equ  01FH    ;31
fc_modewait        equ  020H    ;32
fc_modeundo        equ  021H    ;33
fc_getfont         equ  022H    ;34
fc_getconfig       equ  023H    ;35
fc_setcp           equ  024H    ;36
fc_getcp           equ  025H    ;37
fc_setfont         equ  026H    ;38
fc_getstate        equ  027H    ;39
fc_setstate        equ  028H    ;40
fc_register        equ  029H    ;41
fc_deregister      equ  02AH    ;42
fc_globalreg       equ  02BH    ;43                                     ;1.2
fc_createca        equ  02CH    ;44
fc_getcastate      equ  02DH    ;45
fc_setcastate      equ  02EH    ;46
fc_destroyca       equ  02FH    ;47
fc_checkchartype   equ  030H    ;48
fc_save            equ  041H    ;65                                     ;P3839
fc_restore         equ  042H    ;66                                     ;P3839
fc_free            equ  043H    ;67                                     ;P3839
fc_shellinit       equ  044H    ;68                                     ;P3839

maskgetphysbuf     equ  0000000000010000B ;VIOGETPHYSBUF mask
maskgetbuf         equ  0000000000001000B ;VIOGETBUF mask
maskshowbuf        equ  0000000100000000B ;VIOSHOWBUF mask
maskgetcurpos      equ  0000000000000001B ;VIOGETCURPOS mask
maskgetcurtype     equ  0000000000000010B ;VIOGETCURTYPE mask
maskgetmode        equ  0000000000000100B ;VIOGETMODE mask
masksetcurpos      equ  0000000000100000B ;VIOSETCURPOS mask
masksetcurtype     equ  0000000001000000B ;VIOSETCURTYPE mask
masksetmode        equ  0000000010000000B ;VIOSETMODE mask
maskreadcharstr    equ  0000001000000000B ;VIOREADCHARSTR mask
maskreadcellstr    equ  0000010000000000B ;VIOREADCELLSTR mask
maskwrtnchar       equ  0000100000000000B ;VIOWRTNCHAR mask
maskwrtnattr       equ  0001000000000000B ;VIOWRTNATTR mask
maskwrtncell       equ  0010000000000000B ;VIOWRTNCELL mask
maskwrtcharstr     equ  1000000000000000B ;VIOWRTCHARSTR mask
maskwrtcharstratt  equ  0000000000000001B ;VIOWRTCHARSTRATT mask
maskwrtcellstr     equ  0000000000000010B ;VIOWRTCELLSTR mask
maskwrttty         equ  0100000000000000B ;VIOWRTTTY mask
maskscrollup       equ  0000000000000100B ;VIOSCROLLUP mask
maskscrolldn       equ  0000000000001000B ;VIOSCROLLDN mask
maskscrolllf       equ  0000000000010000B ;VIOSCROLLLF mask
maskscrollrt       equ  0000000000100000B ;VIOSCROLLRT mask
masksetansi        equ  0000000001000000B ;VIOSETANSI mask
maskgetansi        equ  0000000010000000B ;VIOGETANSI mask
maskprtsc          equ  0000000100000000B ;VIOPRTSC mask
maskscrlock        equ  0000001000000000B ;VIOSCRLOCK mask
maskscrunlock      equ  0000010000000000B ;VIOSCRUNLOCK mask
masksavredrawwait  equ  0000100000000000B ;VIOSAVREDRAWWAIT mask
masksavredrawundo  equ  0001000000000000B ;VIOSAVREDRAWUNDO mask
maskpopup          equ  0010000000000000B ;VIOPOPUP mask
maskendpopup       equ  0100000000000000B ;VIOENDPOPUP mask
maskprtsctoggle    equ  1000000000000000B ;VIOPRTSCTOGGLE mask
maskmodewait       equ  0000000000000001B ;VIOMODEWAIT mask
maskmodeundo       equ  0000000000000010B ;VIOMODEUNDO mask
maskgetfont        equ  0000000000000100B ;VIOGETFONT mask
maskgetconfig      equ  0000000000001000B ;VIOGETCONFIG mask
masksetcp          equ  0000000000010000B ;VIOSETCP mask                ;$Z9I
maskgetcp          equ  0000000000100000B ;VIOGETCP mask                ;$Z9I
masksetfont        equ  0000000001000000B ;VIOSETFONT mask              ;$Z9I
maskgetstate       equ  0000000010000000B ;VIOGETSTATE mask             ;$Z9I
masksetstate       equ  0000000100000000B ;VIOSETSTATE mask             ;$Z9I
maskcreateca       equ  0000010000000000B ;XVIOCREATECA mask         ;DCR132
maskgetcastate     equ  0000100000000000B ;XVIOGETCASTATE mask       ;DCR132
masksetcastate     equ  0001000000000000B ;XVIOSETCASTATE mask       ;DCR132
maskdestroyca      equ  0010000000000000B ;XVIODESTROYCA mask        ;DCR132
maskcheckchartype  equ  0100000000000000B ;XVIOCHECKCHARTYPE mask    ;DCR132
masklastplus1      equ  1000000000000000B ;VIOREGISTER boundary marker  ;$Z9I
maskgloblastplus1  equ  0000100000000000B ;VIOGLOBALREG boundary marker ;1.2

bit_getphysbuf     equ  0000000000010000B ;VIOGETPHYSBUF mask
bit_getbuf         equ  0000000000001000B ;VIOGETBUF mask
bit_showbuf        equ  0000000100000000B ;VIOSHOWBUF mask
bit_getcurpos      equ  0000000000000001B ;VIOGETCURPOS mask
bit_getcurtype     equ  0000000000000010B ;VIOGETCURTYPE mask
bit_getmode        equ  0000000000000100B ;VIOGETMODE mask
bit_setcurpos      equ  0000000000100000B ;VIOSETCURPOS mask
bit_setcurtype     equ  0000000001000000B ;VIOSETCURTYPE mask
bit_setmode        equ  0000000010000000B ;VIOSETMODE mask
bit_readcharstr    equ  0000001000000000B ;VIOREADCHARSTR mask
bit_readcellstr    equ  0000010000000000B ;VIOREADCELLSTR mask
bit_wrtnchar       equ  0000100000000000B ;VIOWRTNCHAR mask
bit_wrtnattr       equ  0001000000000000B ;VIOWRTNATTR mask
bit_wrtncell       equ  0010000000000000B ;VIOWRTNCELL mask
bit_wrtcharstr     equ  1000000000000000B ;VIOWRTCHARSTR mask
bit_wrtcharstratt  equ  0000000000000001B ;VIOWRTCHARSTRATT mask
bit_wrtcellstr     equ  0000000000000010B ;VIOWRTCELLSTR mask
bit_wrttty         equ  0100000000000000B ;VIOWRTTTY mask
bit_scrollup       equ  0000000000000100B ;VIOSCROLLUP mask
bit_scrolldn       equ  0000000000001000B ;VIOSCROLLDN mask
bit_scrolllf       equ  0000000000010000B ;VIOSCROLLLF mask
bit_scrollrt       equ  0000000000100000B ;VIOSCROLLRT mask
bit_setansi        equ  0000000001000000B ;VIOSETANSI mask
bit_getansi        equ  0000000010000000B ;VIOGETANSI mask
bit_prtsc          equ  0000000100000000B ;VIOPRTSC mask
bit_scrlock        equ  0000001000000000B ;VIOSCRLOCK mask
bit_scrunlock      equ  0000010000000000B ;VIOSCRUNLOCK mask
bit_savredrawwait  equ  0000100000000000B ;VIOSAVREDRAWWAIT mask
bit_savredrawundo  equ  0001000000000000B ;VIOSAVREDRAWUNDO mask
bit_popup          equ  0010000000000000B ;VIOPOPUP mask
bit_endpopup       equ  0100000000000000B ;VIOENDPOPUP mask
bit_prtsctoggle    equ  1000000000000000B ;VIOPRTSCTOGGLE mask
bit_modewait       equ  0000000000000001B ;VIOMODEWAIT mask
bit_modeundo       equ  0000000000000010B ;VIOMODEUNDO mask
bit_getfont        equ  0000000000000100B ;VIOGETFONT mask
bit_getconfig      equ  0000000000001000B ;VIOGETCONFIG mask
bit_setcp          equ  0000000000010000B ;VIOSETCP mask
bit_getcp          equ  0000000000100000B ;VIOGETCP mask
bit_setfont        equ  0000000001000000B ;VIOSETFONT mask
bit_getstateOEM    equ  0100000000000000B ;VIOGETSTATE mask             ;D811
bit_setstateOEM    equ  1000000000000000B ;VIOSETSTATE mask             ;D811
bit_getstate       equ  0000000010000000B ;VIOGETSTATE mask
bit_setstate       equ  0000000100000000B ;VIOSETSTATE mask
bit_createca       equ  0000010000000000B ;VIOCREATECA mask
bit_getcastate     equ  0000100000000000B ;VIOGETCASTATE mask
bit_setcastate     equ  0001000000000000B ;VIOSETCASTATE mask
bit_destroyca      equ  0010000000000000B ;VIODESTROYCA mask
bit_checkchartype  equ  0100000000000000B ;VIOCHECKCHARTYPE mask

equprtsc           equ  0018H   ;VIO function number of VIOPRTSC
equscrlock         equ  0019H   ;VIO function number of VIOSCRLOCK
equscrunlock       equ  001AH   ;VIO function number of VIOSCRUNLOCK
equsavredrawwait   equ  001BH   ;VIO function number of VIOSAVREDRAWWAIT
equsavredrawundo   equ  001CH   ;VIO function number of VIOSAVREDRAWUNDO
equpopup           equ  001DH   ;VIO function number of VIOPOPUP
equendpopup        equ  001EH   ;VIO function number of VIOENDPOPUP
equprtsctoggle     equ  001FH   ;VIO function number of VIOPRTSCTOGGLE
equmodewait        equ  0020H   ;VIO function number of VIOMODEWAIT
equmodeundo        equ  0021H   ;VIO function number of VIOMODEUNDO
equgetfont         equ  0022H   ;VIO function number of VIOGETFONT
equgetconfig       equ  0023H   ;VIO function number of VIOGETCONFIG

traceonoffmask  equ 08H         ;mask for bit in GDTINFO SYSTRACE byte
SIS_VIOMEC      equ 13          ;VIO major event code in the 13th byte

popwaitmask     equ 0001H       ;VIOPOPUP wait flags mask
poptypemask     equ 0002H       ;VIOPOPUP type flags mask              ;@B50

avstonorm       equ 0FFFFH      ;if returned from AVS, act as if not replaced

wait_hi         equ 0FFFFH      ;dword = -1 waits indefinitely
wait_lo         equ 0FFFFH      ;
nowait_hi       equ 0000H       ;dword = 0 returns immediately
nowait_lo       equ 0000H       ;
mod_len_max     equ 128         ;max length of AVS module name          ;D549f
ep_len_max      equ 32          ;max length of AVS entry name

LOOK_UP_SGID    equ 0           ;D549
LOOK_UP_PID     equ 1           ;D549


;AVSCB - the module and procedure names are added to the end of this struc
avsdata       struc             ;AVSDATA                               ;D549
   avscbsize    dw  0           ;size of AVSCB allocated               ;D549
   ps_enter     dd  0           ;RAMsem for AVS_PRTSC entry            ;D549
   ps_exit      dd  0           ;RAMsem for AVS_PRTSC exit             ;D549
   pstog_enter  dd  0           ;RAMsem for AVS_PRTSCTOGGLE entry      ;D549
   pstog_exit   dd  0           ;RAMsem for AVS_PRTSCTOGGLE exit       ;D549
   prtscAX      dw  0           ;ret. code area from AVS_PRTSC         ;D549
   prtsctogAX   dw  0           ;ret. code area from AVS_PRTSCTOGGLE   ;D549
   psThID       dw  0           ;thread ID for AVS_PRTSC thread        ;D549
   pstogThID    dw  0           ;thread ID for AVS_PRTSCTOGGLE thread  ;D549
   reg_pid      dw  0000H       ;PID that called VIOREGISTER      ;D549,@T14
   modname      db  mod_len_max+1 dup(0)  ;AVS module name             ;D549f
   epname       db  ep_len_max+1  dup(0)  ;AVS entry procedure name    ;D549f   ;D549
avsdata       ends                                                     ;D549

avsSZ         equ     size avsdata-2                                   ;D549

fsRAMstruc struc                                                        ;%A0I
   fs_len     dw  ?                                                     ;%A0I
   fs_PID     dw  ?                                                     ;%A0I
   fs_TID     dw  ?                                                     ;%A0I
   fs_count   dw  ?                                                     ;%A0I
   fs_client  dw  ?                                                     ;%A0I
   fs_sem     dd  ?                                                     ;%A0I
fsRAMstruc ends                                                         ;%A0I

reg_parms       struc   ;parameters of VIOREGISTER function
   reg_filler   db 12 dup(?)
   reghi        dw  ?   ;
   reghiest     dw  ?   ;
   regloest     dw  ?   ;
   reglo        dw  ?   ;
   regepoff     dw  ?   ;
   regepsel     dw  ?   ;
   regmodoff    dw  ?   ;
   regmodsel    dw  ?   ;
reg_parms       ends    ;

;------------------------------------------------------------------------------
; viorout stack frame
;
   trace_0      equ -54 ;(BP-54) viopretrace/vioposttrace work area
   trace_1      equ -52 ;(BP-52)
   trace_2      equ -50 ;(BP-50)
   trace_3      equ -48 ;(BP-48)
   trace_4      equ -46 ;(BP-46)
   trace_5      equ -44 ;(BP-44)
   trace_6      equ -42 ;(BP-42)
   trace_7      equ -40 ;(BP-40)
   trace_8      equ -38 ;(BP-38)
   trace_9      equ -36 ;(BP-36)
   trace_10     equ -34 ;(BP-34)
   trace_IP     equ -32 ;(BP-32) viopretrace/vioposttrace caller's IP
   rout_savDI   equ -30 ;(BP-30) PUSHA register save area
   rout_savSI   equ -28 ;(BP-28)
   rout_savBP   equ -26 ;(BP-26)
   rout_savSP   equ -24 ;(BP-24)
   rout_savBX   equ -22 ;(BP-22)
   rout_savDX   equ -20 ;(BP-20)
   rout_savCX   equ -18 ;(BP-18)
   rout_savAX   equ -16 ;(BP-16) AX initially holds MINOR EVENT CODE
   rout_oldES   equ -14 ;(BP-14)
   rout_oldFS   equ -12 ;(BP-12)                                         ;D549
   extSGmask    equ -10 ;(BP-10) mask of VIO calls not OK for Ext. SGs
   replacemask  equ -8  ;(BP-08) mask of replaced functions
   popupokmask  equ -6  ;(BP-06) mask of VIO calls OK for popups
   viossmask    equ -4  ;(BP-04) mask of VIO Screen Switcher functions
   funcmask     equ -2  ;(BP-02) mask containing VIO function mask
routparms       struc
   rout_oldBP   dw  ?   ;(BP+00) caller's BP save area
   rout_oldDS   dw  ?   ;(BP+02) caller's DS save area
   rout_nearIP  dw  ?   ;(BP+04) near return IP to VIOxxx calling proc
   rout_fc      dw  ?   ;(BP+06) function code
   rout_farIP   dw  ?   ;(BP+08) caller's return IP
   rout_farCS   dw  ?   ;(BP+10) caller's return CS
   rout_parm1   dw  ?   ;(BP+12) callers parm #1
   rout_parm2   dw  ?   ;(BP+14) callers parm #2
   rout_parm3   dw  ?   ;(BP+16) callers parm #3
   rout_parm4   dw  ?   ;(BP+18) callers parm #4
   rout_parm5   dw  ?   ;(BP+20) callers parm #5
   rout_parm6   dw  ?   ;(BP+22) callers parm #6
   rout_parm7   dw  ?   ;(BP+24) callers parm #7
   rout_parm8   dw  ?   ;(BP+26) callers parm #8
   rout_parm9   dw  ?   ;(BP+28) callers parm #9
   rout_parm10  dw  ?   ;(BP+30) callers parm #10
   rout_parm11  dw  ?   ;(BP+32) callers parm #11
   rout_parm12  dw  ?   ;(BP+34) callers parm #12
routparms       ends    ;

gpb_parms       struc   ;parameters of VIOGETPHYSBUF function
   gpbstrt_hi   dw  ?   ;
   gpbstrt_lo   dw  ?   ;
   gpblen_hi    dw  ?   ;
   gpblen_lo    dw  ?   ;
gpb_parms       ends    ;

popup_parms     struc   ;parameters of VIOPOPUP function
   pu_filler    db  12 dup(?)
   puviohndl    dw  ?   ;
   puwaitoff    dw  ?   ;
   puwaitsel    dw  ?   ;
popup_parms     ends    ;

free_parms      struc   ;parameters of VIOFREE function
   free_oldBP   dw  ?   ;(BP+00) caller's BP save area
   free_oldDS   dw  ?   ;(BP+02) caller's DS save area
   free_nearIP  dw  ?   ;(BP+04) near return IP to VIOxxx calling proc
   free_fc      dw  ?   ;(BP+06) function code
   free_farIP   dw  ?   ;(BP+08) caller's return IP
   free_farCS   dw  ?   ;(BP+10) caller's return CS
   free_SG      dw  ?   ;
free_parms      ends    ;

cstr_parms      struc   ;VIOWRTCELLSTR parameters
   cstr_hnd     dw  ?   ;viohandle
   cstr_col     dw  ?   ;starting column position for output
   cstr_row     dw  ?   ;starting row position for output
   cstr_len     dw  ?   ;cell string length
   cstr_off     dw  ?   ;cell string offset
   cstr_sel     dw  ?   ;cell string selector
cstr_parms      ends

chstr_parms     struc   ;VIOWRTCHARSTR parameters
   chstr_hnd    dw  ?   ;viohandle
   chstr_col    dw  ?   ;starting column position for output
   chstr_row    dw  ?   ;starting row position for output
   chstr_len    dw  ?   ;char string length
   chstr_off    dw  ?   ;char string offset
   chstr_sel    dw  ?   ;char string selector
chstr_parms     ends

csa_parms       struc   ;VIOWRTCHARSTRATT parameters
   csa_hnd      dw  ?   ;viohandle
   csa_aoff     dw  ?   ;attribute offset
   csa_asel     dw  ?   ;attribute selector
   csa_col      dw  ?   ;starting column position for output
   csa_row      dw  ?   ;starting row position for output
   csa_len      dw  ?   ;char string length
   csa_off      dw  ?   ;char string offset
   csa_sel      dw  ?   ;char string selector
csa_parms       ends

na_parms        struc   ;VIOWRTNATTR parameters
   na_hnd       dw  ?   ;viohandle
   na_col       dw  ?   ;starting column position for output
   na_row       dw  ?   ;starting row position for output
   na_times     dw  ?   ;times to write attribute
   na_off       dw  ?   ;attribute offset
   na_sel       dw  ?   ;attribute selector
na_parms        ends

nc_parms        struc   ;VIOWRTNCELL parameters
   nc_hnd       dw  ?   ;viohandle
   nc_col       dw  ?   ;starting column position for output
   nc_row       dw  ?   ;starting row position for output
   nc_times     dw  ?   ;times to write cell
   nc_off       dw  ?   ;cell offset
   nc_sel       dw  ?   ;cell selector
nc_parms        ends

nch_parms       struc   ;VIOWRTNCHAR parameters
   nch_hnd      dw  ?   ;viohandle
   nch_col      dw  ?   ;starting column position for output
   nch_row      dw  ?   ;starting row position for output
   nch_times    dw  ?   ;times to write char
   nch_off      dw  ?   ;char offset
   nch_sel      dw  ?   ;char selector
nch_parms       ends

wtt_parms       struc   ;VIOWRTNCHAR parameters
   wtt_hnd      dw  ?   ;viohandle
   wtt_len      dw  ?   ;char string length
   wtt_off      dw  ?   ;char string offset
   wtt_sel      dw  ?   ;char string selector
wtt_parms       ends

tty_parms       struc   ;VIOWRTTTY parameters
                dw  ?   ;BP save area
                dw  ?   ;return ip
                dw  ?   ;return cs
   tty_hnd      dw  ?   ;viohandle
   tty_len      dw  ?   ;size of wrttty data
   tty_off      dw  ?   ;offset of wrttty data
   tty_sel      dw  ?   ;selector of wrttty data
tty_parms       ends

ptty_parms      struc   ;pVIOWRTTTY parameters
                dw  ?   ;BP save area
   ptty_sel     dw  ?   ;offset of wrttty data
   ptty_off     dw  ?   ;offset of wrttty data
   ptty_len     dw  ?   ;size of wrttty data
   ptty_hnd     dw  ?   ;viohandle
                dw  ?   ;dummy ret IP
                dw  ?   ;dummy ret CS
ptty_parms      ends

stateparms      STRUC                                                   ;D811
sp_rblength     dw      12              ;Request block length (=12)     ;D811
sp_reqtype      dw      0               ;Request type                   ;D811
sp_data         dw      0               ;Data word                      ;D811
sp_palregs      dw      0               ;First palette register         ;D811
sp_offset       dw      0               ;Offset of data area            ;D811
sp_selector     dw      0               ;Selector of data area          ;D811
stateparms      ENDS                                                    ;D811

scp_parms       struc   ;VIOSETCP stack structure                       ;@B50
;@B50f          dw  ?   ;saved registers  bx                            ;@B50
;@B50f          dw  ?   ;                 fs                            ;@B50
;@B50f          dw  ?   ;                 ds                            ;@B50
                dw  ?   ;old bp                                         ;@B50f
                dw  ?   ;return ip                                      ;@B50
                dw  ?   ;return cs                                      ;@B50
   scp_hnd      dw  ?   ;viohandle                                      ;@B50
   scp_codepg   dw  ?   ;CodePage id                                    ;@B50
scp_parms       ends                                                    ;@B50

sinit_parms     struc   ;parameters for VIOSHELLINIT function
   pause_off    dw  ?   ;
   pause_sel    dw  ?   ;
sinit_parms     ends    ;

Igvs_record     struc   ;INSTANCE GVS data area                         ;1.2
   Igvs_off     dw  0   ;dword address to GVS entry procedure           ;1.2
   Igvs_sel     dw  0   ;                                               ;1.2
   Ireplaced    dw  ?   ;non-zero => GVS to be called for current func. ;1.2
   Igvs_loest   dw  ?   ;                                               ;1.2
   Igvs_lo      dw  ?   ;                                               ;1.2
   Igvs_hi      dw  ?   ;                                               ;1.2
   Igvs_hiest   dw  ?   ;                                               ;1.2
   Igvs_zero    dw  ?   ;                                               ;1.2
Igvs_record     ends    ;                                               ;1.2
Igvs_rec_sz     equ     size Igvs_record                                ;1.2

Ggvs_record     struc   ;GLOBAL VioGlobalReg storage record             ;1.2
   Ggvs_mod     db  9 dup(0)                                            ;1.2
   Ggvs_ep      db 33 dup(0)                                            ;1.2
   Ggvs_loest   dw  ?   ;                                               ;1.2
   Ggvs_lo      dw  ?   ;                                               ;1.2
   Ggvs_hi      dw  ?   ;                                               ;1.2
   Ggvs_hiest   dw  ?   ;                                               ;1.2
   filler       dw  ?   ;Make it dword aligned                          ;@T73
Ggvs_record     ends    ;                                               ;1.2
Ggvs_rec_sz     equ     size Ggvs_record                                ;1.2

glob_parms      struc   ;parameters of VIOGLOBALREG function            ;1.2
   glob_filler  db 12 dup(?)                                            ;1.2
   glob_rsrv0   dw  ?   ;                                               ;1.2
   glob_rsrv2   dw  ?   ;                                               ;1.2
   globhi       dw  ?   ;                                               ;1.2
   globhiest    dw  ?   ;                                               ;1.2
   globloest    dw  ?   ;                                               ;1.2
   globlo       dw  ?   ;                                               ;1.2
   globepoff    dw  ?   ;                                               ;1.2
   globepsel    dw  ?   ;                                               ;1.2
   globmodoff   dw  ?   ;                                               ;1.2
   globmodsel   dw  ?   ;                                               ;1.2
glob_parms      ends    ;                                               ;1.2

detached        equ  4  ;local info seg process type

OEMFUNCTION EQU 08000h  ;OEM defined state parameter for VioGet/SetState;D811

