Re: GUI
Posted: Wed Dec 10, 2008 10:13 am
You can set vesa mode in realmode and use LFB ( you will need to check that your vesa supports it, most vesa2 do ), then you can use the LFB as easy as you could use 0A000H in the old dos days.
I take a different view. The best way to draw a mouse pointer on the screen is to use the video card's hardware accelerated pointer/cursor, where (typically) you upload data that describes the mouse pointer into the video card, and then tell the video card where to display it if it moves.tantrikwizard wrote:the best way is always going to be a point of discussion, in the long run it will depend on your implementation.alberich wrote:...which is the best way to draw mouse pointer on screen? ...
Code: Select all
AND mask OR mask Result
0 0 Black pixel
0 1 White pixel
1 0 Transparent pixel
1 1 Inverted pixel
search the wiki.. i know somewhere is a patch which does this.quanganht wrote:I' using GRUB, so how to return to Unreal mode? Can GRUB setup Vesa for me?
GRUB can do the VESA mode switches for you, but only if you patch it. I think this is mentioned on the wiki somewhere, and I know for certain there's links to patches in a couple of threads on here. Or you can Google something like "GRUB vesa vbe patch". Ah, found the thread I was talking about: http://forum.osdev.org/viewtopic.php?f=1&p=139446quanganht wrote:I' using GRUB, so how to return to Unreal mode? Can GRUB setup Vesa for me?
Setting VBE LFB is a hardware setting, its language independent. The problem is not the C/C++ language, theres a bug in your code.djsilence wrote:...I tried to use VESA LFB modes, but they just work in assembly code. Trying to do the same in C or C++ environment makes me crash...
Well, bugs can happen because of the language... For example, if you have C + inline assembly, it can be buggier than simple assembly.tantrikwizard wrote:Setting VBE LFB is a hardware setting, its language independent. The problem is not the C/C++ language, theres a bug in your code.djsilence wrote:...I tried to use VESA LFB modes, but they just work in assembly code. Trying to do the same in C or C++ environment makes me crash...
Code: Select all
;----------------------------------------------------;
; Beep ;
;----------------------------------------------------;
Beep:
mov [Hz],0x200 ;Call this function, for beep
call Sound
call DeLay
call NoSound
ret
;----------------------------------------------------;
; Sound ;
;----------------------------------------------------;
Sound:
mov bx,[Hz]
mov ax,0x34dd
mov dx,0x0012
cmp dx,bx
jnc Done1
div bx
mov bx,ax
in al,0x61
test al,3
jnz A99
or al,3
out 0x61,al
mov al,0xb6
out 0x43,al
A99:
mov al,bl
out 0x42,al
mov al,bh
out 0x42,al
Done1:
ret
;----------------------------------------------------;
; NoSound ;
;----------------------------------------------------;
NoSound:
in al,0x61
and al,11111100b
out 0x61,al
ret
;----------------------------------------------------;
; DeLay ;
;----------------------------------------------------;
DeLay:
mov cx,[ms1]
jcxz A2
A1:
call DeLaYoneMS
loop A1
A2:
ret
;----------------------------------------------------;
; DeLaYoneMS ;
;----------------------------------------------------;
DeLaYoneMS:
push ecx
mov cx,[OneMS]
B1:
loop B1
pop ecx
ret
OneMS dw 40000
Hz dw 0
ms1 dw 1000
Or if you want something much easier (in my opinion) you can use the Bochs Graphics Adapter (can be found on the wiki). It might not be what you're looking for but it still allows you to change video resolutions and draw pixels like you would with most other ways of accessing graphics.quanganht wrote:Is there any way to use VESA without returning to Unreal mode?