home *** CD-ROM | disk | FTP | other *** search
/ The Equalizer BBS / equalizer-bbs-collection_2004.zip / equalizer-bbs-collection / DEMOSCENE-STUFF / RVLVBE10.ZIP / VESA.INC < prev   
Text File  |  1997-05-17  |  37KB  |  997 lines

  1. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  2. ;▒▒▒▒▒▒▒▒▒▒▒▒▒   ▒  ▒▒   ▒ ▒▒▒ ▒ ▒  ▒▒   ▒▒▒▒   ▒   ▒ ▒▒▒   ▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒
  3. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ ▒ ▒ ▒▒▒ ▒▒▒ ▒ ▒ ▒ ▒  ▒▒▒▒▒  ▒▒▒ ▒▒ ▒▒▒  ▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒
  4. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ ▒ ▒ ▒▒▒ ▒▒▒ ▒ ▒ ▒ ▒ ▒▒▒▒▒▒ ▒▒▒▒ ▒▒ ▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  5. ;▒▒▒▒▒▒▒▒▒▒▒▒▒   ▒ ▒ ▒   ▒   ▒   ▒  ▒▒   ▒▒▒▒ ▒▒▒   ▒   ▒   ▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒
  6. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  7.  
  8. ;-----------------------------------------------------------------------------
  9. ; (c)opyright 1997, babyloon/revelation
  10. ; use it where you want, for what you want, it is at you own risk !
  11. ;-----------------------------------------------------------------------------
  12.  
  13. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  14. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  15.                 .Code
  16. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  17. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  18.  
  19.  
  20. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  21. ;░ CheckVESA: Check if VBE is present and set primary VBE_????? variables..
  22. ;░ In:
  23. ;░     Nothing
  24. ;░ Out:
  25. ;░     DL - Error code
  26. ;░              =0 VESA Found.
  27. ;░              =1 DOS Memory allocation failed.
  28. ;░              =2 DOS interrupt failed.
  29. ;░              =3 VESA Not supported.
  30. ;░              =4 DOS Memory DeAllocation failed.
  31. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  32. CheckVESA       Proc
  33. ; *** Alloc DOS memory block for GET VESA INFO(4F00), GET MODE INFO(4F01)..
  34.         mov     ax,100h                 ; Allocate DOS memory block
  35.         mov     bx,32                   ; 32*16=512 bytes
  36.         int     31h                     ;
  37.         jnc     @@DOSAllocOk
  38.         Mov     Dl,1    ; DOS Alloc error
  39.         ret
  40. @@DOSAllocOK:
  41.         mov     [VBE_RealSegment],ax    ; Save segment and selector registers.
  42.         mov     [VBE_MemSelector],dx    ;
  43.  
  44. ; *** VBE Controller Informations - DOS interrupt ***
  45.         mov     eax,04F00h
  46.         mov     [Real_Mode_Block.R_EAX],eax
  47.  
  48.         mov     ax,[VBE_RealSegment]
  49.         mov     [Real_Mode_Block.R_ES],ax       ;\ Infos block at ES:DI
  50.         xor     eax,eax                         ; | ES - Reserved Segment
  51.         mov     [Real_Mode_Block.R_EDI],eax     ;/  DI - Offset 0..
  52. ; clear unused parameters..
  53.         mov     [Real_Mode_Block.R_ESI],eax
  54.         mov     [Real_Mode_Block.R_EBP],eax
  55.         mov     [Real_Mode_Block.R_EBP+4],eax
  56.         mov     [Real_Mode_Block.R_EDX],eax
  57.         mov     [Real_Mode_Block.R_EBX],eax
  58.         mov     word ptr [Real_Mode_Block.R_EAX+4],ax
  59.         mov     [Real_Mode_Block.R_DS],ax
  60.         mov     [Real_Mode_Block.R_FS],ax
  61.         mov     [Real_Mode_Block.R_GS],ax
  62.         mov     [Real_Mode_Block.R_CS],ax
  63.         mov     [Real_Mode_Block.R_IP],ax
  64.         mov     [Real_Mode_Block.R_SS],ax
  65.         mov     [Real_Mode_Block.R_SP],ax
  66.  
  67.         mov     ax,0300h                        ;\
  68.         mov     bl,10h                          ; |
  69.         xor     bh,bh                           ; |
  70.         xor     cx,cx                           ; | DOS interrupt simulation.
  71.         push    ds                              ; |
  72.         pop     es                              ; |
  73.         mov     edi,offset Real_Mode_Block      ; |
  74.         int     31h                             ;/
  75.         jnc     @@VBE_PMInterrupt_ok1
  76.         Mov     Dl,2    ; DOS int failure
  77.         jmp     @@EndCheck
  78. @@VBE_PMInterrupt_ok1:
  79.  
  80.         mov     eax,[Real_Mode_Block.R_EAX]     ; Test if VESA driver found.
  81.         cmp     ax,004Fh
  82.         je      @@VBE_VESADriver_found
  83.         Mov     Dl,3    ; VESA not supported
  84.         jmp     @@EndCheck
  85. @@VBE_VESADriver_found:
  86. ;//---Set all primary VBE_?????? variables...
  87.         mov     fs,[VBE_MemSelector]
  88.         xor     edi,edi
  89.  
  90.         mov     eax,Dword ptr fs:[edi.VBESignature]
  91.         mov     [VBE_Signature+0],al
  92.         mov     [VBE_Signature+1],ah
  93.         shr     eax,16
  94.         mov     [VBE_Signature+2],al
  95.         mov     [VBE_Signature+3],ah
  96.  
  97.         mov     ax,Word Ptr fs:[edi.VBEVersion]
  98.         mov     [VBE_VBEVersion],ax
  99.  
  100.         mov     ax,Word Ptr fs:[edi.TotalMemory]
  101.         shl     ax,6                                ; 64Ko blocks
  102.         mov     [VBE_TotalMemory],ax
  103.  
  104.         mov     ax,Word Ptr fs:[edi.OEMSoftwareRev]
  105.         mov     [VBE_SoftwareRev],ax
  106.  
  107.         mov     eax,DWord Ptr fs:[edi.OEMStringPtr] ; eax=Segment*65536+Offset
  108.         mov     edx,eax
  109.         movzx   ebx,ax
  110.         xor     dx,dx
  111.         shr     edx,12
  112.         add     edx,ebx
  113.         mov     [VBE_OEMStringPtr],edx  ; LinearAddress=Segment*4+Offset
  114.  
  115.         mov     eax,DWord Ptr fs:[edi.OEMVendorNamePtr]
  116.         mov     edx,eax
  117.         movzx   ebx,ax
  118.         xor     dx,dx
  119.         shr     edx,12
  120.         add     edx,ebx
  121.         mov     [VBE_OEMVendorNamePtr],edx
  122.  
  123.         mov     eax,DWord Ptr fs:[edi.OEMProductNamePtr]
  124.         mov     edx,eax
  125.         movzx   ebx,ax
  126.         xor     dx,dx
  127.         shr     edx,12
  128.         add     edx,ebx
  129.         mov     [VBE_OEMProductNamePtr],edx
  130.  
  131.         mov     eax,DWord Ptr fs:[edi.OEMProductRevPtr]
  132.         mov     edx,eax
  133.         movzx   ebx,ax
  134.         xor     dx,dx
  135.         shr     edx,12
  136.         add     edx,ebx
  137.         mov     [VBE_OEMProductRevPtr],edx
  138.  
  139. ; *** Initialise VBE Mode List ***
  140.         mov     [VBE_NumberOfMode],0
  141.         mov     esi,Offset VBE_ModeList
  142.         mov     ebp,100h        ; first VESA mode
  143. @@SetModeListLoop:
  144.         mov     eax,04F01h
  145.         mov     [Real_Mode_Block.R_EAX],eax     ; Infos Mode VESA function
  146.         mov     [Real_Mode_Block.R_ECX],ebp     ; which VESA mode ? EBP=Mode
  147.  
  148.         mov     ax,[VBE_RealSegment]
  149.         mov     [Real_Mode_Block.R_ES],ax       ;\ Infos block at ES:DI
  150.         xor     eax,eax                         ; | ES - Reserved Segment
  151.         mov     [Real_Mode_Block.R_EDI],eax     ;/  DI - Offset 0..
  152. ; clear unused parameters..
  153.         mov     [Real_Mode_Block.R_ESI],eax
  154.         mov     [Real_Mode_Block.R_EBP],eax
  155.         mov     [Real_Mode_Block.R_EDX],eax
  156.         mov     [Real_Mode_Block.R_EBX],eax
  157.         mov     [Real_Mode_Block.R_EBP+4],eax
  158.         mov     word ptr [Real_Mode_Block.R_EAX+4],ax
  159.         mov     [Real_Mode_Block.R_DS],ax
  160.         mov     [Real_Mode_Block.R_FS],ax
  161.         mov     [Real_Mode_Block.R_GS],ax
  162.         mov     [Real_Mode_Block.R_CS],ax
  163.         mov     [Real_Mode_Block.R_IP],ax
  164.         mov     [Real_Mode_Block.R_SS],ax
  165.         mov     [Real_Mode_Block.R_SP],ax
  166.  
  167.         push    ebp esi
  168.         mov     ax,300h                         ;\
  169.         mov     bl,10h                          ; |
  170.         xor     bh,bh                           ; |
  171.         xor     cx,cx                           ; | DOS interrupt simulation.
  172.         push    ds                              ; |
  173.         pop     es                              ; |
  174.         mov     edi,offset Real_Mode_Block      ; |
  175.         int     31h                             ;/
  176.         jnc     @@VBE_PMInterrupt_ok2
  177.         pop     esi ebp
  178.         Mov     dl,2    ; DOS int failure
  179.         jmp     @@EndCheck
  180. @@VBE_PMInterrupt_ok2:
  181.         pop     esi ebp
  182.         mov     eax,[Real_Mode_Block.R_EAX]     ; Test if mode available.
  183.         cmp     ax,004Fh
  184.         jne     @@BadVideoMode
  185.         inc     [VBE_NumberOfMode]
  186.         mov     fs,[VBE_MemSelector]
  187.         mov     ax,fs:[XResolution]
  188.         mov     [esi],ax
  189.         mov     ax,fs:[YResolution]
  190.         mov     [esi+2],ax
  191.         xor     eax,eax
  192.         mov     al,fs:[BitsPerPixel]
  193.         mov     [esi+4],ax
  194.         mov     [esi+6],bp
  195.         add     esi,8
  196. @@BadVideoMode:
  197.         inc     ebp
  198.         cmp     ebp,0201h
  199.         jne     @@SetModeListLoop
  200.  
  201. ; *** Free allocated DOS memory block ***
  202.         mov     ax,0101h
  203.         mov     dx,[VBE_MemSelector]
  204.         int     31h
  205.         jnc     @@VBE_FreeMem_Ok
  206.         mov     dl,4
  207.         ret
  208. @@VBE_FreeMem_Ok:
  209.         xor     dl,dl
  210.         ret
  211.  
  212. @@EndCheck:
  213.         push    edx
  214.         mov     ax,0101h
  215.         mov     dx,[VBE_MemSelector]
  216.         int     31h
  217.         pop     edx
  218.         ret
  219. CheckVESA       EndP
  220.  
  221.  
  222.  
  223. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  224. ;░ InitVESAMode: Verify if requested mode is available and initializes it..
  225. ;░ In:
  226. ;░     AX - Video mode WIDTH
  227. ;░     BX - Video mode HEIGHT
  228. ;░     CX - Bits per pixel
  229. ;░ Out:
  230. ;░     DL  - Error code
  231. ;░              =0 Initialisation ok.
  232. ;░              =1 DOS Memory allocation failed.
  233. ;░              =2 DOS interrupt failed.
  234. ;░              =4 DOS Memory DeAllocation failed.
  235. ;░              =5 Requested video mode not found.
  236. ;░              =6 Wrong VESA mode.
  237. ;░              =7 Can't map memory.
  238. ;░              =8 Bank Switching not really available (!).
  239. ;░              =9 Bad Window A attributes.
  240. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  241. InitVESAMode    Proc
  242.         mov     esi,Offset VBE_ModeList
  243.         mov     ebp,[VBE_NumberOfMode]
  244.         or      ebp,ebp
  245.         jnz     @@FindModeLoop
  246.         mov     dl,5
  247.         ret
  248. @@FindModeLoop:
  249.         cmp     ax,[esi]
  250.         jne     @@SkipThisMode
  251.         cmp     bx,[esi+2]
  252.         jne     @@SkipThisMode
  253.         cmp     cx,[esi+4]
  254.         jne     @@SkipThisMode
  255.         mov     dx,[esi+6]
  256.         mov     [VBE_Gfx_Mode],dx       ; Set Graphic Mode
  257.         jmp     @@VideoModeFound
  258. @@SkipThisMode:
  259.         add     esi,8
  260.         dec     ebp
  261.         jnz     @@FindModeLoop
  262.         mov     dl,5
  263.         ret
  264. @@VideoModeFound:
  265.         push    ax
  266.         xor     eax,eax
  267.         pop     ax
  268.         push    bx
  269.         xor     ebx,ebx
  270.         pop     bx
  271.         push    cx
  272.         xor     ecx,ecx
  273.         pop     cx
  274.         imul    eax,ebx
  275.         shr     ecx,3
  276.         imul    eax,ecx
  277.         mov     [VBE_Mapping_Size],eax  ; Set Mapping Size (if LFB available)
  278.  
  279. ; *** Alloc DOS memory block for Mode Info Buffer ***
  280.         mov     ax,100h                 ; Allocate DOS memory block
  281.         mov     bx,32                   ; 32*16=512 bytes
  282.         int     31h                     ;
  283.         jnc     @@VBE_DOSAlloc_ok
  284.         Mov     Dl,1    ; can't alloc DOS memory
  285.         ret
  286. @@VBE_DOSAlloc_Ok:
  287.         mov     [VBE_RealSegment],ax    ; Save segment and selector registers.
  288.         mov     [VBE_MemSelector],dx    ;
  289.  
  290. ; *** VBE Mode Informations - DOS interrupt *** INITIALIZE VIDEO MODE !!!!
  291.         mov     eax,04F01h
  292.         mov     [Real_Mode_Block.R_EAX],eax     ; Infos Mode VESA function
  293.         mov     cx,[VBE_Gfx_Mode]
  294.         mov     [Real_Mode_Block.R_ECX],ecx     ; which VESA mode ?
  295.  
  296.         mov     ax,[VBE_RealSegment]
  297.         mov     [Real_Mode_Block.R_ES],ax       ;\ Infos block at ES:DI
  298.         xor     eax,eax                         ; | ES - Reserved Segment
  299.         mov     [Real_Mode_Block.R_EDI],eax     ;/  DI - Offset 0..
  300. ; clear unused parameters..
  301.         mov     [Real_Mode_Block.R_ESI],eax
  302.         mov     [Real_Mode_Block.R_EBP],eax
  303.         mov     [Real_Mode_Block.R_EDX],eax
  304.         mov     [Real_Mode_Block.R_EBX],eax
  305.         mov     [Real_Mode_Block.R_EBP+4],eax
  306.         mov     word ptr [Real_Mode_Block.R_EAX+4],ax
  307.         mov     [Real_Mode_Block.R_DS],ax
  308.         mov     [Real_Mode_Block.R_FS],ax
  309.         mov     [Real_Mode_Block.R_GS],ax
  310.         mov     [Real_Mode_Block.R_CS],ax
  311.         mov     [Real_Mode_Block.R_IP],ax
  312.         mov     [Real_Mode_Block.R_SS],ax
  313.         mov     [Real_Mode_Block.R_SP],ax
  314.  
  315.         mov     ax,300h                         ;\
  316.         mov     bl,10h                          ; |
  317.         xor     bh,bh                           ; |
  318.         xor     cx,cx                           ; | DOS interrupt simulation.
  319.         push    ds                              ; |
  320.         pop     es                              ; |
  321.         mov     edi,offset Real_Mode_Block      ; |
  322.         int     31h                             ;/
  323.         jnc     @@VBE_PMInterrupt_ok
  324.         Mov     dl,2    ; DOS int failure
  325.         jmp     @@EndInit
  326. @@VBE_PMInterrupt_ok:
  327.  
  328.         mov     eax,[Real_Mode_Block.R_EAX]     ; Test if mode available.
  329.         cmp     ax,004Fh
  330.         je      @@VBE_VideoMode_Ok
  331.         Mov     Dl,6    ; Wrong VESA mode
  332.         jmp     @@EndInit
  333. @@VBE_VideoMode_Ok:
  334.  
  335.         mov     fs,[VBE_MemSelector]
  336.  
  337.         movzx   eax,word ptr fs:[BytesPerScanLine]
  338.         mov     [VBE_BytesPerScanLine],eax
  339.  
  340.         mov     [VBE_PMODESetStartFactor],0
  341.         cmp     byte ptr fs:[BitsPerPixel],4
  342.         je      @@NoFactorNeeded
  343.         mov     [VBE_PMODESetStartFactor],2
  344. @@NoFactorNeeded:
  345.  
  346.         mov     ax,fs:[ModeAttributes]          ; Test if LFB available
  347.         test    ax,010000000b
  348.         jz      @@VBE_BankSwitchMethod
  349. ; *************************************************************
  350. ; ***           LINEAR FRAME BUFFERING AVAILABLE            ***
  351. ; *************************************************************
  352.         mov     [VBE_LFBAvailable],1
  353.  
  354.         mov     eax,fs:[PhysBasePtr]
  355. ;        mov     [VBE_VRAM_Address],eax  ; Physical address of LFB
  356. ; LFB Physical address converted into linear address..
  357.         mov     ecx,eax
  358.         mov     ebx,eax
  359.         shr     ebx,16                  ; BX:CX = Physical address of LFB
  360.  
  361.         mov     eax,[VBE_Mapping_Size]
  362.         mov     edi,eax
  363.         mov     esi,eax
  364.         shr     esi,16                  ; SI:DI=size of zone to map in bytes
  365.  
  366.         mov     ax,0800h                ; DPMI Physical address mapping..
  367.         int     31h
  368.         jnc     @@VBE_MemMapping_ok
  369.         Mov     Dl,7    ; Can't map memory..
  370.         jmp     @@EndInit
  371. @@VBE_MemMapping_ok:
  372.         shl     ebx,16
  373.         mov     bx,cx
  374.         mov     [VBE_VRAM_Address],ebx
  375.         Add     [VBE_Gfx_Mode],4000h    ; Prepare for Linear Addressing.
  376.  
  377.         jmp     @@Check32BitInterface   ; Now set all Accelerated Functions.
  378.  
  379. ; *************************************************************
  380. ; ***                BANK SWITCHING METHOD                  ***
  381. ; *************************************************************
  382. @@VBE_BankSwitchMethod:
  383.         Mov     [VBE_LFBAvailable],0
  384.  
  385.         mov     fs,[VBE_MemSelector]
  386.         mov     ax,fs:[ModeAttributes]          ; Test if bank switching
  387.         test    ax,01000000b                    ; is really available.
  388.         jz      @@VBE_windowing_supported
  389.         Mov     Dl,8    ; BankSwitch not really available..
  390.         jmp     @@EndInit
  391. @@VBE_windowing_supported:
  392.  
  393.         mov     al,fs:[WinAAttributes]          ; Test if Windows Attributes
  394.         and     al,0101b                        ; are OK.
  395.         cmp     al,0101b
  396.         je      @@VBE_WinAttributes_ok
  397.         Mov     Dl,9    ; Bad Window A attributes
  398.         jmp     @@EndInit
  399. @@VBE_WinAttributes_ok:
  400.  
  401.         movzx   eax,word ptr fs:[WinSize]       ;\
  402.         shl     eax,10                          ; | Get window size.
  403.         mov     [VBE_WindowSize],eax            ;/
  404.  
  405.         mov     eax,[VBE_Mapping_Size]
  406.         xor     edx,edx
  407.         mov     ebx,[VBE_WindowSize]
  408.         idiv    ebx
  409.         or      edx,edx
  410.         je      @@VBE_EndCalcBanks
  411.         inc     eax
  412. @@VBE_EndCalcBanks:
  413.         mov     [VBE_NumberOfBanks],AL
  414.  
  415. ; Setup bank numering table..
  416.         Movzx   eax,word ptr fs:[WinSize]
  417.         Movzx   ebx,word ptr fs:[WinGranularity]
  418.         xor     edx,edx
  419.         div     ebx
  420.         xor     edx,edx
  421.         xor     ecx,ecx
  422. @@LoopSetUpBank:
  423.         mov     VBE_BANKSetTable[ECX*4],edx
  424.         add     edx,eax
  425.         inc     ecx
  426.         cmp     ecx,LENGTH VBE_BANKSetTable
  427.         jb      @@LoopSetUpBank
  428.  
  429. ; Window A physical Address converted into 32bits pointer. 0A000h -> 0A0000h
  430.         xor     eax,eax
  431.         mov     ax,fs:[WinASegment]
  432.         shl     eax,4
  433.         mov     [VBE_VRAM_Address],eax
  434.  
  435.         mov     eax,Offset RealModeSetBank      ; Pointer to the standard
  436.         mov     [VBE_SetVBEBankPtr],eax         ; bankswitch function. (real mode).
  437.  
  438.         mov     [VBE_CurrentBank],1     ;\
  439.         xor     dl,dl                   ; |-- Initialize to first bank..->0
  440.         call    SetVBEBank              ;/
  441.  
  442. ;******************************************************
  443. ;*** Now Check for a 32bit bank switch interface !! ***
  444. ;******************************************************
  445. @@Check32BitInterface:
  446.         mov     [VBE_PMODEInterface],0  ; firstly suppose there is none.
  447.         mov     [VBE_PMODEBankSwitch],0
  448.  
  449. ; *** Return VBE Protected Mode Interface - DOS interrupt *** check it !!
  450.         mov     eax,04F0Ah
  451.         mov     [Real_Mode_Block.R_EAX],eax
  452.         xor     eax,eax
  453.         mov     [Real_Mode_Block.R_EBX],eax
  454. ; clear unused parameters..
  455.         mov     [Real_Mode_Block.R_ECX],eax
  456.         mov     [Real_Mode_Block.R_EDI],eax
  457.         mov     [Real_Mode_Block.R_ESI],eax
  458.         mov     [Real_Mode_Block.R_EBP],eax
  459.         mov     [Real_Mode_Block.R_EDX],eax
  460.  
  461.         mov     [Real_Mode_Block.R_EBP+4],eax
  462.         mov     word ptr [Real_Mode_Block.R_EAX+4],ax
  463.         mov     [Real_Mode_Block.R_ES],ax
  464.         mov     [Real_Mode_Block.R_DS],ax
  465.         mov     [Real_Mode_Block.R_FS],ax
  466.         mov     [Real_Mode_Block.R_GS],ax
  467.         mov     [Real_Mode_Block.R_CS],ax
  468.         mov     [Real_Mode_Block.R_IP],ax
  469.         mov     [Real_Mode_Block.R_SS],ax
  470.         mov     [Real_Mode_Block.R_SP],ax
  471.  
  472.         mov     ax,300h                         ;\
  473.         mov     bl,10h                          ; |
  474.         xor     bh,bh                           ; |
  475.         xor     cx,cx                           ; | DOS interrupt simulation.
  476.         push    ds                              ; |
  477.         pop     es                              ; |
  478.         mov     edi,offset Real_Mode_Block      ; |
  479.         int     31h                             ;/
  480.         jnc     @@VBE_PMInterrupt_ok2
  481.         Mov     dl,2    ; DOS int failure
  482.         jmp     @@EndInit
  483. @@VBE_PMInterrupt_ok2:
  484.  
  485.         mov     eax,[Real_Mode_Block.R_EAX]
  486.         cmp     ax,004Fh
  487.         jne     @@No32BitInterface
  488.  
  489.         movzx   esi,[Real_Mode_Block.R_ES]     ; RM pointer->Linear Pointer
  490.         shl     esi,4
  491.         mov     edi,[Real_Mode_Block.R_EDI]
  492.         and     edi,0FFFFh
  493.         add     esi,edi                         ; ESI=Segment*16+Offset
  494.  
  495. ; Check if there's a zero length memory list, it should be that for most video
  496. ; card. If memory list have a non-zero length, you are not lucky, because its
  497. ; too boring to code that case .. (it runs on 99% of video cards..)
  498.         movzx   edi,Word Ptr [ESI+06]      ; get port/memory table list
  499.         or      edi,edi
  500.         jz      @@UsePmodeInterface        ; No port list.. coool..
  501.         mov     ax,Word Ptr [esi+edi]
  502.         cmp     ax,0FFFFh
  503.         je      @@CheckMemoryList
  504. @@CheckPortList:
  505.         add     edi,2
  506.         mov     ax,Word Ptr [Esi+Edi]           ; CMP WORD PTR [ESI+EDI],0FFFFh
  507.         cmp     ax,0FFFFh ; search port list    ; causes problems under my W95!
  508.         jne     @@CheckPortList
  509. @@CheckMemoryList:
  510.         add     edi,2
  511.         mov     ax,Word Ptr [Esi+Edi]
  512.         cmp     ax,0FFFFh ; see if mem list is zero
  513.         jne     @@NoPMODEBankSwitch
  514. @@UsePmodeInterface:
  515.         movzx   eax,Word Ptr [ESI+00]
  516.         add     eax,esi
  517.         mov     [VBE_SetVBEBankPtr],eax     ; save SetBank code address
  518.         mov     [VBE_PMODEBankSwitch],1
  519. @@NoPMODEBankSwitch:
  520.         movzx   eax,Word Ptr [ESI+02]
  521.         add     eax,esi
  522.         mov     [VBE_PMODESetStartPtr],eax  ; save SetStart code address
  523. ;
  524. ; Here I should set all others available
  525. ; 32bit functions..
  526. ;
  527.         mov     [VBE_PMODEInterface],1
  528. @@No32BitInterface:
  529.  
  530.         mov     ax,0101h
  531.         mov     dx,[VBE_MemSelector]
  532.         int     31h
  533.         jnc     @@VBE_FreeMem_Ok
  534.         mov     dl,4
  535.         ret
  536. @@VBE_FreeMem_Ok:
  537.         xor     dl,dl   ; All is ok !!
  538.         RET
  539.  
  540. @@EndInit:
  541.         push    edx
  542.         mov     ax,0101h
  543.         mov     dx,[VBE_MemSelector]
  544.         int     31h
  545.         pop     edx
  546.         ret
  547.  
  548. InitVESAMode    EndP
  549.  
  550.  
  551.  
  552. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  553. ;░ SetVBEMode: Set VESA mode
  554. ;░ In:
  555. ;░     Nothing
  556. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  557. SetVBEMode      Proc
  558.         pushad
  559.         mov     ax,4F02h
  560.         mov     bx,[VBE_Gfx_Mode]
  561.         Int     10h
  562.         popad
  563.         Ret
  564. SetVBEMode      EndP
  565.  
  566.  
  567.  
  568. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  569. ;░ CloseVBEMode: Close VESA mode and unmap VIDEO memory
  570. ;░ In:
  571. ;░     Nothing
  572. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  573. CloseVBEMode    Proc
  574.         cmp     [VBE_LFBAvailable],1
  575.         jne     @@NoNeed
  576.         mov     ax,0801h
  577.         mov     ebx,[VBE_VRAM_Address]
  578.         mov     cx,bx
  579.         shr     ebx,16
  580.         int     31h
  581. @@NoNeed:
  582.         Ret
  583. CloseVBEMode    Endp
  584.  
  585.  
  586.  
  587. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  588. ;░ SetVBEBank: Setup writable bank
  589. ;░ In:
  590. ;░     DL - Bank number
  591. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  592. SetVBEBank      Proc
  593.         cmp     [VBE_CurrentBank],dl
  594.         je      @@BankAlreadySet
  595.         and     edx,01fh
  596.         mov     VBE_CurrentBank,dl
  597.         mov     edx,VBE_BANKSetTable[edx*4]
  598.         push    ebx
  599.         call    [VBE_SetVBEBankPtr]
  600.         pop     ebx
  601. @@BankAlreadySet:
  602.         RET
  603. SetVBEBank      EndP
  604.  
  605.  
  606.  
  607. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  608. ;░ RealModeSetBank: Set the position of Window A in the frame buffer memory
  609. ;░ In:
  610. ;░     DX - Window number in video memory in window granularity units
  611. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  612. RealModeSetBank Proc
  613.         xor     ebx,ebx
  614.         mov     ax,4F05h        ; Use Real Mode interrupt
  615.         int     10h
  616.         ret
  617. RealModeSetBank EndP
  618.  
  619.  
  620.  
  621. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  622. ;░ SetVBEStart: Setup start address
  623. ;░ In:
  624. ;░     ECX - Pixel in scanline
  625. ;░     EDX - scanline number
  626. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  627. SetVBEStart     Proc
  628.         cmp     [VBE_PMODEInterface],1
  629.         je      @@PMODESetStart
  630.         mov     eax,4F07h
  631.         xor     ebx,ebx
  632.         int     10h
  633.         RET
  634. @@PMODESetStart:
  635.         imul    edx,[VBE_BytesPerScanLine]
  636.         add     edx,ecx
  637.         mov     cl,[VBE_PMODESetStartFactor]
  638.         shr     edx,cl
  639.         mov     cx,dx
  640.         shr     edx,16
  641.         xor     ebx,ebx
  642.         call    [VBE_PMODESetStartPtr]
  643.         ret
  644. SetVBEStart     EndP
  645.  
  646.  
  647.  
  648. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  649. ;░ ShowVBEInfos: Write all necessary infos. Must be called after InitVESAMode.
  650. ;░ In:
  651. ;░     Nothing
  652. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  653. ShowVBEInfos    Proc
  654.         mov     ah,9
  655.         mov     edx,Offset VSTR_TitleString
  656.         int     21h
  657.  
  658.         mov     ah,9
  659.         mov     edx,Offset VSTR_Signature
  660.         int     21h
  661.         mov     ah,9
  662.         mov     edx,Offset VBE_Signature
  663.         int     21h
  664.  
  665.         mov     ah,9
  666.         mov     edx,Offset VSTR_VBEVersion
  667.         int     21h
  668.         mov     ax,[VBE_VBEVersion]
  669.         Call    WriteBCD
  670.         Call    CRLF
  671.  
  672.         mov     ah,9
  673.         mov     edx,Offset VSTR_OEMString
  674.         int     21h
  675.         mov     edx,[VBE_OEMStringPtr]
  676.         call    WriteASCIIZ
  677.  
  678.         mov     ah,9
  679.         mov     edx,Offset VSTR_TotalMemory
  680.         int     21h
  681.         mov     ax,[VBE_TotalMemory]
  682.         Call    WriteWord
  683.         mov     al,'K'
  684.         call    WriteChar
  685.         mov     al,'b'
  686.         call    WriteChar
  687.         Call    CRLF
  688.  
  689.         Cmp     [VBE_VBEVersion],0200h
  690.         jb      @@SkipVBE2Implementations
  691.  
  692.         mov     ah,9
  693.         mov     edx,Offset VSTR_SoftwareRev
  694.         int     21h
  695.         mov     ax,[VBE_SoftwareRev]
  696.         Call    WriteBCD
  697.         Call    CRLF
  698.  
  699.         mov     ah,9
  700.         mov     edx,Offset VSTR_OEMVendorName
  701.         int     21h
  702.         mov     edx,[VBE_OEMVendorNamePtr]
  703.         call    WriteASCIIZ
  704.  
  705.         mov     ah,9
  706.         mov     edx,Offset VSTR_OEMProductName
  707.         int     21h
  708.         mov     edx,[VBE_OEMProductNamePtr]
  709.         call    WriteASCIIZ
  710.  
  711.         mov     ah,9
  712.         mov     edx,Offset VSTR_OEMProductRev
  713.         int     21h
  714.         mov     edx,[VBE_OEMProductRevPtr]
  715.         call    WriteASCIIZ
  716.  
  717. @@SkipVBE2Implementations:
  718.  
  719.         mov     ah,9
  720.         mov     edx,Offset VSTR_DrawMode
  721.         int     21h
  722.         cmp     [VBE_LFBAvailable],1
  723.         jne     @@NoLFBFound
  724.         mov     edx,Offset VSTR_LFB
  725.         jmp     @@DrawInfoEnd
  726. @@NoLFBFound:
  727.         cmp     [VBE_PMODEBankSwitch],1
  728.         jne     @@NoPMODEBankSwitch
  729.         mov     edx,Offset VSTR_PMBS
  730.         jmp     @@DrawInfoEnd
  731. @@NoPMODEBankSwitch:
  732.         mov     edx,Offset VSTR_RMBS
  733. @@DrawInfoEnd:
  734.         mov     ah,9
  735.         int     21h
  736.  
  737.         cmp     [VBE_PMODEInterface],1
  738.         jne     @@No32BitInterface
  739.         mov     ah,9
  740.         mov     edx,Offset VSTR_PMODEInterface
  741.         int     21h
  742. @@No32BitInterface:
  743.  
  744.         mov     ah,9
  745.         mov     edx,Offset VSTR_NumberOfMode
  746.         int     21h
  747.         mov     eax,[VBE_NumberOfMode]
  748.         call    WriteWord
  749.  
  750.         ret
  751. ShowVBEInfos    EndP
  752.  
  753.  
  754.  
  755. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  756. ;░ WriteASCIIZ: Write a "/0" terminated string
  757. ;░ In:
  758. ;░     EDX - Pointer to the ASCIIZ string
  759. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  760. WriteASCIIZ     Proc
  761. @@AsciiLoop:
  762.         mov     al,[edx]
  763.         or      al,al
  764.         jz      @@ZeroCharFound
  765.         call    WriteChar
  766.         inc     edx
  767.         jmp     @@AsciiLoop
  768. @@ZeroCharFound:
  769.         mov     al,13
  770.         call    WriteChar
  771.         mov     al,10
  772.         call    WriteChar
  773.         ret
  774. WriteASCIIZ     EndP
  775.  
  776.  
  777.  
  778. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  779. ;░ WriteChar: Write a char at the current cursor position and move it.
  780. ;░ In:
  781. ;░     AL - ASCII number
  782. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  783. WriteChar       Proc
  784.         push    ax
  785.         push    dx
  786.         mov     dl,al
  787.         mov     ah,2
  788.         int     21h
  789.         pop     dx
  790.         pop     ax
  791.         ret
  792. WriteChar       EndP
  793.  
  794.  
  795.  
  796. CRLF            Proc
  797.         mov     al,13
  798.         call    WriteChar
  799.         mov     al,10
  800.         Call    writechar
  801.         ret
  802. CRLF            EndP
  803.  
  804.  
  805. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  806. ;░ WriteWord: Write a WORD as a decimal number
  807. ;░ In:
  808. ;░     AX - Number
  809. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  810. WriteWord       Proc
  811.         pushad
  812.         mov     bx,10
  813.         xor     cx,cx
  814. affdecimal_decompose:
  815.         xor     dx,dx
  816.         div     bx
  817.         push    dx
  818.         inc     cx
  819.         or      ax,ax
  820.         jnz     affdecimal_decompose
  821. affdecimal_affiche:
  822.         pop     ax
  823.         add     al,48   ; yek !!!
  824.         call    WriteChar
  825.         dec     cx
  826.         jnz     affdecimal_affiche
  827.         popad
  828.         ret
  829. WriteWord       EndP
  830.  
  831.  
  832.  
  833. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  834. ;░ WriteBCD: Write 2 bytes BCD number
  835. ;░ In:
  836. ;░     AX - Number
  837. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  838. WriteBCD        Proc
  839.         mov     edx,eax
  840.         mov     al,dh
  841.         add     al,48
  842.         call    WriteChar
  843.         mov     al,'.'
  844.         call    WriteChar
  845.         mov     al,dl
  846.         add     al,48
  847.         call    WriteChar
  848.         ret
  849. WriteBCD        EndP
  850.  
  851.  
  852. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  853. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  854.                 .Data
  855. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  856. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  857. RealMode_Registers      STRUC   ; DOS int structure as explain in PMODEW.DOC !
  858.         R_EDI     dd 0
  859.         R_ESI     dd 0
  860.         R_EBP     dd 0
  861.                   dd 0 ; reserved
  862.         R_EBX     dd 0
  863.         R_EDX     dd 0
  864.         R_ECX     dd 0
  865.         R_EAX     dd 0
  866.                   dw 0 ; reserved (cpu status flag)
  867.         R_ES      dw 0 ; \
  868.         R_DS      dw 0 ;  | --- Real mode segments
  869.         R_FS      dw 0 ;  |
  870.         R_GS      dw 0 ; /
  871.         R_IP      dw 0 ; ignored
  872.         R_CS      dw 0 ; ignored
  873.         R_SP      dw 0
  874.         R_SS      dw 0
  875. RealMode_Registers      ENDS
  876.  
  877.  
  878. ;▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ VBEInfoBlock ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  879. VBEInfoBlock            STRUC
  880.         VBESignature      dd 0    ; VBE Signature
  881.         VBEVersion        dw 0    ; VBE Version
  882.         OEMStringPtr      dd 0    ; Pointer to OEM string
  883.         Capabilities      dd 4    ; Graphics capabilities of card
  884.         VideoModePtr      dd 0    ; Pointer to Video Mode List
  885.         TotalMemory       dw 0    ; Number of 64kb memory blocks (add for 2.0)
  886.         OemSoftwareRev    dw 0    ; VBE implementation Software revision (2.0)
  887.         OemVendorNamePtr  dd 0    ; Pointer to Vendor Name String        (2.0)
  888.         OemProductNamePtr dd 0    ; Pointer to Product Name String       (2.0)
  889.         OemProductRevPtr  dd 0    ; Pointer to Product Revision String   (2.0)
  890.         Reserved          db 222 dup (?) ; Reserved for VBE implementation..
  891.         OemData           db 256 dup (?) ; Data Area for OEM Strings     (2.0)
  892. VBEInfoBlock            ENDS
  893.  
  894. ;▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ModeInfoBlock ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  895.      ; Mandatory information for all VBE revisions
  896.      ModeAttributes      EQU 0   ; DW mode attributes
  897.      WinAAttributes      EQU 2   ; DB window A attributes
  898.      WinBAttributes      EQU 3   ; DB window B attributes
  899.      WinGranularity      EQU 4   ; DW window granularity
  900.      WinSize             EQU 6   ; DW window size
  901.      WinASegment         EQU 8   ; DW window A start segment
  902.      WinBSegment         EQU 10  ; DW window B start segment
  903.      WinFuncPtr          EQU 12  ; DD pointer to window function
  904.      BytesPerScanLine    EQU 16  ; DW bytes per scan line
  905.      ; Mandatory information for VBE 1.2 and above
  906.      XResolution         EQU 18  ; DW horizontal resolution in pixels or chars
  907.      YResolution         EQU 20  ; DW vertical resolution in pixels or chars
  908.      XCharSize           EQU 22  ; DB character cell width in pixels
  909.      YCharSize           EQU 23  ; DB character cell height in pixels
  910.      NumberOfPlanes      EQU 24  ; DB number of memory planes
  911.      BitsPerPixel        EQU 25  ; DB bits per pixel
  912.      NumberOfBanks       EQU 26  ; DB number of banks
  913.      MemoryModel         EQU 27  ; DB memory model type
  914.      BankSize            EQU 28  ; DB bank size in KB
  915.      NumberOfImagePages  EQU 29  ; DB number of images
  916.      Reserved_           EQU 30  ; DB reserved for page function
  917.      ; Direct Color fields (required for direct/6 and YUV/7 memory models)
  918.      RedMaskSize         EQU 31  ; DB size of direct color red mask in bits
  919.      RedFieldPosition    EQU 32  ; DB bit position of lsb of red mask
  920.      GreenMaskSize       EQU 33  ; DB size of direct color green mask in bits
  921.      GreenFieldPosition  EQU 34  ; DB bit position of lsb of green mask
  922.      BlueMaskSize        EQU 35  ; DB size of direct color blue mask in bits
  923.      BlueFieldPosition   EQU 36  ; DB bit position of lsb of blue mask
  924.      RsvdMaskSize        EQU 37  ; DB size of direct color reserved mask in bits
  925.      RsvdFieldPosition   EQU 38  ; DB bit position of lsb of reserved mask
  926.      DirectColorModeInfo EQU 39  ; DB direct color mode attributes
  927.      ; Mandatory information for VBE 2.0 and above
  928.      PhysBasePtr         EQU 40  ; DD physical address for flat frame buffer
  929.      OffScreenMemOffset  EQU 44  ; DD pointer to start of off screen memory
  930.      OffScreenMemSize    EQU 48  ; DW amount of off screen memory in 1k units
  931.  
  932.         Real_Mode_Block         RealMode_Registers ?
  933.  
  934.         VBE_RealSegment         dw 0
  935.         VBE_MemSelector         dw 0
  936.  
  937.         VBE_Signature           db 0,0  ; Signature
  938.                                 db 0,0
  939.                                 db 13,10,'$'
  940.         VBE_TotalMemory         dw 0    ; Video Ram (in kb)
  941.         VBE_VBEVersion          dw 0    ; BCD Version
  942.         VBE_OEMStringPtr        dd 0    ; Pointer to OEM string
  943.         VBE_SoftwareRev         dw 0    ; BCD Software rev.
  944.         VBE_OEMVendorNamePtr    dd 0    ; Pointer to Vendor Name String
  945.         VBE_OEMProductNamePtr   dd 0    ; Pointer to Product Name String
  946.         VBE_OEMProductRevPtr    dd 0    ; Pointer to Product Revision String
  947.         VBE_NumberOfMode        dd 0
  948.         VBE_ModeList            dw 4*256 dup (0) ; Video Mode List with :
  949.                                 ; Width, Height, bpp & mode number
  950.         VBE_Gfx_Mode            dw 0    ; Hexadecimal graphic mode found
  951.         VBE_Mapping_Size        dd 0    ; Size of VRAM mapping needed
  952.         VBE_VRAM_Address        dd 0    ; Pointer to VIDEO RAM
  953.  
  954.         VBE_BytesPerScanLine    dd 0    ; Bytes per scan line
  955.         VBE_BANKSetTable        dd 128 DUP (0)
  956.         VBE_WindowSize          dd 0
  957.         VBE_NumberOfBanks       db 0
  958.         VBE_CurrentBank         db 0    ; Current used bank
  959.         VBE_LFBAvailable        db 0    ; =1 if LFB available
  960.         VBE_PMODEInterface      db 0    ; =1 if Protected Mode interface found
  961.         VBE_PMODEBankSwitch     db 0    ; =1 if use P-Mode bank switch
  962.         VBE_PMODESetStartPtr    dd 0    ; Pointer to P-Mode set start function
  963.         VBE_PMODESetStartFactor db 0    ; Factor need for Start Address
  964.         VBE_SetVBEBankPtr       dd 0    ; Pointer to BankSwitch function rm&pm
  965.         VBE_Counter             db 0
  966.  
  967.         VSTR_TitleString        db 13,10,'Revelation''s VESA driver, (c) 1997 babyloon/revelation',13,10,'$'
  968.         VSTR_Signature          db ' ∙ Signature             : $'
  969.         VSTR_VBEVersion         db ' ∙ VBE version           : $'
  970.         VSTR_OEMString          db ' ∙ OEM string            : $'
  971.         VSTR_TotalMemory        db ' ∙ Video RAM found       : $'
  972.         VSTR_SoftwareRev        db ' ∙ OEM Software revision : $'
  973.         VSTR_OEMVendorName      db ' ∙ OEM vendor name       : $'
  974.         VSTR_OEMProductName     db ' . OEM product name      : $'
  975.         VSTR_OEMProductRev      db ' ∙ OEM product revision  : $'
  976.         VSTR_DrawMode           db ' ∙ Drawing mode          : $'
  977.         VSTR_LFB                db 'Linear Frame Buffering',13,10,'$'
  978.         VSTR_RMBS               db 'Real Mode BankSwitching',13,10,'$'
  979.         VSTR_PMBS               db 'Protected Mode BankSwitching',13,10,'$'
  980.         VSTR_PMODEInterface     db ' ∙ Protected Mode interface found !',13,10,'$'
  981.         VSTR_NumberOfMode       db ' ∙ Number of VBE Mode    : $'
  982.  
  983.         VBE_Msg_Table           dd offset VBE_Err0,offset VBE_Err1,offset VBE_Err2
  984.                                 dd offset VBE_Err3,offset VBE_Err4,offset VBE_Err5
  985.                                 dd offset VBE_Err6,offset VBE_Err7,Offset VBE_Err8,Offset VBE_Err9
  986.  
  987.         VBE_Err0                db '>VESA assembler functions (c) 1997 babyloon/revelation$'
  988.         VBE_Err1                db '>DOS memory allocation failed$'
  989.         VBE_Err2                db '>DOS interrupt failed$'
  990.         VBE_Err3                db '>VESA not supported$'
  991.         VBE_Err4                db '>DOS memory DeAllocation failed$'
  992.         VBE_Err5                db '>Requested video mode not found$'
  993.         VBE_Err6                db '>Wrong VESA mode$'
  994.         VBE_Err7                db '>Cannot map memory$'
  995.         VBE_Err8                db '>Bank Switching not really available$'
  996.         VBE_Err9                db '>Bad Window A attributes$'
  997.