SCREEN1 = SYSVAR @ JSROM

Anything QL Software or Programming Related.
User avatar
janbredenbeek
Gold Card
Posts: 329
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: SCREEN1 = SYSVAR @ JSROM

Postby janbredenbeek » Wed Jul 10, 2019 4:11 pm

Also bear in mind that the pixels of the original QL screen are not square-shaped. The original QL screen was made for a 4:3 television screen (the actual aspect ratio was about 3:2, which caused the horizontal overscan on TVs). However, the X/Y pixel ratio in MODE 4 is 2:1 (indeed, QDOS also assumes 512 logical pixels across in MODE 8). The graphics coordinate system compensates for this so that, say, 50 units in the system correspond to the same distance in both X and Y direction... on the original QL screen!

But now take an emulator on a PC, with modern 16:9 screen and 1920x1080 resolution. You see that 1920/1080 is exactly 16:9, so the pixels are square-shaped. A 512x256 emulated QL screen will now have an aspect ratio of 2:1, so wider than the original 3:2. Thus, a circle drawn in QDOS will look like an ellipse in QPC2.

(actually, Qemulator squeezes the QL screen horizontally so it retains the 3:2 ratio, and SMSQ/E has a system variable in which you can set the aspect ratio so you will get perfect circles again).

Jan.


Ralf R.
Brittle Membrane
Posts: 118
Joined: Fri Jun 15, 2018 8:58 pm

Re: SCREEN1 = SYSVAR @ JSROM

Postby Ralf R. » Wed Jul 10, 2019 5:38 pm

janbredenbeek wrote:SMSQ/E has a system variable in which you can set the aspect ratio so you will get perfect circles again.

And how do you start this?


User avatar
janbredenbeek
Gold Card
Posts: 329
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: SCREEN1 = SYSVAR @ JSROM

Postby janbredenbeek » Wed Jul 10, 2019 9:31 pm

Ralf R. wrote:
janbredenbeek wrote:SMSQ/E has a system variable in which you can set the aspect ratio so you will get perfect circles again.

And how do you start this?

It's a float PT_ASPRT at offset $14a in the CON linkage block pointed to by the system variable SYS_CLNK at $280c4.
So you can read it out using PEEK_F(!$c4!$14a) and set using POKE_F !$c4!$14a,X where X is the pixel aspect ratio.

If you have a screen resolution with square-shaped pixels, then POKE_F !$c4!$14a,1 will get you a perfect circle.
(POKE_F !196!330,1 might be a bit more readable :) ).

Jan.


Ralf R.
Brittle Membrane
Posts: 118
Joined: Fri Jun 15, 2018 8:58 pm

Re: SCREEN1 = SYSVAR @ JSROM

Postby Ralf R. » Thu Jul 11, 2019 5:35 am

POKE_F !196!330,1 (and also POKE_F !$c4!$14a,1) gives ERR.BP in QPC2.


User avatar
janbredenbeek
Gold Card
Posts: 329
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: SCREEN1 = SYSVAR @ JSROM

Postby janbredenbeek » Thu Jul 11, 2019 9:37 am

Ralf R. wrote:POKE_F !196!330,1 (and also POKE_F !$c4!$14a,1) gives ERR.BP in QPC2.

That's interesting. Which version are you using? (the aspect ratio POKE is only supported from SMSQ/E 3.00 onwards, and not in QDOS/Minerva anyway).
It does work in SMSQmulator too (even with no extensions from BOOT file loaded).

Jan


User avatar
mk79
Gold Card
Posts: 356
Joined: Sun Feb 02, 2014 10:54 am

Re: SCREEN1 = SYSVAR @ JSROM

Postby mk79 » Thu Jul 11, 2019 9:43 am

Ralf R. wrote:POKE_F !196!330,1 (and also POKE_F !$c4!$14a,1) gives ERR.BP in QPC2.
Turbo extension comes with its own POKE_F that doesn't have quite as many features as the SMSQ version, so try not loading that.


Ralf R.
Brittle Membrane
Posts: 118
Joined: Fri Jun 15, 2018 8:58 pm

Re: SCREEN1 = SYSVAR @ JSROM

Postby Ralf R. » Thu Jul 11, 2019 10:03 am

mk79 wrote:Turbo extension comes with its own POKE_F that doesn't have quite as many features as the SMSQ version, so try not loading that.

Ah, that is the reason, why. I have loaded Turbo toolkit for Cash Trader. I should probably take that out.


Martin_Head
Gold Card
Posts: 410
Joined: Tue Dec 17, 2013 1:17 pm

Re: SCREEN1 = SYSVAR @ JSROM

Postby Martin_Head » Thu Jul 11, 2019 10:22 am

There's a program here http://www.dilwyn.me.uk/graphics/g_ratio.zip that corrects circles in QPC2. I assume it does the POKE.


tcat
Super Gold Card
Posts: 541
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: SCREEN1 = SYSVAR @ JSROM

Postby tcat » Thu Jul 11, 2019 1:09 pm

Hi Jan,
However, the X/Y pixel ratio in MODE 4 is 2:1

I believe it is mode 8, that has wider pixels across.
As I count 0,1,2..256 pixels in mode 8, I unified the code, using now ellipse for circles as well. For mode 8, I just halve the ellipse width (a - excentricity). Actually, now thinking more general to also halve x coordinates as Tobias pointed out.
Tomas


Derek_Stewart
QL Wafer Drive
Posts: 1365
Joined: Mon Dec 20, 2010 11:40 am
Location: Runcorn, Cheshire, UK

Re: SCREEN1 = SYSVAR @ JSROM

Postby Derek_Stewart » Fri Jul 12, 2019 9:57 am

Martin_Head wrote:There's a program here http://www.dilwyn.me.uk/graphics/g_ratio.zip that corrects circles in QPC2. I assume it does the POKE.

Here is the DISA disassembley of the G_RATIO extension:
G_RATIO_dis.zip
G_RATIO disassembley, using DISA...
(659 Bytes) Downloaded 10 times


Regards,

Derek

Who is online

Users browsing this forum: No registered users and 5 guests