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

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  4. ;
  5. ;    The following IBM OS/2 WARP source code is provided to you solely for
  6. ;    the purpose of assisting you in your development of OS/2 WARP device
  7. ;    drivers. You may use this code in accordance with the IBM License
  8. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  9. ;    Copyright statement may not be removed.;
  10. ;*****************************************************************************/
  11.         PAGE    ,132
  12.         NAME    VVVTEXTA
  13.         TITLE   Virtual Video Vtext Support
  14.  
  15. ;/*****************************************************************************
  16. ;*
  17. ;* SOURCE FILE NAME = VVVTEXTA.ASM
  18. ;*
  19. ;* DESCRIPTIVE NAME = Virtual Video Device Vtext Support
  20. ;*
  21. ;*
  22. ;* VERSION      V2.0
  23. ;*
  24. ;* DATE         03/10/93
  25. ;*
  26. ;* DESCRIPTION  This module contains the VVD's Vtext support routines.
  27. ;*
  28. ;* FUNCTIONS
  29. ;*
  30. ;* NOTES        NONE
  31. ;*
  32. ;* STRUCTURES   NONE
  33. ;*
  34. ;* EXTERNAL REFERENCES
  35. ;*
  36. ;*              NONE
  37. ;*
  38. ;* EXTERNAL FUNCTIONS
  39. ;*
  40. ;*              NONE
  41. ;*
  42. ;* CHANGE ACTIVITY =
  43. ;*   DATE      FLAG        APAR   CHANGE DESCRIPTION
  44. ;*   --------  ----------  -----  --------------------------------------
  45. ;*   mm/dd/yy  @Vr.mpppxx  xxxxx  xxxxxxx
  46. ;*
  47. ;*   03/10/93                     Created.
  48. ;*
  49. ;*****************************************************************************/
  50.  
  51.         .xlist
  52.         include mvdm.inc
  53.         include vddseg.inc
  54.         include struc30.inc
  55.         .list
  56.         include vvd.inc
  57.         include vvdp.inc
  58.  
  59.  
  60.         DefCode     IMPORT,SWAP,PASCAL
  61.         DefFn       vvAddEvent
  62.         DefFn       mapc
  63.         DefFn       IsKanjiGale
  64.         EndCode
  65.  
  66.  
  67.         DefCode     EXPORT,SWAP,PASCAL
  68.  
  69. IFDEF   VTEXT
  70.  
  71.         DefFn       vvUpdateCursorDataVtext
  72.         DefFn       vvCopyLVBToLVBVtext
  73.  
  74. ;***LP  vvUpdateCursorDataVtext() - Return current cursor data for Vtext
  75. ;
  76. ;   Returns current row, column, start and end scan lines, and
  77. ;   current visibility for cursor.
  78. ;
  79. ;   ENTRY
  80. ;       hvdm -> VDM
  81. ;   EXIT
  82. ;       None
  83. ;   USES
  84. ;       All but EBX, ESI, EDI, EBP, DS and ES
  85. ;
  86. ;   CONTEXT
  87. ;       Task-time
  88. ;
  89. ;   PSEUDO-CODE                                     REFERENCES
  90. ;
  91.         align   4
  92. Procedure vvUpdateCursorDataVtext
  93.         ArgVar  hvdm,HVDM
  94.  
  95.         EnterProc
  96.         push    ebx
  97.         push    edx
  98.         push    edi
  99.  
  100.         mov     ebx, [hvdm]
  101.         lea     edi, VDMData.vvCursor[ebx]
  102.         mov     dx, VDMBase.rb_nVCharHeight[ebx]
  103.  
  104.         mov     cx, VDMBase.rb_wVCursorMode[ebx]
  105.         mov     al, dl
  106.         call    mapc
  107.         .if     <ch ae dl> or                   ; hidden cursor
  108.         .if     <ch a cl>                       ; or invalid type
  109.             mov     [edi].vvc_fVisible, FALSE
  110.         .else
  111.             mov     [edi].vvc_fVisible, TRUE
  112.         .endif
  113.         .if     <cl ae dl>                      ; too large cursor
  114.             mov     cl, dl
  115.             dec     cl
  116.         .endif
  117.         movzx   eax, cl
  118.         mov     [edi].vvc_ulScanEnd, eax
  119.         movzx   eax, ch
  120.         mov     [edi].vvc_ulScanStart, eax
  121.         movzx   eax, byte ptr VDMBase.rb_awVCursorPos[ebx]
  122.         mov     [edi].vvc_col, eax
  123.         movzx   eax, byte ptr VDMBase.rb_awVCursorPos[ebx+1]
  124.         mov     [edi].vvc_row, eax
  125.  
  126.         CallFn  vvAddEvent, <ebx, VVDEVENT_CURSOR, edi, 0>
  127.  
  128.         pop     edi
  129.         pop     edx
  130.         pop     ebx
  131.         ExitProc
  132. EndProc   vvUpdateCursorDataVtext
  133.  
  134. ;***LP  vvCopyLVBToLVBVText() - Copy rectangle of LVB to specfied LVB
  135. ;
  136. ;   WARNING: This only supports text mode!
  137. ;
  138. ;   ENTRY
  139. ;       hvdm  -> VDM
  140. ;       prcl  -> rectangle description
  141. ;       pBuff -> destination LVB buffer
  142. ;   EXIT
  143. ;       None
  144. ;   USES
  145. ;       32-bit small-model PASCAL calling/register conventions
  146. ;   CONTEXT
  147. ;       Task-time
  148. ;
  149.         align   4
  150. Procedure vvCopyLVBToLVBVtext
  151.         ArgVar  hvdm,HVDM
  152.         ArgVar  prcl,PRECTL
  153.         ArgVar  pBuff,PVOID
  154. IFDEF   XVIO
  155.         ArgVar  fFrom,BOOL
  156. ENDIF   ;XVIO
  157.  
  158.         LocalVar    Rows,      DWORD
  159.         LocalVar    Cols,      DWORD
  160.         LocalVar    SkipCount, DWORD
  161.         LocalVar    KanjiFlag, BYTE
  162.  
  163.         EnterProc
  164.         push    ebx
  165.         push    esi
  166.         push    edi
  167.  
  168.         mov     ebx, [hvdm]
  169.         mov     esi, VDMData.GaleData.pVtextLVB[ebx]
  170.         .if     <esi eq 0>
  171.             jmp     LVBToLVBVTextExit
  172.         .endif
  173.         add     esi, ebx                        ; source LVB addr
  174.         mov     edi, [pBuff]                    ; target buffer
  175.  
  176.         mov     edx, [prcl]                     ; get rect ptr
  177.  
  178.         mov     eax, [edx].xRight
  179.         sub     eax, [edx].xLeft
  180.         inc     eax
  181.         mov     [Cols], eax                     ; copy cols count
  182.         jz      LVBToLVBVTextExit
  183.  
  184.         mov     eax, [edx].yBottom
  185.         sub     eax, [edx].yTop
  186.         inc     eax
  187.         mov     [Rows], eax                     ; copy rows count
  188.         jz      LVBToLVBVTextExit
  189.  
  190.         mov     eax, VDMData.vvMode.vvm_nCols[ebx]
  191.         sub     eax, [Cols]
  192.         shl     eax, 1
  193.         mov     [SkipCount], eax                ; line skip byte count
  194.  
  195.         mov     eax, VDMData.vvMode.vvm_nCols[ebx]
  196.         imul    eax, [edx].yTop
  197.         add     eax, [edx].xLeft
  198.         shl     eax, 1                          ; top offset
  199.  
  200.         mov     ecx, VDMData.ulBIOSMode[ebx]    ; get video mode
  201.         .if     <cl eq 03h> or                  ; CGA format ?
  202.         .if     <cl eq 70h>                     ; 
  203.  
  204.             add     esi, eax                    ; skip ptrs to top
  205.             add     edi, eax
  206.  
  207. LVBToLVBVtextLoop1:
  208.             mov     ecx, [Cols]                 ; copy one row
  209.             rep movsw
  210.  
  211.             add     esi, [SkipCount]            ; skip to next row
  212.             add     edi, [SkipCount]
  213.             dec     [Rows]
  214.             jnz     LVBToLVBVtextLoop1
  215.  
  216.         .elseif <cl eq 73h> or                  ; Common format ?
  217.         .if     <cl eq 71h>                     ; 
  218.             shl     eax, 1                      ; adjust bytes/cell
  219.             shl     [SkipCount], 1
  220.  
  221.             add     esi, eax                    ; skip ptrs to top
  222.             add     edi, eax
  223.  
  224. LVBToLVBVtextLoop2:
  225.             mov     ecx, [Cols]                 ; copy one row
  226.             mov     KanjiFlag, 0                ; clear kanji flag
  227.  
  228. LVBToLVBVtextLoop3:
  229.             lodsd
  230.             and     eax, 008cffffh              ; clear reserved attribute
  231.             .if     <KanjiFlag eq 0>            ; Not DBCS 2nd ?
  232.                 call    IsKanjiGale
  233.                 .if     <c>                     ; DBCS 1st ?
  234.                     mov     KanjiFlag, 1
  235.                     or      eax, 01000000h
  236.                 .endif
  237.             .else                               ; DBCS 2nd
  238.                 or      eax, 81000000h
  239.                 mov     KanjiFlag, 0
  240.             .endif
  241.             stosd
  242.             loop    LVBToLVBVtextLoop3
  243.  
  244.             add     esi, [SkipCount]            ; skip to next row
  245.             add     edi, [SkipCount]
  246.             dec     [Rows]
  247.             jnz     LVBToLVBVtextLoop2
  248.         .endif
  249.  
  250. LVBToLVBVTextExit:
  251.         pop     edi
  252.         pop     esi
  253.         pop     ebx
  254.         ExitProc
  255. EndProc   vvCopyLVBToLVBVtext
  256.  
  257. ENDIF   ;VTEXT
  258.  
  259.         EndCode     EXPORT,SWAP,PASCAL
  260.  
  261.  
  262.         END
  263.