Thursday, August 12, 2021

man page correctness query re. man 4 vga

Privyet,

On man 4 vga, it says:

"This is the standard VGA text mode with 80 columns and 25 rows. (...)
Characters are 8 x 16 pixels large (...)."

To my understanding, that is borderline technically correct, but misleading:

A naïve calculation of the screen's pixel resolution from these data
would yield 640x400px. However, AFAIK, the VGA adapter still treats
text mode like the MDA adapter did[0], which means that though each
character's matrix is an eight pixel-wide bitmap (sometimes only seven
pixels are actually used), the adapter itself always renders a ninth
pixel for each text mode character (and scanline). Usually that pixel
is blank, but for characters C0h–DFh, it is a copy of what was in the
eighth pixel. This special-casing of characters C0h through DFh
(where horizontal box-drawing characters and the like are usually
located) can be turned off in VGA adapters[1], but is hardwired into
MDA cards. The long and short of it is that with a total of nine
pixel-columns being rendered for each character-column, the
pixel-resolution of the standard VGA text mode is 720x400, not
640x400, as some have naïvely calculated.

Why am I making noise about this, when the description on vga(4) is
TECHNICALLY correct?
Because I have noticed that ever since this edit[2], OpenBSD has been
cited at Wikipedia as evidence for the incorrect assertion that the
default VGA text mode was 640x400px. Evidently the editor in question
has made exactly the naïve (mis)calculation noted above. (By this
edit[3], the error had been propagated to the article's main text
modes table, leaving it further entrenched.)

I don't intend to get involved in correcting this at Wikipedia (which
would probably lead to a life force-sucking edit war), but it bothers
me that OpenBSD's man page appears to be misleading on this point.
Though the page actually cited is from OpenBSD 3.9, the same wording
is still present in 6.9 and -current, with minor differences in
formatting.


========================================================================
Would people here be able to confirm that I'm not myself mistaken in
what I'm saying? And could anyone suggest how to word an edit so as
to concisely clarify the point and make the vga(4) man page less
misleading? I'm not always good at being concise myself.
========================================================================


* I think the 80x25 & 80x25bf, as well as the 80x50 & 80x50bf modes
all are 720x400px. If the 80x25 mode in particular is not 720x400px,
then it is not the standard VGA text mode (as is claimed).

* The 80x40 & 80x40bf modes confuse me. It's unclear to me if they
render a ninth pixel-column and thus whether their screen width is 640
or 720. Arithmetically, 8x10px characters with an 80x40 text mode
ought to yield 640x400px, but the only information I could find is
here[4], and it suggests a display resolution of 640x480, which is
neither here nor there. It would make sense with two extra blank
scanlines per line of text, but then again, 480 instead of 400 could
be a typo. I'm also confused by these modes because I'm much more
familiar with 80x43 text modes and I'm low-key wondering whether 40
instead of 43 is an error. This page[5] makes no mention of an 80x40
text mode. I realise that is an altogether different project, but
still.
Second thought, I did find this[6], which suggests an 8x12px font for
an 80x40 text mode, but then, this is again an altogether different
project and may be nothing to do with OpenBSD's 80x40 text modes. I'm
just wondering how VGA-typical are those?

* If the only difference of the 80x24 & 80x24bf modes from their
25-line counterparts is the omission of the last row of text, then
maybe these are 720x384px? I really don't know though.

* I think the "bf" in the *bf modes is for "big font" or "bigger
font", but I could not find confirmation of that. Also, if I'm
reading this right, then it says under BUGS that these modes have not
been tested and won't work with a monochrome monitor. (It's a little
unclear to me how that's meant.)


I have tried looking at source code, but I don't really know where to
look, and at least in /src/sys/dev/ic/vga.c, I've not been able to
identify anything that specifies the correct size of the actual
default 720x400 VGA text mode, or that would account for the 9th
pixel-column in each character. I've not been able to use the source
to answer my own questions.

Any help or clarifications would be great appreciated.

Thanks and regards,
Ian

(Ian Ropers)


PS: Btw., can anyone elucidate the etymology of the "ic" in
/src/sys/dev/ic/? Is it because these devices all have integrated
circuits, or does the "ic" stand for something else?


[0] http://www.seasip.info/VintagePC/mda.html#memmap

[1] "LGA - Line Graphics Enable
This field is used in 9 bit wide character modes to provide continuity
for the horizontal line characters in the range C0h-DFh. If this field
is set to 0, then the 9th column of these characters is replicated from
the 8th column of the character. Otherwise, if it is set to 1 then the
9th column is set to the background like the rest of the characters."
--http://www.osdever.net/FreeVGA/vga/attrreg.htm#10

[2] https://en.wikipedia.org/w/index.php?title=VGA_text_mode&diff=950771231&oldid=950759222

[3] https://en.wikipedia.org/w/index.php?title=VGA_text_mode&diff=1022622974&oldid=1021428913#PC_common_text_modes

[4] https://opencores.org/projects/interface_vga80x40

[5] http://www.columbia.edu/~em36/wpdos/videomodes.txt

[6] http://javiervalcarce.eu/html/vhdl-vga80x40-en.html

No comments:

Post a Comment