Problem setting vesa text mode

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.
trolly
Member
Member
Posts: 52
Joined: Tue Mar 25, 2008 12:26 pm

Post by trolly »

and without bios?
User avatar
gzaloprgm
Member
Member
Posts: 141
Joined: Sun Sep 23, 2007 4:53 pm
Location: Buenos Aires, Argentina
Contact:

Post by gzaloprgm »

and without bios?
Read Stevo14 post in this same thread :P

Cheers,
Gonzalo
Visit https://gzalo.com : my web site with electronic circuits, articles, schematics, pcb, calculators, and other things related to electronics.
trolly
Member
Member
Posts: 52
Joined: Tue Mar 25, 2008 12:26 pm

Post by trolly »

i made like stevo14 but it has a problem,

when i put something to the screen, it look like if the both fonts (8x8 and 8x16) are drawed:

Image

can you help me?
User avatar
Stevo14
Member
Member
Posts: 179
Joined: Fri Mar 07, 2008 3:40 am
Location: Arad, Romania

Post by Stevo14 »

trolly wrote:i made like stevo14 but it has a problem,

when i put something to the screen, it look like if the both fonts (8x8 and 8x16) are drawed:

...image...

can you help me?
I am actually working on this right now. The code works fine in Bochs but Qemu and real hardware don't like it. (qemu won't change the font and real hardware does exactly what is in the picture)

Maybe someone with more experience with VGA programming could help? All I did was move the values out of the array (and give them names based on some VGA documentation). I'm still learning what all of those values actually do. :?
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Post by xyzzy »

trolly: Go back to your other thread, and READ what I posted.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Post by jal »

Stevo14 wrote:
trolly wrote:when i put something to the screen, it look like if the both fonts (8x8 and 8x16) are drawn
I am actually working on this right now. (...) Maybe someone with more experience with VGA programming could help?
It looks like you didn't set the correct planes enabled. When enabling all four planes (needed for writing the font to the memory, or at least plane 2) and forgetting to set it back to planes 0 and 1 only, this may be the result. However, Bochs also doesn't display it correctly in that case.


JAL
User avatar
Stevo14
Member
Member
Posts: 179
Joined: Fri Mar 07, 2008 3:40 am
Location: Arad, Romania

Post by Stevo14 »

Good news: It works in Bochs and real hardware now! :)

I actually followed the link that AlexExtreme provided in this -> http://www.osdev.org/phpBB2/viewtopic.php?p=122751 <- thread. I made sure that all of the registers matched and that I was correctly saving and restoring the vga's state before and after changing the font.

I will update the code in my earlier post to reflect the changes... [done]
Last edited by Stevo14 on Thu Mar 27, 2008 7:24 am, edited 1 time in total.
trolly
Member
Member
Posts: 52
Joined: Tue Mar 25, 2008 12:26 pm

Post by trolly »

sorry, but i get the same problem,it look like the 2 font are interlaced
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Post by jal »

trolly wrote:sorry, but i get the same problem,it look like the 2 font are interlaced
So what problems are you experiencing exactly? I really don't know what you and Stevo14 are trying to do. Take a look at the Video.cpp I attached in an earlier post, as that includes a working font set routine that does not use the BIOS.


JAL
trolly
Member
Member
Posts: 52
Joined: Tue Mar 25, 2008 12:26 pm

Post by trolly »

exactly the problem is:

when i set the new font , i copy it to the address 0xa0000 and says the controler to use it.
with bochs, it work, but with real hardware, the controler display the both fonts (old and new) and the effect is that the both fonts are interlaced

iv read in the freevga site:
The VGA's hardware provides for two banks of 256 character bitmaps to displayed simultaneously
; so i think that i must stet the both character set select (A and B) to the same address bu i dont know how

this is my code in macro asm:

Code: Select all

SetFont:
		outportb SEQ_ADDR, SEQ_I_MAPMASK
		inportb  SEQ_DATA
		mov [old_mapmask],al
		outportb SEQ_DATA, 0x4		;// select plane 2 (font plane)

		outportb SEQ_ADDR, SEQ_I_MEMMODE
		inportb  SEQ_DATA
		mov [old_memmode],al
		outportb SEQ_ADDR,0x6

		outportb SEQ_ADDR, SEQ_I_CHARMAP
		outportb SEQ_DATA,0x00		;//font a and b are mapped to zero

		outportb GFX_ADDR,GFX_I_MISC
		inportb GFX_DATA		
		mov [old_gfx],al
		outportb GFX_ADDR,GFX_I_MISC
		outportb GFX_DATA, 0x00		;//disable odd/even
		
		mov [i],0x0
		mov [buff],font_data
		mov [vidmem0],0xa0000
		.for_i:
		cmp [i],256
		jnb .next_i
			copy_user_to_mem [buff],[vidmem0],line_height	;
		add [vidmem0],32
		add [buff],line_height
		inc [i]
		jmp .for_i
		.next_i:
		outportb SEQ_ADDR, SEQ_I_MEMMODE
		outportb SEQ_DATA, [old_memmode]

		outportb SEQ_ADDR, SEQ_I_MAPMASK
		outportb SEQ_DATA, [old_mapmask]

		outportb GFX_ADDR, GFX_I_MISC		;// restore old gfx misc settings
		outportb GFX_DATA, [old_gfx]

		outportb GFX_ADDR, GFX_I_MODE
		outportb GFX_DATA, 0x10

		outportb GFX_ADDR, GFX_I_BITMASK
		outportb GFX_DATA, 0xff
ret
[/code]
User avatar
Stevo14
Member
Member
Posts: 179
Joined: Fri Mar 07, 2008 3:40 am
Location: Arad, Romania

Post by Stevo14 »

jal wrote: I really don't know what you and Stevo14 are trying to do.
We were merely experiencing the same problem. My problem is fixed, trolly's isn't.

trolly: That asm stub will point character set a and b to the same address. Specifically this part:

Code: Select all

 
outportb SEQ_ADDR, SEQ_I_CHARMAP
outportb SEQ_DATA,0x00      ;//font a and b are mapped to zero 
Go here http://www.osdever.net/FreeVGA/vga/seqreg.htm and find the register called "Character Map Select Register". This should make everything clearer.
trolly
Member
Member
Posts: 52
Joined: Tue Mar 25, 2008 12:26 pm

Post by trolly »

Stevo14 wrote:
jal wrote: I really don't know what you and Stevo14 are trying to do.
We were merely experiencing the same problem. My problem is fixed, trolly's isn't.

trolly: That asm stub will point character set a and b to the same address. Specifically this part:

Code: Select all

 
outportb SEQ_ADDR, SEQ_I_CHARMAP
outportb SEQ_DATA,0x00      ;//font a and b are mapped to zero 
Go here http://www.osdever.net/FreeVGA/vga/seqreg.htm and find the register called "Character Map Select Register". This should make everything clearer.
in this site , he says that :
000b -- Select font residing at 0000h - 1FFFh
also why do you copy the font to 0xa0000 and not 0x0000?
User avatar
Stevo14
Member
Member
Posts: 179
Joined: Fri Mar 07, 2008 3:40 am
Location: Arad, Romania

Post by Stevo14 »

trolly wrote: in this site , he says that :
000b -- Select font residing at 0000h - 1FFFh
also why do you copy the font to 0xa0000 and not 0x0000?
0xA0000 is the start of video memory AFAIK.
The values on that site are offsets from the beginning of video memory.
So by setting the "Character Map Select Register" to all zeros, you are telling the VGA card that both font A and B will start at (the beginning of video memory + the offset that we put in the register), which means they will start at 0xA0000.
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

He doesn't want to use BIOS (INT 10h)... :?
trolly
Member
Member
Posts: 52
Joined: Tue Mar 25, 2008 12:26 pm

Post by trolly »

ok i unterstand.
maybe the problem is that the sequencer copy only One byte on Two :?
Post Reply