home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / VDH / IDHINFO.ASM < prev    next >
Assembly Source File  |  1995-04-14  |  56KB  |  1,195 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   IDHINFO.Asm -- Windowable Device Handler Info Routines
  14. ;/*****************************************************************************
  15. ;*
  16. ;* SOURCE FILE NAME = IDHINFO.Asm
  17. ;*
  18. ;* DESCRIPTIVE NAME = Install Device Handler - Cursor/Variable Info  
  19. ;*
  20. ;*
  21. ;* VERSION      V2.0
  22. ;*
  23. ;* DATE         
  24. ;*
  25. ;* DESCRIPTION  Windowable Device Handler Info Routines 
  26. ;*              This source file contains VDH entry points for setting
  27. ;*              and getting cursor and variable information.
  28. ;*
  29. ;* FUNCTIONS    GetState 
  30. ;*              SetState 
  31. ;*              GetCurPos 
  32. ;*              SetCurPos 
  33. ;*              SetCurType 
  34. ;*              CopyFont 
  35. ;*              FixVGABug 
  36. ;*              GetCursorInfo 
  37. ;*              SetCursorInfo 
  38. ;*              GetVarInfo 
  39. ;*              SetVarInfo 
  40. ;*              GetCodePage 
  41. ;*              RandomRead 
  42. ;*              GetDBCSInfo 
  43. ;*              GetLVBInfo  
  44. ;*
  45. ;* NOTES        NONE
  46. ;*             
  47. ;* STRUCTURES   NONE
  48. ;*
  49. ;* EXTERNAL REFERENCES   RegSave, RegRest           
  50. ;*
  51. ;* EXTERNAL FUNCTIONS
  52. ;*
  53. ;*              NONE
  54. ;*
  55. ;* CHANGE ACTIVIY =
  56. ;*   DATE      FLAG       APAR    CHANGE DESCRIPTION
  57. ;*   --------  ---------- -----   --------------------------------------
  58. ;*   mm/dd/yy  @Vr.mpppxx xxxxx   xxxxxxx
  59. ;*   01/12/89  @@A        P2986   STJ, Enhance Cursor and Codepage support,    
  60. ;*   03/06/89  @@S1       B700065 STJ, Enhance flag checking for GetXXXInfo         
  61. ;*                                calls
  62. ;*   03/25/89  @P1        D132    TPL, DCR 132 changes
  63. ;*   05/22/89  @T30       D511    TPL, DCR 511 changes
  64. ;*   07/14/89  @S17       B704811 STJ, Change PhystoUVirt from FAR to NEAR,    
  65. ;*   07/15/89  @T39       B784056 TPL, Remove hardware dependencies in VDHINIT,  
  66. ;*   07/24/89  @S20       B705116 STJ, 8514/A configs fixed,                   
  67. ;*   11/30/89  D811       D811    MS,  DCR 811
  68. ;*   01/24/90  @T52       D704    TPL, DCR 704 work
  69. ;*   05/15/90  @TL8       B711846 TPL, GetCursorInfo fix,                      
  70. ;*****************************************************************************/
  71.  
  72.         .xlist
  73.         INCLUDE idhequ.inc                        ;Install Device Handler Equates
  74.         INCLUDE bvsparms.inc                      ;BVS Parameter Equates
  75.         INCLUDE error2.inc                        ;CP/DOS Error Codes
  76.         INCLUDE struc.inc                         ;Structured Macros
  77.         .list
  78.  
  79.         INCLUDE cdib.inc                          ;CodePage Data Info Block ;@@A
  80.         INCLUDE fontfile.inc                      ;Font File structures ;@@A
  81.  
  82.         EXTRN   DOSALLOCSEG:FAR                   ;Dos Allocate Segment routine ;@@A
  83.         EXTRN   DOSGETSHRSEG:FAR                  ;Dos Get Shared Segment routine ;@@A
  84.         EXTRN   DOSFREESEG:FAR                    ;Dos Free Segment routine ;@@A
  85.  
  86.         EXTRN   DOSOPEN:FAR                       ;Dos Open routine ;@@A
  87.         EXTRN   DOSREAD:FAR                       ;Dos Read routine ;@@A
  88.         EXTRN   DOSCHGFILEPTR:FAR                 ;Dos Change File Ptr routine ;@@A
  89.         EXTRN   DOSCLOSE:FAR                      ;Dos Close routine ;@@A
  90.  
  91.         extrn   _PhysToUVirt:NEAR                 ;@@A;@S17
  92.         extrn   _FreePhysToUVirt:NEAR             ;@@A;@S17
  93.  
  94.         extrn   RegSave:NEAR
  95.         extrn   RegRest:NEAR
  96.  
  97.         extrn   Config:WORD                       ;@@A
  98.  
  99. IDHGSEG SEGMENT WORD PUBLIC 'DATA'      ;Global data segment for IDH    ;@T52
  100. IDHGSEG ENDS
  101.  
  102. R2SEG   SEGMENT BYTE PUBLIC 'CODE'      ;IOPL Segment
  103.         ASSUME  CS:R2SEG
  104.  
  105. ;/****************************************************************************
  106. ;*                                                    
  107. ;*  SUBROUTINE NAME: GetState                         
  108. ;*                                                    
  109. ;*  DESCRIPTIVE NAME:  Get the requested video state    
  110. ;*                                                    
  111. ;*  FUNCTION:                                         
  112. ;*                                                    
  113. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 280 )  
  114. ;*                                                  
  115. ;*  INPUT: (Passed on stack)                          
  116. ;*             FAR *Environment ( Environment buffer for the session )  
  117. ;*             FAR *ParmBlock                         
  118. ;*             ULONG Function ( Call vector table entry = 280 )  
  119. ;*                                                    
  120. ;*  EXIT-NORMAL: If OEM defines this function then    
  121. ;*                 AX = 0                             
  122. ;*                 user defined information is returned   
  123. ;*               Else                                 
  124. ;*                 AX = ERROR_VIO_INVALID_PARMS    
  125. ;*                                                    
  126. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS        
  127. ;*                                                  
  128. ;*  EFFECTS:  None                                    
  129. ;*                                                    
  130. ;*  INTERNAL REFERENCES:                              
  131. ;*    ROUTINES: None                                  
  132. ;*                                                    
  133. ;*  EXTERNAL REFERENCES:                              
  134. ;*    ROUTINES:  None                                 
  135. ;*                                                    
  136. ;****************************************************************************/
  137.  
  138. Public   GetState                                     ;D811
  139. GetState Proc Far                                     ;D811
  140.          mov ax, ERROR_VIO_INVALID_PARMS              ;D811
  141.          ret 12                                       ;D811
  142. GetState EndP                                         ;D811
  143.  
  144. ;/****************************************************************************
  145. ;*                                                    
  146. ;*  SUBROUTINE NAME: SetState                         
  147. ;*                                                  
  148. ;*  DESCRIPTIVE NAME:  Set the requested video state    
  149. ;*                                                    
  150. ;*  FUNCTION:                                         
  151. ;*                                                    
  152. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 280 )  
  153. ;*                                                    
  154. ;*  INPUT: (Passed on stack)                          
  155. ;*             FAR *Environment ( Environment buffer for the session )  
  156. ;*             FAR *ParmBlock                         
  157. ;*             ULONG Function ( Call vector table entry = 281 )  
  158. ;*                                                    
  159. ;*  EXIT-NORMAL: If OEM defines this function then    
  160. ;*                 AX = 0                           
  161. ;*                 user defined information is set    
  162. ;*               Else                                 
  163. ;*                 AX = ERROR_VIO_INVALID_PARMS    
  164. ;*                                                    
  165. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS        
  166. ;*                                                    
  167. ;*  EFFECTS:                                          
  168. ;*                                                    
  169. ;*  INTERNAL REFERENCES:                              
  170. ;*    ROUTINES: NONE                                  
  171. ;*                                                    
  172. ;*  EXTERNAL REFERENCES:                              
  173. ;*    ROUTINES:                                     
  174. ;*                                                    
  175. ;****************************************************************************/
  176.  
  177. Public   SetState                                     ;D811
  178. SetState Proc Far                                     ;D811
  179.          mov ax, ERROR_VIO_INVALID_PARMS              ;D811
  180.          ret 12                                       ;D811
  181. SetState EndP                                         ;D811
  182.  
  183. ;/****************************************************************************
  184. ;*
  185. ;* FUNCTION NAME = GetCurPos
  186. ;*
  187. ;* DESCRIPTION   = 
  188. ;*
  189. ;* INPUT         = NONE
  190. ;* OUTPUT        = NONE
  191. ;*
  192. ;* RETURN-NORMAL = NONE
  193. ;* RETURN-ERROR  = NONE
  194. ;*
  195. ;****************************************************************************/
  196.  
  197. GetCurPos PROC  FAR
  198.         public  GetCurPos
  199.  
  200.         push    ds
  201.         push    IDHGSEG
  202.         pop     ds
  203.         mov     dx,[bx].idh_ioport               ;Base address for video ;@@A
  204.         pop     ds
  205.  
  206.         mov     al,hp_cursoraddrh
  207.         out     dx,al
  208.         inc     dl
  209.         in      al,dx
  210.         mov     ah,al                             ;Get high byte of cursor address
  211.  
  212.         dec     dl
  213.         mov     al,hp_cursoraddrl
  214.         out     dx,al
  215.         inc     dl
  216.         in      al,dx                             ;Get low byte of cursor address
  217.  
  218.         sub     dx,dx
  219.         div     es:[di].env_cols
  220.  
  221.         .if     <ax b es:[di].env_rows> and
  222.         .if     <dx b es:[di].env_cols> ;Values are in valid range
  223.             mov     es:[di].env_row,ax           ;Update number of rows
  224.             mov     es:[di].env_col,dx           ;Update number of columns
  225.         .endif
  226.  
  227.         ret
  228. GetCurPos ENDP
  229.  
  230. ;/****************************************************************************
  231. ;*
  232. ;* FUNCTION NAME = SetCurPos
  233. ;*
  234. ;* DESCRIPTION   = 
  235. ;*
  236. ;* INPUT         = NONE
  237. ;* OUTPUT        = NONE
  238. ;*
  239. ;* RETURN-NORMAL = NONE
  240. ;* RETURN-ERROR  = NONE
  241. ;*
  242. ;****************************************************************************/
  243.  
  244. SetCurPos PROC  FAR
  245.         public  SetCurPos
  246.  
  247.         mov     ax,es:[di].env_cols              ;Number of columns
  248.         mul     es:[di].env_row
  249.         add     ax,es:[di].env_col
  250.         mov     cx,ax                             ;Get cursor address in CX
  251.  
  252.         push    ds
  253.         push    IDHGSEG
  254.         pop     ds
  255.         mov     dx,[bx].idh_ioport               ;Base address for video ;@@A
  256.         pop     ds
  257.  
  258.         mov     al,hp_cursoraddrh
  259.         mov     ah,ch
  260.         out     dx,ax                             ;Set high byte of cursor address
  261.  
  262.         mov     al,hp_cursoraddrl
  263.         mov     ah,cl
  264.         out     dx,ax                             ;Set low byte of cursor address
  265.  
  266.         ret
  267. SetCurPos ENDP
  268.  
  269. ;/****************************************************************************
  270. ;*
  271. ;* FUNCTION NAME = SetCurType
  272. ;*
  273. ;* DESCRIPTION   = 
  274. ;*
  275. ;* INPUT         = NONE
  276. ;* OUTPUT        = NONE
  277. ;*
  278. ;* RETURN-NORMAL = NONE
  279. ;* RETURN-ERROR  = NONE
  280. ;*
  281. ;****************************************************************************/
  282.  
  283. SetCurType PROC FAR                               ;@@A
  284.         public  SetCurType
  285.  
  286.         push    ds
  287.         push    IDHGSEG
  288.         pop     ds
  289.         mov     dx,[bx].idh_ioport               ;Base address for video
  290.         mov     al,byte ptr ds:Config+cf_adapter
  291.         mov     ah,byte ptr [bx].idh_fontsize ;AH/AL = Fontsize/Adapter
  292.         pop     ds
  293.  
  294.         mov     cl,byte ptr es:[di].env_startline
  295.         mov     ch,byte ptr es:[di].env_endline
  296.  
  297.         .if     <es:[di].env_attr eq -1> ;Attribute = Hidden
  298.             mov     cl,0FFh                       ;Turn off cursor
  299.         .endif
  300.         .if     <al eq cf_a_ega>                 ;EGA quirks
  301.             .if     <ch ne cl>                    ;if top ne bot
  302.                 inc     ch
  303.             .endif
  304.             .if     <ch ae ah> and               ;Bottom of char box
  305.             and     cl,cl
  306.             .if     <nonzero cl>                 ;top not equal to zero
  307.                 sub     ch,ch                     ;Wrap to top of char box
  308.             .endif
  309.         .endif
  310.  
  311.         mov     al,hp_cursorstart
  312.         mov     ah,cl
  313.         out     dx,ax                             ;Starting line of cursor
  314.  
  315.         mov     al,hp_cursorend
  316.         mov     ah,ch
  317.         out     dx,ax                             ;Ending line of cursor
  318.  
  319.         ret
  320. SetCurType ENDP                                   ;@@A
  321.  
  322. ;/*
  323. ;**  Copy the font from the work buffer to the video font buffer.
  324. ;*/
  325.  
  326. CopyFont PROC   FAR                               ;@@A
  327.         public  CopyFont
  328.  
  329. ;/*
  330. ;**  Map the video font buffer at A0000h
  331. ;*/
  332.  
  333.         mov     dx,03C4h                          ;=03C4h
  334.         mov     ax,0100h                          ;Set synch reset
  335.         cli                                       ;Disable interrupts
  336.         out     dx,ax                             ;Write to reg pair
  337.  
  338.         mov     dl,0CEh                           ;=03CEh
  339.         mov     ax,0204h
  340.         out     dx,ax                             ;Read Map Select register
  341.  
  342.         mov     ax,0005h
  343.         out     dx,ax                             ;Graphics Mode register
  344.  
  345.         mov     ax,0406h
  346.         out     dx,ax                             ;Graphics Misc register
  347.  
  348.         mov     dl,0C4h                           ;=03C4h
  349.         mov     ax,0402h                          ;write font to bp only bi plane 0
  350.         out     dx,ax                             ;Write Map Select
  351.  
  352.         mov     ax,0404h
  353.         out     dx,ax                             ;Turn on odd/even
  354.  
  355.         Call    FixVGABug
  356.  
  357.         mov     ax,0300h                          ;Turn off synchronous reset
  358.         out     dx,ax                             ;Write data to reset register
  359.         sti
  360.  
  361. ;/*
  362. ;**  Copy the font from the work buffer to the video font buffer
  363. ;*/
  364.  
  365.         push    ds
  366.         mov     dx,[bx].idh_fontsize
  367.         mov     ds,[bx].idh_selector              ;Get the work buffer selector
  368.  
  369.         sub     si,si
  370.         sub     di,di                             ;Get the font buffer ptr in ES:DI
  371.  
  372.         mov     ax,256                            ;For all 256 characters
  373.         .repeat
  374.             mov     cx,dx
  375.             rep     movsb                         ;Refresh one character of the font
  376.             add     di,32
  377.             sub     di,dx
  378.             dec     ax
  379.         .until  z
  380.  
  381.         pop     ds
  382.  
  383. ;/*
  384. ;**  Restore the original video buffer
  385. ;*/
  386.  
  387.         mov     cx,0A06h                          ;Setup mono buffer with chaining
  388.         .if     <[bx].idh_ioport eq 03D4h>
  389.             mov     cx,0E06h                      ;Setup color buffer with chaining
  390.         .endif
  391.  
  392.         mov     dx,03C4h                          ;=03C4h
  393.         mov     ax,0100h                          ;Set synch reset
  394.         cli                                       ;Disable interrupts
  395.         out     dx,ax                             ;Write to reg pair
  396.  
  397.         mov     dl,0CEh                           ;=03CEh
  398.         mov     ax,0004h
  399.         out     dx,ax                             ;Read Map Select register
  400.  
  401.         mov     ax,1005h
  402.         out     dx,ax                             ;Graphics Mode register
  403.  
  404.         mov     ax,cx
  405.         out     dx,ax                             ;Graphics Misc register
  406.  
  407.         mov     dl,0C4h
  408.         mov     ax,0302h
  409.         out     dx,ax                             ;Write Map Select
  410.  
  411.         mov     ax,0004h
  412.         out     dx,ax                             ;Turn off odd/even
  413.  
  414.         Call    FixVGABug
  415.  
  416.         mov     ax,0300h                          ;Turn off synchronous reset
  417.         out     dx,ax                             ;Write data to reset register
  418.         sti
  419.  
  420.         ret
  421. CopyFont ENDP                                     ;@@A
  422.  
  423. ;/****************************************************************************
  424. ;*
  425. ;* FUNCTION NAME = FixVGABug
  426. ;*
  427. ;* DESCRIPTION   = 
  428. ;*
  429. ;* INPUT         = NONE
  430. ;* OUTPUT        = NONE
  431. ;*
  432. ;* RETURN-NORMAL = NONE
  433. ;* RETURN-ERROR  = NONE
  434. ;*
  435. ;****************************************************************************/
  436.  
  437. FixVGABug PROC  NEAR                              ;@@A
  438.         mov     ax,ds:Config+cf_adapter
  439.         .if     <al eq cf_a_vga> or
  440.         .if     <al eq cf_a_8514a>                ;if this is a VGA
  441.             push    dx
  442.             mov     ax,013Fh                      ;Set full instead of half cycles
  443.             mov     dx,[bx].idh_ioport
  444.             out     dx,ax
  445.             pop     dx
  446.         .endif
  447.         ret
  448. FixVGABug ENDP                                    ;@@A
  449.  
  450. R2SEG   ENDS
  451.  
  452. R2CSEG  SEGMENT BYTE PUBLIC 'CODE'
  453.         ASSUME  CS:R2CSEG
  454.  
  455. ;/****************************************************************************
  456. ;*                                                   
  457. ;*  SUBROUTINE NAME: GetCursorInfo                  
  458. ;*                                                   
  459. ;*  DESCRIPTIVE NAME: Get cursor position and/or cursor type  
  460. ;*                                                   
  461. ;*  FUNCTION: GetCursorInfo is called by BVS to return selected 
  462. ;*            information about either the cursor position or the 
  463. ;*            cursor type.  If the request specifies hardware and the 
  464. ;*            hardware is readable, the actual hardware setting will 
  465. ;*            be read and returned.  Otherwise the returned
  466. ;*            information will be taken from the environment buffer, 
  467. ;*            if it has been passed.                
  468. ;*                                                   
  469. ;*  ENTRY POINT: GetCursorInfo                      
  470. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 265 ) 
  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 Row                 
  479. ;*                     USHORT Column                
  480. ;*                     USHORT TopScanLine          
  481. ;*                     USHORT BottomScanLine       
  482. ;*                     USHORT Width                 
  483. ;*                     USHORT Attribute            
  484. ;*             ULONG Function ( Call vector table entry = 265 ) 
  485. ;*                                                   
  486. ;*  EXIT-NORMAL: AX = 0                              
  487. ;*               Cursor information is returned.   
  488. ;*                                                   
  489. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS       
  490. ;*                                                   
  491. ;*  EFFECTS: If hardware specified and hardware is readable, the
  492. ;*           environment buffer is updated, if passed.   
  493. ;*                                                   
  494. ;*  INTERNAL REFERENCES:                             
  495. ;*    ROUTINES: NONE                                 
  496. ;*                                                   
  497. ;*  EXTERNAL REFERENCES:                             
  498. ;*    ROUTINES: RegSave, RegRest, SecureSema4, ReleaseSema4  
  499. ;*                                                   
  500. ;****************************************************************************/
  501.  
  502. GetCursorInfo PROC FAR
  503.         public  GetCursorInfo
  504.         Call    RegSave
  505.  
  506.         mov     ax,ERROR_VIO_INVALID_LENGTH
  507.         .if     <[si].vp_parmlength ae vp_c_attr+2> or ;@@S1
  508.         .if     <[si].vp_parmlength ae vp_c_col+2> and ;@@S1
  509.         test    [si].vp_flags,vp_f_curtype ;@@S1
  510.         .if     <z>                               ;@@S1
  511.  
  512.             test    [si].vp_flags,vp_f_curpos ;@@S1
  513.             .if     <nz>                          ;@@S1
  514.                 test    [si].vp_flags,vp_f_physical
  515.                 .if     <nz>
  516.                     Call    GetCurPos            ;Read the hardware
  517.                 .endif
  518.  
  519.                 mov     ax,es:[di].env_row
  520.                 mov     [si].vp_c_row,ax
  521.                 mov     ax,es:[di].env_col
  522.                 mov     [si].vp_c_col,ax
  523.             .endif                                ;@@S1
  524.  
  525.             test    [si].vp_flags,vp_f_curtype ;@@S1;@TL8
  526.             .if     <nz>                          ;@@S1
  527.                 mov     ax,es:[di].env_startline
  528.                 mov     [si].vp_c_startline,ax
  529.                 mov     ax,es:[di].env_endline
  530.                 mov     [si].vp_c_endline,ax
  531.                 mov     ax,es:[di].env_width
  532.                 mov     [si].vp_c_width,ax
  533.                 mov     ax,es:[di].env_attr
  534.                 mov     [si].vp_c_attr,ax
  535.             .endif                                ;@@S1
  536.  
  537.             sub     ax,ax                         ;Set good return code
  538.         .endif
  539.  
  540.         Call    RegRest
  541.         ret     12
  542. GetCursorInfo ENDP
  543.  
  544. ;/****************************************************************************
  545. ;*                                                   
  546. ;*  SUBROUTINE NAME: SetCursorInfo                  
  547. ;*                                                   
  548. ;*  DESCRIPTIVE NAME: Set cursor position and/or cursor type  
  549. ;*                                                   
  550. ;*  FUNCTION: SetCursorInfo is called by BVS to set selected  
  551. ;*            information about either the cursor position or the 
  552. ;*            cursor type.  If the request specifies hardware, the 
  553. ;*            hardware and the environment buffer, if passed, will be 
  554. ;*            updated.  Otherwise just the environment buffer, if 
  555. ;*            passed, will be updated.             
  556. ;*                                                   
  557. ;*  NOTES: This routine puts the PS cursor fields in synch with BVS. 
  558. ;*         then advises the Engine of the changes.  Note that the 
  559. ;*         PS cursor references the bottom left, rather than top left. 
  560. ;*                                                   
  561. ;*  ENTRY POINT: SetCursorInfo                    
  562. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 266 ) 
  563. ;*                                                   
  564. ;*  INPUT: (Passed on stack)                         
  565. ;*             FAR *Environment ( Environment buffer for the session ) 
  566. ;*             FAR *ParmBlock                        
  567. ;*                     USHORT Length = length of this packet  
  568. ;*                     USHORT Flags  = 0 - Environment buffer only 
  569. ;*                                               1 - Hardware also  
  570. ;*                     USHORT Row                   
  571. ;*                     USHORT Column                
  572. ;*                     USHORT TopScanLine          
  573. ;*                     USHORT BottomScanLine       
  574. ;*                     USHORT Width               
  575. ;*                     USHORT Attribute            
  576. ;*             ULONG Function ( Call vector table entry = 266 ) 
  577. ;*                                                   
  578. ;*  EXIT-NORMAL: AX = 0                              
  579. ;*               Cursor information is set         
  580. ;*                                                   
  581. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS       
  582. ;*                                                   
  583. ;*  INTERNAL REFERENCES:                             
  584. ;*    ROUTINES: NONE                                 
  585. ;*                                                   
  586. ;*  EXTERNAL REFERENCES:                             
  587. ;*    ROUTINES: RegSave, RegRest, SecureSema4, ReleaseSema4, GreEntry
  588. ;*                                                   
  589. ;****************************************************************************/
  590.  
  591. SetCursorInfo PROC FAR
  592.         public  SetCursorInfo
  593.         Call    RegSave
  594.  
  595.         mov     ax,ERROR_VIO_INVALID_LENGTH
  596.         .if     <[si].vp_parmlength ae vp_c_attr+2> or ;@@S1
  597.         .if     <[si].vp_parmlength ae vp_c_col+2> and near ;@@S1
  598.         test    [si].vp_flags,vp_f_curtype ;@@S1
  599.         .if     <z> near                          ;@@S1
  600.  
  601.             test    [si].vp_flags,vp_f_curpos
  602.             .if     <nz>                          ;Cursor position update
  603.                 mov     ax,[si].vp_c_row
  604.                 mov     es:[di].env_row,ax
  605.                 mov     ax,[si].vp_c_col
  606.                 mov     es:[di].env_col,ax
  607.  
  608.                 test    [si].vp_flags,vp_f_physical
  609.                 .if     <nz>
  610.                     Call    SetCurPos            ;Update the hardware
  611.                 .endif
  612.             .endif
  613.  
  614.             test    [si].vp_flags,vp_f_curtype
  615.             .if     <nz>                          ;Cursor type update
  616.                 mov     ax,ERROR_VIO_INVALID_PARMS
  617.                 push    ds
  618.                 push    IDHGSEG
  619.                 pop     ds
  620.                 mov     ax,[bx].idh_fontsize
  621.                 pop     ds
  622.                 test    [si].vp_c_width,NOT 1
  623.                 .if     <z> and
  624.                 .if     <[si].vp_c_startline b ax> AND
  625.                 .if     <[si].vp_c_endline be 31>
  626.                     mov     ax,[si].vp_c_startline
  627.                     mov     es:[di].env_startline,ax
  628.                     mov     ax,[si].vp_c_endline
  629.                     mov     es:[di].env_endline,ax
  630.                     mov     ax,[si].vp_c_width
  631.                     mov     es:[di].env_width,ax
  632.                     mov     ax,[si].vp_c_attr
  633.                     mov     es:[di].env_attr,ax
  634.  
  635.                     Call    SetCurType
  636.                     sub     ax,ax
  637.                 .endif
  638.             .endif
  639.  
  640.             sub     ax,ax                         ;Set good return code
  641.         .endif
  642.  
  643.         Call    RegRest
  644.         ret     12
  645. SetCursorInfo ENDP
  646.  
  647. ;/****************************************************************************
  648. ;*                                                   
  649. ;*  SUBROUTINE NAME: GetVarInfo                     
  650. ;*                                                   
  651. ;*  DESCRIPTIVE NAME: Get selected variable information  
  652. ;*                                                   
  653. ;*  FUNCTION: GetVariableInfo is called by BVS to return selected 
  654. ;*            information about video state - blink versus background 
  655. ;*            intensity, overscan color, underscore scan line, video 
  656. ;*            enable, 8514/A display mask, and the current codepage. 
  657. ;*                                                 
  658. ;*  NOTES: Since only the codepage is actually returned for  
  659. ;*         Windowable sessions, the semaphore is not taken to  
  660. ;*         read only one word from the PSCB.       
  661. ;*                                                   
  662. ;*  ENTRY POINT: GetVarInfo                          
  663. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 269 ) 
  664. ;*                                                   
  665. ;*  INPUT: (Passed on stack)                         
  666. ;*             FAR *Environment ( Environment buffer for the session ) 
  667. ;*             FAR *ParmBlock                        
  668. ;*                     USHORT Length = length of this packet  
  669. ;*                     USHORT Flags  = 0 - Environment buffer only 
  670. ;*                                               1 - Hardware also  
  671. ;*                     USHORT Blink                 
  672. ;*                     USHORT Overscan             
  673. ;*                     USHORT Underscore           
  674. ;*                     USHORT VideoEnable          
  675. ;*                     ULONG  DisplayMask          
  676. ;*             ULONG Function ( Call vector table entry = 269 ) 
  677. ;*                                                   
  678. ;*  EXIT-NORMAL: AX = 0                              
  679. ;*               Selected variable information is returned  
  680. ;*                                                   
  681. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS       
  682. ;*                   ERROR_VIO_INVALID_LENGTH      
  683. ;*                                                   
  684. ;*  EFFECTS: If hardware specified and hardware is readable, the 
  685. ;*           environment buffer is updated, if passed.   
  686. ;*                                                   
  687. ;*  INTERNAL REFERENCES:                             
  688. ;*    ROUTINES: NONE                                 
  689. ;*                                                   
  690. ;*  EXTERNAL REFERENCES:                             
  691. ;*    ROUTINES: NONE                                 
  692. ;*                                                   
  693. ;****************************************************************************/
  694.  
  695. GetVarInfo PROC FAR                               ;@@A
  696.         public  GetVarInfo
  697.         Call    RegSave
  698.  
  699.         mov     ax,ERROR_VIO_INVALID_PARMS
  700.         test    [si].vp_flags,NOT (vp_f_physical+vp_f_codepage+vp_f_scrlrect+vp_f_scrndim) ;@@S1
  701.         .if     <z> and
  702.         mov     ax,ERROR_VIO_INVALID_LENGTH
  703.         .if     <[si].vp_parmlength ae vp_scrncols+2>                   ;@P1
  704.  
  705.             mov     [si].vp_blink,bx             ;Blink state
  706.             mov     [si].vp_border,bx            ;Border color
  707.             mov     [si].vp_underscore,bx ;Underscore line
  708.             mov     [si].vp_dispmask1,bx ;Display mask (bits 0-15)
  709.             mov     [si].vp_dispmask2,bx ;Display mask (bits 16-31)
  710.  
  711.             mov     ax,es:[di].env_scrlleft                             ;@P1
  712.             mov     [si].vp_scrlleft,ax ;Scrollable Rectange of screen  ;@P1
  713.             mov     ax,es:[di].env_scrltop                              ;@P1
  714.             mov     [si].vp_scrltop,ax   ;Scrollable Rectange of screen ;@P1
  715.             mov     ax,es:[di].env_scrlright                            ;@P1
  716.             mov     [si].vp_scrlright,ax;Scrollable Rectange of screen  ;@P1
  717.             mov     ax,es:[di].env_scrlbottom                           ;@P1
  718.             mov     [si].vp_scrlbottom,ax ;Scrollable Rectange of screen;@P1
  719.             mov     ax,es:[di].env_rows                                 ;@P1
  720.             mov     [si].vp_scrnrows,ax ;Screen Dimensions              ;@P1
  721.             mov     ax,es:[di].env_cols                                 ;@P1
  722.             mov     [si].vp_scrncols,ax ;Screen Dimensions              ;@P1
  723.  
  724.             push    IDHGSEG
  725.             pop     es
  726.             mov     ax,es:[bx].idh_codepage
  727.             mov     [si].vp_codepage,ax ;Codepage
  728.  
  729.             sub     ax,ax                         ;Set good return code
  730.         .endif
  731.  
  732.         Call    RegRest
  733.         ret     12
  734. GetVarInfo ENDP                                   ;@@A
  735.  
  736. ;/****************************************************************************
  737. ;*                                                   
  738. ;*  SUBROUTINE NAME: SetVarInfo                     
  739. ;*                                                   
  740. ;*  DESCRIPTIVE NAME: Set selected variable information  
  741. ;*                                                   
  742. ;*  FUNCTION: SetVariableInfo is called by BVS to set selected  
  743. ;*            information about video state - blink versus background 
  744. ;*            intensity, overscan color, underscore scan line, video 
  745. ;*            enable, or 8514/A display mask. If the request specifies 
  746. ;*            hardware the hardware and the environment buffer, if 
  747. ;*            passed, will be updated.  Otherwise just the environment 
  748. ;*            buffer, if passed, will be updated.   
  749. ;*                                                   
  750. ;*  ENTRY POINT: SetVarInfo                          
  751. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 270 ) 
  752. ;*                                                   
  753. ;*  INPUT: (Passed on stack)                         
  754. ;*             FAR *Environment ( Environment buffer for the session ) 
  755. ;*             FAR *ParmBlock                        
  756. ;*                     USHORT Length = length of this packet  
  757. ;*                     USHORT Flags  = 0 - Environment buffer only 
  758. ;*                                               1 - Hardware also  
  759. ;*                     USHORT Blink                 
  760. ;*                     USHORT Overscan             
  761. ;*                     USHORT Underscore           
  762. ;*                     USHORT VideoEnable          
  763. ;*                     ULONG  DisplayMask          
  764. ;*             ULONG Function ( Call vector table entry = 270 ) 
  765. ;*                                                   
  766. ;*  EXIT-NORMAL: AX = 0                              
  767. ;*               Selected variable information is set   
  768. ;*                                                   
  769. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS       
  770. ;*                   ERROR_VIO_INVALID_LENGTH      
  771. ;*                   ERROR_VIO_BAD_CP               
  772. ;*                                                   
  773. ;*  INTERNAL REFERENCES:                             
  774. ;*    ROUTINES: NONE                                 
  775. ;*                                                   
  776. ;*  EXTERNAL REFERENCES:                             
  777. ;*    ROUTINES: AccessCursorBlink, AccessCursorOverscan  
  778. ;*              AccessCursorUnderscore, AccessCursorVideoEnable 
  779. ;*              AccessDisplayMask                   
  780. ;*                                                   
  781. ;****************************************************************************/
  782.  
  783. SetVarInfo PROC FAR                               ;@@A
  784.         public  SetVarInfo
  785.         Call    RegSave
  786.  
  787.         mov     ax,ERROR_VIO_INVALID_PARMS
  788.         test    [si].vp_flags,NOT (vp_f_physical+vp_f_codepage)
  789.         .if     <z> and
  790.         mov     ax,ERROR_VIO_INVALID_LENGTH
  791.         .if     <[si].vp_parmlength ae vp_codepage+2>
  792.             mov     ax,ERROR_VIO_BAD_CP
  793.             mov     cx,[si].vp_codepage
  794.             push    IDHGSEG
  795.             pop     ds
  796.             .if     <cx eq [bx].idh_codepage>
  797.                 sub     ax,ax
  798.             .endif
  799.         .endif
  800.  
  801.         Call    RegRest
  802.         ret     12
  803. SetVarInfo ENDP                                   ;@@A
  804.  
  805. ;/****************************************************************************
  806. ;*                                                   
  807. ;* SUBROUTINE NAME:  GetCodePage                    
  808. ;*                                                   
  809. ;* DESCRIPTIVE NAME:   Get the Prepared CodePage for the VDH  
  810. ;*                                                   
  811. ;* FUNCTION:   Loads the font buffer with the first prepared codepage 
  812. ;*                                                   
  813. ;* NOTES:  Executes on Level 3                      
  814. ;*                                                   
  815. ;* ENTRY POINT:  GetCodePage                         
  816. ;*   LINKAGE:  Call GetCodePage                     
  817. ;*                                                   
  818. ;* INPUT:  DS = PPBVSCB, ES = CodePage Data Info Block (CDIB)  
  819. ;*         CX = Number of CodePages                 
  820. ;*         SI = Offset of CodePage substructure in CDIB  
  821. ;*                                                   
  822. ;* EXIT-NORMAL:  N/A                               
  823. ;*                                                   
  824. ;* EXIT-ERROR:   N/A                             
  825. ;*                                                   
  826. ;* EFFECTS:  None                                    
  827. ;*                                                   
  828. ;* INTERNAL REFERENCES: None                         
  829. ;*   ROUTINES:  ReadFont, RandomRead                
  830. ;*                                                   
  831. ;* EXTERNAL REFERENCES:  CDIB                        
  832. ;*   ROUTINES: DOSOPEN, DOSREAD, DOSCHGFILEPTR, DOSCLOSE,  
  833. ;*             DOSGETSHRSEG, DOSFREESEG            
  834. ;****************************************************************************/
  835.  
  836. GetCodePage PROC NEAR
  837.         public  GetCodePage
  838.  
  839.         push    ax                                ;Save VideoConfig type  ;@T39
  840.         push    si                                ;Save Config offset  ;@T39
  841.         push    di                                ;Save ENV offset  ;@S20
  842.  
  843.         push    ds
  844.         push    idh_cdib                          ;Ptr to CDIB name
  845.         push    ds
  846.         push    idh_selector                      ;Ptr to CDIB selector
  847.         Call    DOSGETSHRSEG                      ;Get the CDIB selector
  848.  
  849.         .if     <zero ax>
  850.             mov     es,ds:[bx].idh_selector
  851.             mov     di,es:[bx].CDIB_codepage_ptr ;ES:DI = CodePage Info
  852.             mov     cx,es:[di].CDIB_cp_number_codepages
  853.  
  854.             mov     ax,ERROR_VIO_BAD_CP
  855.             .if     <ncxz>                        ;Some codepages prepared
  856.  
  857.                 mov     si,es:[di].CDIB_cp_first_id ;Get first CP in SI
  858.  
  859.                 mov     di,es:[bx].CDIB_screen_ptr ;Get offset of screen
  860.                 .if     <nonzero di>             ;Screen substructure found
  861.                     mov     di,es:[di].CDIB_dev_filename_ptr ;Offset of file name
  862.                 .endif
  863.  
  864.                 .if     <nonzero di>             ;Filename specified
  865.                     push    es
  866.                     push    di                    ;Device name ASCIIZ string
  867.                     push    ds
  868.                     push    idh_handle           ;Return for device handle
  869.                     push    ds
  870.                     push    idh_scratch ;Action Taken
  871.                     push    bx
  872.                     push    bx                    ;File size
  873.                     push    bx                    ;File Attribute
  874.                     push    00001h               ;Open Flag = Fail if missing
  875.                     push    00020h               ;Open Mode = Read Only/Deny Write
  876.                     push    bx
  877.                     push    bx                    ;Reserved (0:0)
  878.                     Call    DOSOPEN              ;Open the CodePage file
  879.                 .endif
  880.             .endif
  881.         .endif
  882.  
  883.         push    ax
  884.         push    [bx].idh_selector
  885.         Call    DOSFREESEG                        ;Relinquish use of the CDIB
  886.         pop     ax
  887.  
  888.         .if     <zero ax> near                    ;File opened properly
  889.  
  890.             mov     ax,[bx].idh_fontsize
  891.             xchg    al,ah
  892.             push    ax                            ;Size of font segment
  893.             push    ds
  894.             push    idh_selector                 ;Selector return ptr
  895.             push    bx                            ;Do not share this segment
  896.             Call    DosAllocSeg                  ;Allocate work buffer
  897.             .if     <zero ax> near               ;Buffer allocated properly
  898.  
  899.                 sub     dx,dx
  900.                 sub     di,di                     ;Point to file header
  901.  
  902.                 mov     es,[bx].idh_selector
  903.                 mov     cx,size fontfilehdr
  904.                 Call    RandomRead               ;Read the font file header
  905.                 .if     <zero ax> near           ;Font header read properly
  906.  
  907.                     mov     cx,word ptr es:[bx].ffh_numfonts ;Number
  908.                     mov     di,word ptr es:[bx].ffh_ptroffset ;Offset
  909.  
  910.                     .repeat
  911.                         push                     cx ;Number of fonts left in file
  912.                         sub                      dx,dx
  913.                         push                     di ;Fonthdr ptr
  914.  
  915.                         mov                      cx,4
  916.                         Call                     RandomRead ;Read the fonthdr ptr
  917.                         .if                      <zero ax> and
  918.  
  919.                         mov                      di,word ptr es:[bx]
  920.                         mov                      dx,word ptr es:[bx+2] ;Get fonthdr ptr
  921.                         mov                      cx,size fonthdr
  922.                         Call                     RandomRead ;Read the fonthdr
  923.                         .if                      <zero ax>
  924.  
  925.                             .if     <es:[bx].fh_cpid eq si> and
  926.                             mov     cx,[bx].idh_fontsize
  927.                             .if     <es:[bx].fh_cellrows eq cl> and
  928.                             .if     <es:[bx].fh_cellcols eq 8>
  929.                                                  add di,es:[bx].fh_dataoffset
  930.                                                  adc dx,bx ;32-bit Offset of font in file
  931.                                                  xchg cl,ch ;Get size to read
  932.                                                  Call RandomRead ;Read the font data
  933.  
  934.                                                  .if <zero ax>
  935.                                                      mov     [bx].idh_codepage,si ;Mark as found
  936.  
  937.                                                      push    bx    ;@T30
  938.                                                      push    bx
  939.                                                      mov     ax,sp ;Make room for a return value
  940.  
  941.                                                      push    2000h ;Size of video font buffer
  942.                                                      push    ss
  943.                                                      push    ax ;Return area for selector
  944.                                                      push    000Ah
  945.                                                      push    bx ;Address of video font buffer
  946.                                                      Call    _PhysToUVirt ;Allocate new PVB selector
  947.                                                      add     sp, 12 ;Balance the stack ;@T30
  948.  
  949.                                                      pop     es ;Get the video font selector
  950.                                                      push    es ;Save it for Free below
  951.                                                      Call    CopyFont ;Init font buffer
  952.  
  953.                                                      mov     es,bx ;Avoid trap when popping ES
  954.                                                      Call    _FreePhysToUVirt ;Free the selector
  955.                                                      add     sp, 2 ;Balance the stack
  956.                                                  .endif
  957.                             .endif
  958.  
  959.                         .endif
  960.  
  961.                         pop                      di
  962.                         add                      di,4 ;Next ptr to font ptr
  963.                         pop                      cx
  964.                     .leave  <[bx].idh_codepage ne bx> ;Until font found
  965.                     .loop                         ;Until all fonts examined
  966.                 .endif
  967.  
  968.                 push    [bx].idh_selector
  969.                 Call    DOSFREESEG               ;Relinquish use of work buffer
  970.             .endif
  971.             push    [bx].idh_handle
  972.             Call    DOSCLOSE                      ;Close the Font File
  973.         .endif
  974.  
  975.         pop     di                                ;Save ENV offset  ;@S20
  976.         pop     si                                ;Restore Config offset  ;@T39
  977.         pop     ax                                ;Restore VideoConfig type ;@T39
  978.         RET
  979. GetCodePage ENDP
  980.  
  981. ;/****************************************************************************
  982. ;*
  983. ;* FUNCTION NAME = RandomRead:
  984. ;*
  985. ;* DESCRIPTION   = 
  986. ;*
  987. ;* INPUT         = DX:DI = New file offset          
  988. ;*                         ES:0  = Ptr to buffer    
  989. ;*                         CX    = Length of buffer 
  990. ;*
  991. ;* OUTPUT        = NONE
  992. ;*
  993. ;* RETURN-NORMAL = NONE
  994. ;* RETURN-ERROR  = NONE
  995. ;*
  996. ;****************************************************************************/
  997.  
  998.  
  999. RandomRead PROC NEAR                              ;@@A
  1000.         public  RandomRead
  1001.  
  1002.         push    [bx].idh_handle                  ;File handle
  1003.         push    dx
  1004.         push    di                                ;Distance
  1005.         push    bx                                ;Type = Abs from Start
  1006.         push    ds
  1007.         push    idh_scratch                       ;New ptr return area
  1008.         Call    DOSCHGFILEPTR                     ;Set new file read location
  1009.  
  1010.         push    [bx].idh_handle                  ;File handle
  1011.         push    es
  1012.         push    bx                                ;Buffer ptr
  1013.         push    cx                                ;Read Length
  1014.         push    ds
  1015.         push    idh_scratch                       ;Return Length
  1016.         Call    DOSREAD                           ;Read from current location
  1017.  
  1018.         ret
  1019. RandomRead ENDP                                   ;@@A
  1020.  
  1021. ;/****************************************************************************
  1022. ;*                                                   
  1023. ;*  SUBROUTINE NAME: GetDBCSInfo                    
  1024. ;*                                                   
  1025. ;*  DESCRIPTIVE NAME: Get DBCS character display width information 
  1026. ;*                                                   
  1027. ;*  FUNCTION: GetDBCSInfo is called by BVS to get character display 
  1028. ;*            width information for use with WrtTTY.  The call should 
  1029. ;*            return the ranges of characters that require two cells 
  1030. ;*            for display.  On us adapters there are none.  
  1031. ;*                                                   
  1032. ;*  ENTRY POINT: GetDBCSInfo                         
  1033. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 261 ) 
  1034. ;*                                                   
  1035. ;*  INPUT: (Passed on stack)                         
  1036. ;*             FAR *Environment ( Environment buffer for the session ) 
  1037. ;*             FAR *ParmBlock                        
  1038. ;*                     USHORT Length = length of this packet  
  1039. ;*                     USHORT Flags  = 0 - Environment buffer only 
  1040. ;*                                               1 - Hardware also  
  1041. ;*                     USHORT Table Length length of following table 
  1042. ;*                     USHORT Beginning of first range   
  1043. ;*                     USHORT End of first range   
  1044. ;*                                              ...     
  1045. ;*                     USHORT Beginning of nth range   
  1046. ;*                     USHORT End of nth range    
  1047. ;*             ULONG Function ( Call vector table entry = 261 ) 
  1048. ;*                                                   
  1049. ;*  EXIT-NORMAL: AX = 0                              
  1050. ;*               The table is returned (Table length = 0)  
  1051. ;*                                                   
  1052. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS       
  1053. ;*                   ERROR_VIO_INVALID_LENGTH      
  1054. ;*                                                   
  1055. ;*  INTERNAL REFERENCES:                             
  1056. ;*    ROUTINES: NONE                                 
  1057. ;*                                                   
  1058. ;*  EXTERNAL REFERENCES:                             
  1059. ;*    ROUTINES: NONE                                 
  1060. ;*                                                   
  1061. ;****************************************************************************/
  1062.  
  1063. GetDBCSInfo PROC FAR                                                    ;@P1
  1064.         public  GetDBCSInfo                                             ;@P1
  1065.         Call    RegSave                                                 ;@P1
  1066.  
  1067.  
  1068.         mov     ax,ERROR_VIO_INVALID_LENGTH                             ;@P1
  1069.         .if     <[si].vp_parmlength e 2> near                           ;@P1
  1070.             xor     ax,ax                                               ;@P1
  1071.             mov     [si].vp_parmlength,(vp_di_tbllen + 2)               ;@P1
  1072.         .else                                                           ;@P1
  1073.             .if     <[si].vp_parmlength ae 4> near                      ;@P1
  1074.                 mov     ax,ERROR_VIO_INVALID_PARMS                      ;@P1
  1075.                 cmp     [si].vp_flags,bx                                ;@P1
  1076.                 .if     <z> and                                         ;@P1
  1077.                 mov     ax,ERROR_VIO_INVALID_LENGTH                     ;@P1
  1078.                 .if     <[si].vp_parmlength ae 6>                       ;@P1
  1079.                     mov     [si].vp_di_tbllen,bx                        ;@P1
  1080.                     sub     ax,ax                ; Set good return code ;@P1
  1081.                 .endif                                                  ;@P1
  1082.             .endif                                                      ;@P1
  1083.         .endif                                                          ;@P1
  1084.  
  1085.         Call    RegRest                                                 ;@P1
  1086.         ret     12                                                      ;@P1
  1087. GetDBCSInfo ENDP                                                        ;@P1
  1088.  
  1089. ;/****************************************************************************
  1090. ;*                                                   
  1091. ;*  SUBROUTINE NAME: GetLVBInfo                     
  1092. ;*                                                   
  1093. ;*  DESCRIPTIVE NAME: Return LVB size and default attribute info 
  1094. ;*                                                   
  1095. ;*  FUNCTION: GetLVBInfo is called by BVS to determine the size of the 
  1096. ;*            LVB required for a given display size.  Based on the 
  1097. ;*            mode and its associated LVB format the allocation size 
  1098. ;*            of the LVB is returned.           Also a default attribute may 
  1099. ;*            be returned.                           
  1100. ;*                                                   
  1101. ;*  ENTRY POINT: GetLVBInfo                          
  1102. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 2xx ) 
  1103. ;*                                                   
  1104. ;*  INPUT: (Passed on stack)                         
  1105. ;*             FAR *Environment ( Environment buffer for the session ) 
  1106. ;*             FAR *ParmBlock                        
  1107. ;*                     USHORT Length = length of this packet  
  1108. ;*                     USHORT Flags  = 0 - Environment buffer only 
  1109. ;*                                               1 - Hardware also  
  1110. ;*                     UCHAR  FormatId;            
  1111. ;*                     UCHAR  AttrCount;           
  1112. ;*                     USHORT LVBWidth;            
  1113. ;*                     USHORT LVBHeight;           
  1114. ;*                     ULONG  LVBSize;             
  1115. ;*                     USHORT AttrBufSize;         
  1116. ;*                     UCHAR far *AttrBufAddr;    
  1117. ;*             ULONG Function ( Call vector table entry = 261 ) 
  1118. ;*                                                   
  1119. ;*  EXIT-NORMAL: AX = 0                              
  1120. ;*               The correct size of the LVB is returned  
  1121. ;*                                                   
  1122. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS       
  1123. ;*                                                   
  1124. ;*  INTERNAL REFERENCES:                             
  1125. ;*    ROUTINES: NONE                                 
  1126. ;*                                                   
  1127. ;*  EXTERNAL REFERENCES:                             
  1128. ;*    ROUTINES: NONE                                 
  1129. ;*                                                   
  1130. ;****************************************************************************/
  1131.  
  1132. GetLVBInfo  PROC FAR                                                    ;@P1
  1133.         public  GetLVBInfo                                              ;@P1
  1134.         Call    RegSave                                                 ;@P1
  1135.                                                                         ;@P1
  1136.         mov     ax,ERROR_VIO_INVALID_PARMS                              ;@P1
  1137.         .if     <[si].vp_parmlength ge vp_li_attrsize>                  ;@P1
  1138.             .if     <[si].vp_li_fidatt e bx>                            ;@P1
  1139.                 .if     <[si].vp_li_width e bx>                         ;@P1
  1140.                     mov     ax,es:[di].env_cols                         ;@P1
  1141.                 .else                                                   ;@P1
  1142.                     mov     ax,[si].vp_li_width                         ;@P1
  1143.                 .endif                                                  ;@P1
  1144.                 .if     <[si].vp_li_height e bx>                        ;@P1
  1145.                     mul     es:[di].env_rows                            ;@P1
  1146.                 .else                                                   ;@P1
  1147.                     mul     [si].vp_li_height                           ;@P1
  1148.                 .endif                                                  ;@P1
  1149.                 shl     ax,1       ; 2 bytes per cell * number of cells ;@P1
  1150.                 .if     <c>                                             ;@P1
  1151.                     shl     dx,1                                        ;@P1
  1152.                     inc     dx                                          ;@P1
  1153.                 .else                                                   ;@P1
  1154.                     shl     dx,1                                        ;@P1
  1155.                 .endif                                                  ;@P1
  1156.                 mov     [si].vp_li_allocl,ax                            ;@P1
  1157.                 mov     [si].vp_li_alloch,dx                            ;@P1
  1158.                 xor     ax,ax                                           ;@P1
  1159.             .endif                                                      ;@P1
  1160.         .endif                                                          ;@P1
  1161.         .if     <[si].vp_parmlength ge vp_li_attroffst> near            ;@P1
  1162.              mov    cx,[si].vp_li_attrsize                              ;@P1
  1163.             .if     <cx e bx> near                                      ;@P1
  1164.                 mov     cx,es:[di].env_attrbufsiz                       ;@P1
  1165.                 mov     [si].vp_li_attrsize,cx                          ;@P1
  1166.             .else                                                       ;@P1
  1167.                 .if     <cx ae es:[di].env_attrbufsiz> and              ;@P1
  1168.                 .if     <[si].vp_parmlength ae vp_li_attrseg+2>         ;@P1
  1169.                     mov     bx,[si].vp_li_attroffst                     ;@P1
  1170.                     mov     cx,[si].vp_li_attrseg                       ;@P1
  1171.                     mov     ds,cx                                       ;@P1
  1172.                     mov     cx,es:[di].env_attrbufsiz                   ;@P1
  1173.                     add     di,env_attrbuf                              ;@P1
  1174.                     .repeat                                             ;@P1
  1175.                         mov                      dl,es:[di]             ;@P1
  1176.                         mov                      ds:[bx],dl             ;@P1
  1177.                         inc                      di                     ;@P1
  1178.                         inc                      bx                     ;@P1
  1179.                         dec                      cx                     ;@P1
  1180.                     .until  <zero cx>                                   ;@P1
  1181.                 .else                                                   ;@P1
  1182.                     mov     ax,ERROR_VIO_INVALID_LENGTH                 ;@P1
  1183.                 .endif                                                  ;@P1
  1184.             .endif                                                      ;@P1
  1185.         .endif                                                          ;@P1
  1186.  
  1187.         Call    RegRest                                                 ;@P1
  1188.         ret     12                                                      ;@P1
  1189. GetLVBInfo  ENDP                                                        ;@P1
  1190.  
  1191.  
  1192. R2CSEG  ENDS
  1193.         END
  1194.  
  1195.