Page 3 of 3
Posted: Fri Mar 28, 2008 5:23 am
by Combuster
trolly wrote:000b -- Select font residing at 0000h - 1FFFh
also why do you copy the font to 0xa0000 and not 0x0000?
trolly wrote:maybe the problem is that the sequencer copy only One byte on Two
Why do I get the idea you have no clue as to how a VGA's video memory works? There have been links posted to freevga all over the place already. I'll just add:
VGA Hardware
The VGA has four banks, each have 64k of memory. In alpha mode, the first bank holds the character, the second the color. The third bank contains the font, but due to the addressing mode (odd/even), it can't normally be written. You have to change the settings of the GC (which is responsible for transferring data between the CPU and video memory) to get access to this bank. After that, you are free to load any font. Next, you should restore the original mode to have text draw normally.
If after properly reading all the material thrown at you, this still sounds like abracadabra to you, try Mode 13 programming, then Mode-X programming first. That way you get access to video memory as it really is, so you can develop a sense for how things work. Also in a graphics mode you can visually check what's currently in video memory, whereas in alpha mode you don't have that direct mapping.
It's hardly ever right to copy code of which you do not understand how it works...
Posted: Fri Mar 28, 2008 10:22 am
by trolly
i was carry about that, i think i've selected the correct modes and after copying the new font, i restored the register to theirs originals values
now it work with qemu And bochs, but not with real hardware. the font are like interlaced.
i show you a picture to illustrate the problem:
its a example with the "A" character. in left is the original font, in middle is the 8x8 font, and in right is the displayed font. you can see that the 2 firsts fonts are mixed
ps: i dont stupidly copy the code without trying to unterstand it. i look everywhere the information to know how it work, i spend all my night to figure out how i can resolve my problem, i'll get mad
Posted: Sat Mar 29, 2008 12:11 am
by trolly
houraaa, i get it working
finaly i got the idea to use the code from a bios and i use the code from vgabios used in quemu and bochs:
for setting graphic and sequencer registers
Code: Select all
get_font_access:
outportw SEQ_ADDR,0x0100
outportw SEQ_ADDR,0x0402
outportw SEQ_ADDR,0x0704
outportw SEQ_ADDR,0x0300
outportw GFX_ADDR,0x0204
outportw GFX_ADDR,0x0005
outportw GFX_ADDR,0x0406
ret
for restoring the state of the graphic and sequencers register
Code: Select all
release_font_access:
outportw SEQ_ADDR,0x0100
outportw SEQ_ADDR,0x0302
outportw SEQ_ADDR,0x0304
outportw SEQ_ADDR,0x0300
inportb VGA_MISC_R
and al,0x01
shl al,2
or al,0x0a
mov ah,al
mov al,0x06
outportw GFX_ADDR,ax
outportw GFX_ADDR,0x0004
outportw GFX_ADDR,0x1005
ret
and finaly the main code to load the font
Code: Select all
load_text:
call get_font_access
mov esi,font_data ;offset source in the flat memory
mov edi,0x0 ;offset destination in the graphic segment
call copy_font ;copy_font set a segment begining at 0xa0000
call release_font_access
call set_scan_lines
ret
Posted: Mon Mar 31, 2008 12:57 pm
by jal
trolly wrote:now it work with qemu And bochs, but not with real hardware. the font are like interlaced.
That's really weird. One would expect it having to do with some write mode, but then you'd have to read first, and besides I'd expect it to work correctly in Bochs as well. The only thing I can think of is some default value being different in Bochs than on your hardware.
ps: i dont stupidly copy the code without trying to unterstand it. i look everywhere the information to know how it work, i spend all my night to figure out how i can resolve my problem, i'll get mad :evil:
Good for you, that's the way to go.
JAL
Posted: Mon Mar 31, 2008 12:58 pm
by jal
trolly wrote:houraaa, i get it working
Congrats. You did check to see why this works and your code didn't, or?
JAL