QL SCALE Calculator

Retro Programmers For Obscure Systems
Ce site est en constante évolution.
This site is continually evolving.


More information about RPUFOS GameJam on Olipix YouTube channel


Purpose

The purpose of this tool is to calculate the QL window values based on the 'SCALE' function.

How to

Enter your values in the appropriate fields, then click the 'Calculate' button.

 Input 
 Screen 

 Window 

 SCALE 

not implemented

not implemented

Results

The result will appear here once you click the Calculate button.


To understand the results

The SCALE function more detailed

Call : SCALE f, x, y

Parameters:

  • f: the scale factor
  • x: origin point bottom left x axis, width
  • y: origin point bottom left y axis, height

Think of x,y as the origin of an axis if it's 0,0.
If you change x,y to another value, it's like moving along the axes.

SCALE isn't just for the window; it's more complex. You can redraw an element to the chosen dimensions.


About the QL's screen

Its default size is 512×256 pixels. However, other dimensions are available with additional options. So if you're working on a standard Sinclair QL, don't change the Screen values.


For the Y axis (height)

For your drawings, the Y-axis dimension will always be the value of 'f', regardless of the defined window size.

Example, if f=100, imagine you have 100 pixels of height.
The QL automatically recalculates everything for you, minimizing display artifacts.

N.B.: It would be preferable for the Y-axis to follow the window dimension. If the Y value is 50, then use SCALE 50,0,0. Thus, POINT 0,50 corresponds to the top-left corner. For the rightmost X point, refer to the calculation above.


For the X axis (height)

On the X-axis, the ratio isn’t what you’d expect (due to the QL’s specific handling), so a precise calculation is required...

That’s why this calculator was made.


And what does this scaling factor do?

  • If F = Y, then it's 1:1 scale.
  • If F > Y, the drawing is scaled down.
  • If F < Y, the drawing is scaled up.

We assume Y is the window height.


The formula

This is why this calculator was designed.


Calculated ratios, always 1 on a QL base screen:
Xratio = ScreenX 512

Yratio = ScreenY 256

XY ratio calculation (MINERVA, currently used):
XY_ratio = ( 101 × Yratio Window Height × Window Width ( 135.5041505 × Xratio ) )


Maximum x value:
x_right = INT ( size × XY_ratio )

This calculated value of X is the rightmost visible point on the screen.


Redraw a Pixel Art

Consider a line drawing (such as pixel art, a logo, etc.) using POINT, LINE, etc. To resize it, you would then use the SCALE function.
Put your code into a procedure. Call the procedure that takes a parameter named for example SCALE.

Example :
To draw your design anywhere, it is always best to use relative coordinates.

  • Define a starting point: x0, y0.
  • Provide the channel (#c) to target the correct window.
  • Optionally, for a line drawing, the color.
  • Optionally, for FILL.
  • Finally, the scale (SCALE) of the design.
					1000 DEFine PROCedure p_my_draw( ch, x0, y0, scale, c, f)
					...
					1020   SCALE #ch,scale,0,0
					1030   INK #ch,c
					...
					1998   SCALE #ch,100,0,0: REMark return to default values
					1999 END DEFine p_my_draw
					
Call the procedure in your program.
					100 p_my_draw 1, 10, 10, 200, 0, 0
					
Draw in channel 1, position 10-10, SCALE 200, color Black, no FILL


⚠️ Disclaimer ⚠️

The software and resources provided here are experimental and unofficial. They are offered as-is, without warranty of any kind. Use at your own risk.