Text in graphics 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.
Post Reply
User avatar
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Text in graphics mode?

Post 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
User avatar
~
Member
Member
Posts: 1228
Joined: Tue Mar 06, 2007 11:17 am
Libera.chat IRC: ArcheFire

Post 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.
User avatar
mystran
Member
Member
Posts: 670
Joined: Thu Mar 08, 2007 11:08 am

Post 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.
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
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:

Post 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.
"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
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Post by Zenith »

Thanks for the help.

I figure out that bochs has a problem with calling a procedure then not doing anything else...
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post 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
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
Post Reply