Problems When Printing Using VESA

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.
Post Reply
User avatar
Nathan
Member
Member
Posts: 201
Joined: Sun Jul 19, 2009 1:48 pm
Location: Brazil
Contact:

Problems When Printing Using VESA

Post by Nathan »

Hello,
I'm reconstructing my Assembly OS(the first one that I've tried to do), but now using VESA modes. I'm doing all correct to use it, moving the value 4F02h to AX, then setting the new mode by moving the value 103h to BX and then calling the 10h interrupt to make the things happen, like this:

Code: Select all

[BITS 16]	 ; 16 bit code generation
[ORG 0x7C00]	 ; ORGin location is 7C00

	mov ax, 4F02h
	mov bx, 103h
	int 10h
	
	mov si, welcome
	call print_string
 
welcome db 'Welcome to My OS!', 0Dh, 0Ah, 0
 
print_string:
	lodsb		  ; grab a byte from SI
 
	or al, al  ; logical or AL by itself
	jz .done	; if the result is zero, get out
 
	mov ah, 0Eh
	int 10h		; otherwise, print out the character
 
	jmp print_string
 
.done:
	ret
 
	times 510-($-$$) db 0
	dw 0xAA55
But the problem is that when I execute it on Bochs, all that I got is some colored dots, near the middle of the screen:
Image

Then my questions are:
  • What is the problem?
  • What I need to do to solve it?
Best Regards,
Nathan Paulino Campos
Last edited by quok on Sun May 23, 2010 8:44 pm, edited 1 time in total.
Reason: Removed color tags (don't use colors, it's against forum rules!)
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: Problems When Printing Using VESA

Post by Creature »

Well, I don't see any colored dots on that screenshot.

AFAIK, you can't print strings when using VESA VBE graphics modes. You'll have to create your own ASCII font (or if you want to go further: implement a freetype library) and then plot the pixels on the screen one by one. What you're using is text mode character printing (which is designed ONLY for text modes, not for graphical modes).
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
User avatar
Nathan
Member
Member
Posts: 201
Joined: Sun Jul 19, 2009 1:48 pm
Location: Brazil
Contact:

Re: Problems When Printing Using VESA

Post by Nathan »

Creature wrote:Well, I don't see any colored dots on that screenshot.

AFAIK, you can't print strings when using VESA VBE graphics modes. You'll have to create your own ASCII font (or if you want to go further: implement a freetype library) and then plot the pixels on the screen one by one. What you're using is text mode character printing (which is designed ONLY for text modes, not for graphical modes).
They are there, but how could I do what you said?
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: Problems When Printing Using VESA

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 ]
User avatar
Nathan
Member
Member
Posts: 201
Joined: Sun Jul 19, 2009 1:48 pm
Location: Brazil
Contact:

Re: Problems When Printing Using VESA

Post by Nathan »

I've already read that, but I still don't know how to do it in Assembly. :cry:
User avatar
Teehee
Posts: 16
Joined: Fri Jan 15, 2010 11:22 am
Location: Brazil

Re: Problems When Printing Using VESA

Post by Teehee »

[en-us]
Hey Nathan, I think i dont understand your problem. I'm also making a OS and i'm having trouble with VESA 1280x1024 in PM mode. :(

[pt-br]
Ei Nathan, acho que não entendi seu problema. Eu também estou fazendo um SO e estou tendo problema com VESA, mas em resolução maior. E em Modo Protegido :(.

Vamos unir forças! rs Manda uma mensagem privada pra mim.
Sorry if bad english.
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: Problems When Printing Using VESA

Post by Combuster »

English only, please
"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 ]
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Problems When Printing Using VESA

Post by neon »

Hello,

Probably the easiest way (although I personally dont recommend it) is hard coding the pixels of the characters of your font. Then rendering a character in the font is a simple loop to render each pixel in the character bitmap.

This method begins with implementing a PlotPixel(x,y) routine and a routine to render a character bitmap. This should be easy to do.

(Also its VBE not Vesa, Vesa is the organization behind the VBE standard. Im considering putting this in my signature)
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Post Reply