Hacking Award BIOS to disable onboard video

Only for programmers and BIOS gurus with technical questions.
bc
New visitors - please read the rules.
Posts: 10
Joined: Mon Jun 28, 2004 7:59 pm

One trick might be to asap put the onboard vga card into MDA mode,
then initialize the PCI/etc card. If the onboard card does a good job of strictly emulating MDA, coexistence with another vga card should be no problem (port and memory IO wise).

If you can pre-initialize the onboard card into MDA mode (before the
system bios does its normal check/vga initialization), the bios *might*
try to do the right thing and initialize the pci card normally.
This involves calling the onboard vga bios first, setting MDA mode up (by a hack), then hoping the bios detects/calls your pci card's video bios.

It's weird that your system can run without video. I would guess some int10 modes like "get the cursor position" or "get video mode info" would get confused and cause programs to crash.
ruelnov
Master Flasher
Posts: 172
Joined: Tue Jun 08, 2004 2:11 pm
Contact:

bc:

I'm interested to try your idea. But can you please give some details how to set up MDA mode by a hack?
bc
New visitors - please read the rules.
Posts: 10
Joined: Mon Jun 28, 2004 7:59 pm

CALL FAR C000:0003
MOV AX,0007
INT 10
(now the default card is set to mda mode)
CALL FAR xxxx:0003
MOV AX,0003
INT 10
(pci card/bios is alive in ega)
...

Those last 3 lines are just for experimentation outside the bios, ie in dos.
I suppose nothing really prevents their inclusion. If so, however, this code listing would be more suitable *after* the onboard vga card is first initialized as we are brute force calling into the pci video card's bios.

xxxx is the location of the pci video card's bios we want.
Its my understanding that pci video bios's should be relocatable/runnable from any segment.

Some additional info (not qute the same thing but a similar problem):

http://groups.google.com/groups?hl=en&l ... 26tab%3Dwg

hth
ruelnov
Master Flasher
Posts: 172
Joined: Tue Jun 08, 2004 2:11 pm
Contact:

bc:

Let me clarify the hacking codes you suggested:
a) INT 10h function 07h is for Scroll Down/Clear Screen Rectangle, not for enabling MDA.
b) INT 10h function 03h is for Query Cursor Position & Size, not for EGA.

Please comment.

Also, I plan to incorporate your suggested hacking codes in the Onboard VGA ROM (which is called by original.bin via C000h:3) just before the retf instruction is invoked which gives control back to original.bin.

Do you see any problem if I do it that way? And would the desired results be achieved?

I'm more comfortable hacking the Onboard VGA ROM rather than original.bin because it can be easily extracted from the bios binary using Cbrom, and then re-inserted after modding, and then the final step would just be to reflash the BIOS. Besides, I can update the checksum of my Onboard VGA ROM to make it zero after the modding process.

By the way, the thread you referred above is very good. I was looking for these ideas also on how to enable/disable the read/write access protection for the VGA memory space in RAM.
bc
New visitors - please read the rules.
Posts: 10
Joined: Mon Jun 28, 2004 7:59 pm

Im using dos debug. I wasnt showing the byte swapped opcode, just the
program listing.
Anyway mov ax,0007 is indeed correct for setting mda mode. ah=0 al=7. Trace a simple program like the following and the registers match.
Sorry if this causes confusion.

B80700 MOV AX,0007
B700 MOV BH,00
B307 MOV BL,07
AX=0007 BX=0007 CX=0000 DX=0000 SP=FFEE BP=0000 ....

I would suggest doing all testing/prototypes in dos first before pulling apart the bios. But its really up to you.

My guess is you'll probably have to call c000:3 before the vga detection stuff (setting the card up in mda mode before it gets detected normally as vga), and possibly call again afterword (followed by the pci bios call as well) if things dont go well, ie the onboard card just resets back to vga.
ruelnov
Master Flasher
Posts: 172
Joined: Tue Jun 08, 2004 2:11 pm
Contact:

bc:

I have just finished dissecting my original.bin looking for the pci vga initialization routine, and found out that this routine is simply not there.

So there's no point in hoping that my pci vga would be initialized by the BIOS after we enable that MDA.

This means I really need to finish writing the pci vga initialization routine, then convert to ISA ROM together with the MDA enabling code.

Also, I've read several complete documentation of the BIOS INT 10h Function 03h & Function 07h, but did not find any reference to MDA/EGA for these 2 functions. I'm not trying to prove you wrong here, but this idea of yours on how to enable MDA must be an undocumented feature of INT 10h Function 03h.
Rainbow
The UniFlasher
Posts: 3122
Joined: Wed Mar 20, 2002 4:16 pm
Location: Slovakia
Contact:

bc is not talking about functions 3 and 7 but about function 0 - "set video mode". AH=0, AL=mode number. Mode 3 is standard color text mode, mode 7 is black&white mode.
Patched and tested BIOSes are at http://wims.rainbow-software.org
UniFlash - Flash anything anywhere
ruelnov
Master Flasher
Posts: 172
Joined: Tue Jun 08, 2004 2:11 pm
Contact:

That mda enabling trick did not work.

Anyway, I'm now at the finishing stage of this assembly coding project to initialize my PCI VGA. It took me long to figure out how to build the correct GDT Table for switching to 16-bit protected mode at late POST stage, esp. the routine that fixes the 32-bit linear base address of the GDT at runtime.

The completed routines that I've tested to work fine are as follows:
1. Programming the PCI-PCI bridge to gain access to the PCI VGA,
2. Enabling XROMBAR, I/O Space, and Memory Space,
3. Mapping the PCI-PCI bridge to RAM,
4. Building the Global Descriptor Table (GDT) and setting it up,
5. Switching to 16-bit Protected Mode to be able to point to the PCI VGA ROM address which is beyond the 1Mb limit of Real Mode,
6. Interrogating the PCI Slot for an installed VGA Card with a valid Video ROM signature.

So what needs to be done are the routines for copying the PCI VGA ROM to RAM, and then the Final PCI VGA Initialization Routine (which is simply a far call to xxxx:3 in memory where the PCI VGA ROM is copied to).
Post Reply