home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / PEN / PENTKT / PENBASE / VMC.ASM < prev   
Assembly Source File  |  1995-04-14  |  8KB  |  236 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. ;      /*****************************************************************/
  12. ;      /*                                                               */
  13. ;      /*                                                               */
  14. ;      /*****************************************************************/
  15. ;      /******************* START OF SPECIFICATIONS *********************/
  16. ;      /*                                                               */
  17. ;      /*  SOURCE FILE NAME: VMC.ASM                                    */
  18. ;      /*                                                               */
  19. ;      /*  DESCRIPTIVE NAME: Video change extents adjustments           */
  20. ;      /*                                                               */
  21. ;      /*                                                               */
  22. ;      /*  STATUS:  Version 1.0                                         */
  23. ;      /*                                                               */
  24. ;      /*  NOTES: This module provides routines to service changes      */
  25. ;      /*         in vido mode.                                         */
  26. ;      /*  ENTRY POINTS:                                                */
  27. ;      /*      See public statements                                    */
  28. ;      /*  EXTERNAL REFERENCES:                                         */
  29. ;      /*      See extrn statements                                     */
  30. ;      /*                                                               */
  31. ;      /******************* END  OF  SPECIFICATIONS *********************/
  32. .xlist
  33.   include pensegs.inc
  34.   include pen.inc
  35.   include penei.inc
  36.   include penidc.inc
  37.   include struc.inc
  38. .list
  39.  
  40. .286p
  41.  
  42. ;------------------------------------------------------------------------------
  43. ; external routines
  44. ;------------------------------------------------------------------------------
  45.  
  46. extrn Idc_UpdateCaps:near
  47. extrn skip_to_white :near
  48. extrn skip_white    :near
  49. extrn str_i_cmp     :near
  50.  
  51. ;------------------------------------------------------------------------------
  52. ; external data
  53. ;------------------------------------------------------------------------------
  54.  
  55.  
  56. ;------------------------------------------------------------------------------
  57. ; local data
  58. ;------------------------------------------------------------------------------
  59. DSEG segment
  60. public Vmc_PMYRes,Vmc_Type
  61.   Vmc_PMYRes     dw 01E0h   ; default Y pixel resolution for this device
  62.                             ; can be changed by device dependent routine
  63.   Vmc_Type db VMC_TYPE_NONE ; Type of video mode processing
  64.  
  65. DSEG ends
  66.  
  67. DSEGI segment
  68.   opt_ltypeC    db  'LTYPE=C',0
  69.   opt_ltypeT    db  'LTYPE=T',0
  70.   opt_ltypeN    db  'LTYPE=N',0
  71. DSEGI ends
  72.  
  73. CSEG SEGMENT
  74.      ASSUME    CS:CGROUP, SS:nothing, ES:nothing, DS:DGROUP
  75.  
  76. ;------------------------------------------------------------------------------
  77. ; process Vidie Mode changes. Call from IDC as result of notification by
  78. ; pen device driver services.
  79. ;    es:di = vinfo structure
  80. ;------------------------------------------------------------------------------
  81. Public Vmc_Change
  82. Vmc_Change     Proc  Near
  83.   .if  <Vmc_Type ne VMC_TYPE_NONE>
  84.      CALL_TYPE fixExtents,DT_LOCATOR  ;call fixExtents for all locator DCBs
  85.   .endif
  86.   xor  ax,ax
  87.   ret
  88.  
  89. ; do this for each locator device
  90. ; bx = DCB
  91. fixExtents:
  92.   .386p
  93.   push es
  94.   push di
  95.  
  96.   mov  eax, [bx].dcb_Ytrans.trn_ext_adj_calibrated
  97.   xor  edx,edx
  98.   mov  dx, es:[di].vinfo_GRow_res
  99.  
  100. ; for non-PM screen group video modes, scale the translation adjustments
  101. ; for the new screen dimensions
  102.  
  103.   .if  <dx ne Vmc_PMYRes>
  104.      imul edx                                 ; eax*edx = EDX:EAX
  105.      xor  ecx,ecx
  106.      mov  cx, Vmc_PMYRes
  107.      idiv ecx                                 ; edx:eax / ecx = EAX.EDX
  108.      .if  <nonzero edx>                       ; if remainder
  109.         inc  eax
  110.      .endif
  111.      mov  [bx].dcb_Ytrans.trn_ext_adj, eax    ; set up extents ratio
  112.      mov  [bx].dcb_Ytrans.trn_ext_max, eax    ; and use for maximum also
  113.  
  114.      .if  <Vmc_Type eq VMC_TYPE_CENTER>       ; need to modify the origin
  115.         mov edx, eax                          ; (don't mess up eax)
  116.         sub edx, [bx].dcb_Ytrans.trn_ext_adj_calibrated
  117.         sar edx, 1
  118.         add edx, [bx].dcb_Ytrans.trn_org_calibrated
  119.         mov [bx].dcb_Ytrans.trn_org_adj, edx
  120.      .endif
  121.  
  122. ; for PM screen group video modes, restore the PM calibrated values
  123.   .else
  124.      mov  [bx].dcb_Ytrans.trn_ext_adj, eax       ; restore PM extents ratio
  125.  
  126.      mov  eax,[bx].dcb_Ytrans.trn_org_calibrated ; and origin adjustment
  127.      mov  [bx].dcb_Ytrans.trn_org_adj, eax       ; (in case LTYPE=C changed it)
  128.  
  129.      mov  eax,[bx].dcb_Ytrans.trn_ext_max_PM     ; and maximum extent
  130.      mov  [bx].dcb_Ytrans.trn_ext_max, eax
  131.   .endif
  132.  
  133. ; need to update capabilities
  134. ; eax = maximum Y extent
  135.  
  136.   mov  si, [bx].dcb_@RegCaps
  137.   .if  <[si].lcap_dev_y_extent ne eax>       ; extents have changed
  138.      mov  [si].lcap_dev_y_extent,eax         ; update it and update caps
  139.      call Idc_UpdateCaps
  140.   .endif
  141.  
  142.   pop di
  143.   pop es
  144.   .286p
  145.   ret
  146.  
  147. Vmc_Change     EndP
  148.  
  149. ;------------------------------------------------------------------------------
  150. ; Interface to set the LCD type. Set the type based on how the LCD hardware
  151. ; behaves when in less than full video mode (squeeze to top, center)
  152. ; al = VMC_TYPE_xxx
  153. ;------------------------------------------------------------------------------
  154. Public Vmc_LcdType
  155. Vmc_LcdType proc
  156.   mov  Vmc_Type,al
  157.   ret
  158. Vmc_LcdType endp
  159.  
  160. ;------------------------------------------------------------------------------
  161. ; Interface to set the LCD Y (vertical) resolution in PM screen group.
  162. ; ax = resolution
  163. ;------------------------------------------------------------------------------
  164. Public Vmc_LcdPMRes
  165. Vmc_LcdPMRes proc
  166.   mov  Vmc_PMYRes,ax
  167.   ret
  168. Vmc_LcdPMRes endp
  169.  
  170. ;------------------------------------------------------------------------------
  171. ; Set style bit to receive video mode notification
  172. ; dx = style bits from READ_ENABLE
  173. ;------------------------------------------------------------------------------
  174. Public Vmc_ReadEnable
  175. Vmc_ReadEnable proc
  176.   .if  <Vmc_Type ne VMC_TYPE_NONE>
  177.      and  dx,NOT STYLE_NOTIFY_VMCHANGE
  178.   .endif
  179.   ret
  180. Vmc_ReadEnable endp
  181.  
  182. CSEG ends
  183.  
  184. CSEGI SEGMENT
  185.      ASSUME    CS:CGROUP, SS:nothing, ES:nothing, DS:DGROUP
  186.  
  187. ;------------------------------------------------------------------------------
  188. ; look for command line overrides for video type
  189. ;    es:di = config.sys line
  190. ;------------------------------------------------------------------------------
  191. CR equ 0Dh
  192. LF equ 0Ah
  193.  
  194. Public Vmc_Init
  195. Vmc_Init proc
  196.   call    skip_to_white             ; Skip driver name
  197.   .repeat
  198.      call    skip_white
  199.      mov     al, es:[di]
  200.      .leave  <al eq CR>
  201.      .leave  <al eq LF>
  202.      .leave  <al eq 0>
  203. ; look for full screen LTYPE option
  204.      push    di
  205.      mov     si, offset opt_ltypeN
  206.      call    str_i_cmp
  207.      pop     di
  208.      .if     <zero ax> ; found it, set default values
  209.         mov ax, VMC_TYPE_NONE
  210.         call Vmc_LCDType
  211.         .leave
  212.      .endif
  213.      push    di
  214.      mov     si, offset opt_ltypeC
  215.      call    str_i_cmp
  216.      pop     di
  217.      .if     <zero ax> ; found it, set default values
  218.         mov ax,VMC_TYPE_CENTER
  219.         call Vmc_LCDType
  220.         .leave
  221.      .endif
  222.      mov     si, offset opt_ltypeT
  223.      call    str_i_cmp
  224.      .if     <zero ax> ; found it, set default values
  225.         mov ax,VMC_TYPE_TOP
  226.         call Vmc_LCDType
  227.         .leave
  228.      .endif
  229.      call  skip_to_white           ; Skip to next parameter
  230.   .until
  231.   ret
  232. Vmc_Init endp
  233.  
  234. CSEGI ends
  235. end
  236.