Skip to content

--scaling=native closely respects aspect ratio, but could be more accurate #255

@JDoucette

Description

@JDoucette

PURPOSE:
--scaling=native will scale the pixel zoom as integer in X and Y.
PC-BASIC attempts to approximate this, close to the actual pixel size.

EXPECTATION:
320x200 resolution on a 4:3 aspect ratio screen, means the pixels are 5:6
Ideally, the pixels could be zoomed 5x6, and you get a perfect representation.
But that needs a monitor >= 1600x1200 in size.
Therefore, on a 1920x1080 monitor, you could choose 4x5, which gives you 1280x1000.
This isn't perfect 5:6, but is close.

ACTUAL:
(NOTE - in some cases, the border would have to be reduced and/or full-screen used.)

In 1920x1200 resolution monitor:
EGA 640x350: PC-BASIC gives 1x2 pixel zoom, it could have done better: 2x3
EGA 640x200: PC-BASIC gives 2x4 pixel zoom, it could have done better: 2x5
EGA 320x200: PC-BASIC gives 3x4 pixel zoom, it could have done better: 4x5
TGA 640x200: PC-BASIC gives 2x4 pixel zoom, it could have done better: 2x5
TGA 320x200: PC-BASIC gives 4x4 pixel zoom, it could have done better: 4x5
TGA 160x200: PC-BASIC gives 8x4 pixel zoom, it could have done better: 8x5
CGA 640x200: PC-BASIC gives 2x4 pixel zoom, it could have done better: 2x5
CGA 320x200: PC-BASIC gives 3x4 pixel zoom, it could have done better: 4x5

In 3840x2160 resolution monitor:
EGA 640x350: PC-BASIC gives 4x5 pixel zoom -- this is good.
EGA 640x200: PC-BASIC gives 3x8 pixel zoom, it could have done better: 3x7
EGA 320x200: PC-BASIC gives 7x8 pixel zoom -- this is good
TGA 640x200: PC-BASIC gives 4x8 pixel zoom, it could have done better: 4x10
TGA 320x200: PC-BASIC gives 8x8 pixel zoom, it could have done better: 8x10
TGA 160x200: PC-BASIC gives 15x8 pixel zoom, it could have done better: 15x9 (exactly correct)
CGA 640x200: PC-BASIC gives 3x8 pixel zoom, it could have done better: 3x7
CGA 320x200: PC-BASIC gives 7x8 pixel zoom -- this is good

NOTE:
I am assuming the display monitor's own pixels are square, which is reasonable assumption these days.
I am assuming that all CGA, TGA, EGA, VGA modes are being emulated as if displayed on 4:3 aspect ratio monitors, which is reality of the 80's and 90's.

ROOT CAUSE:
Given the near accurate within 4K monitor resolution, I feel the calculations are close, but not accurate.
It is likely the border getting in the way, since the accurate calculations are pretty simple.
Also, given same resolutions between EGA, TGA, CGA (320x200) with different results suggests an issue here as well.

SOLUTION:
Just assume 4:3 aspect ratio. Get the monitor resolution. Assume no border.
Compute the best fit (native = integer scaling), rounding as needed.
Note that compute best fit should try for best in X, and best in Y, and a middle ground.
Then you have your answer.
Only then do you try to fit a border -- which may not fit.
Allow the window size even if it has to overflow the Windows task bar.
Allow ALT+ENTER full-screen toggle to make it easy to see without the task bar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions