Graphics

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
tera4d
Member
Member
Posts: 37
Joined: Sun Apr 26, 2009 11:22 am

Re: Graphics

Post by tera4d »

Yes i have enabled the A20 gate so i was quite surprised that it wouldnt work.
I mean i can draw in the whole width. but on the lengt (768..) i can only draw about 32 pixels from the top of the screen.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Re: Graphics

Post by Dex »

Here some things to try:
1. First make sure you have the 4 in the mode number.
2. Make sure the A20 code works, as some snips of code, do not work on some PC.
This code works on most

Code: Select all

;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;
;                                     enable  A20 line                                         ;
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;

enable_A20:
	pusha
	cli				       ; Disable all irqs
	cld
	mov   al,255			       ; Mask all irqs
	out   0xa1,al
	out   0x21,al
l.5:	in    al,0x64			       ; Enable A20
	test  al,2			       ; Test the buffer full flag
	jnz   l.5			       ; Loop until buffer is empty
	mov   al,0xD1			       ; Keyboard: write to output port
	out   0x64,al			       ; Output command to keyboard
l.6:	in    al,0x64			       
	test  al,2
	jnz   l.6			       ; Wait 'till buffer is empty again
	mov   al,0xDF			       ; keyboard: set A20
	out   0x60,al			       ; Send it to the keyboard controller
	mov   cx,14h
l.7:					       ; this is approx. a 25uS delay to wait
	out   0edh,ax			       ; for the kb controler to execute our
	loop  l.7			       ; command.
	;sti
	popa
	ret
To test if it is the A20 code not working, set it to a lower res say 800x600 and see if this write to more of the screen.
Ps : Call the A20 function in realmode.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Graphics

Post by Combuster »

The pixels you can see looks equivalent to 64K of data (1024x768, 16 colors, 32 rows 1024*2*32=65536) - looks like you are using banking and neglect to *change* banks? Have you properly gotten the LFB offset, and set a LFB mode?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
tera4d
Member
Member
Posts: 37
Joined: Sun Apr 26, 2009 11:22 am

Re: Graphics

Post by tera4d »

@Dex:
I will try that but i really did enable the a20 later on instead of the bootloader though.
So ill replace my current one with this one and ill see what happens.

@Combuster:
Well to be honest :oops: I really do not know what i am using hehe
This is my first try at a graphical video mode (vesa) so i dont know how or what could you please explain that banking to me? And then a question right away if i use banking and later on (maybe *not going to happen xD*) have a window manager how would i draw to the whole screen? if i have to change between banks with a window while dragging it that would take up to much cpu right? But what about banking? Now i write to the video memory at 0xA0000
So how could i switch to another part? That banking is really vague to me could you please clarify it?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Graphics

Post by Combuster »

"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Locked