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