Hacker News new | ask | show | jobs
by susam 2562 days ago
I am running DOSBox with default settings. I draw a square and then a circle with these lines of Logo code:

  REPEAT 4 [FD 1 RT 90]

  REPEAT 360 [FD 1 RT 1]
I find that both the square and the circle appear squashed. On measuring the pixel height and width of these figures as they appear on my desktop, I see that the square is 400 pixels in width and 320 pixels in height. That's an aspect ratio of 5:4. Similarly, the circle is 460 pixels in width and 364 pixels in height. That's an aspect ratio of 1.26:1.

I find the same aspect ratio in full screen (Alt + Enter) mode too. In the full screen mode, the square is 200 pixels in width and 160 pixels in height and the circle is 230 pixels in width and 182 pixels in height.

Here are the screenshots:

- https://imgur.com/l9YpTqp

- https://imgur.com/WTwfSzq

- https://imgur.com/CjMYJN6

1 comments

Edit the dosbox configuration file and change aspect=0 to aspect=1, it'll resize the output to be aspect correct but it might be a bit blurry (IIRC the scale3x scaler will do a pixel-scale and then that will be bilinearly resized, giving mostly crispy pixels with a bit of in-between bleeding which is probably the best you can get with an LCD monitor)
With aspect=1, the square is 400 pixels high and 384 pixels wide, not exactly an aspect ratio of 1:1 but quite close, 1.04:1.

The parent of my earlier comment, i.e., the one by klodolph, claims that the pixel aspect ratio would be square by default in DOSBox, so I thought I would verify it once. As per my experiments, that does not seem to be the case.

This is a misinterpretation of the experiment results.

By default, aspect=false. This gives incorrect results, as you observed, with Logo producing a squashed circle and square.

The fix is aspect=true (or aspect=1). This gives correct results, with non-square aspect for pixels, with Logo producing a more correct circle and square.

Because the Logo implementation was written for an actual IBM PC or compatible, it assumes that the aspect ratio of a 320x200 pixel screen is about 4:3. However, when displayed with the incorrect square-pixel aspect ratio given by default in DOSBox, it will be 8:5.

In other words, DOSBox displays graphics with a square pixel ratio by default, which is different from the original hardware. If you wrote a DOS program to draw a square number of pixels, say 128x128, then you would see that in DOSBox it would also be square, but on real hardware it would be about 20% taller than it is wide. If you use Logo you will get the opposite results, because Logo is correctly designed for the original hardware.

I think what he meant is that,

The pixels are square in DOSBox, but the graphics from these old programs are designed for non-square pixel ratio. So, if you display it with square pixel, the display aspect ratio will be wrong.

(Of course, this still contradicts with what neatcoder said, but I can't remember if these programs were "squished" on CRTs or not.)

See these screenshots of SCREEN 2 in GW-BASIC running in DOSBox:

- https://imgur.com/NZUGL1e (aspect=0)

- https://imgur.com/rnQOfA4 (aspect=1)

The one with aspect=1 looks very odd.

The one with aspect=1 looks incorrectly configured.

There are a number of different graphics modes, they have different pixel aspect ratios, you can also adjust the monitor, it is possible that back in school you were using a different mode or a different monitor. I think there are some other factors that can affect this.

Back in school, I played with SCREEN 0, SCREEN 1, and SCREEN 2 documented in the GW-BASIC user manual. Here's a copy: http://www.antonis.de/qbebooks/gwbasman/screens.html .

The reason why I stick to aspect=0 (the DOSBox default) is that this is the one that more closely reproduces the experience I had with the CRT monitors at school. I agree that the actual monitor or the way it is configured could affect the aspect ratio we observe. Perhaps ours was not adjusted to produce 1:1 square while working with IBM Logo. But it did produce 1:1 square with GW-BASIC SCREEN 1 mode.