Page 1 of 1

Text in graphics mode?

Posted: Tue Apr 10, 2007 4:49 pm
by Zenith
I'm currently coding my kernel, but when I switch to graphics mode, the text doesn't show.

Can anyone tell me what I'm doing wrong? And if possible, an alternative?

The code compiles in NASMW.

Code: Select all

jmp main

main:
	mov ah, 0	; Set new video mode
	mov al, 10h	; Video mode = 10h (80x25 with 16 colors)

	int 10h

	mov si,Kernel_Load
	call printstr

printstr:
	mov ah,0Eh	; Set to video teletype mode
 	mov bh,00h	; Page Number
	mov bl,0Eh	; Font colour

printnextchar:

	lodsb
	or al,al
	jz return

	int 10h
	jmp printnextchar

return:
	ret

Kernel_Load db 13,10,'Loading Kernel...',0
Thanks in advance,
Karekare0

Posted: Tue Apr 10, 2007 4:57 pm
by ~
If you really are entering into graphics mode, you will need much, much more than only copying bytes to video memory and hope it actually shows up its proper ASCII representations, and neither just using BIOS functions since you'll have to abandon them soon if you plan to enter intro protected mode.

Also, it will be incredibly difficult for you to keep up with graphics mode your kernel development, unless you are really skilled at that.

Anyway, try to copy the data to B800:0000 or A000:0000 RAM video locations, maybe they show up something, at least so you know where is your display memory.

Posted: Tue Apr 10, 2007 6:58 pm
by mystran
~ wrote: Anyway, try to copy the data to B800:0000 or A000:0000 RAM video locations, maybe they show up something, at least so you know where is your display memory.
Mmm.. that is not very helpful.

What is needed is a font, from which you then draw (in case of bitmap fonts, copy) the characters to the graphics mode screen. As long as you are in a text mode the VGA compatible adapter does this for you, but when you enter graphics mode, it's your problem to deal with such things.

Posted: Wed Apr 11, 2007 1:35 am
by Combuster
he is using the BIOS to do the text drawing for him. The idea is good, but i cant see from here why it does not work...

The difference with my own teletype function is that i'm reloading all of AX each iteration, so you can try that.

Some other things you might want to check are that BITS 16 is present, the ORG is set correctly and that the data registers are set to the appropriate values.

Also, some specification of hardware/VM could be helpful in diagnosing your problem.

Posted: Sun Apr 15, 2007 6:06 pm
by Zenith
Thanks for the help.

I figure out that bochs has a problem with calling a procedure then not doing anything else...

Posted: Sat Apr 21, 2007 2:12 am
by inflater
As long as you are in a text mode
Mode 10h is 640x350 graphics mode, compatible with EGA and VGA video adapters, with 4 (EGA) or 16 colors (VGA) supported.

inflater