Mail Archives: djgpp/1999/11/23/09:28:59
On 22 Nov 99, at 22:03, Chaos wrote:
>
> First, I'm wondering what is your "magic" video card. Secondly, I
have
> tested LFB method on my RIVA 128 (VESA 3.0). Using fprintf
didn't cause any
> sudden errors or screen garbage. The text was appearing right as
it supose
> to. I will do some more intensive test to ensure correctness. Eli
Zarestki
> (big thnx 4 that) also mentioned about checking no of columns
and rows in my
> specific mode(ScreenCols() and ScreenRows() functions),
640x480x256c - 0x101
> in my case. It turned out that there is 80 columns and 30 rows.
The number
> of rows can make some problems but I'm looking forward to solve
it.
>
First of all my "magic" card happens to be an ancient Cirrus Logic
GD5430 with 1MB video ram and it supports VESA 1.2 (BTW
Please don't laugh as I am prone to having heart attacks). To get
VESA 3.0 support I use UNIVBE.
Rather than using printf to draw text I think you should try to write
your own font drawing routines which directly write to memory. If
you want you can check out the allegro library for examples on
how it handles fonts.
The reasons for using Font drawing routines IMHO are,
1. When you draw a font you are directly writing to video memory.
printf on the other hand is much slooower because it generates an
interrupt (10h) which is intercepted by the DPMI server which
switches the CPU into real mode and generates the interrupt which
is handled by the BIOS which draws the text (BTW BIOS routines
are often very slow) afterwards the DPMI server switches the CPU
into Protected mode and your program resumes etc...
As you can see IMHO just a simple printf can take a lot of time
and instructions relative to a Font routine which draws the text
directly to screen.
And BTW I don't think it's possible to use printf to position text
exactly at certain x,y coordinate's on the screen (for ex if you want
to print some text starting at x=337 and y=108 how do you instruct
printf etc.. to do it? On the other hand a graphics mode based font
routine will have no problem as you can give the coordinates
directly to it).
So I think that although coding for a Font Drawing routine might be
harder it's worth it, because It will be faster than printf and it also
will be fully compatible with the graphics mode you are using.
Happy Hacking!
Kalum
- Raw text -