You are not logged in.


#1 2005-08-01 04:12:31

Nelson
Member
Registered: 2005-07-02
Posts: 35
PM

Fonts in VGA Mode

I know there has to be a better way instead of the method I'm using (which looks nasty)

Anyone have any ideas?

Offline

 

#2 2005-08-01 09:54:08

smiddy
Active member
Registered: 2005-02-15
Posts: 183
PM

Re: Fonts in VGA Mode

I haven't looked into VGA fonts yet, sorry, I'm no help. I think Dex may have done some though...


- [color=red]s[/color][color=blue]m[/color][color=red]i[/color][color=blue]d[/color][color=red]d[/color][color=blue]y[/color]

Offline

 

#3 2005-08-01 16:03:40

Dex4u
Active member
Registered: 2005-02-19
Posts: 132
PM

Re: Fonts in VGA Mode

Vga fonts never look great as the pixels are too big, you can make them look better by using lots of color, but you will never get small mode 13h fonts to look good.

I have code for vga fonts that use bits for each pixel (eg: 1 = a pixel, 0= space) which is smaller than your code, but would look the same.
here is the same fonts one in vga mode:
http://jas2o.forthworks.com/index.php?s … nshots#pic
and this one in vesa mode:
http://jas2o.forthworks.com/index.php?s … nshots#pic
one looks better, but it just the screen size the is differant.

So let me know if you want code.

Offline

 

#4 2005-08-01 19:43:55

Nelson
Member
Registered: 2005-07-02
Posts: 35
PM

Re: Fonts in VGA Mode

Doesn't look half bad, I reckon it's time to start VESA support in BOS then smile

Offline

 

#5 2005-08-01 20:13:54

Dex4u
Active member
Registered: 2005-02-19
Posts: 132
PM

Re: Fonts in VGA Mode

If you go here: http://board.flatassembler.net/topic.ph … p;start=50
and get "CdPod" the fasm code may help you with vesa port for BOS, as its only 512bytes.
Any ???, about vesa just ask ;-).

NOTE: I was called "ASHLEY4" when i wrote that code.

Offline

 

#6 2005-08-02 00:55:20

Nelson
Member
Registered: 2005-07-02
Posts: 35
PM

Re: Fonts in VGA Mode

Nice bit of code there, thanks.
I'll attempt this tonight, any documents on VESA?
Specificly plotting a pixel and stuff? Thanks.

Offline

 

#7 2005-08-02 11:29:52

Dex4u
Active member
Registered: 2005-02-19
Posts: 132
PM

Re: Fonts in VGA Mode

Once you have set vesa up you will find it as easy as vga modes to program for.
First you test for vesa (in realmode) and set it up like this:

Code:

mov   dword [VESAInfo_Signature],'VBE2'
mov   ax,4f00h   ; Is Vesa installed ?
mov   di,VESA_Info    ; This is the address of our info block.
int   10h

cmp   ax,004Fh   ; Is vesa installed ?,
jne   near NoVesa2    ; If not print a mesage & quit.

mov   ax,4f01h   ; Get Vesa Mode information.
mov   di,Mode_Info   ; This is the address of how info block.
mov   cx,0x4101   ; 4112h = 32/24bit ; 0x4101 = 8bit ;4111h = 15bit (640*480)
and   cx,0xfff
int   10h

cmp   dword [VESAInfo_Signature], 'VESA'
jne   near NoVesa2

cmp   byte [VESAInfo_Version+1], 2
jb    NoVesa2   ; VESA version below 2.0

The above code will test for vesa2 and set up 640x480 x 256color, or jump to error code to print a error message (error message is not included in the above code).
If the above code is sucessfull it fills out the "VESA_Info" and "Mode_Info".

Once in pmode to plot a pixel we do this

Code:

mov  edi,[ModeInfo_PhysBasePtr]   ; This is = to mov   edi,0xA0000 in vga
add  edi, 640*6    ; This is = to x = 0, y = 6
mov  al,0x09   ; Color of pixel
stosb   ; Put whats in al at es:edi

To fill the screen to white, we do this:

Code:

mov   edi,[ModeInfo_PhysBasePtr]       
mov   ecx,640*480   ; Size of screen
mov   al,0xff   ; This is for the color of one pixel
rep   stosb

NOTE: we could make the above code a little faster by doing this

Code:

mov   edi,[ModeInfo_PhysBasePtr]       
mov   ecx,640*480/4   ; Size of screen
mov   eax,0xffffffff    ; This is for the color of one pixel
rep   stosd

Here are some things to remember 1.  you should start like the above, but latter use off screen buffers, 2. if you use a 24bit mode some graphic cards use 24bit others use 32bit, you need to test for this and use differant code.
Also unless you can go to real mode or call realmode int's you will be stuck in the vesa mode you set up in realmode.
Hope this helps.

Offline

 

#8 2005-08-02 15:09:55

Nelson
Member
Registered: 2005-07-02
Posts: 35
PM

Re: Fonts in VGA Mode

That's suprisingly simple, thanks for that clarification! smile

Offline

 

 

Board footer

Powered by PunBB
BOS homepage © Copyright 2005 Christoffer Bubach
Strict XHTML and valid CSS.