home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v2.zip / DDKX86 / DBCSDD / SRC_DBCS / VDHWNDW / WDHINFO.ASM < prev    next >
Assembly Source File  |  1995-04-14  |  34KB  |  834 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT (C) Microsoft Corporation, 1989
  4. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  5. ;
  6. ;    The following IBM OS/2 WARP source code is provided to you solely for
  7. ;    the purpose of assisting you in your development of OS/2 WARP device
  8. ;    drivers. You may use this code in accordance with the IBM License
  9. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  10. ;    Copyright statement may not be removed.;
  11. ;*****************************************************************************/
  12.         PAGE    58,132
  13.         TITLE   WDHINFO.Asm -- Windowable Device Handler Info Routines
  14.  
  15. ;/*****************************************************************************
  16. ;*
  17. ;* SOURCE FILE NAME = WDHINFO.Asm
  18. ;*
  19. ;* DESCRIPTIVE NAME = Windowable Device Handler Info Routines
  20. ;*
  21. ;*
  22. ;* VERSION      V2.0
  23. ;*
  24. ;* DATE
  25. ;*
  26. ;* DESCRIPTION  This source file contains VDH entry points for setting
  27. ;*              and getting cursor and variable information.
  28. ;*
  29. ;* FUNCTIONS    GetState
  30. ;*              SetState
  31. ;*              GetCursorInfo
  32. ;*              SetCursorInfo
  33. ;*              GetVarInfo
  34. ;*              SetVarInfo
  35. ;*              GetDBCSInfo
  36. ;*              GetLVBInfo
  37. ;*
  38. ;* NOTES        NONE
  39. ;*
  40. ;* STRUCTURES   NONE
  41. ;*
  42. ;* EXTERNAL REFERENCES  RegSave, RegRest
  43. ;*
  44. ;*              NONE
  45. ;*
  46. ;* EXTERNAL FUNCTIONS
  47. ;*
  48. ;*              NONE
  49. ;*
  50. ;* CHANGE ACTIVIY =
  51. ;*   DATE      FLAG       APAR    CHANGE DESCRIPTION
  52. ;*   --------  ---------- -----   --------------------------------------
  53. ;*   mm/dd/yy  @Vr.mpppxx xxxxx   xxxxxxx
  54. ;*   12/29/88  @@A        P3344   TLB,CJJ In SetCursorInfo save the return code
  55. ;*                                before call to ReleaseSema4
  56. ;*   01/12/89  @T12       P3451   TPL, Return proper cursor type width &
  57. ;*                                attribute,
  58. ;*   02/06/89   @C3       3854    CJJ, Check for CodePage flag, everything else
  59. ;*                                is invalid and should return VIO_EXTENDED_SG
  60. ;*                                error
  61. ;*   03/06/89  @@S1       B700065 STJ, Shadow the cursor type,
  62. ;*   03/22/89  @T22       B700622 TPL, Return codepage of 0 if DEVINFO is wrong
  63. ;*   03/25/89  @P1        D132    TPL, DCR 132 changes
  64. ;*   04/27/89  @C18       B701438 CJJ, Check both start & end line parms are
  65. ;*                                valid,
  66. ;*   06/13/89  @C23       B703614 CJJ, Allow ForceCP call during
  67. ;*                                SetVariableInfo,
  68. ;*   06/15/89  @T35       B703689 TPL, Check start line properly for
  69. ;*                                SetCursorInfo,
  70. ;*   08/07/89  @C30       B706051 CJJ, For VioWindowable check for valid
  71. ;*                                codepage,
  72. ;*   10/24/89  @S38       B786295 STJ, Use 8-pel default size for non-25-line
  73. ;*                                modes,
  74. ;*   11/02/89  @D549      D549    CJJ, Seltable changes due to rangeless
  75. ;*                                sessions,
  76. ;*   11/30/89  D811       D811    MS,  DCR811
  77. ;*   02/02/90  @T52       D704    DCR  704 work
  78. ;*   07/06/90  @T71       B714347 TPL, Allow Shell to make AVIO calls, Hursley
  79. ;*                                DCR 25177
  80. ;*   04/11/91  D1348      D1348   NAKADA, Enable DBCS support in Vio-Window,
  81. ;*   06/05/91  @S38f      SM03642 WKB, Use 8-pel default size for > 25-line
  82. ;*                                modes,
  83. ;****************************************************************************/
  84.  
  85.         .xlist
  86.         INCLUDE pmwinx.inc
  87.         INCLUDE pmaviop.inc
  88.         INCLUDE wdhequ.inc              ;Windowable Device Handler Equates
  89.         INCLUDE wdhgdata.inc            ;BVH global data externals      ;@T52
  90.         INCLUDE bvsparms.inc            ;BVS Parameter Equates
  91.         INCLUDE error2.inc              ;CP/DOS Error Codes
  92.         INCLUDE struc.inc               ;Structured Macros
  93.         .list
  94.  
  95.         .386p                   ;@D549
  96.  
  97.         extrn   CheckAvio:NEAR
  98.         extrn   SecureSema4:NEAR
  99.         extrn   ReleaseSema4:NEAR
  100.         extrn   UpdateCharRect:NEAR
  101.  
  102.         extrn   RegSave:NEAR
  103.         extrn   RegRest:NEAR
  104.  
  105.         extrn   GREENTRY4:FAR                                           ;@T52
  106.  
  107. IFDEF D1348 ;reflesh dbcs env. at VioSetCp
  108.         extrn   DOSGETDBCSEV:FAR        ; Get DBCS environment vectors
  109. ENDIF ;D1348
  110.  
  111. WDHGSEG SEGMENT PARA PUBLIC 'DATA' USE16 ;Global data segment for WDH  @D549
  112. WDHGSEG ENDS
  113.  
  114. R2CSEG  SEGMENT BYTE PUBLIC 'CODE' USE16        ;@D549
  115.         ASSUME  CS:R2CSEG
  116.  
  117. ;/****************************************************************************
  118. ;*
  119. ;*  SUBROUTINE NAME: GetState
  120. ;*
  121. ;*  DESCRIPTIVE NAME:  Get the requested video state
  122. ;*
  123. ;*  FUNCTION:
  124. ;*
  125. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 280 )
  126. ;*
  127. ;*  INPUT: (Passed on stack)
  128. ;*             FAR *Environment ( Environment buffer for the session )
  129. ;*             FAR *ParmBlock
  130. ;*             ULONG Function ( Call vector table entry = 280 )
  131. ;*
  132. ;*  EXIT-NORMAL: If OEM defines this function then
  133. ;*                 AX = 0
  134. ;*                 user defined information is returned
  135. ;*               Else
  136. ;*                 AX = ERROR_VIO_INVALID_PARMS
  137. ;*
  138. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS
  139. ;*
  140. ;*  EFFECTS:  None
  141. ;*
  142. ;*  INTERNAL REFERENCES:
  143. ;*    ROUTINES: None
  144. ;*
  145. ;*  EXTERNAL REFERENCES:
  146. ;*    ROUTINES:  None
  147. ;*
  148. ;****************************************************************************/
  149.  
  150. Public   GetState                                                       ;D811
  151. GetState Proc Far                                                       ;D811
  152.         mov ax, ERROR_VIO_INVALID_PARMS                                 ;D811
  153.         ret 12                                                          ;D811
  154. GetState EndP                                                           ;D811
  155.  
  156. ;/****************************************************************************
  157. ;*
  158. ;*  SUBROUTINE NAME: SetState
  159. ;*
  160. ;*  DESCRIPTIVE NAME:  Set the requested video state
  161. ;*
  162. ;*  FUNCTION:
  163. ;*
  164. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 280 )
  165. ;*
  166. ;*  INPUT: (Passed on stack)
  167. ;*             FAR *Environment ( Environment buffer for the session )
  168. ;*             FAR *ParmBlock
  169. ;*             ULONG Function ( Call vector table entry = 281 )
  170. ;*
  171. ;*  EXIT-NORMAL: If OEM defines this function then
  172. ;*                 AX = 0
  173. ;*                 user defined information is set
  174. ;*               Else
  175. ;*                 AX = ERROR_VIO_INVALID_PARMS
  176. ;*
  177. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS
  178. ;*
  179. ;*  EFFECTS:
  180. ;*
  181. ;*  INTERNAL REFERENCES:
  182. ;*    ROUTINES: NONE
  183. ;*
  184. ;*  EXTERNAL REFERENCES:
  185. ;*    ROUTINES:
  186. ;*
  187. ;****************************************************************************/
  188.  
  189. Public   SetState                                                       ;D811
  190. SetState Proc Far                                                       ;D811
  191.         mov ax, ERROR_VIO_INVALID_PARMS                                 ;D811
  192.         ret 12                                                          ;D811
  193. SetState EndP                                                           ;D811
  194.  
  195. ;/****************************************************************************
  196. ;*
  197. ;*  SUBROUTINE NAME: GetCursorInfo
  198. ;*
  199. ;*  DESCRIPTIVE NAME: Get cursor position and/or cursor type
  200. ;*
  201. ;*  FUNCTION: GetCursorInfo is called by BVS to return selected
  202. ;*            information about either the cursor position or the
  203. ;*            cursor type.  If the request specifies hardware and the
  204. ;*            hardware is readable, the actual hardware setting will
  205. ;*            be read and returned.  Otherwise the returned
  206. ;*            information will be taken from the environment buffer,
  207. ;*            if it has been passed.
  208. ;*
  209. ;*  ENTRY POINT: GetCursorInfo
  210. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 265 )
  211. ;*
  212. ;*  INPUT: (Passed on stack)
  213. ;*             FAR *Environment ( Environment buffer for the session )
  214. ;*             FAR *ParmBlock
  215. ;*                     USHORT Length = length of this packet
  216. ;*                     USHORT Flags  = 0 - Environment buffer only
  217. ;*                                     1 - Hardware also
  218. ;*                     USHORT Row
  219. ;*                     USHORT Column
  220. ;*                     USHORT TopScanLine
  221. ;*                     USHORT BottomScanLine
  222. ;*                     USHORT Width
  223. ;*                     USHORT Attribute
  224. ;*             ULONG Function ( Call vector table entry = 265 )
  225. ;*
  226. ;*  EXIT-NORMAL: AX = 0
  227. ;*               Cursor information is returned.
  228. ;*
  229. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS
  230. ;*
  231. ;*  EFFECTS: If hardware specified and hardware is readable, the
  232. ;*           environment buffer is updated, if passed.
  233. ;*
  234. ;*  INTERNAL REFERENCES:
  235. ;*    ROUTINES: NONE
  236. ;*
  237. ;*  EXTERNAL REFERENCES:
  238. ;*    ROUTINES: RegSave, RegRest, SecureSema4, ReleaseSema4
  239. ;*
  240. ;****************************************************************************/
  241.  
  242. GetCursorInfo PROC FAR
  243.         public  GetCursorInfo
  244.         Call    RegSave
  245.  
  246.         mov     ax,ERROR_VIO_INVALID_PARMS
  247.         test    [si].vp_flags,NOT (vp_f_physical+vp_f_curpos+vp_f_curtype) ;@@S1
  248.         .if     <z> and near
  249.         mov     ax,ERROR_VIO_INVALID_LENGTH
  250.         .if     <[si].vp_parmlength eq vp_c_attr+2> near
  251.             Call    SecureSema4
  252.  
  253.             mov     ax,es:[viops_BufferRowCount] ;Get # of rows from PSCB ;@T52
  254.             dec     ax                  ;Normalize to 0 base
  255.             sub     ax,es:[viops_TextCursorRow]                         ;@T52
  256.             mov     [si].vp_c_row,ax
  257.             mov     ax,es:[viops_TextCursorColumn]                      ;@T52
  258.             mov     [si].vp_c_col,ax
  259.  
  260.             Call    CheckAvio           ;Start of new code for B700065 ;@@S1
  261.             .if     <nz>                ;AVIO screen group
  262.                 mov     ax,es:[viops_TextCursorStartLine]               ;@T52
  263.                 mov     [si].vp_c_startline,ax
  264.                 mov     ax,es:[viops_TextCursorEndLine]                 ;@T52
  265.                 mov     [si].vp_c_endline,ax
  266.             .else
  267.                 mov     cx,8            ;Default character height ;@S38
  268.                 .if     <es:[env_rows] be 25> ;@S38;@S38f               ;@T52
  269.                     add     cx,cx       ;Default for 25-line mode ;@S38
  270.                 .endif                  ;@S38
  271.  
  272.                 mov     ax,es:[env_startline]                           ;@T52
  273.                 mov     [si].vp_c_startline,ax ;Copy from shadow
  274.                 mul     es:[viops_CellImageHeight] ;Scale the BVS value ;@T52
  275.                 div     cx
  276.                 .if     <ax ne es:[viops_TextCursorStartLine]> ;Shadow       ;@T52
  277.                     mov     ax,es:[viops_TextCursorStartLine]           ;@T52
  278.                     mul     cx
  279.                     div     es:[viops_CellImageHeight] ;Compute new value ;@T52
  280.                     mov     es:[env_startline],ax                       ;@T52
  281.                     mov     [si].vp_c_startline,ax ;Use new value
  282.                 .endif
  283.  
  284.                 mov     ax,es:[env_endline]                             ;@T52
  285.                 mov     [si].vp_c_endline,ax ;Copy from shadow
  286.                 mul     es:[viops_CellImageHeight] ;Scale the BVS value ;@T52
  287.                 div     cx
  288.                 .if     <ax ne es:[viops_TextCursorEndLine]> ;Shadow       ;@T52
  289.                     mov     ax,es:[viops_TextCursorEndLine]             ;@T52
  290.                     mul     cx
  291.                     div     es:[viops_CellImageHeight] ;Compute new value ;@T52
  292.                     mov     es:[env_endline],ax                         ;@T52
  293.                     mov     [si].vp_c_endline,ax ;Use new value
  294.                 .endif
  295.             .endif                      ;End of new code for B700065 ;@@S1
  296.  
  297.             mov     [si].vp_c_width,1   ;Always 1                       @T12
  298.             mov     ax,es:[viops_TextCursorVisible]                     ;@T52
  299.             dec     ax                  ;Revert Back                    @T12
  300.             mov     [si].vp_c_attr,ax
  301.  
  302.             Call    ReleaseSema4
  303.             sub     ax,ax               ;Set good return code
  304.         .endif
  305.  
  306.         Call    RegRest
  307.         ret     12
  308. GetCursorInfo ENDP
  309.  
  310. ;/****************************************************************************
  311. ;*
  312. ;*  SUBROUTINE NAME: SetCursorInfo
  313. ;*
  314. ;*  DESCRIPTIVE NAME: Set cursor position and/or cursor type
  315. ;*
  316. ;*  FUNCTION: SetCursorInfo is called by BVS to set selected
  317. ;*            information about either the cursor position or the
  318. ;*            cursor type.  If the request specifies hardware, the
  319. ;*            hardware and the environment buffer, if passed, will be
  320. ;*            updated.  Otherwise just the environment buffer, if
  321. ;*            passed, will be updated.
  322. ;*
  323. ;*  NOTES: This routine puts the PS cursor fields in synch with BVS.
  324. ;*         then advises the Engine of the changes.  Note that the
  325. ;*         PS cursor references the bottom left, rather than top left.
  326. ;*
  327. ;*  ENTRY POINT: SetCursorInfo
  328. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 266 )
  329. ;*
  330. ;*  INPUT: (Passed on stack)
  331. ;*             FAR *Environment ( Environment buffer for the session )
  332. ;*             FAR *ParmBlock
  333. ;*                     USHORT Length = length of this packet
  334. ;*                     USHORT Flags  = 0 - Environment buffer only
  335. ;*                                     1 - Hardware also
  336. ;*                     USHORT Row
  337. ;*                     USHORT Column
  338. ;*                     USHORT TopScanLine
  339. ;*                     USHORT BottomScanLine
  340. ;*                     USHORT Width
  341. ;*                     USHORT Attribute
  342. ;*             ULONG Function ( Call vector table entry = 266 )
  343. ;*
  344. ;*  EXIT-NORMAL: AX = 0
  345. ;*               Cursor information is set
  346. ;*
  347. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS
  348. ;*
  349. ;*  INTERNAL REFERENCES:
  350. ;*    ROUTINES: NONE
  351. ;*
  352. ;*  EXTERNAL REFERENCES:
  353. ;*    ROUTINES: RegSave, RegRest, SecureSema4, ReleaseSema4, GreEntry4
  354. ;*
  355. ;****************************************************************************/
  356.  
  357. SetCursorInfo PROC FAR
  358.         public  SetCursorInfo
  359.         Call    RegSave
  360.  
  361.         mov     ax,ERROR_VIO_INVALID_PARMS
  362.         test    [si].vp_flags,NOT (vp_f_physical+vp_f_curpos+vp_f_curtype)
  363.         .if     <z> and near
  364.         mov     ax,ERROR_VIO_INVALID_LENGTH
  365.         .if     <[si].vp_parmlength eq vp_c_attr+2> near
  366.             Call    SecureSema4
  367.  
  368.             sub     eax,eax                                             ;@T71
  369.             test    [si].vp_flags,vp_f_curpos
  370.             .if     <nz>                ;Cursor position update
  371.                 mov     cx,[si].vp_c_col
  372.                 mov     ax,ERROR_VIO_COL
  373.                 .if     <cx b es:[env_cols]>                            ;@T52
  374.                     mov     dx,[si].vp_c_row
  375.                     mov     ax,ERROR_VIO_ROW
  376.                     .if     <dx b es:[env_rows]>                        ;@T52
  377.                         mov     ax,es:[viops_BufferRowCount] ;Get # of rows from PSCB
  378.                         dec     ax      ;Normalize to 0 base
  379.                         sub     ax,dx
  380.                         mov     es:[viops_TextCursorRow],ax             ;@T52
  381.                         mov     es:[viops_TextCursorColumn],cx ;@@S1    ;@T52
  382.                         sub     eax,eax                                 ;@T71
  383.                     .endif
  384.                 .endif
  385.             .endif
  386.  
  387.             .if     <zero ax> AND
  388.             test    [si].vp_flags,vp_f_curtype
  389.             .if     <nz>                ;Cursor type update
  390.                 mov     ax,ERROR_VIO_WIDTH
  391.                 test    [si].vp_c_width,NOT 1
  392.                 .if     <z>             ;Valid width?
  393.                     mov     cx,8        ;Default character height ;@S38
  394.                     .if     <es:[env_rows] be 25> ;@S38;@S38f           ;@T52
  395.                         add     cx,cx   ;Default for 25-line mode ;@S38
  396.                     .endif              ;@S38
  397.                     Call    CheckAvio
  398.                     .if     <nz>        ;AVIO screen group?
  399.                         mov     cx,es:[viops_CellImageHeight] ;Get cell size
  400.                     .endif
  401.  
  402.                     mov     ax,ERROR_VIO_INVALID_PARMS
  403.                     .if     <[si].vp_c_startline be cx> AND ;@T35 ;@C18
  404.                     .if     <[si].vp_c_endline be 31>
  405.                         Call    CheckAvio
  406.                         .if     <nz>    ;AVIO screen group
  407.                             mov     ax,[si].vp_c_startline
  408.                             mov     es:[viops_TextCursorStartLine],ax   ;@T52
  409.                             mov     ax,[si].vp_c_endline
  410.                             mov     es:[viops_TextCursorEndLine],ax     ;@T52
  411.                         .else
  412.                             mov     ax,[si].vp_c_startline
  413.                             mov     es:[env_startline],ax ;@@S1         ;@T52
  414.                             mul     es:[viops_CellImageHeight] ;Scale the BVS value
  415.                             div     cx  ;Scale it for virtual cursor
  416.                             mov     es:[viops_TextCursorStartLine],ax   ;@T52
  417.  
  418.                             mov     ax,[si].vp_c_endline
  419.                             mov     es:[env_endline],ax ;@@S1           ;@T52
  420.                             mul     es:[viops_CellImageHeight] ;Scale the BVS value
  421.                             div     cx  ;Scale it for virtual cursor
  422.                             mov     es:[viops_TextCursorEndLine],ax     ;@T52
  423.                         .endif
  424.  
  425.                         mov     ax,[si].vp_c_attr
  426.                         inc     ax      ;engine expects 0 to mean invisible
  427.                         mov     es:[viops_TextCursorVisible],ax         ;@T52
  428.                         sub     eax,eax                                 ;@T71
  429.                     .endif
  430.                 .endif
  431.             .endif
  432.             .if     <zero ax>
  433.                 push    dword ptr es:[viops_hConsoleDisplayContext] ;DC handle ;@T71
  434.                 push    es
  435.                 push    ax              ;Ptr to VioPS              ;@T52,@T71
  436.                 push    eax             ;"cookie" parm pt. 2       ;@T52,@T71
  437.                 push    dword ptr GreUpdateCursorLo ;Engine function pt. 2 ;@T71
  438.                 call    GREENTRY4                                       ;@T52
  439.                 sub     ax,ax           ;Set good return code
  440.             .endif
  441.             push    ax                  ;@@A
  442.             Call    ReleaseSema4
  443.             pop     cx                  ;@@A
  444.             .if     <ncxz>              ;@@A                            ;@T71
  445.                 mov     ax,cx           ;@@A
  446.             .endif                      ;@@A
  447.         .endif
  448.  
  449.         Call    RegRest
  450.         ret     12
  451. SetCursorInfo ENDP
  452.  
  453. ;/****************************************************************************
  454. ;*
  455. ;*  SUBROUTINE NAME: GetVarInfo
  456. ;*
  457. ;*  DESCRIPTIVE NAME: Get selected variable information
  458. ;*
  459. ;*  FUNCTION: GetVariableInfo is called by BVS to return selected
  460. ;*            information about video state - blink versus background
  461. ;*            intensity, overscan color, underscore scan line, video
  462. ;*            enable, 8514/A display mask, and the current codepage.
  463. ;*
  464. ;*  NOTES: Since only the codepage is actually returned for
  465. ;*         Windowable sessions, the semaphore is not taken to
  466. ;*         read only one word from the PSCB.
  467. ;*
  468. ;*  ENTRY POINT: GetVarInfo
  469. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 269 )
  470. ;*
  471. ;*  INPUT: (Passed on stack)
  472. ;*             FAR *Environment ( Environment buffer for the session )
  473. ;*             FAR *ParmBlock
  474. ;*                     USHORT Length = length of this packet
  475. ;*                     USHORT Flags  = 0 - Environment buffer only
  476. ;*                                     1 - Hardware also
  477. ;*                     USHORT Blink
  478. ;*                     USHORT Overscan
  479. ;*                     USHORT Underscore
  480. ;*                     USHORT VideoEnable
  481. ;*                     ULONG  DisplayMask
  482. ;*             ULONG Function ( Call vector table entry = 269 )
  483. ;*
  484. ;*  EXIT-NORMAL: AX = 0
  485. ;*               Selected variable information is returned
  486. ;*
  487. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS
  488. ;*
  489. ;*  EFFECTS: If hardware specified and hardware is readable, the
  490. ;*           environment buffer is updated, if passed.
  491. ;*
  492. ;*  INTERNAL REFERENCES:
  493. ;*    ROUTINES: NONE
  494. ;*
  495. ;*  EXTERNAL REFERENCES:
  496. ;*    ROUTINES: NONE
  497. ;*
  498. ;****************************************************************************/
  499.  
  500. GetVarInfo PROC FAR
  501.         public  GetVarInfo
  502.         Call    RegSave
  503.  
  504.         mov     ax,ERROR_VIO_EXTENDED_SG ;@C3
  505.         test    [si].vp_flags,NOT (vp_f_scrlrect+vp_f_physical+vp_f_codepage) ;@C3
  506.         .if     <z> and
  507.         mov     ax,ERROR_VIO_INVALID_LENGTH
  508.         .if     <[si].vp_parmlength ae vp_scrncols+2> ;@P1
  509.  
  510.             mov     [si].vp_blink,bx    ;Blink state
  511.             mov     [si].vp_border,bx   ;Border color
  512.             mov     [si].vp_underscore,bx ;Underscore line
  513.             mov     [si].vp_dispmask1,bx ;Display mask (bits 0-15)
  514.             mov     [si].vp_dispmask2,bx ;Display mask (bits 16-31)
  515.             mov     ax,es:[viops_CodepageID]                            ;@T52
  516.             mov     [si].vp_codepage,ax ;Codepage
  517.  
  518.             mov     ax,es:[di].env_scrlleft ;@P1
  519.             mov     [si].vp_scrlleft,ax ;Scrollable Rectange of screen  ;@P1
  520.             mov     ax,es:[di].env_scrltop ;@P1
  521.             mov     [si].vp_scrltop,ax  ;Scrollable Rectange of screen  ;@P1
  522.             mov     ax,es:[di].env_scrlright ;@P1
  523.             mov     [si].vp_scrlright,ax ;Scrollable Rectange of screen  ;@P1
  524.             mov     ax,es:[di].env_scrlbottom ;@P1
  525.             mov     [si].vp_scrlbottom,ax ;Scrollable Rectange of screen ;@P1
  526.             mov     ax,es:[di].env_rows ;@P1
  527.             mov     [si].vp_scrnrows,ax ;Screen Dimensions              ;@P1
  528.             mov     ax,es:[di].env_cols ;@P1
  529.             mov     [si].vp_scrncols,ax ;Screen Dimensions              ;@P1
  530.  
  531.             sub     ax,ax               ;Set good return code
  532.         .endif
  533.  
  534.         Call    RegRest
  535.         ret     12
  536. GetVarInfo ENDP
  537.  
  538. ;/****************************************************************************
  539. ;*
  540. ;*  SUBROUTINE NAME: SetVarInfo
  541. ;*
  542. ;*  DESCRIPTIVE NAME: Set selected variable information
  543. ;*
  544. ;*  FUNCTION: SetVariableInfo is called by BVS to set selected
  545. ;*            information about video state - blink versus background
  546. ;*            intensity, overscan color, underscore scan line, video
  547. ;*            enable, or 8514/A display mask. If the request specifies
  548. ;*            hardware the hardware and the environment buffer, if
  549. ;*            passed, will be updated.  Otherwise just the environment
  550. ;*            buffer, if passed, will be updated.
  551. ;*
  552. ;*  ENTRY POINT: SetVarInfo
  553. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 270 )
  554. ;*
  555. ;*  INPUT: (Passed on stack)
  556. ;*             FAR *Environment ( Environment buffer for the session )
  557. ;*             FAR *ParmBlock
  558. ;*                     USHORT Length = length of this packet
  559. ;*                     USHORT Flags  = 0 - Environment buffer only
  560. ;*                                     1 - Hardware also
  561. ;*                     USHORT Blink
  562. ;*                     USHORT Overscan
  563. ;*                     USHORT Underscore
  564. ;*                     USHORT VideoEnable
  565. ;*                     ULONG  DisplayMask
  566. ;*             ULONG Function ( Call vector table entry = 270 )
  567. ;*
  568. ;*  EXIT-NORMAL: AX = 0
  569. ;*               Selected variable information is set
  570. ;*
  571. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS
  572. ;*
  573. ;*  INTERNAL REFERENCES:
  574. ;*    ROUTINES: NONE
  575. ;*
  576. ;*  EXTERNAL REFERENCES:
  577. ;*    ROUTINES: AccessCursorBlink, AccessCursorOverscan
  578. ;*              AccessCursorUnderscore, AccessCursorVideoEnable
  579. ;*              AccessDisplayMask
  580. ;*
  581. ;****************************************************************************/
  582.  
  583. SetVarInfo PROC FAR
  584.         public  SetVarInfo
  585.         Call    RegSave
  586.  
  587.         mov     ax,ERROR_VIO_EXTENDED_SG ;@C3
  588.         test    [si].vp_flags,NOT (vp_f_physical+vp_f_codepage+vp_f_forcecp) ;@C23
  589. ;js01541.if     <z> and
  590.         .if     <z> and near
  591.         mov     ax,ERROR_VIO_INVALID_LENGTH
  592.         .if     <[si].vp_parmlength ae vp_codepage+2>
  593.  
  594.             sub     ax,ax               ;@C30
  595.             mov     cx,[si].vp_codepage ;@T22
  596.             call    CheckAvio           ;@C30
  597.             .if     <z> and             ;and Vio windowable session ;@C30
  598.             .if     <ncxz>              ;actual CP # specified       @C30
  599.                 push    WDHGSEG         ;then check for valid CP    ;@C30
  600.                 pop     ds              ;@C30
  601.                 mov     dx,cx           ;@C30
  602.                 mov     si,offset wdh_cpid1     ;@C30                   ;@T52
  603.                 mov     cx,ds:wdh_numcpids      ;@C30                   ;@T52
  604.                 .if     <ncxz>          ;@C30
  605.                     .repeat             ;@C30
  606.                         lodsw           ;@C30
  607.                     .leave  <ax eq dx>  ;@C30
  608.                     .loop               ;@C30
  609.                 .endif                  ;@C30
  610.                 .if     <ncxz>          ;@C30
  611.                     mov     cx,dx       ;@C30
  612.                     sub     ax,ax       ;@C30
  613.                 .else                   ;@C30
  614.                     mov     ax,ERROR_VIO_BAD_CP ;@C30
  615.                 .endif                  ;@C30
  616.             .endif                      ;@C30
  617.  
  618.             .if     <zero ax>           ;@C30
  619.                 mov     dx,es:[viops_CodepageID] ;Save original CP      ;@T52
  620.                 mov     es:[viops_CodepageID],cx ;@T22                  ;@T52
  621.                 Call    UpdateCharRect
  622.                 .if     <es:[viops_CodepageID] ne cx> ;CP not accepted  ;@T52
  623.                     mov     es:[viops_CodepageID],dx ;Restore original CP ;@T52
  624.                     Call    UpdateCharRect
  625.                     mov     ax,ERROR_VIO_BAD_CP
  626.                 .else
  627.                     sub     ax,ax       ;CP set ok
  628.                 .endif
  629.             .endif                      ;@C30
  630.  
  631. IFDEF D1348
  632.             .if     <zero ax>
  633.                 ;/Reflesh dbcs env. vectors in my environment.
  634. ;js01541 jc20 +
  635.                 mov     dx,es:[viops_CodepageID]                                ;; added for PTR #JS01541
  636. ;js01541 jc20 -
  637.                 mov     word ptr es:[env_CtryCode],0
  638.                 mov     word ptr es:[env_CtryCode+2],dx  ;set new code page
  639.                 push    DBCSEvBufSiz
  640.                 push    es
  641.                 mov     ax,offset env_CtryCode
  642.                 push    ax
  643.                 push    es
  644.                 mov     ax,offset env_DBCSEvBuff
  645.                 push    ax
  646.                 call    DosGetDBCSEv
  647.                                         ;Ignore the r/c
  648.                                         ;If r/c !=0 ==> env_DBCSEvBuff
  649.                                         ;is filled with zeros.
  650.             .endif
  651. ENDIF ;D1348
  652.  
  653.         .endif
  654.  
  655.         Call    RegRest
  656.         Ret     12
  657. SetVarInfo ENDP
  658.  
  659.  
  660. ;/****************************************************************************
  661. ;*
  662. ;*  SUBROUTINE NAME: GetDBCSInfo
  663. ;*
  664. ;*  DESCRIPTIVE NAME: Get DBCS character display width information
  665. ;*
  666. ;*  FUNCTION: GetDBCSInfo is called by BVS to get character display
  667. ;*            width information for use with WrtTTY.  The call should
  668. ;*            return the ranges of characters that require two cells
  669. ;*            for display.  On us adapters there are none.
  670. ;*
  671. ;*  ENTRY POINT: GetDBCSInfo
  672. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 261 )
  673. ;*
  674. ;*  INPUT: (Passed on stack)
  675. ;*             FAR *Environment ( Environment buffer for the session )
  676. ;*             FAR *ParmBlock
  677. ;*                     USHORT Length = length of this packet
  678. ;*                     USHORT Flags  = 0 - Environment buffer only
  679. ;*                                     1 - Hardware also
  680. ;*                     USHORT Table Length length of following table
  681. ;*                     USHORT Beginning of first range
  682. ;*                     USHORT End of first range
  683. ;*                             ...
  684. ;*                     USHORT Beginning of nth range
  685. ;*                     USHORT End of nth range
  686. ;*             ULONG Function ( Call vector table entry = 261 )
  687. ;*
  688. ;*  EXIT-NORMAL: AX = 0
  689. ;*               The table is returned (Table length = 0)
  690. ;*
  691. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS
  692. ;*                   ERROR_VIO_INVALID_LENGTH
  693. ;*
  694. ;*  INTERNAL REFERENCES:
  695. ;*    ROUTINES: NONE
  696. ;*
  697. ;*  EXTERNAL REFERENCES:
  698. ;*    ROUTINES: NONE
  699. ;*
  700. ;****************************************************************************/
  701.  
  702. GetDBCSInfo PROC FAR                    ;@P1 begin
  703.         public  GetDBCSInfo
  704.         Call    RegSave
  705.  
  706.  
  707.         mov     ax,ERROR_VIO_INVALID_LENGTH
  708.         .if     <[si].vp_parmlength e 2> near
  709.             xor     ax,ax
  710.             mov     [si].vp_parmlength,(vp_di_tbllen + 2)
  711.         .else
  712.             .if     <[si].vp_parmlength ae 4> near
  713.                 mov     ax,ERROR_VIO_INVALID_PARMS
  714.                 cmp     [si].vp_flags,bx
  715.                 .if     <z> and
  716.                 mov     ax,ERROR_VIO_INVALID_LENGTH
  717.                 .if     <[si].vp_parmlength ae 6>
  718.                     mov     [si].vp_di_tbllen,bx
  719.                     sub     ax,ax       ; Set good return code
  720.                 .endif
  721.             .endif
  722.         .endif
  723.  
  724.         Call    RegRest
  725.         ret     12
  726. GetDBCSInfo ENDP                        ;@P1 end
  727.  
  728. ;/****************************************************************************
  729. ;*
  730. ;*  SUBROUTINE NAME: GetLVBInfo
  731. ;*
  732. ;*  DESCRIPTIVE NAME: Return LVB size and default attribute information
  733. ;*
  734. ;*  FUNCTION: GetLVBInfo is called by BVS to determine the size of the
  735. ;*            LVB required for a given display size.  Based on the
  736. ;*            mode and its associated LVB format the allocation size
  737. ;*            of the LVB is returned.  Also a default attribute may
  738. ;*            be returned.
  739. ;*
  740. ;*  ENTRY POINT: GetLVBInfo
  741. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 2xx )
  742. ;*
  743. ;*  INPUT: (Passed on stack)
  744. ;*             FAR *Environment ( Environment buffer for the session )
  745. ;*             FAR *ParmBlock
  746. ;*                     USHORT Length = length of this packet
  747. ;*                     USHORT Flags  = 0 - Environment buffer only
  748. ;*                                     1 - Hardware also
  749. ;*                     UCHAR  FormatId;
  750. ;*                     UCHAR  AttrCount;
  751. ;*                     USHORT LVBWidth;
  752. ;*                     USHORT LVBHeight;
  753. ;*                     ULONG  LVBSize;
  754. ;*                     USHORT AttrBufSize;
  755. ;*                     UCHAR far *AttrBufAddr;
  756. ;*             ULONG Function ( Call vector table entry = 261 )
  757. ;*
  758. ;*  EXIT-NORMAL: AX = 0
  759. ;*               The correct size of the LVB is returned
  760. ;*
  761. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS
  762. ;*
  763. ;*  INTERNAL REFERENCES:
  764. ;*    ROUTINES: NONE
  765. ;*
  766. ;*  EXTERNAL REFERENCES:
  767. ;*    ROUTINES: NONE
  768. ;*
  769. ;****************************************************************************/
  770.  
  771. GetLVBInfo PROC FAR                     ;@P1 begin
  772.         public  GetLVBInfo
  773.         Call    RegSave
  774.  
  775.         mov     ax,ERROR_VIO_INVALID_PARMS
  776.         .if     <[si].vp_parmlength ge vp_li_attrsize>
  777.             .if     <[si].vp_li_fidatt e bx>
  778.                 .if     <[si].vp_li_width e bx>
  779.                     mov     ax,es:[di].env_cols
  780.                 .else
  781.                     mov     ax,[si].vp_li_width
  782.                 .endif
  783.                 .if     <[si].vp_li_height e bx>
  784.                     mul     es:[di].env_rows
  785.                 .else
  786.                     mul     [si].vp_li_height
  787.                 .endif
  788.                 shl     ax,1            ; 2 bytes per cell * number of cells
  789.                 .if     <c>
  790.                     shl     dx,1
  791.                     inc     dx
  792.                 .else
  793.                     shl     dx,1
  794.                 .endif
  795.                 mov     [si].vp_li_allocl,ax
  796.                 mov     [si].vp_li_alloch,dx
  797.                 xor     ax,ax
  798.             .endif
  799.         .endif
  800.         .if     <[si].vp_parmlength ge vp_li_attroffst> near
  801.             mov     cx,[si].vp_li_attrsize
  802.             .if     <zero cx> near                                      ;@T52
  803.                 mov     cx,es:[di].env_attrbufsiz
  804.                 mov     [si].vp_li_attrsize,cx
  805.             .else
  806.                 .if     <cx ae es:[di].env_attrbufsiz> and
  807.                 .if     <[si].vp_parmlength ae vp_li_attrseg+2>
  808.                     mov     bx,[si].vp_li_attroffst
  809.                     mov     cx,[si].vp_li_attrseg
  810.                     mov     ds,cx
  811.                     mov     cx,es:[di].env_attrbufsiz
  812.                     add     di,env_attrbuf
  813.                     .repeat
  814.                         mov     dl,es:[di]
  815.                         mov     ds:[bx],dl
  816.                         inc     di
  817.                         inc     bx
  818.                         dec     cx
  819.                     .until  <z>                                         ;@T71
  820.                 .else
  821.                     mov     ax,ERROR_VIO_INVALID_LENGTH
  822.                 .endif
  823.             .endif
  824.         .endif
  825.  
  826.         Call    RegRest
  827.         ret     12
  828. GetLVBInfo ENDP                         ;@P1 end
  829.  
  830.  
  831. R2CSEG  ENDS
  832.         END
  833.  
  834.