Page 1 of 1

Problems When Printing Using VESA

Posted: Sun May 23, 2010 8:35 am
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

Re: Problems When Printing Using VESA

Posted: Sun May 23, 2010 9:09 am
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).

Re: Problems When Printing Using VESA

Posted: Sun May 23, 2010 9:22 am
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?

Re: Problems When Printing Using VESA

Posted: Sun May 23, 2010 10:07 am
by Combuster

Re: Problems When Printing Using VESA

Posted: Sun May 23, 2010 12:41 pm
by Nathan
I've already read that, but I still don't know how to do it in Assembly. :cry:

Re: Problems When Printing Using VESA

Posted: Sun May 23, 2010 1:03 pm
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.

Re: Problems When Printing Using VESA

Posted: Sun May 23, 2010 1:05 pm
by Combuster
English only, please

Re: Problems When Printing Using VESA

Posted: Sun May 23, 2010 1:33 pm
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)