Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.4 KiB

  1. ;---------------------------Module-Header------------------------------;
  2. ; Module Name: vgaregs.asm
  3. ;
  4. ; Copyright (c) 1992 Microsoft Corporation
  5. ;-----------------------------------------------------------------------;
  6. ;-----------------------------------------------------------------------;
  7. ; VOID vInitRegs(void)
  8. ;
  9. ; Sets the VGA's data control registers to their default states.
  10. ;
  11. ;-----------------------------------------------------------------------;
  12. .386
  13. .model small,c
  14. assume cs:FLAT,ds:FLAT,es:FLAT,ss:FLAT
  15. assume fs:nothing,gs:nothing
  16. .xlist
  17. include stdcall.inc ;calling convention cmacros
  18. include i386\strucs.inc
  19. include i386\driver.inc
  20. include i386\egavga.inc
  21. .list
  22. .code
  23. cProc vInitRegs,4,< \
  24. uses esi edi ebx, \
  25. ppdev: ptr PDEV >
  26. mov esi,ppdev
  27. ; Initialize sequencer to its defaults (all planes enabled, index
  28. ; pointing to Map Mask).
  29. mov dx,VGA_BASE + SEQ_ADDR
  30. mov ax,(MM_ALL shl 8) + SEQ_MAP_MASK
  31. out dx,ax
  32. ; Initialize graphics controller to its defaults (set/reset disabled for
  33. ; all planes, no rotation & ALU function == replace, write mode 0 & read
  34. ; mode 0, color compare ignoring all planes (read mode 1 reads always
  35. ; return 0ffh, handy for ANDing), and the bit mask == 0ffh, gating all
  36. ; bytes from the CPU.
  37. mov dl,GRAF_ADDR
  38. mov ax,(0 shl 8) + GRAF_ENAB_SR
  39. out dx,ax
  40. mov ax,(DR_SET shl 8) + GRAF_DATA_ROT
  41. out dx,ax
  42. ; Default to read mode 0, write mode 0:
  43. mov edx,VGA_BASE + GRAF_ADDR
  44. mov ah,byte ptr [esi].pdev_ulrm0_wmX[0]
  45. mov al,GRAF_MODE
  46. out dx,ax ;write mode 0, read mode 0
  47. mov ax,(0 shl 8) + GRAF_CDC
  48. out dx,ax
  49. mov ax,(0FFh shl 8) + GRAF_BIT_MASK
  50. out dx,ax
  51. cRet vInitRegs
  52. endProc vInitRegs
  53. ;-----------------------------------------------------------------------;
  54. ; VOID vSetWriteModes(ULONG * pulWriteModes);
  55. ;
  56. ; Sets the four bytes at *pulWriteModes to the values to be written to
  57. ; the Graphics Mode register to select read mode 0 and:
  58. ; write mode 0, write mode 1, write mode 2, and write mode 3,
  59. ; respectively.
  60. ;
  61. ; Must already be in graphics mode when this is called.
  62. ;-----------------------------------------------------------------------;
  63. cProc vSetWriteModes,4,< \
  64. pulWriteModes:ptr >
  65. mov edx,VGA_BASE + GRAF_ADDR
  66. mov al,GRAF_MODE
  67. out dx,al ;point the GC Index to the Graphics Mode reg
  68. inc edx ;point to the GC Data reg
  69. in al,dx ;get the current setting of the Graphics Mode
  70. and eax,0fch ;mask off the write mode fields
  71. mov ah,al
  72. mov edx,eax
  73. shl edx,16
  74. or eax,edx ;put the Graphics Mode setting in all 4 bytes
  75. mov edx,pulWriteModes ;the mode values go here
  76. or eax,03020100h ;insert the write mode fields
  77. mov [edx],eax ;store the Graphics Mode settings
  78. cRet vSetWriteModes
  79. endProc vSetWriteModes
  80. end
  81.