Nov 25, 2009

VESA Programming - Assembly

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > Assembly

VESA Programming - Assembly

vizskywalker
For months now I have been trying t o do assembly programming in SVGA. I am doing 16 bit assembly, not 32 bit , so I do not have an API to use. I have been to the VESA page and downloaded their standards. But when entering a lot of the video modes, The screen goes into power saving mode. Any help on resolving this issue would be helpful. And it is a problem with every computer I try it on, so it is not a hardware problem.

Comment/Reply (w/o sign-up)

zomo
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:
CODE
 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     es
End; { 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     bx
End; { SetVesaMode }

This is pure assembler procedure, in Pascal you need write their prototype.
CODE
;/---------------------------------------------------------------------------
;  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, cx
RET

Vesa_PutPixel_800x600x64  ENDP

 

 

 


Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Vesa Programming Assembly

  1. [ebook] The Art Of Assembly Code - (0)
  2. X86: Assembler AT&T Or Intel Mode? - Which do you prefer AT&T or Intel mode for programming assembler? (0)
    I started programming Assembler back in 94 or 95 using TASM (the Borland assembler, quite
    similar to the Microsoft's MASM ). I was comfortable with that configuration. Later I began to
    embed code with the Borland C assembler, that was easy, but it was difficult to make some complex
    tasks... And then I had to switch to Linux... hummm, there were no Borland C nor TASM oh! What
    to do! Fortunately, gcc provided a much better C compiler (the Borland C was completely
    surpassed!) but it was hard for me to get used to the assembler included: GAS . It uses the ...



Looking for vesa, programming, assembly

See Also,

*SIMILAR VIDEOS*
Searching Video's for vesa, programming, assembly
advertisement



VESA Programming - Assembly

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com