VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

Anyone knows the exact difference between VGA's mode 7h and modes 0-3h? Modes 0-3h seem to be giving correct output (at least display wise, all characters turn out fine, including the 40x25 mode 8088 MPH returns to after execution, except it's jumping left and right every row, like the rows are being moved left and right half a row each time a new row is added. Is it maybe messing with the display RAM start address register?).

Only mode 7h gives:
- Wrong colors? It doesn't seem to use the correct pallette or pallette entries (Attribute Controller / DAC colors)
- Problem with the row size (The Offset register, CRTC index 13h)? Either this has the wrong value, or the Byte/Word/DWord mode is set wrong (unlikely, because sequential characters give correct input without gaps or wrong/duplicated(x2/x4) characters horizontally)?
- Horizontal CRTC display characters is used incorrectly? If it only displays half the horizontal characters at half rows (40 characters instead of 80 characters, as in this case), would it generate this display?

Old screen capture (but still relevant):
download/file.php?id=21902&mode=view

Anyone knows what's exactly being done here? It's the verification screen of the checkit diagnostics program mode 7h.

Edit: Here's the dump of the VGA registers (See FreeVGA documentation for the official documented register order. It also contains the undocumented VGA registers in the dumps):

Filename
vga_dump20160314_1208.zip
File size
8.93 KiB
Downloads
80 downloads
File comment
Dump of the registers and VRAM content displaying the screen capture.
File license
Fair use/fair dealing exception

Edit: Changed the upload and application to include two bitmap files in the dump containing the DAC table (as a 16x16 grid of 16x16 squares representing the color of each pallette entry).

The VGA_DAC.bmp contains the DAC colors itself in the same format as https://upload.wikimedia.org/wikipedia/common … borders.svg.png .
The VGA_ATT contains the Attribute Controller translations according to the following format:
Font pixel, background pixel, font pixel, background pixel etc., so interleaved font/background pixels for each entry horizontally.
The top half of the image are the colors when the blink status of the VGA is off, The second half is when the blink status is on (cursor displayed).
Each of the half of the image contains 256 color entries that can be translated from VRAM(8-bit color index, whose format is dependant on the 8-bit color mode being set or other pallette settings combined with a 4-bit color index(4-bit pallette entry value, bit 6-7 setting, bit 4-5 setting to form the 8-bit lookup value in this table)).

The current mode is a text mode, so it should use the normal 4-bit value combined with 4-5 setting and/or bit 6-7 setting for the lookup (which it looks like it doesn't use those), thus resulting in DAC entries 0, 0x8 and 0x18 for the four colors to display(with attribute 0x8 using DAC entry 0).

The colors in the pallette seem a bit strange though. Anyone can confirm this pallette?

Last edited by superfury on 2016-03-16, 00:01. Edited 2 times in total.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 2 of 58, by Scali

User metadata
Rank l33t
Rank
l33t

VGA is not fully register compatible with CGA.
Running CGA-specific code on VGA reads to undefined results. Different VGA cards will respond differently.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 3 of 58, by superfury

User metadata
Rank l33t++
Rank
l33t++

It's being set with a IBM VGA BIOS loaded in the ROM at address 0xA0000 (as far as I know), which should be called by the application to set the mode? It's Checkit Diagnostics.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 4 of 58, by reenigne

User metadata
Rank Oldbie
Rank
Oldbie

When 8088 MPH exits, it leaves all the registers as they should be for normal CGA BIOS mode 1. But since it messes with CRTC registers (in particular the start address) it may very well confuse VGA cards.

I haven't looked at the dump you provided but I have previously analyzed all IBM's register tables for CGA, MDA, PCjr, EGA and VGA.

I see the offset register being programmed with 0x28 for both 350 and 400 scanline variants of mode 7 (same as for modes 2 and 3). This is correct since the CRTC is in word mode (4 bytes of memory data per CRTC offset unit). And indeed bit 6 of CRTC mode control register 0x17 is 0 for all these modes. Horizontal display enable end is 0x4f for all variants of modes 2, 3 and 7, so that's not it either.

You'd expect to see wide characters like that if the pixel clock is halved with bit 3 of the clocking mode register, but the VGA tables have 0 for that in all variants of modes 2, 3 and 7.

The internal palette registers for mode 7 are all set to 0, 8, 0x10 and 0x18 for monochrome emulation. Perhaps the external palette is set up differently for this mode? Or the color select register (attribute controller register 0x14) - these aren't in the main register tables.

Reply 5 of 58, by reenigne

User metadata
Rank Oldbie
Rank
Oldbie

Oh, I just looked at your dumps and they are not what they assumed I would be.

Whatever set these values, it does not seem to be the normal IBM VGA BIOS setting the mode to 7. CRTC register 1 is 0x27, but the IBM VGA BIOS sets it to 0x4f if its tables are to be believed.

Reply 6 of 58, by superfury

User metadata
Rank l33t++
Rank
l33t++

I'm using the IBM VGA BIOS downloaded from the PCE PC emulator at http://www.hampa.ch/pce/index.html . The description says "IBM VGA BIOS (1986-10-27)". The ROM itself says:

 (C)COPYRIGHT IBM Corp. 1984, 1986 10/27/86U.

(typed manually since XVI32 won't copy it and notepad won't display it (just displays chinese characters for the entire file).

I'll try the ROM from the http://minuszerodegrees.net/ ROM dump (Dumped by Great Hierophant ?). Although looking at the start at 8KB inside the ROM it seems to be the same ROM?

Edit: It seems to be missing it's required data, so it isn't working?
Edit: Retrying by removing the first 8KB to make the BIOS see it...

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 7 of 58, by Scali

User metadata
Rank l33t
Rank
l33t

VGA was introduced in 1987.
The 1984, 1986 datecode seems to me like this is an EGA bios.
In 1986 you could have a preproduction VGA card at best, and in 1984 they were still working on EGA.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 8 of 58, by superfury

User metadata
Rank l33t++
Rank
l33t++

So I can find two ROMs that mostly work, which claim to be a 'IBM VGA ROM' dump, but won't work fully (only mode 7h fails, all other modes are correct). I still need to find myself a valid VGA ROM which will work on a 80186 with the correct mode setting. Anyone?

Edit: Just tried the internal emulator 'BIOS', which is based on Dosbox's int10 handler. It seems to work partially (although the graphics modes show no text below and around the image being tested for some reason). It also won't even test mode 7h (just skipping it altogether). Other text modes work without problems.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 10 of 58, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've ran the full range of video tests of CheckIt Diagnostics. So far there's two modes failing in my emulator: Mode 7h (see earlier image) and mode 0xF (EGA MONO). Mode 0xF simply results in a black screen instead using those BIOSes.

Is there any other emulator which emulates a IBM VGA to test this with?

Edit: Just tested the software with the online emulator at:
http://www.pcjs.org/disks/pc/windows/3.10/

It gives 100% the same results as my emulator (except the colours being a brighter/darker at some points). So this would mean that either both are invalid, or the program is buggy when using those modes with the IBM VGA? Anyone has a IBM VGA to verify this with?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 11 of 58, by reenigne

User metadata
Rank Oldbie
Rank
Oldbie

The VGA ROM I have has the same (1986) copyright string. The EGA one I have has a 1984 copyright. Nothing mysterious about the copyright date being before the release date of adapter (though it being after would be strange). The CRC32 checksums of the ROMs I have are:
2f2fbc40 ibmega.rom
6c12d745 ibmvga.rom

It might be interesting to know the address of the code that sets CRTC register 1 to 0x27, and what the stack and registers look like that point. Then we can see if it's the user application or the BIOS that's setting that value, and how it got to that point.

Btw, forgetting CheckIt Diagnostics for a moment, what happens if you just set mode 7 from the DOS prompt by writing a tiny .com file that just does "mov ax,7 / int 0x10 / ret"?

I also wonder if the IBM VGA BIOS will set mode 7 correctly if it's not in mono mode (i.e. if it detects a colour monitor). I remember having some trouble with my IBM VGA card a while back refusing to set colour modes because it couldn't detect my monitor and was configuring itself for mono operation.

Reply 12 of 58, by superfury

User metadata
Rank l33t++
Rank
l33t++

When compressing the VGAROM.bin in a ZIP file I'm using I end up with a CRC-32 (According to Windows) of 6C12D745.

I'm now using debug.com to assemble a little .COM file to execute the mov ax,7 int 0x10 ret (or rather instead of ret, using mov ax,4c00 int 21?).

Edit: Just written the file and executed it (which works) using debug.exe:

-a
mov ax,7
int 10
int 20

rcx
7
nmodemono.com
w
q

Finally, executing modemono.com results in a low-resolution 40x25 text display, just like as 8088 MPH finishes.

Edit: Running the same program using the internal default BIOS (An adjusted Dosbox int10h handler-based BIOS used by the emulator) does result in the proper 80x25 mode. Checkit, however won't execute the mode 7h check it it (it's running booted with a virtual monochrome monitor attached using the emulator settings).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 14 of 58, by superfury

User metadata
Rank l33t++
Rank
l33t++

I do remember putting support for reporting monochrome monitor using one of the Input Status registers or Feature Control register, but I seem to have removed it for some reason(because it was incorrect?).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 15 of 58, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

To set a monochrome mode (07h or 0Fh) with the IBM VGA BIOS it is necessary for the BIOS installed equipment word at 40h:10h to indicate mono, but if color is indicated then mode 1 will be set instead. The MODE program included with DOS performs the change of the equipment word as required (e.g. MODE CO80 or MODE MONO). It seems that many clone VGA cards do not bother with this check, and so are not 100% IBM compatible.

Reply 16 of 58, by Scali

User metadata
Rank l33t
Rank
l33t
reenigne wrote:

Nothing mysterious about the copyright date being before the release date of adapter (though it being after would be strange).

Well, I think for a VGA BIOS, a date of 1984 is suspicious. I think the answer is that they may have based the VGA BIOS on the EGA one.
And a copyright date being after the release of a piece of hardware is certainly possible. For example, the XT was released in 1983, but there have been a few BIOS updates, so you can encounter BIOSes with a date of 1986.
So I wouldn't be surprised to find EGA or VGA cards with a newer BIOS than the initial release date either.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 17 of 58, by Jepael

User metadata
Rank Oldbie
Rank
Oldbie

The mode 7h does not just set palette to monochrome, it also makes the attribute byte not to indicate foreground/background colors but blinking, underlining and high intensity instead to be MDA compatible.

AFAIK, whether VGA is made to emulate CGA or MDA attributes, the information is found in Attribute Controller register 10h, bit 1.

Reply 18 of 58, by superfury

User metadata
Rank l33t++
Rank
l33t++

So what's the effect of bit 1 of the attribute controller register 10h? It's just a bit called MonochromeEmulation in my emulator (unhandled in my emulator). What is it's effect supposed to do exactly (which isn't already handled in other settings in the attribute controller registers)? The blink enable bit is already processed.

According to the FreeVGA documentation:

MONO - Monochrome Emulation

This field is used to store your favorite bit. According to IBM, "When this bit is set to 1, monochrome emulation mode is selected. When this bit is set to 0, color |emulation mode is selected." It is present and programmable in all of the hardware but it apparently does nothing. The internal palette is used to provide monochrome emulation instead.

All other bits (except the unknown bit 4) are already emulated.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 19 of 58, by superfury

User metadata
Rank l33t++
Rank
l33t++

Anyone can tell me what the exact effect of bit 1 of the attribute controller mode control register is? Blinking is already handled in another bit of that register(bit 3), Underline is handled by the CRT Controller's Underline location register (higher than max scanline minus 1 is disabled). The colors to use are handled in the attribute controller registers 0x0-0xF combined with other settings (like bit6-7 and bit4-5 settings in the attribute controller).

So what exactly does the setting of bit 1 being 1 change about the attribute, that isn't already handled by other parts of the VGA registers?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io