Jump to content
xisto Community

zomo

Members
  • Content Count

    1
  • Joined

  • Last visited

Posts posted by zomo


  1. No need to use their standards, just use interrupt 10h to do that, I show you how to program VESA 1.2 because VESA 2.0 is protected mode programing.

    1. You need to gather information about requested graphics mode,
    2. you must initialize that mode,

    3. switch bank, if needed (in VESA you have access to memory across bank)
    4. draw

    I give you some code in Pascal/Assembler:

     TModeInfo = Record    ModeAttributes    :Word;    WinAAttributes    :Byte;    WinBAttributes    :Byte;    WinGranularity    :Word;    WinSize           :Word;    WinASegment       :Word;    WinBSegment       :Word;    BankSwitch        :Pointer;    BytesPerScanLine  :Word;    XResolution       :Word;    YResolution       :Word;    Reserved          :Array[0..233] of Byte;  End;Var  ActualBank :Word;  BankSwitch :Pointer;{/---------------------------------------------------------------------------  Name: GetModeInfo(Mode: Integer; ModeInfo: TModeInfo)  Desc:  Exp.: GetModeInfo($114,ModeInfo); $114 = 800x600 (64K Colors)/---------------------------------------------------------------------------}Procedure GetModeInfo(Mode: Integer; ModeInfo: TModeInfo); Assembler;Asm       push    es       push    di       push    cx       les     di, ModeInfo       mov     cx, Mode       mov     ax, 4F01h       int     10h       mov     ax, word ptr es:[di+0].(TModeInfo).BankSwitch       mov     word ptr [BankSwitch+0], ax       mov     ax, word ptr es:[di+2].(TModeInfo).BankSwitch       mov     word ptr [BankSwitch+2], ax       pop     cx       pop     di       pop     esEnd; { GetModeInfo }{/---------------------------------------------------------------------------  Name: SetVesaMode(Mode: Integer)  Desc:  Exp.: SetVesaMode($114);/---------------------------------------------------------------------------}Procedure SetVesaMode(Mode: Integer); Assembler;Asm       push    bx       mov     bx, Mode       mov     ax, 4F02h       int     10h       pop     bxEnd; { SetVesaMode }
    This is pure assembler procedure, in Pascal you need write their prototype.
    ;/---------------------------------------------------------------------------;  Name:  Vesa_PutPixel_800x600x64;  Desc:;/---------------------------------------------------------------------------Vesa_PutPixel_800x600x64  PROC FAR USES ebx ecx edx esi edi es, \                               x :DWORD, y :DWORD, r :BYTE, g :BYTE,  b :BYTE       mov     eax, y       mov     ebx, eax       mov     edx, eax       shl     eax, 10       shl     ebx, 9       shl     edx, 6       add     eax, ebx       add     eax, edx       mov     ecx, x       shl     ecx, 1       add     eax, ecx       mov     esi, eax       shr     esi, 16       mov     cx, si       mov     ebx, esi       shl     ebx, 16       sub     eax, ebx       mov     di, ax       mov     ax, ActualBank       cmp     ax, cx       je      @@1       xor     bx, bx       mov     dx, cx       call    dword ptr [BankSwitch]@@1:   mov     ax, 0A000h       mov     es, ax       mov     si, di       mov     al, r       shl     ax, 6       add     al, g       shl     ax, 5       add     al, b       mov     word ptr es:[si], ax       mov     ActualBank, cxRETVesa_PutPixel_800x600x64  ENDP

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.