The man page needs to explain what it needs to explain,
and nothing more.  What you are talking about below is beyond the scope
of the page.

ropers <rop...@gmail.com> wrote:

> Thanks for your reply.
> 
> On 13/08/2021, Theo de Raadt wrote:
> > The vga(4) manual page takes no position on these details.
> 
> This is true.  That's why the man page is TECHNICALLY correct.
> However, as currently put, it is also sufficiently misleading to have
> convinced multiple readers and Wikipedia editors that a naive
> arithmetic of the 80x25 standard VGA text mode with its 8-bit wide
> character definitions should yield 640 horizontal pixels (but it
> doesn't, because of each character's mode-inserted ninth column).
> 
> You're quite right, THEY'RE jumping to conclusions, and man 4 vga does
> not state what the screen's pixel resolution is.
> That said, the vga(4) man page gives the uninformed and unaware plenty
> of rope to hang themselves with.
> 
> This is what I propose addressing, but since I don't understand all
> the listed modes particularly well, I'm asking for help.
> 
> 
> Instead of:
> "Characters are 8 x 16 pixels large, and a font consists of 256 characters",
> would it suffice to say:
> "8x16-font characters are rendered in 9x16-pixel cells, and a font
> consists of 256 characters"?
> 
> Or alternatively (and with context) maybe this?
> "This is the standard VGA text mode with 80 columns and 25 rows. 16
> different colors can be displayed at the same time. Characters are
> defined in 8 x 16 fonts, but rendered in 9 x 16px cells, with an
> standard VGA adapter-inserted ninth column, for a total screen
> resolution of 720 x 400px.  A font consists of 256 characters."
> 
> Too clumsy?  Can anyone do better?
> 
> 
> There's also the issue that a (potentially misleading) character size
> description shows up four times on the man page (the other four modes
> that don't mention one are the corresponding -bf variants).
> But I'm not actually sure if those modes that are not the standard VGA
> text mode really use 9 or 8-pixel wide cells.  I certainly would not
> want to change vga(4) from correct but misleading to wrong!
> 
> 
> It appears the misleading language is originally from NetBSD.  It
> looks like an earlier version of the vga(4) man page was present in
> NetBSD 1.4 (released May 1999)[0], from whence it found its way to
> OpenBSD 2.9 (released June 2001)[1].  The odd 40- and 24-line modes
> were also added in NetBSD, sometime between 1.4 and 1.5.
> I'm still unclear on which of these non-standard modes are 720px and
> which are 640px wide.  But since I couldn't figure out where to look
> for enlightenment from source code, I did some practical experiments.
> 
> The results were interesting:
> 
> First I did some pixel-counting on an old OpenBSD laptop, and it
> seemed there were only 8 columns per cell, so I wondered, am I taking
> crazy pills?  Then I hooked that laptop up to an external VGA monitor
> that can tell you the resolution via an On-Screen Display.  I am not
> taking crazy pills, but it seems proper VGA support is on the wane.
> * When that laptop first boots its BIOS, its text mode is actually not
> the standard VGA text mode, but an approximation using 8x19cells, and
> though the monitor identifies the mode as 640x480/60Hz, it's actually
> 640x475, as the 5 lines at the bottom remain black, and so you get
> some kind of 80x25 text mode.
> * As soon as OpenBSD's first-stage biosboot(8) has control, the laptop
> switches to the real standard VGA text mode, i.e. 720x400/70Hz with
> 9x16cell 80x25; the real McCoy, the whole nine yards, the complete
> enchilada.
> * Once wsdisplay0 loads, the mode changes again; probably to something
> hi-rez or other.
> 
> The long and the short of it is that, yes, vga(4) DOES in fact default
> to the real standard VGA text mode that's been around for donkey's
> years.  WITH nine-column character cells.  WITH 720x400px.
> 
> I noticed that while I could switch the display from the laptop's
> screen to external VGA, I could not mirror it until wsdisplay0 was up.
> That's normal.
> Far weirder though was that if I switched back to the built-in screen
> while at the boot> prompt, the laptop rendered the text in that weird
> 640x475 mode again.  Change to the external monitor again, and its VGA
> output is the entirely default and correct 720x400 mode.  Of course
> some laptop's quirks don't have too much to do with OpenBSD, but what
> has something to do with OpenBSD is understanding what resolution
> these eight vga(4) modes actually are. I'm certain about the default
> 80x25 mode now.
> I would need to look into wsconscfg(8) etc. to figure out the rest,
> but that's for another day; I've gone on long enough.
> 
> But any input, any assistance to make this actually yield an
> improvement would be very welcome!
> 
> In the end of the day, I don't want some Wikipeejit to blame OpenBSD
> for their mode-ical misinformation: "But they said...", yadda, yadda,
> yadda.
> 
> Thanks and regards,
> Ian
> 
> (Ian Ropers)
> 
> [0] https://man.netbsd.org/NetBSD-1.4/vga.4
> 
> [1] https://man.openbsd.org/OpenBSD-2.9/vga.4
>     c.f. https://www.openbsd.org/plus29.html
> 
> 
> > ropers wrote:
> >
> >> 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
> >>
> >

Reply via email to