Is there a way to change the aspect ratio used by DOS?

Discussions about using non Windows and Linux guests such as FreeBSD, DOS, OS/2, OpenBSD, etc.

Is there a way to change the aspect ratio used by DOS?

Postby All Screws Loose » 16. Dec 2018, 12:08

I have a Windows 3.1 VM and a Windows 95 VM that I'm running for fun. I'm using a monitor with a 4:3 aspect ratio, which works perfectly when I'm in Windows, but when I'm in text mode, the dimensions are all wrong - as in, it's too wide from left to right and too narrow from top to bottom. Is there any way to change the text mode resolution in VirtualBox?
All Screws Loose
 
Posts: 2
Joined: 16. Dec 2018, 12:04
Location: A place of darkness and chaos
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Currently FreeDOS, MS-DOS/Win3.1, Win95, OS/2 Warp, Arch Linux, Kali Linux, TempleOS, and Visopsys

Re: Is there a way to change the aspect ratio used by DOS?

Postby socratis » 16. Dec 2018, 12:59

All Screws Loose wrote: Is there any way to change the text mode resolution in VirtualBox?

The resolution? No, it's always going to be 640x480 for a DOS guest.
The way it looks? Yes, you could use Scaled-Mode from the View menu...
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 22026
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Is there a way to change the aspect ratio used by DOS?

Postby All Screws Loose » 16. Dec 2018, 13:25

Ah, I see. Any way to do that in full screen?
All Screws Loose
 
Posts: 2
Joined: 16. Dec 2018, 12:04
Location: A place of darkness and chaos
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Currently FreeDOS, MS-DOS/Win3.1, Win95, OS/2 Warp, Arch Linux, Kali Linux, TempleOS, and Visopsys

Re: Is there a way to change the aspect ratio used by DOS?

Postby socratis » 16. Dec 2018, 14:44

It's easier to try it than actually ask, is it not? ;)
You just stretch the window from top to bottom and left to right, instead of going full-screen...
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 22026
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Is there a way to change the aspect ratio used by DOS?

Postby mpack » 16. Dec 2018, 16:04

In DOS text mode the display is usually 80 columns wide by 25 lines high, the aspect ratio is therefore dictated by the font (which sets the dimensions of one character cell). Without source code changes I don't know of a way to force VirtualBox to use a different font.
mpack
Site Moderator
 
Posts: 28581
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Is there a way to change the aspect ratio used by DOS?

Postby socratis » 16. Dec 2018, 16:21

mpack wrote:I don't know of a way to force VirtualBox to use a different font

But does VirtualBox uses its own fonts it there? I thought that was DOS doing its own thing, I don't think that VirtualBox gets particularly involved in there...
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 22026
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Is there a way to change the aspect ratio used by DOS?

Postby mpack » 17. Dec 2018, 11:36

Michal seems to have a better memory for these things, but AFAIR DOS did not have its own fonts. In fact it didn't care about the display at all, individual apps did their own thing on that. In nearly all early PCs the font used in text modes was built into the display controller.

I just had a hunt around the source. The file "vgafonts.h" looks like it defines 8x8, 8x14 and 8x16 "ROM fonts".
mpack
Site Moderator
 
Posts: 28581
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Is there a way to change the aspect ratio used by DOS?

Postby socratis » 18. Dec 2018, 01:10

mpack wrote:The file "vgafonts.h" looks like it defines 8x8, 8x14 and 8x16 "ROM fonts".

It seems that all of these are used in the BIOS/EFI part, not after the OS takes over. I'll try to ping Michal on IRC, see if we can better understand the whole thing...
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 22026
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Is there a way to change the aspect ratio used by DOS?

Postby mpack » 18. Dec 2018, 10:45

We were discussing DOS text mode, so there is no "take over" of graphics by the OS. DOS has no graphics.
mpack
Site Moderator
 
Posts: 28581
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Is there a way to change the aspect ratio used by DOS?

Postby Martin » 18. Dec 2018, 11:01

Who has a DOS VM available and can test a
'mode con cols=120 lines=50'
;)
Martin
Volunteer
 
Posts: 2143
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Linux, OS/2

Re: Is there a way to change the aspect ratio used by DOS?

Postby socratis » 18. Dec 2018, 11:26

I have FreeDOS (I can't read my old 5 1/4" floppies anymore), and if I try what you said, I get:
C:\> mode con cols=120 lines=50
Columns must be 40 or 80 or 132
C:\> mode con cols=132 lines=50
Using VGA 400 line resolution.
C:\> mode con cols=80 lines=25
C:\>

Yeah, it works! Use the Scaled-Mode for the VM, and we're in business! ;)
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 22026
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Is there a way to change the aspect ratio used by DOS?

Postby michaln » 18. Dec 2018, 12:40

The normal resolution of a 80x25 text mode is not 640x480, it is 720x400 because the character cells are 16x9 pixels wide. The does indeed result in the "wrong" aspect ratio because the pixels on a classic VGA monitor wouldn't be square, but in a VM they are.

VirtualBox (VGA BIOS) does supply its own "hardware" fonts, and the fonts VirtualBox uses match standard IBM fonts. DOS is perfectly capable of overriding those, and it is a requirement for supporting any "international" codepages, as the BIOS fonts only support the standard IBM codepage 437. The GRAFTABL command is used to load fonts supporting alternative codepages.

But that's not very relevant, because although GRAFTABL can load different character glyphs, it cannot change the size of the character cells, that's defined by hardware.

The closest you can get to the "right" aspect ratio is probably running the VM in scale mode (Host+C). That will rescale the screen contents to a fixed window size rather than the other way around.
michaln
Oracle Corporation
 
Posts: 2944
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all

Re: Is there a way to change the aspect ratio used by DOS?

Postby socratis » 18. Dec 2018, 18:51

Thanks Michal for shedding some light on this...
You see, I always remembered VGA to be 640x480, but I can't (for the life of me) remember whether it was "shorter and wider", haven't used an actual computer like that since (oh boy) 1995, '96(?) or something like that...
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 22026
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Is there a way to change the aspect ratio used by DOS?

Postby michaln » 8. Jan 2019, 12:29

The so-called "VGA" resolution is 640x480. That was the highest-resolution graphics mode which all VGA chips (and monitors) could handle. But VGA text modes were never 640x480 (except, one way or another, on laptops with a 640x480 LCD) and by default used 720x400 resolution, same as the old MDA (monochrome text-only cards). The reasons were probably ergonomic more than anything, the extended 9 pixel wide character cells are more legible than 8 pixel wide, but the cards had limited pixel clocks and monitors had fixed horizontal frequency, so the added horizontal resolution came at the expense of reduced vertical resolution. At 400 pixels high, you still get 25 lines of 16 pixel high character cells, which was entirely sufficient. Note that VGA text modes also had higher refresh rate (70 Hz) than 640x480 graphics modes (60 Hz).

If you look at the second table here and just consider the VGA graphics modes 0 to 13h, you'll see that the original VGA monitors were dumb fixed-frequency monitors with 31.778 KHz horizontal refresh, no fancy multisync. The VGA chip itself had whopping two pixel clock rates (25.175 MHz and 28.322 MHz), nothing programmable like mid-1990s cards (when you look at old graphics cards like this one, they usually have two to four discrete oscillators on them, very low-tech). The 25.175 MHz clock was used for 640-wide modes, the 28.322 MHz clock for 720-wide modes.

There are 17 modes listed in that table, but that is an illusion. A VGA monitor cannot display a 320x200 mode, the display controller uses double-scanning and pixel doubling to send two lines and/or pixels to the monitor so that a 320x200 resolution, 640x200 resolution, and (if one goes beyond BIOS) 320x400 resolution are all actually displayed as 640x400. The resolutions that a VGA card can really display are 640x400, 640x350, 720x350, 720x400, and 640x480. The last one at 60 Hz vertical refresh, the others at 70 Hz.

The 350-line modes are a bit of a special on VGA systems, they are actually delivered with the exact same timings as the 400-line modes, but with a total of extra 50 lines of padding added at the top and bottom. The monitor senses the 350-line mode based on sync polarity and stretches the 350 lines to cover the same area as 400 lines would. The monitor similarly senses a 480-line mode and spaces the lines such that 480, 400, or 350 lines all take about the same vertical space on the monitor.

All that covers just standard VGA modes; there is a bit of wiggle room because the displays were analog, and some room for creativity when programming the VGA hardware directly rather than strictly using the BIOS. The relative complexity didn't come out of nowhere, it was dictated by requirements to a) provide backwards compatibility with CGA and EGA, and b) allow the use of cheap fixed-frequency monitors.
michaln
Oracle Corporation
 
Posts: 2944
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all


Return to Other Guests

Who is online

Users browsing this forum: No registered users and 0 guests