home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / VDH / WDHBUFUP.ASM < prev    next >
Assembly Source File  |  1995-04-14  |  24KB  |  577 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    60,132
  13.         TITLE   WDHBUFUP.ASM -- Buffer Update Routine for Windows
  14.  
  15. ;/*****************************************************************************
  16. ;*
  17. ;* SOURCE FILE NAME = WDHBUFUP.ASM
  18. ;*
  19. ;* DESCRIPTIVE NAME = Buffer Update Routine for Windows
  20. ;*
  21. ;*
  22. ;* VERSION      V2.0
  23. ;*
  24. ;* DATE
  25. ;*
  26. ;* DESCRIPTION  Mainline routine for video buffer read, write,
  27. ;*              scroll functions.
  28. ;*
  29. ;*   LINKAGE:   Far Call from Base Video Subsystem (BVSCALLS.DLL)
  30. ;*
  31. ;* INPUT:       STACK FRAME on entry
  32. ;*
  33. ;* SS:SP  --->  bvsip           dw      BVS IP offset
  34. ;*              bvscs           dw      BVS CS selector
  35. ;*              parmn           dd      Function number (256)
  36. ;*              parmnm2         dd      Parameter block
  37. ;*              parmnm4         dd      Environment buffer
  38. ;*
  39. ;*
  40. ;* PARAMETER BLOCK FORMAT:
  41. ;*
  42. ;*   SIZE   DESCRIPTION
  43. ;*   ----   -----------
  44. ;*
  45. ;*   WORD   ParmLength (length of structure - 28 bytes)
  46. ;*   WORD   Flags
  47. ;*            Bit 0 = 0, do not update physical display buffer
  48. ;*            Bit 0 = 1, update physical display buffer if possible
  49. ;*            Bit 1 = 0, logical display buffer update not required
  50. ;*            Bit 1 = 1, update logical display buffer
  51. ;*            Bit 2 = 0, use attribute as is
  52. ;*            Bit 2 = 1, convert attribute to or from CGA format
  53. ;*            Bit 3 - 15 are reserved and must be OFF
  54. ;*
  55. ;*          NOTE:  If bit 0 and 1 are both ON then the LVB will
  56. ;*                 be written first before the PVB is updated.
  57. ;*                 This will ensure that video devices with
  58. ;*                 slower VRAM will benefit from this algorithm.
  59. ;*
  60. ;*                 The caller of BufferUpdate routine (BVS) must
  61. ;*                 serialize access to this routine to insure
  62. ;*                 that the LVB and the PVB will not get out of sync.
  63. ;*
  64. ;*   DWORD  AppDataAddr (address of application data)
  65. ;*   DWORD  AppCellAddr (address of character, attribute, or cell)
  66. ;*   WORD   Index (BufferUpdate sub-function to be performed)
  67. ;*            0 = Read cell types
  68. ;*                  Bit 0 = 0, single cell character
  69. ;*                             (occupies one cell on the screen)
  70. ;*                  Bit 0 = 1, double cell character
  71. ;*                             (occupies two cells on the screen)
  72. ;*                  Bit 1 = 0, leading (or only) cell
  73. ;*                  Bit 1 = 1, trailing cell
  74. ;*                  Bit 2 - 15 are reserved and must be OFF
  75. ;*            1 = Read characters from (Row, Col)
  76. ;*            2 = Read cells from (Row, Col)
  77. ;*            3 = Scroll (Row, Col) through (Row2, Col2) Up
  78. ;*            4 = Scroll (Row, Col) through (Row2, Col2) Down
  79. ;*            5 = Scroll (Row, Col) through (Row2, Col2) Left
  80. ;*            6 = Scroll (Row, Col) through (Row2, Col2) Right
  81. ;*            7 = Write cells to (Row, Col)
  82. ;*            8 = Write characters to (Row, Col)
  83. ;*            9 = Write characters with constant attr to (Row, Col)
  84. ;*           10 = Write repeat character to (Row, Col)
  85. ;*           11 = Write repeat attribute to (Row, Col)
  86. ;*           12 = Write repeat cell to (Row, Col)
  87. ;*   WORD   Row  (Starting row)
  88. ;*   WORD   Col  (Starting column)
  89. ;*   WORD   Row2 (Secondary row)
  90. ;*   WORD   Col2 (Secondary column)
  91. ;*   WORD   RepeatFactor (# of character cells or rows/columns)
  92. ;*   WORD   LogicalBufSel (logical buffer selector - LVB)
  93. ;*
  94. ;*
  95. ;* ENVIRONMENT BUFFER FORMAT:
  96. ;*
  97. ;*   SIZE   DESCRIPTION
  98. ;*   ----   -----------
  99. ;*   WORD   ModeDataOff (offset to mode data structure)
  100. ;*
  101. ;*
  102. ;* MODEDATA STRUCTURE FORMAT:
  103. ;*
  104. ;*   SIZE   DESCRIPTION
  105. ;*   ----   -----------
  106. ;*   WORD   Length (length of mode data structure - 34 bytes)
  107. ;*   BYTE   ModeType
  108. ;*            Bit 0 = 0, monochrome compatible
  109. ;*            Bit 0 = 1, other
  110. ;*            Bit 1 = 0, text mode
  111. ;*            Bit 1 = 1, graphics mode
  112. ;*            Bit 2 = 0, enable color burst
  113. ;*            Bit 2 = 1, disable color burst
  114. ;*            Bit 3 = 0, VGA compatible modes (0 - 13h)
  115. ;*            Bit 3 = 1, native mode
  116. ;*            Bit 4 - 15 are reserved
  117. ;*   BYTE   Color (number of colors as a power of 2)
  118. ;*   WORD   TextCols (number of text columns in current mode)
  119. ;*   WORD   TextRows (number of text rows in current mode)
  120. ;*   WORD   HorizRes (horizontal pel resolution)
  121. ;*   WORD   VertRes (vertical pel resolution)
  122. ;*   BYTE   AttrFormat (attribute format)
  123. ;*   BYTE   NAttributes (number of attributes in a character cell)
  124. ;*  DWORD   BufferAddr (32-bit physical address of PVB)
  125. ;*  DWORD   BufferLength (length of PVB in current mode)
  126. ;*  DWORD   FullBufSize (size of buffer required for screen save)
  127. ;*  DWORD   PartBufSize (size of buffer for popup save)
  128. ;*  DWORD   ExtDataAddr (extended mode data structure address)
  129. ;*
  130. ;* EXIT-NORMAL: AX = 0
  131. ;*
  132. ;* EXIT-ERROR:  AX = error code, ERROR_VIO_COL
  133. ;*                               ERROR_VIO_INVALID_LENGTH
  134. ;*                               ERROR_VIO_INVALID_PARMS
  135. ;*                               ERRPR_VIO_MODE
  136. ;*                               ERROR_VIO_ROW
  137. ;*                               ERROR_VIO_INTERNAL_RESOURCE
  138. ;*
  139. ;* EFFECTS:     All other registers are preserved
  140. ;*
  141. ;* INTERNAL REFERENCES: None
  142. ;*
  143. ;* EXTERNAL REFERENCES: ReadCellTypes           in XGAREAD.ASM
  144. ;*                      ReadCharStr             in XGAREAD.ASM
  145. ;*                      ReadCellStr             in XGAREAD.ASM
  146. ;*                      ScrollUp                in XGASCROL.ASM
  147. ;*                      ScrollDown              in XGASCROL.ASM
  148. ;*                      ScrollLeft              in XGASCROL.ASM
  149. ;*                      ScrollRight             in XGASCROL.ASM
  150. ;*                      WriteCellStr            in XGAWRITE.ASM
  151. ;*                      WriteCharStr            in XGAWRITE.ASM
  152. ;*                      WriteCharStrAttr        in XGAWRITE.ASM
  153. ;*                      WriteNChar              in XGAWRITE.ASM
  154. ;*                      WriteNAttr              in XGAWRITE.ASM
  155. ;*                      WriteNCell              in XGAWRITE.ASM
  156. ;*
  157. ;* FUNCTIONS    BUFFERUPDATE
  158. ;*              DummyLVBToPVB
  159. ;*              SetGenParms
  160. ;*
  161. ;* NOTES        NONE
  162. ;*
  163. ;* STRUCTURES   NONE
  164. ;*
  165. ;* EXTERNAL REFERENCES  NONE
  166. ;*
  167. ;* EXTERNAL FUNCTIONS
  168. ;*
  169. ;*              NONE
  170. ;*
  171. ;* PSEUDOCODE
  172. ;*
  173. ;*      Begin BufferUpdate
  174. ;*          Preset return code to ERROR_VIO_MODE
  175. ;*          If text mode
  176. ;*              Preset return code to ERROR_VIO_INVALID_LENGTH
  177. ;*              If correct parameter length
  178. ;*                  Preset return code to ERROR_VIO_INVALID_PARMS
  179. ;*                  If valid reserved flags     AND
  180. ;*                  If valid video buffer flags AND
  181. ;*                  If valid function number    AND
  182. ;*                  If valid index number
  183. ;*                      Call Read/Write/Scroll routines
  184. ;*                  Endif
  185. ;*              Endif
  186. ;*          Endif
  187. ;*      End BufferUpdate
  188. ;*
  189. ;* CHANGE ACTIVIY =
  190. ;*   DATE      FLAG       APAR    CHANGE DESCRIPTION
  191. ;*   --------  ---------- -----   --------------------------------------
  192. ;*   mm/dd/yy  @Vr.mpppxx xxxxx   xxxxxxx
  193. ;*   03/25/89  @P1        D132    TPL, DCR 132 changes
  194. ;*   05/01/89  @C19       HM00550 CJJ, Clear carry flag for SetBuffAddr
  195. ;*                                routine,
  196. ;*   08/19/89  @S23       B706727 CJJ,TLB Save pssel in instance data,
  197. ;*   11/02/89  @D549      D549    CJJ, Seltable changes due to rangeless
  198. ;*                                sessions,
  199. ;*   01/22/90  @T52       D704    TPL, DCR 704 work
  200. ;*             @B55       B788870 WKB, Convert bytes to cell value for graphics
  201. ;*                                engine call
  202. ;*   04/11/91  D1348      D1348   NAKADA, Enable DBCS support in Vio-Window
  203. ;*   09/14/94  @95837             WKB, pmwinp.inc -> pmwinx.inc
  204. ;****************************************************************************/
  205.  
  206.         .xlist
  207.         include bvscb.inc               ;BVS Control Blocks     @S23
  208.         INCLUDE struc.inc               ; Structure macro
  209.         INCLUDE error2.inc              ; Subsystem error equates
  210.         INCLUDE vdhstruc.inc            ; Buffer update data structures
  211.         INCLUDE vdhequ.inc              ; Buffer update equates
  212.         .xlist
  213.  
  214.         EXTRN   ReadCellTypes    : NEAR ; 
  215.         EXTRN   ReadCharStr      : NEAR ; VioReadCharStr
  216.         EXTRN   ReadCellStr      : NEAR ; VioReadCellStr
  217.         EXTRN   ScrollUp         : NEAR ; VioScrollUp
  218.         EXTRN   ScrollDown       : NEAR ; VioScrollDn
  219.         EXTRN   ScrollLeft       : NEAR ; VioScrollLt
  220.         EXTRN   ScrollRight      : NEAR ; VioScrollRt
  221.         EXTRN   WriteCellStr     : NEAR ; VioWriteCellStr
  222.         EXTRN   WriteCharStr     : NEAR ; VioWriteCharStr
  223.         EXTRN   WriteCharStrAttr : NEAR ; VioWriteCharStrAttr
  224.         EXTRN   WriteNChar       : NEAR ; VioWriteNChar
  225.         EXTRN   WriteNAttr       : NEAR ; VioWriteNAttr
  226.         EXTRN   WriteNCell       : NEAR ; VioWriteNCell
  227.  
  228.         EXTRN   bvh_instance     : DWORD                                ;@T52
  229.  
  230. ;/*
  231. ;**  Start of window specific code
  232. ;*/
  233.  
  234.         .xlist
  235.         include pmwinx.inc              ;@95387
  236.         include pmaviop.inc
  237.         include wdhequ.inc              ; WDH Equates
  238.         include bvsparms.inc            ; BVS Parameter Equates
  239.         .list
  240.  
  241.         .386p                   ;@D549
  242.  
  243.         extrn   SecureSema4:NEAR
  244.         extrn   ReleaseSema4:NEAR
  245.         extrn   CharStr:NEAR
  246.         extrn   WinScroll:NEAR
  247.  
  248. ;/*
  249. ;**  End of window specific code
  250. ;*/
  251.  
  252.         PUBLIC  BUFFERUPDATE
  253.         PUBLIC  DispTbl
  254.  
  255. WDHGSEG SEGMENT PARA PUBLIC 'DATA' USE16                                ;@T52
  256. WDHGSEG ENDS                                                            ;@T52
  257.  
  258.  
  259. R2CSEG  SEGMENT WORD    PUBLIC 'CODE' USE16     ;@D549
  260.         ASSUME  CS:R2CSEG,DS:NOTHING,ES:NOTHING
  261.  
  262. DispTbl DW      OFFSET R2CSEG:ReadCellTypes ; 
  263.         DW      OFFSET R2CSEG:ReadCharStr ; Read characters
  264.         DW      OFFSET R2CSEG:ReadCellStr ; Read character/attribute 's
  265.         DW      OFFSET R2CSEG:ScrollUp  ; Scroll window up
  266.         DW      OFFSET R2CSEG:ScrollDown ; Scroll window down
  267.         DW      OFFSET R2CSEG:ScrollLeft ; Scroll window left
  268.         DW      OFFSET R2CSEG:ScrollRight ; Scroll window right
  269.         DW      OFFSET R2CSEG:WriteCellStr ; Write character/attribute 's
  270.         DW      OFFSET R2CSEG:WriteCharStr ; Write characters
  271.         DW      OFFSET R2CSEG:WriteCharStrAttr ; Write characters with attr
  272.         DW      OFFSET R2CSEG:WriteNChar ; Write character N times
  273.         DW      OFFSET R2CSEG:WriteNAttr ; Write attribute N times
  274.         DW      OFFSET R2CSEG:WriteNCell ; Write cell N times
  275.         DW      OFFSET R2CSEG:DummyLVBToPVB ; Copy a rect of LVB to the PVB @P1
  276.  
  277. ;/****************************************************************************
  278. ;*
  279. ;* FUNCTION NAME = BUFFERUPDATE
  280. ;*
  281. ;* DESCRIPTION   =
  282. ;*
  283. ;*           This mainline routine checks all high level errors before
  284. ;*           control is transfer to the worker routine.
  285. ;*           On entry to each worker routine, the following registers
  286. ;*           are setup:
  287. ;*
  288. ;* INPUT     =   DS:SI -> Parameter block buffer
  289. ;*               ES:DI -> Mode data structure in the environment buffer
  290. ;*               SS:BP -> Parameter stack frame
  291. ;*
  292. ;*               All registers are preserved
  293. ;*
  294. ;* OUTPUT        = NONE
  295. ;*
  296. ;* RETURN-NORMAL = NONE
  297. ;* RETURN-ERROR  = NONE
  298. ;*
  299. ;****************************************************************************/
  300.  
  301. BUFFERUPDATE PROC FAR
  302.  
  303.  
  304.         sub     sp, bottomdest-PVB_Sel+2; Allocate storage for: PVB selector @P1
  305.                                         ;                       Scroll parms
  306.         push    bp                      ; Save caller's BP
  307.         mov     bp, sp                  ; Establish parameter addressability
  308.         pusha                           ; Save all registers
  309.         push    ds                      ; 
  310.         push    es                      ; 
  311.         les     di, [bp].EnvBufParm     ; ES:DI -> environment buffer
  312.  
  313. IFDEF D1348
  314.                                         ;/prepare the 2nd LVB for DBCS flag
  315.         mov     ax,es:[di].env_lvbsize
  316.         mov     [bp].j_lvbsize,ax
  317.         mov     ax,es:[di].env_funcindx
  318.         mov     [bp].j_funcindx,ax
  319.         mov     [bp].j_dbcsstatus,0     ; clear bisecting flag
  320.  
  321.         mov     ax,es:[di].viops_CellByteSize
  322.         mov     [bp].cellsize,ax
  323.  
  324.         mov     ax,word ptr es:[di].viops_lpNLSExt   ; get the pointer to nls exteded env.
  325.         mov     word ptr [bp].lpNLSExt,ax
  326.         mov     ax,word ptr es:[di+2].viops_lpNLSExt
  327.         mov     word ptr [bp+2].lpNLSExt,ax
  328.  
  329.         mov     [bp].flgDBCS,0          ;/set dbcs flag
  330.                                         ; 0         : there is no dbcs.
  331.                                         ; otherwize : one or more dbcs exist(s).
  332.         .if     <<es:[di].env_DBCSEvBuff>  ne 0> or
  333.             or      [bp].flgDBCS,defaultDBCS
  334.         .if     <<es:[di].env_DBCSEvBuff1> ne 0> or
  335.         .if     <<es:[di].env_DBCSEvBuff2> ne 0> or
  336.         .if     <<es:[di].env_DBCSEvBuff3> ne 0>
  337.             or      [bp].flgDBCS,AvioDBCS
  338.         .endif
  339. ENDIF ;D1348
  340.  
  341.         push    WDHGSEG                                                 ;@T52
  342.         pop     ds                      ; @S23
  343.         lds     bx,ds:bvh_instance      ;                               ;@T52
  344.         mov     [bx].wdhi_pssel,es      ; @S23 Save PS selector in instance data
  345.  
  346.         add     di, env_mdlen           ; ES:DI -> mode data structure
  347.         mov     ax, ERROR_VIO_MODE      ; Preset invalid mode error
  348.  
  349.         lds     si, [bp].ParmBuf        ; DS:SI -> parameter buffer
  350. IFDEF D1348
  351.         mov     ax,[si].Flags
  352.         mov     [bp].shadow_Flags,ax
  353. ENDIF ;D1348
  354.         mov     ax, ERROR_VIO_INVALID_LENGTH ; Preset error code
  355.         .if     <[si].ParmLength ae LogicalBufSel+2> NEAR  ; Valid parm length? @P1
  356.             mov     ax, ERROR_VIO_INVALID_PARMS ; Preset error code
  357.             test    [si].Flags, RESERVED_FLAGS ; 
  358.             .if     <z>                         AND ; Valid reserved flags?
  359.             .if     <[bp].FuncNumHi e 0>        AND ; Correct function #?
  360.             .if     <[bp].FuncNumLo e FUNC_NUM> AND ; 
  361.             .if     <[si].FuncIndex be MAX_INDEX> ; Invalid index?
  362.  
  363.                 sub     ax, ax          ; Clear return code
  364.                 push    ds
  365.                 push    si
  366.                 push    es
  367.                 push    di
  368.  
  369.                 cld
  370.                 mov     bx, [si].FuncIndex
  371.                 shl     bx, 1           ; Word align jump table
  372.                 call    cs:DispTbl[bx]  ; Dispatch to handler
  373.  
  374. ;/*
  375. ;**   Start of window specific code
  376. ;*/
  377.  
  378.                 pop     di
  379.                 pop     es
  380.                 pop     si
  381.                 pop     ds
  382.  
  383.                 .if     <zero ax>
  384.                     mov     dx,[si].vp_index ;Get the subroutine index
  385.                     sub     bx,bx
  386.  
  387.                     .if     <dl ae sx_ScrollUp> and
  388.                     .if     <dl be sx_WriteNCell> ;Update window
  389.                         Call    SecureSema4
  390.  
  391. IFDEF D1348 ;DBCS BufferUpdate (bisecting DBCS character status)
  392.                         mov     ax,[bp].j_dbcsstatus
  393.                         mov     es:[bx].env_dbcsstatus,ax
  394. ENDIF ;D1348
  395.  
  396.                         .if     <dl ae sx_WriteCellStr> ;Writing
  397.                             .if     <dl e sx_WriteCellStr> ;Writing     ;@B55
  398.                                mov     ax,[si].vp_repeatlength          ;@B55
  399.                                shr     ax,1                             ;@B55
  400.                                mov     [si].vp_repeatlength,ax          ;@B55
  401.                             .endif                                      ;@B55
  402.                             Call    CharStr
  403.                         .else           ;Scrolling
  404.                             Call    WinScroll
  405.                         .endif
  406.  
  407.                         Call    ReleaseSema4
  408.                         sub     ax,ax
  409.                     .endif
  410.                 .endif
  411.  
  412. ;/*
  413. ;**  End of window specific code
  414. ;*/
  415.  
  416.             .endif
  417.         .endif
  418.  
  419.         mov     [bp-2], ax
  420.         pop     es
  421.         pop     ds
  422.         popa
  423.         pop     bp
  424.         add     sp, bottomdest          ; Deallocate local storage
  425.  
  426.         ret     12
  427.  
  428. BUFFERUPDATE ENDP
  429.  
  430. ;/****************************************************************************
  431. ;*
  432. ;* FUNCTION NAME = DummyLVBToPVB
  433. ;*
  434. ;* DESCRIPTION   =
  435. ;*
  436. ;*      DummyLVBToPVB replaces the function LVBToPVB.  The LVBToPVB copies
  437. ;*      a rectangle from the LVB onto the PVB.  Since the LVB == PVB for
  438. ;*      the windowed VDH, this function is a NOP.
  439. ;*
  440. ;* INPUT         = NONE
  441. ;* OUTPUT        = NONE
  442. ;*
  443. ;* RETURN-NORMAL = AX = 0
  444. ;* RETURN-ERROR  = NONE
  445. ;*
  446. ;****************************************************************************/
  447.  
  448.                 PUBLIC  DummyLVBToPVB                           ;@P1 begin
  449. DummyLVBToPVB   PROC                                            ; 
  450.                                                                 ; 
  451.         xor     ax,ax                   ; return good error code;
  452.         ret                                                     ; 
  453.                                                                 ; 
  454. DummyLVBToPVB   ENDP                                            ;@P1 end
  455.  
  456.  
  457. ;/****************************************************************************
  458. ;*
  459. ;* FUNCTION NAME = SetGenParms
  460. ;*
  461. ;* DESCRIPTION   = Set general parameters used by all buffer update functions
  462. ;*
  463. ;*      SetGenParms sets up basic information relating to LVB substitution.
  464. ;*      The routine sets up the boundaries for the write based on whether
  465. ;*      the LVB has been superceeded by passed parameters.
  466. ;*
  467. ;* INPUT         = SS:BP - local data storage area
  468. ;*                 DS:SI - user passed parameter block
  469. ;*                 ES:DI - mode data structure
  470. ;*
  471. ;* OUTPUT       AX - index of right most row in LVB
  472. ;*              CX - index of bottom most column in LVB
  473. ;*              [bp].minrow - index of top most row in LVB (PVB coordinates)
  474. ;*              [bp].mincol - index of left most col in LVB (PVB coordinates)
  475. ;*              [bp].maxrow - index of bottom most row in LVB (PVB coordinates)
  476. ;*              [bp].maxcol - index of right most col in LVB (PVB coordinates)
  477. ;*              [bp].lvb_width - width of the LVB in cells
  478. ;*              [bp].lvb_height - height of the LVB in cells
  479. ;*
  480. ;*      CALLS   none
  481. ;*
  482. ;*      USES    AX,CX,DX,FLAGS
  483. ;*
  484. ;*      NOTES
  485. ;*
  486. ;*  PSEUDOCODE
  487. ;*
  488. ;*      PVB_SEL = 0
  489. ;*      LVB_SEL = parmLVB
  490. ;*      cellsize = VioPSCellByteSize
  491. ;*
  492. ;*      if (parmlength >= LVBHeight)
  493. ;*          mincol = parmLVBColOff
  494. ;*          maxcol = parmLVBWidth + mincol
  495. ;*          minrow = parmLVBRowOff
  496. ;*          maxrow = parmLVBHeight + minrow
  497. ;*          lvb_width = parmLVBWidth
  498. ;*          lvb_height = parmLVBHeight
  499. ;*          if (parmlength >= LVBAttrCount)
  500. ;*              if (parmAttrCount == 3)
  501. ;*                  cellsize = 4
  502. ;*              else
  503. ;*                  cellsize = 2
  504. ;*      else
  505. ;*          mincol = 0
  506. ;*          maxcol = modeCols - 1
  507. ;*          minrow = 0
  508. ;*          maxrow = modeRows - 1
  509. ;*          lvb_width = modeCols
  510. ;*          lvb_height = modeRows
  511. ;*          cellsize = modeattrcnt + 1
  512. ;*
  513. ;* RETURN-NORMAL = AX = 0
  514. ;* RETURN-ERROR  = NONE
  515. ;*
  516. ;****************************************************************************/
  517.  
  518.                 PUBLIC  SetGenParms                             ;@P1 begin
  519. SetGenParms     PROC
  520.  
  521.         mov     [bp].PVB_Sel,0          ; do not use PVB selector
  522.         mov     ax, [si].LogicalBufSel  ; use LVB selector
  523.         mov     [bp].LVB_Sel,ax         ; save the LVB selector
  524.  
  525.         mov     ax,es:viops_CellByteSize
  526.         mov     [bp].cellsize,ax
  527.  
  528.         cmp     ds:[si].ParmLength,LVBFormatID  ; Did the caller specify LVB info?
  529.         .if     <ae>                        ;   Yes, use callers information
  530.             mov     cx,ds:[si].LVBColOff    ; (cx) = left most column
  531.             mov     [bp].mincol,cx          ; store left most column
  532.             mov     dx,ds:[si].LVBWidth     ; (dx) = number of columns
  533.             mov     [bp].lvb_width,dx       ; store number of columns
  534.             add     cx,dx                   ; (cx) = right most column + 1
  535.             dec     cx                      ; (cx) = right most column
  536.             mov     [bp].maxcol,cx          ; store right most column
  537.             mov     ax,ds:[si].LVBRowOff    ; (ax) = top most row
  538.             mov     [bp].minrow,ax          ; store top most row
  539.             mov     dx,ds:[si].LVBHeight    ; (dx) = number of rows
  540.             mov     [bp].lvb_height,dx      ; store number of rows
  541.             add     ax,dx                   ; (ax) = bottom most row + 1
  542.             dec     ax                      ; (ax) = bottom most row
  543.             mov     [bp].maxrow,ax          ; store bottom most row
  544.             cmp     ds:[si].ParmLength,LVBAttrCount + 1 ; Is the parm present?
  545.             .if     <ae> and near           ;   Yes, attribute count is included
  546.             cmp     word ptr ds:[si].LVBFormatID,WorldFMTATTR   ; Special format?
  547. IFDEF D1348 ;support format ID 00h, attr count 3. (un-necessary ?)
  548.             .if     <e> or near             ;   Yes, use three byte attributes
  549.             cmp     word ptr ds:[si].LVBFormatID,ExtPSFMTATTR
  550. ENDIF ;D1348
  551.             .if     <e> near                ;   Yes, use three byte attributes
  552.                 mov     [bp].cellsize,WorldCellSize
  553.             .else
  554.                 mov     [bp].cellsize,DefaultCellSize
  555.             .endif
  556.         .else                               ; Use default screen group information
  557.             mov     [bp].mincol,0           ; store left most column
  558.             mov     cx,es:[di].TextCols     ; (ax) = number of columns
  559.             mov     [bp].lvb_width,cx       ; store number of columns
  560.             dec     cx                      ; (ax) = right most column
  561.             mov     [bp].maxcol,cx          ; store right most column
  562.             mov     [bp].minrow,0           ; store top most row
  563.             mov     ax,es:[di].TextRows     ; (ax) = number of rows
  564.             mov     [bp].lvb_height,ax      ; store number of rows
  565.             dec     ax                      ; (ax) = bottom most row
  566.             mov     [bp].maxrow,ax          ; store bottom most row
  567.             cmp     [bp].cellsize,ExtAttrib ; clear carry if extended attr @C19
  568.         .endif
  569.  
  570.         ret
  571.  
  572. SetGenParms     ENDP                                            ;@P1 end
  573.  
  574. R2CSEG  ENDS
  575.         END
  576.  
  577.