|
|
|
|
![]() ![]() |
Mar 28 2005, 10:35 PM
Post
#1
|
|
|
Techno-Necromancer Group: Members Posts: 1,018 Joined: 13-January 05 From: The Net Member No.: 2,127 |
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.
|
|
|
|
Aug 20 2005, 09:16 AM
Post
#2
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 1 Joined: 20-August 05 From: Poland Member No.: 7,970 |
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 |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
Lo-Fi Version | Time is now: 6th September 2008 - 01:20 AM |