Skip to content

Fix a couple issues from the vgaonly PR #2424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 21, 2023
Merged

Fix a couple issues from the vgaonly PR #2424

merged 7 commits into from
Apr 21, 2023

Conversation

kcgen
Copy link
Member

@kcgen kcgen commented Apr 21, 2023

Fixes up a couple issues from the vgaonly PR:

  1. Allows config values to be deprecated with alternatives (that can be different than the default). For example:

    [dosbox]
    #   machine: The type of machine DOSBox tries to emulate ('svga_s3' by default).
    #   Possible values: hercules, cga, cga_mono, tandy, pcjr, ega, ...
    #   Deprecated values: vgaonly.

    Using a deprecated option warns:

    CONFIG: 'machine = vgaonly' is deprecated, falling back to the alternate: 'machine = svga_paradise'
    

    So now vgaonly is actually handled. Thanks @NicknineTheEagle for reporting this.

  2. Now draws all 400-lines (low resolution double-scanned) whenever it translates to a visible difference on the output side (code-comment has a more thorough explanation). Thanks @NicknineTheEagle for reporting this.

  3. Lets the user force 8-pixel-wide fonts for VGA machine types. Thanks @FeralChild64 for requesting this.

@kcgen kcgen added bug Something isn't working video Graphics and video related issues labels Apr 21, 2023
@kcgen kcgen self-assigned this Apr 21, 2023
@kcgen kcgen marked this pull request as ready for review April 21, 2023 09:08
Copy link
Contributor

@NicknineTheEagle NicknineTheEagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that fixed the problem for me. Low-res modes are now properly rendered with double lines (e.g. 320x200 appears as 640x400) when bilinear filtering is on.

@kcgen kcgen changed the title Fixup a couple issues from the vgaonly PR Fix a couple issues from the vgaonly PR Apr 21, 2023
@kcgen kcgen force-pushed the kc/vgamode-fixes-1 branch 3 times, most recently from a119047 to 16536a7 Compare April 21, 2023 15:32
@kcgen kcgen force-pushed the kc/vgamode-fixes-1 branch from 16536a7 to 83bc4fc Compare April 21, 2023 15:32
@kcgen
Copy link
Member Author

kcgen commented Apr 21, 2023

Thanks @dreamer and @johnnovak.
Comments addressed; will merge this when it gets through CI.

Copy link
Collaborator

@FeralChild64 FeralChild64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK, works correctly for me - thank you!

@kcgen
Copy link
Member Author

kcgen commented Apr 21, 2023

Looks OK, works correctly for me - thank you!

Thanks for the test, @FeralChild64 !

@kcgen kcgen merged commit 9c0f980 into main Apr 21, 2023
@FeralChild64
Copy link
Collaborator

Regarding the 8px vs 9px font, for completeness - explanation:

  • some VGA cards behaves as DOSBox Staging just before this PR
  • some have a proper 9px fonts (or can generate them by altering 8px fonts, I'm not sure)
  • some (laptops) behave as vga_8dot_font is enabled (or like DOSBox SVN)

@kcgen
Copy link
Member Author

kcgen commented Apr 21, 2023

That's an incredibly thorough explanation and investigation; thanks for that reference, @FeralChild64 !

@kcgen kcgen deleted the kc/vgamode-fixes-1 branch April 21, 2023 17:28
@johnnovak
Copy link
Member

johnnovak commented Apr 21, 2023

Nice link about the explanations @FeralChild64. The situation on laptops is being mentioned a couple of times, multiple people claim that they default to 8x16 fonts in 640px wide modes. That kinda makes sense if that matches with the native LCD res.

some VGA cards behaves as DOSBox Staging just before this PR

I'm asking again, do you have proof of this? Excluding the special laptop situation.The linked discussion does not say a word about such cards, and my understanding is all non-laptop VGA adapters use 9x16. VileR states the same thing here, and I think we can consider him an expert on DOS fonts.
https://int10h.org/blog/2019/05/fontraption-vga-text-mode-font-editor/

From the DOSBox Requirements section:

Set "machine" to "vgaonly" in your DOSBox config file, otherwise 9-dots-per-column mode (F8) is disabled. 9 dots is the default with real (S)VGA hardware, and in DOSBox's "vgaonly" mode, but the "svga"/"vesa" machines force all text modes to 8 for some reason.
If you REALLY want to, you can force Fontraption to allow 9-dot mode regardless of DOSBox's machine type, by pressing Ctrl+Alt+9. Just don't expect things to look right if you do that - this option exists in case DOSBox changes its behavior in the future, or for certain forks (like DOSBox-X) that control it with a separate config option.

Btw I realised you can use the Trident font if you load it with FONTEDIT in your global autoexec. That's a nice way to use any font from any card.

@johnnovak
Copy link
Member

@FeralChild64 I quite like these 9x16 VGA fonts, btw. All used in the default VGA text modes, as mentioned on their respective pages.

https://int10h.org/oldschool-pc-fonts/fontlist/font?phoenixvga_9x16

https://int10h.org/oldschool-pc-fonts/fontlist/font?ati_9x16

https://int10h.org/oldschool-pc-fonts/fontlist/font?toshibasat_9x16

@FeralChild64
Copy link
Collaborator

@johnnovak I think it got messed up a bit, so - we have 2 flavors of VGA fonts, 8x16 and 9x16, as on picture below:

Fonts


some VGA cards behaves as DOSBox Staging just before this PR

I mean: when VGA is asked to display 9x16 cells, it does so, but uses 8x16 font. This is how DOSBox Staging started behaving after #2398 was merged. This is how it currently behaves when vga_8dot_font is disabled. Discussion I linked describes it as:

However, character cells are merely often 9 pixels wide, and the glyph bitmaps are never. The glyph bitmaps are actually 8×16, drawn inside character cells that could be either 9×16 or 8×16. The ninth column of pixels in a character cell, if present, is not encoded in the glyph bitmap, but is generated by the graphics adapter: either entirely blank or, if the character index is in the box-drawing character range [0xC0, 0xE0), by repeating the eighth column

I cannot easily find a definite proof that this happens (just someone's words) - and since I don't like this behavior at all I kind-of lack the motivation :)


some have a proper 9px fonts (or can generate them by altering 8px fonts, I'm not sure)

AFAIK this behavior is not currently emulated, most likely we don't even have 9x16 font built-in.

I believe this happens, see this photo (original post). Zoom-in, look at letters V, W, T, m - this is the 9x16 font, there is no doubt.

FJLUfP-XwAQfRuk


some (laptops) behave as vga_8dot_font is enabled (or like DOSBox SVN)

I mean: no 9x16 cells at all - just 8x16 glyphs in 8x16 cells, always, even if 9x16 is asked by the software. There are reports regarding the laptops, but I'm sure this is not always the case.

Check the video https://www.youtube.com/watch?v=QmwDBfFKnvE, timestamp 1:45. Look at lowercase letter w - this definitely is a 8x16 font in 8x16 cells (you can count individual pixels). I don't know if this was caused by specific hardware, specific BIOS, or anything else - but this is definitely also a "historically valid" behavior.

Example

@johnnovak
Copy link
Member

I mean: when VGA is asked to display 9x16 cells, it does so, but uses 8x16 font. This is how DOSBox Staging started behaving after #2398 was merged. This is how it currently behaves when vga_8dot_font is disabled.

No, that's not true 😄

To be clear @FeralChild64, I'm quite sure you and I want exactly the same thing and we're vehemently agreeing with each other, but you got a bit confused about what DOSBox is actually doing after #2398 was merged. That's alright, and I'll prove it below why I'm quite certain the current behaviour is correct. Please point out if I made a mistake or misunderstood what you want! 😅

It seems to me that you're advocating for the use of proper 9x16 IBM VGA fonts as the default on all VGA adapters. I want the same! (Not that 8x16 extended with a blank column thing; I don't care about that, and it's unproven... And you seem to care neither. Good! 😅 The guy who made that comment might be totally confused, so let's stick to the verifiable facts).


DOSBox output after #2398.
I compiled 9c0f980 and start DOSBox with -noprimaryconf (or with explicit vga_8dot_font = false):

image

With crt/aperture:
image

That is the proper 9x16 IBM VGA font! And it looks exactly like the font on the DOS LaunchBox screenshot you posted.

It's the IBM 9x16 VGA font from VileR's page:
https://int10h.org/oldschool-pc-fonts/fontlist/font?ibm_vga_9x16#-
image

Relevant bits from the screenshot you posted—yep, that's the 9x16 IBM VGA font, without a shadow of a doubt!
image
image
image
image
image


Prior to #2398 we get the 8x16 font (that's weird 8-column MCGA variant).
Or building main (9c0f980) then setting vga_8dot_font = true:

image

With crt/aperture:
image

It's the IBM 8x16 VGA font from VileR's page:
https://int10h.org/oldschool-pc-fonts/fontlist/font?ibm_vga_8x16#-

image


AFAIK this behavior is not currently emulated, most likely we don't even have 9x16 font built-in.

But it is emualted, it is emulated correctly, and we do have the 9x16 font built in! 😄 Please see the proof above. You can easily replicate it yourself 😄

It all matches up perfectly with this other image you posted as well:

image


Check the video https://www.youtube.com/watch?v=QmwDBfFKnvE, timestamp 1:45. Look at lowercase letter w - this definitely is a 8x16 font in 8x16 cells (you can count individual pixels). I don't know if this was caused by specific hardware, specific BIOS, or anything else - but this is definitely also a "historically valid" behavior.

Great job digging this video up! The description says it's a Tseng Labs ET4000, so now we can consider it proven that some older VGA cards defaulted to the 8x16 font instead of the 9x16 IBM standard. Users can emulate that by setting vga_8dot_font = true easily, or we might want to enable 8-dot fonts automatically for svga_et4000. That would be my preference, not because it's a super important thing, but info like this is hard to dig up, so we should just do the authentic thing if it's easy enough (and it seems to be very easy!). If we can get reliable proof for the other svga_* boards we emulate, we could default to the authentic font choice on them as well. Paging @kcgen 😄 (but anyone can do this change, it's simple enough)

I'm glad you found this 😄 👍🏻

@kcgen
Copy link
Member Author

kcgen commented Apr 22, 2023

I believe this happens, see this photo (original post). Zoom-in, look at letters V, W, T, m - this is the 9x16 font, there is no doubt.

[sdl]
output = opengl

[render]
glshader = crt/aperture.vga-retina

[dosbox]
machine = svga_s3
vga_8dot_font = false

2023-04-21_18-23

Compare the background's shaded columns. At the center of the screen, these columns and the gaps match DOSBox's in width. However as we get to the far right edge, the CRTs colums and gaps are quite a bit narrower, so this is definitely giving it a bit more narrow appearance (atleast off-center).

@johnnovak
Copy link
Member

johnnovak commented Apr 22, 2023

The physical monitor's <-HSize-> dial might be sqeezing in a tiny bit; but besides that - these look pretty darn close? (atleast to me 😅 )

Yes, it's visually very close–as it should be, as we're using the correct 9x16 font now, as I explained.

I guess it's easy to make mistakes when comparing real screenshots vs the output of DOSBox on a low-res screen without a shader... that can look a bit different.

But if you carefully compare the dead giveaways, e.g. the shapes of the letters W, V, T, m, and 0, it becomes obvious whether the 8x16 or the 9x16 font is in use.

@ThomasEricB
Copy link
Contributor

I guess I missed this PR out! Great job @kcgen !

@FeralChild64
Copy link
Collaborator

@johnnovak , @kcgen OK, I know what happens on my system - it's the CPI/CPX file support! Start with -noprimaryconf, then type keyb pl. It seems MS-DOS under DOSBox Staging behaves the same. I don't remember what was the behavior on the real PC, as I didn't use MS-DOS CPI files - I was using a 3rd party TSR which consumes much less conventional memory, and it is smart enough to not disable the 9x16 font.

@johnnovak

Users can emulate that by setting vga_8dot_font = true easily, or we might want to enable 8-dot fonts automatically for svga_et4000. That would be my preference, not because it's a super important thing, but info like this is hard to dig up, so we should just do the authentic thing if it's easy enough (and it seems to be very easy!)

Right, but we still don't know how ET3000, Paradise and S3 cards behave... And I think we should keep some override option, so that users of various other cards or 3rd party font/keyboard utilities (like me :D) can tune the display to be close to what they remember.

@rderooy
Copy link
Collaborator

rderooy commented Apr 22, 2023

Right, but we still don't know how ET3000, Paradise and S3 cards behave... And I think we should keep some override option, so that users of various other cards or 3rd party font/keyboard utilities (like me :D) can tune the display to be close to what they remember.

Would running 86Box, emulating the respective adapters and their matching ROMs not clarify that?

@rderooy
Copy link
Collaborator

rderooy commented Apr 22, 2023

86Box emulation screenshots. To me it seems they all use the 9px font.

ET3000AX

640x350

et3000ax_640x350

720x400

et3000ax_720x400

ET4000AX

640x350

et4000ax_640x350

720x400

et4000ax_720x400

PVGA1A

640x350

pvga1a_640x350

720x400

pvga1a_720x400

Trio64

640x350

trio64_640x350

720x400

trio64_720x400

@johnnovak
Copy link
Member

Right, but we still don't know how ET3000, Paradise and S3 cards behave... And I think we should keep some override option, so that users of various other cards or 3rd party font/keyboard utilities (like me :D) can tune the display to be close to what they remember.

Sure, I did not propose removing vga_8dot_font at all. It should stay, and then people can revert to the 8-dot wide fonts on VGA if they want to.

86Box emulation screenshots. To me it seems they all use the 9px font.

That's all good and well, but I wouldn't bet my house on the 86box behaviour on anything 😄
What has been proved is that the Tseng ET4000 uses the 8-dot fonts by default as @FeralChild64 found an actual YouTube recording of it. Although these 86Box tests are for the ET4000AX and ET3000AX, but they're at the very least a bit suspect, given we have the ET4000 evidence...

@rderooy
Copy link
Collaborator

rderooy commented Apr 22, 2023

That's all good and well, but I wouldn't bet my house on the 86box behaviour on anything smile What has been proved is that the Tseng ET4000 uses the 8-dot fonts by default as @FeralChild64 found an actual YouTube recording of it. Although these 86Box tests are for the ET4000AX and ET3000AX, but they're at the very least a bit suspect, given we have the ET4000 evidence...

Could it be that the machine in the video is not in 720x400 mode, but rather in 640x350? I do not see any video mode transition like I had with my 86box runs.

Never mind. Found the transition at 0:38 it is when he moves the camera from the screen to the keyboard and back.

p.s. based on the #401A0-0207 OEM ID, it seems to be a Asus P/I-P55T2P4 systemboard.

@rderooy
Copy link
Collaborator

rderooy commented Apr 22, 2023

You may want to check: https://www.vogons.org/viewtopic.php?t=50159 for some ET4000 screenshots.

@johnnovak
Copy link
Member

johnnovak commented Apr 22, 2023

By the way, the Trio64 screenshot uses the 8x16 font. Look for the uppercase T letter.

The rest are 9x16.

Actually, there are surely board revisions of many VGA cards too. E.g. one Tseng ET4000 might do this, another revision of the same card might do something else...

Like the infamous S3 brightness bug...

I'd say the config override is enough for people who are desperate for the 8px wide fonts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working video Graphics and video related issues
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants