home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / VDH / WDHMODE.ASM < prev    next >
Assembly Source File  |  1995-04-14  |  26KB  |  602 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   WDHMODE.Asm -- Windowable Device Handler Mode Routines
  14.  
  15. ;/*****************************************************************************
  16. ;*
  17. ;* SOURCE FILE NAME = WDHMODE.Asm
  18. ;*
  19. ;* DESCRIPTIVE NAME = Windowable Device Handler Mode Routines
  20. ;*
  21. ;*
  22. ;* VERSION      V2.0
  23. ;*
  24. ;* DATE
  25. ;*
  26. ;* DESCRIPTION  BVS Device Handler for Windowable Sessions
  27. ;*              This module contains the equivalent of the OS/2 1.1
  28. ;*              hooks for Windowable and Advanced VIO.
  29. ;*
  30. ;* FUNCTIONS    GetMode, SetMode, ClearLVB
  31. ;*
  32. ;* NOTES        NONE
  33. ;*
  34. ;* STRUCTURES   NONE
  35. ;*
  36. ;* EXTERNAL REFERENCES  NONE
  37. ;*
  38. ;* EXTERNAL FUNCTIONS
  39. ;*
  40. ;*              NONE
  41. ;*
  42. ;* CHANGE ACTIVIY =
  43. ;*   DATE      FLAG       APAR    CHANGE DESCRIPTION
  44. ;*   --------  ---------- -----   --------------------------------------
  45. ;*   mm/dd/yy  @Vr.mpppxx xxxxx   xxxxxxx
  46. ;*   12/02/88  @T1        P2944   TPL, Grow LVB as neccessary,
  47. ;*   02/16/89  @T16       HZ00014 TPL, Disallowed Get/Set mode in AVIO session,
  48. ;*   03/06/89  @@S1       B700065 STJ, Refresh the cursor after SetMode,
  49. ;*   03/06/89  @@S2       B700413 STJ, Disallow Color Burst with Mono Modes,
  50. ;*   03/15/89  @C11       B700599 CJJ, Allow size of 4 and 5 for SetMode,
  51. ;*   03/25/89  @P1        D132    TPL, DCR 132 changes
  52. ;*   04/04/89  @C14       B700906 CJJ, Zero out AX after being used as temp
  53. ;*                                storage
  54. ;*   05/18/89  @C22       HZ00183 CJJ, Update scrollable region in UpdateMode,
  55. ;*   08/09/89  @B22       B706089 WKB, Check number of rows for validity,
  56. ;*   08/18/89  @S25       B706860 STJ, Use 1.0 length as default for GetXXXX
  57. ;*                                calls,
  58. ;*   11/02/89  @D549      D549    CJJ, Seltable changes due to rangeless
  59. ;*                                sessions
  60. ;*   01/22/90  @T52       D704    TPL, DCR 704 work
  61. ;*   07/06/90  @T71       B714347 TPL, Allow Shell to make AVIO calls, Hursley
  62. ;*                                DCR 25177,
  63. ;*   04/11/91             D1348   NAKADA, Enable DBCS support in Vio-Window,
  64. ;*   02/06/92  @T80               TPL, Don't use the reserved register FS
  65. ;*   11/10/93  @JLO1      D75613  Pj10886. Prevent overwrite of dev_name when
  66. ;*                                multiple threads write to Getsysmode area
  67. ;*   08/10/94  @92702             WKB, Allow modes other than 80 columns
  68. ;*   08/26/94  @94870             WKB, Check number of cols for validity
  69. ;*   09/14/94  @95837             WKB, pmwinp.inc -> pmwinx.inc
  70. ;*****************************************************************************/
  71.  
  72.         .xlist
  73.         include pmwinx.inc              ;@95837
  74.         include pmaviop.inc
  75.         include wdhequ.inc              ;Windowable Device Handler Equates
  76.         include wdhgdata.inc            ;BVH global data externals      ;@T52
  77.         include bvscb.inc               ;BVS Control Blocks
  78.         include bvsparms.inc            ;BVS Parameter Equates
  79.         include error2.inc              ;OS/2 Subsystem Error Codes
  80.         include infoseg.inc             ;System Information Segments
  81.         include struc.inc               ;Structured Macros
  82.         include error.inc               ;OS/2 Kernel Error Codes
  83.         .list
  84.  
  85.         .386p                   ;@D549
  86.  
  87.         extrn   DOSREALLOCSEG:FAR       ;Realloc AVIO LVB               ;@T1
  88.         extrn   DOSREALLOCHUGE:FAR      ;Realloc VIO windowable         ;@T1
  89.  
  90.         extrn   SecureSema4:NEAR
  91.         extrn   ReleaseSema4:NEAR
  92.  
  93.         extrn   RegSave:NEAR
  94.         extrn   RegRest:NEAR
  95.         extrn   UpdateMode:NEAR
  96.         extrn   CheckAvio:NEAR          ;@T16
  97.  
  98.         extrn   bvh_instance:DWORD                                      ;@T52
  99.         extrn   GREENTRY4:FAR                                           ;@T52
  100.         extrn   GREENTRY6:FAR                                           ;@T52
  101.         extrn   WINSYNCWITHPS:FAR                                       ;@T52
  102.  
  103. WDHGSEG SEGMENT PARA PUBLIC 'DATA' USE16        ;@D549
  104. WDHGSEG ENDS
  105.  
  106. R2CSEG  SEGMENT BYTE PUBLIC 'CODE' USE16        ;@D549
  107.         ASSUME  CS:R2CSEG
  108.  
  109. ;/****************************************************************************
  110. ;*
  111. ;*  SUBROUTINE NAME: GetMode
  112. ;*
  113. ;*  DESCRIPTIVE NAME: Get current video mode setting
  114. ;*
  115. ;*  FUNCTION: GetMode is called by BVS to get the current mode setting.
  116. ;*            If the request specifies hardware and the hardware is
  117. ;*            readable, the actual hardware setting will be read and
  118. ;*            returned.  Otherwise the returned information will be
  119. ;*            taken from the environment buffer, if it has been passed.
  120. ;*
  121. ;*  ENTRY POINT: GetMode
  122. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 271 )
  123. ;*
  124. ;*  INPUT: (Passed on stack)
  125. ;*             FAR *Environment ( Environment buffer for the session )
  126. ;*             FAR *ParmBlock
  127. ;*                     USHORT Length = length of this packet
  128. ;*                     USHORT Flags  = 0 - Environment buffer only
  129. ;*                                     1 - Hardware also
  130. ;*                     VIOMODEINFO FAR *ModeDataPTR
  131. ;*             ULONG Function ( Call vector table entry = 271 )
  132. ;*         (Referenced)
  133. ;*             Modes[] (global data - table of supported video modes )
  134. ;*
  135. ;*  EXIT-NORMAL: AX = 0
  136. ;*               Current mode setting is returned
  137. ;*
  138. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS
  139. ;*
  140. ;*  EFFECTS: If hardware specified and hardware is readable, the
  141. ;*           environment buffer is updated, if passed.
  142. ;*
  143. ;*  INTERNAL REFERENCES:
  144. ;*    ROUTINES: NONE
  145. ;*
  146. ;*  EXTERNAL REFERENCES:
  147. ;*    ROUTINES: NONE
  148. ;*
  149. ;****************************************************************************/
  150.  
  151. GetMode PROC    FAR
  152.         public  GetMode
  153.         Call    RegSave
  154.  
  155.         mov     ax,ERROR_VIO_INVALID_LENGTH
  156. ;@JLO1  .if     <[si].vp_parmlength eq 8> and
  157.         .if     <[si].vp_parmlength eq 8>                               ;@JLO1
  158.         Call    SecureSema4                                             ;@JLO1
  159.         les     di,dword ptr [si].vp_offset ;Get address of mode data
  160.         lds     si,dword ptr [bp].stk_envblock ;Get environment block
  161.         add     si,env_mdlen            ;Get offset of mode data
  162.         mov     cx,es:[di].mode_datalen ;Get length of mode data
  163.         .if     <cx a 1>
  164. ;@JLO1      Call    SecureSema4
  165.  
  166.             mov     ax,cx
  167.             .if     <al a <size modedata>> ;@S25
  168.                 mov     al,mode_attrformat ;@S25
  169.             .endif                      ;@S25
  170.  
  171.             push    di
  172.             sub     al,size mode_datalen
  173.             .if     <ns>
  174.                 movsw
  175.             .endif
  176.  
  177.             sub     al,size mode_type
  178.             .if     <ns>
  179.                 movsb
  180.             .endif
  181.  
  182.             sub     al,size mode_colors
  183.             .if     <ns>
  184.                 movsb
  185.             .endif
  186.  
  187.             sub     al,size mode_cols
  188.             .if     <ns>
  189.                 movsw
  190.             .endif
  191.  
  192.             sub     al,size mode_rows
  193.             .if     <ns>
  194.                 movsw
  195.             .endif
  196.  
  197.             sub     al,size mode_gcols
  198.             .if     <ns>
  199.                 movsw
  200.             .endif
  201.  
  202.             sub     al,size mode_grows
  203.             .if     <ns>
  204.                 movsw
  205.             .endif
  206.  
  207.             sub     al,size mode_attrformat
  208.             .if     <ns>
  209.                 movsb
  210.             .endif
  211.  
  212.             sub     al,size mode_attrbytes
  213.             .if     <ns>
  214.                 movsb
  215.             .endif
  216.  
  217.             sub     al,size mode_bufaddr
  218.             .if     <ns>
  219.                 movsd                                                   ;@T71
  220.             .endif
  221.  
  222.             sub     al,size mode_bufsize
  223.             .if     <ns>
  224.                 movsd                                                   ;@T71
  225.             .endif
  226.  
  227.             sub     al,size mode_fullbufsz
  228.             .if     <ns>
  229.                 movsd                                                   ;@T71
  230.             .endif
  231.  
  232.             sub     al,size mode_partbufsz
  233.             .if     <ns>
  234.                 movsd                                                   ;@T71
  235.             .endif
  236.  
  237.             sub     al,size mode_extdata
  238.             .if     <ns>
  239.                 movsd                                                   ;@T71
  240.             .endif
  241.  
  242.             mov     ax,di
  243.             pop     di
  244.             sub     ax,di
  245.             .if     <al a 2>            ;More than just a length request
  246.                 stosw                   ;Update length in Mode data
  247.             .endif
  248.  
  249. ;@JLO       Call    ReleaseSema4
  250.             sub     ax,ax               ;Set good return code
  251.         .endif
  252.  
  253.         Call    ReleaseSema4                                            ;@JLO
  254.         .endif                                                          ;@JLO
  255.         Call    RegRest
  256.         ret     12
  257. GetMode ENDP
  258.  
  259. ;/****************************************************************************
  260. ;*
  261. ;*  SUBROUTINE NAME: SetMode
  262. ;*
  263. ;*  DESCRIPTIVE NAME: Set video mode
  264. ;*
  265. ;*  FUNCTION: SetMode is called by BVS to set the video mode.
  266. ;*            If the request specifies hardware, the hardware and the
  267. ;*            environment buffer, if passed, will be updated.
  268. ;*            Otherwise just the environment buffer, if passed, will
  269. ;*            be updated.
  270. ;*
  271. ;*  ENTRY POINT: SetMode
  272. ;*    LINKAGE:   CALL FAR ( via BVS-DDI call vector table entry 272 )
  273. ;*
  274. ;*  INPUT: (Passed on stack)
  275. ;*             FAR *Environment ( Environment buffer for the session )
  276. ;*             FAR *ParmBlock
  277. ;*                     USHORT Length = length of this packet
  278. ;*                     USHORT Flags  = 0 - Environment buffer only
  279. ;*                                     1 - Hardware also
  280. ;*                     VIOMODEINFO FAR *ModeDataPTR
  281. ;*             ULONG Function ( Call vector table entry = 272 )
  282. ;*         (Referenced)
  283. ;*             Modes[] (global data - table of supported video modes )
  284. ;*
  285. ;*  EXIT-NORMAL: AX = 0
  286. ;*               Video mode is set
  287. ;*
  288. ;*  EXIT-ERROR: AX = ERROR_VIO_INVALID_PARMS
  289. ;*
  290. ;*  INTERNAL REFERENCES:
  291. ;*    ROUTINES: NONE
  292. ;*
  293. ;*  EXTERNAL REFERENCES:
  294. ;*    ROUTINES: NONE
  295. ;*
  296. ;****************************************************************************/
  297.  
  298. SetMode PROC    FAR
  299.         public  SetMode
  300.         Call    RegSave
  301.  
  302.         mov     ax,ERROR_VIO_EXTENDED_SG ;@T16
  303.         call    CheckAvio               ;@T16
  304.         .if     <z> near                ; Vio windowable session?       ;@T16
  305.             mov     ax,ERROR_VIO_INVALID_LENGTH
  306. ;@JLO1      .if     <[si].vp_parmlength eq 8> and near
  307.             .if     <[si].vp_parmlength eq 8> near                      ;@JLO1
  308.             Call    SecureSema4                                         ;@JLO1
  309.             lds     si,dword ptr [si].vp_offset ;Get address of mode data
  310.             mov     cx,[si].mode_datalen ;Get length of mode data
  311.             .if     <cl ae 3> and near
  312.             mov     ax,ERROR_VIO_MODE   ;Preset mode error
  313.             mov     dl,[si].mode_type
  314.             test    dl,NOT (mode_f_color + mode_f_uncolor)
  315.             .if     <z> and near        ;Mono/Color Text only (Type = 0/1)
  316.             mov     dh,dl               ;@@S2
  317.             and     dh,mode_f_color + mode_f_uncolor ;@@S2
  318.             .if     <dh ne mode_f_uncolor> and near ;No Color Burst w/Mono ;@@S2
  319.             .if     <cl eq 3> or        ;Only Type specified
  320.             and     dl,mode_f_color
  321.             shl     dl,2
  322.             .if     <dl eq [si].mode_colors> near ;Type/Colors = 1/4 or 0/0 ;@T1
  323.  
  324. IFDEF D1348
  325.                 .if     <cl ae <mode_attrformat+size mode_attrformat>>
  326.                     mov     al,[si].mode_attrformat
  327.                     .if     <cl ae <mode_attrbytes+size mode_attrbytes>> and
  328.                     mov     ah,[si].mode_attrbytes
  329.                     .if     <ax eq WorldFMTATTR>    and
  330.                     .if     <<[si].mode_cols> eq 0>
  331.                         mov     [si].mode_cols,80   ;set the default value
  332.                     .endif
  333.                     .if     <ax eq WorldFMTATTR>    and
  334.                     .if     <<[si].mode_rows> eq 0>
  335.                         mov     [si].mode_rows,25   ;set the default value
  336.                     .endif
  337.                 .endif
  338. ENDIF ;D1348
  339.                 mov     dx,25           ;Preset 25 rows
  340.                 .if     <cl b <mode_cols+size mode_cols>> or             ;@C11
  341.                 .if     <[si].mode_cols le 255> ;@92702
  342. ;@92702         .if     <[si].mode_cols eq 80> ;80-column modes only
  343.                     sub     ax,ax
  344.                     .if     <cl ae <mode_rows+size mode_rows>>
  345.                         mov     ax,[si].mode_rows
  346. ;@94870                 .if     <ax be 0>       ;Check rows<=0          ;@B22
  347.                         .if     <ax be 0> or    ;Check rows<=0          ;@94870
  348.                         .if     <[si].mode_cols le 0>                   ;@94870
  349.                             mov     ax,ERROR_VIO_MODE                   ;@B22
  350.                         .else
  351.                             mul     [si].mode_cols
  352.                             .if     <ax a 2000h> or
  353.                             .if     <nonzero dx>    ;Buffer too large
  354.                                 mov     ax,ERROR_VIO_MODE
  355.                             .else
  356.                                 sub     ax,ax
  357.                                 mov     dx,[si].mode_cols               ;@92702
  358.                                 mov     es:[viops_BufferColumnCount],dx ;@92702
  359.                                 mov     dx,[si].mode_rows
  360.                             .endif
  361.                         .endif                                          ;@B22
  362.                     .endif
  363.                 .endif
  364.  
  365. IFDEF D1348 ;set the format ID and attribute count
  366.                 .if     <zero ax> and
  367.                 mov     es:[viops_FormatID],DefaultFormat    ; initialize
  368.                 mov     es:[env_attrbytes],DefaultAttrCount  ; initialize
  369.                 .if     <cl ae <mode_attrformat+size mode_attrformat>>
  370.                                         ; check format ID and attribute count
  371.                     mov     ax,word ptr es:[env_attrformat]
  372.                     mov     al,[si].mode_attrformat
  373.                     .if     <cl ae <mode_attrbytes+size mode_attrbytes>>
  374.                         mov     ah,[si].mode_attrbytes
  375.                     .endif
  376.                     .if     <ax eq DefaultFMTATTR> or
  377.                     .if     <ax eq WorldFMTATTR>
  378.                         mov     es:[env_attrbytes],ah        ; update
  379.                         sub     ah,ah
  380.                         mov     es:[viops_FormatID],ax       ; update
  381.                         sub     ax,ax
  382.                     .else
  383.                         mov     ax,ERROR_VIO_MODE
  384.                     .endif
  385.                 .endif
  386. ENDIF ;D1348
  387.  
  388.                 .if     <zero ax>   near                                ;@T1
  389. ;@JLO1              Call    SecureSema4
  390.  
  391.                     push    dx          ;Save requested rows
  392.                     push    es          ;Save PS selector
  393.  
  394. IFDEF D1348 ;prepare the 2nd LVB for DBCS flag
  395.                     mov     ax,es:[viops_FormatID]
  396.                     .if     <al ne es:[env_attrformat]> ; change format ID
  397.                         .if     <al eq DefaultFormat>
  398.                             mov     es:[env_funcindx],DefaultFmtIndx
  399.  
  400.                             mov     es:[viops_CellByteSize],DefaultCellSize
  401.                         .else                           ; WorldFMTATTR
  402.                             mov     es:[env_funcindx],WorldFmtIndx
  403.  
  404.                             mov     es:[viops_CellByteSize],WorldCellSize
  405.                         .endif
  406.                         mov     es:[env_attrformat],al  ; update
  407.                         call    ClearLVB                ; clear current LVB
  408.                     .endif
  409. ENDIF ;D1348
  410.  
  411.                     mov     ax,es:[viops_BufferColumnCount]         ;@T1;@T52
  412.                     mul     dx          ;LVB size = row * col * cellsize;@T1
  413.                     mul     es:[viops_CellByteSize]                 ;@T1;@T52
  414. IFDEF D1348 ;save LVB size
  415.                     push    ax
  416.                     sub     ax,dx                       ; if 64KB, set 0FFFFh
  417.                     mov     es:[env_lvbsize],ax
  418.                     pop     ax
  419. ENDIF ;D1348
  420.                     cmp     dx,word ptr es:[bx].env_bufsize+2           ;@T1
  421.                     .if     < a >   or                                  ;@T1
  422.                     .if     < e > near  and                             ;@T1
  423.                     .if     <ax a <word ptr es:[env_bufsize]>> near ;@T1;@T52
  424.                         mov     di,WDHGSEG                              ;@T1
  425.                         mov     ds,di   ;Global data segment            ;@T1
  426.                         mov     cx,ax   ;Save size(low)                 ;@T1
  427.  
  428.                         push    dx                                      ;@T1
  429.                         push    ax                                      ;@T1
  430.                         push    es:[viops_Sel_LogicalVideoBuffer]   ;@T1;@T52
  431.                         call    DOSREALLOCHUGE                          ;@T1
  432.                         .if     <zero ax>   or                          ;@T1
  433.                         .if     <ax e ERROR_ACCESS_DENIED>              ;@T1
  434.                             mov     di,word ptr es:[env_bufsize]    ;@T1;@T52
  435.                             sub     cx,di                               ;@T1
  436. IFDEF D1348 ;update LVB clear to corresponding format ID
  437.                             .if     <es:[viops_CellByteSize] eq DefaultCellSize>
  438. ENDIF ;D1348
  439.                                 shr     cx,1                                ;@T1
  440.                                 mov     ax,0720H                            ;@T1
  441.                                 push    es                                  ;@T1
  442.                                 mov     es,es:[viops_Sel_LogicalVideoBuffer];@T1;@T52
  443.                                 cld                                         ;@T1
  444.                                 rep     stosw                               ;@T1
  445.                                 pop     es                                  ;@T1
  446. IFDEF D1348 ;update LVB clear to corresponding format ID
  447.                             .else                       ; WorldCellSize
  448.                                 shr     cx,2
  449.                                 mov     ax,0720h
  450.                                 mov     dx,0000h
  451.                                 push    es
  452.                                 mov     es,es:[viops_Sel_LogicalVideoBuffer]
  453.                                 cld
  454.                                 .repeat
  455.                                     stosw
  456.                                     mov     es:[di],dx
  457.                                     inc     di
  458.                                     inc     di
  459.                                 .loop
  460.                                 pop     es
  461.                             .endif
  462. ENDIF ;D1348
  463.                             sub     ax,ax                               ;@T1
  464.                         .endif                                          ;@T1
  465.                     .else                                               ;@T1
  466.                         sub     ax,ax                                   ;@T1
  467.                     .endif                                              ;@T1
  468.  
  469.                     .if     <zero ax> near                          ;@T1;@T52
  470.  
  471.                         push    WDHGSEG                                 ;@T52
  472.                         pop     ds                                      ;@T52
  473.                         lgs     si,ds:bvh_instance                      ;@T80
  474.  
  475.                         push    dword ptr es:[viops_hConsoleDisplayContext] ;@@E,@T71
  476.                         push    dword ptr 5     ;32-bit Index           ;@T71
  477.                         push    gs                                      ;@T80
  478.                         lea     ax,gs:[si].wdhi_Scratch                 ;@T80
  479.                         push    ax              ;32-bit Return Value    ;@T52
  480.                         push    dword ptr 1     ;32-bit number of items ;@T71
  481.                         push    dword ptr 0     ;32-bit "cookie" parm ;@T52,@T71
  482.                         push    dword ptr GreQueryDevCapsLo             ;@T71
  483.  
  484.                         call    GREENTRY6                               ;@T52
  485.  
  486.                         pop     es              ;Restore PS selector
  487.                         pop     dx              ;Restore requested number of rows
  488.                         sub     bx,bx
  489.                         .if     <ax ne 1>
  490.                             mov     ax,ERROR_VIO_MODE
  491.                         .else
  492.                             mov     es:[bx].viops_BufferRowCount,dx ;Update #rows
  493.                             Call    UpdateMode
  494.  
  495.                             push    es
  496.                             push    es:[bx].env_conhandle
  497.                             call    WINSYNCWITHPS                       ;@T52
  498.                             pop     es
  499.  
  500.                             sub     bx,bx ;@@S1
  501.                             mov     ax,es:[bx].viops_BufferRowCount ;Get # of rows ;@@S1
  502.                             dec     ax  ;Normalize to 0 base ;@@S1
  503.                             mov     es:[bx].viops_TextCursorRow,ax ;@@S1
  504.                             mov     es:[bx].viops_TextCursorColumn,bx ;@@S1
  505.  
  506.                             mov     ax,es:[bx].viops_CellImageHeight ;@@S1
  507.                             dec     ax  ;@@S1
  508.                             mov     es:[bx].viops_TextCursorEndLine,ax ;@@S1
  509.                             dec     ax  ;@@S1
  510.                             mov     es:[bx].viops_TextCursorStartLine,ax ;@@S1
  511.  
  512.                             push    es                                  ;@P1
  513.                             push    dword ptr es:[bx].viops_hConsoleDisplayContext ;DC handle ;@@S1,@T71
  514.                             push    es  ;@@S1
  515.                             push    bx  ;Ptr to VioPS ;@@S1
  516.                             push    dword ptr 0  ;"cookie" parm pt. 2 ;@@S1,@T71
  517.                             push    dword ptr GreUpdateCursorLo ;Engine function pt. 2 ;@@S1,@T71
  518.                             call    GREENTRY4 ;Refresh the cursor  ;@@S1;@T52
  519.                             pop     es                                  ;@P1
  520.  
  521.                             sub     ax,ax
  522.                         .endif
  523.                     .else                                               ;@T1
  524.                         pop     es                                      ;@T1
  525.                         pop     dx                                      ;@T1
  526.                     .endif                                              ;@T1
  527. ;@JLO1              Call    ReleaseSema4
  528.                 .endif
  529.             .endif                      ;@T16
  530.         .endif
  531.  
  532.         Call    ReleaseSema4                                            ;@JLO1
  533.         .endif                                                          ;@JLO1
  534.  
  535.         Call    RegRest
  536.         ret     12
  537. SetMode ENDP
  538.  
  539. IFDEF D1348
  540.  
  541. ;/****************************************************************************
  542. ;*
  543. ;* FUNCTION NAME = ClearLVB
  544. ;*
  545. ;* DESCRIPTION   =
  546. ;*
  547. ;* INPUT         =
  548. ;* OUTPUT        = NONE
  549. ;*
  550. ;* RETURN-NORMAL = NONE
  551. ;* RETURN-ERROR  = NONE
  552. ;*
  553. ;****************************************************************************/
  554.  
  555. ClearLVB proc   near
  556.          public ClearLVB
  557.  
  558.         push    ds
  559.         push    es
  560.         push    di
  561.         push    cx
  562.         push    dx
  563.  
  564.         mov     cx,word ptr es:[env_lvbsize]
  565.         mov     dl,es:[env_attrformat]
  566.         push    es
  567.         pop     ds
  568.         mov     es,es:[viops_Sel_LogicalVideoBuffer]    ; LVB selector
  569.         sub     di,di
  570.  
  571.         .if     <dl eq DefaultFormat>
  572.             shr     cx,1                                ; cell size
  573.             mov     ax,0720h                            ; attr and char
  574.             rep     stosw
  575.                                                         ; prepare the 2nd LVB
  576.                                                         ; for DBCS flag
  577.         .else                                           ; WorldFormat
  578.             shr     cx,2                                ; cell size
  579.             mov     ax,0720h                            ; attr1 and char
  580.             mov     dx,0000h                            ; attr3 and attr2
  581.             .repeat
  582.                 stosw
  583.                 mov     es:[di],dx
  584.                 inc     di
  585.                 inc     di
  586.             .loop
  587.         .endif
  588.  
  589.         pop     dx
  590.         pop     cx
  591.         pop     di
  592.         pop     es
  593.         pop     ds
  594.  
  595.         ret
  596. ClearLVB endp
  597. ENDIF ;D1348
  598.  
  599. R2CSEG  ENDS
  600.         END
  601.  
  602.