The QL UDG Playground

Anything QL Software or Programming Related.
Derek_Stewart
Font of All Knowledge
Posts: 3928
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: The QL UDG Playground

Post by Derek_Stewart »

Hi,

I have been trying to port over ZX Spectrum games, but the main problems other than the different Basic syntax, was the Spectrum User Defined Graphics.

A while back, I thought of using a custom Font that could have characters 128-143 defined as Spectrum Block Graphics, Spectrum UDG A-U, Characters 144-164 as User Defined Graphics. Which if the Font is user defined can QL User Defined Graphics. This was confirmed by Dilwyn's articles in QL Today.

But the manipulation of the custom Font relies on the use of the Toolkit 2 "CHAR_USE" command or similar and attaching the new font to the QL channel where the game is running.

I have been at this point for a long time, as I always used Toolkit 2 ever since Tony Tebby released it, but there are some who do not use it and prefer to poke values into the channel table to point to the new font routine. Clearly a bad solution.

I have a few ZX Spectrum software 80% converted, which include:

Football Manager
Make A Chip
VU3D
Mad Martha

WHich some use Z80 machine routines, but this is easy to convert to 68000 or rewrite in SBASIC

Also I must add, I also prefer to use SMSQ/E rather than QDOS , if a BBQL is to be used then Minerva is the only choice, with Toolkit 2 installed.

So my question here is is this a incorrect assumption not to use new software developments, if Toolkit 2 is new compared to a Pre-Minerva QDOS system without the Toolkit 2 Rom installed?

Maybe I know the answer to the question, but I am always interested in a consensus view.


Regards,

Derek
User avatar
XorA
Site Admin
Posts: 1358
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: The QL UDG Playground

Post by XorA »

My software developer view is always use libraries and toolkits that make your life easier.

If the weirdly conservative people who don't want to use them complain make them work around these requirements themselves.

I would just go ahead and assume everyone has access to TK2 as its easily available to fit even in a BBQL with only uDrives.


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: The QL UDG Playground

Post by tofro »

I think in 2021, it is perfectly acceptable to assume TK2 is available to anyone. It allows you to improve and shorten SuperBASIC programs so much that it would be a very unnecessary restriction. When I'm compiling programs for the BBQL, I typically link TK2 into the program (yes, that might waste some memory, but I simply don't care).


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: The QL UDG Playground

Post by dilwyn »

Indeed. And even if including a full Toolkit 2 is too much of an overhead, there are several free and smaller extensions out there which can do the equivalent of the CHAR_USE command.


User avatar
Andrew
Aurora
Posts: 786
Joined: Tue Jul 17, 2018 9:10 pm

Re: The QL UDG Playground

Post by Andrew »

Derek_Stewart wrote:I have a few ZX Spectrum software 80% converted, which include:

Football Manager
Make A Chip
VU3D
Mad Martha

....

So my question here is is this a incorrect assumption not to use new software developments, if Toolkit 2 is new compared to a Pre-Minerva QDOS system without the Toolkit 2 Rom installed?

Maybe I know the answer to the question, but I am always interested in a consensus view.
Hi Derek

I assume that everybody uses TK2. Unlike Tofro, I never link TK2 into my programs, as it is a waste of memory, but I try to link any other code extensions I may use in the program.
Now speaking about using UDGs in the programs, and this applies specifically to converting Spectrum games to QL: the Sinclair QL is a peculiar machine, and some commands simply do not work in the way I expected.
The most important part is this: THERE IS NO WAY TO USE UDGs IN MODE 8 WITHOUT USING SMSQ/E !

QDOS and Pre-JS ROM
natively cannot use fat fonts. The characters rendered on screen will always be 6 pixels wide, not 8
(I have not tested with TK2 or Speedscreen because I presume most users do not use pre-JS ROMS)

QDOS and JS or Minerva ROM + TK2
Mode 4 - can use fat fonts, so it is possible to use 8x8 or 8x9 UDGs with no gaps between them
Mode 8 - cannot use fat fonts - The characters rendered on screen will always be 6 pixels wide
(Tested with TK2 and also with Speedscreen - I still have to test with Lightning, but I expect the same result)

SMSQ/E
can use fat fonts both in Mode 4 and Mode 8 so it is possible to use 8x8 or 8x9 UDGs with no gaps between them

So if you are planning to convert Spectrum games to QL there are only 2 options
1. Use only Mode 4 - this, of course, implies:
  • the program will correctly run both in QDOS and SMSQ/E
  • you can use only 4 colors instead of Spectrum's 16, so the image might look like rubbish
  • the UDG will be a rectangle instead of square, so the image will be heavily distorted
  • the Spectrum screen will be less than half of the QL screen, so you will need to make large changes in the code
2. Use Mode 8
  • Your program can be used only in SMSQ/E
  • There will also be some distortion in the UDG - all UDGs will look "fat", - but we have to live with that
From my point of view the preferred option is the second one: Use Mode 8 and SMSQ/E !
Due to the different way the Spectrum screen is organised, especially when using 8x8 UDGs there are some more changes/programming tricks that need to be employed to correctly render the screen on the QL, but I might write more about that later.


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: The QL UDG Playground

Post by NormanDunbar »

dilwyn wrote:Indeed. And even if including a full Toolkit 2 is too much of an overhead, there are several free and smaller extensions out there which can do the equivalent of the CHAR_USE command.
USE_FONT from DJToolkit springs to mind! :D


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Derek_Stewart
Font of All Knowledge
Posts: 3928
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: The QL UDG Playground

Post by Derek_Stewart »

...oh my lots of colourful text in upper case...

Ithink I will not persue the Spectrum conversion of games and applications, as Spectrum were rubbish, and woukd wosrt on the QL.

Maybe better to direct my attensions back to assembley programming, where it does not matter about extensions.


Regards,

Derek
User avatar
RalfR
Aurora
Posts: 870
Joined: Fri Jun 15, 2018 8:58 pm

Re: The QL UDG Playground

Post by RalfR »

Andrew wrote:Use Mode 8 and SMSQ/E !
Makes me wonder as nothing happens when you type "MODE 8" in SMSQ/E.....


4E75 7000
User avatar
Andrew
Aurora
Posts: 786
Joined: Tue Jul 17, 2018 9:10 pm

Re: The QL UDG Playground

Post by Andrew »

RalfR wrote:
Andrew wrote:Use Mode 8 and SMSQ/E !
Makes me wonder as nothing happens when you type "MODE 8" in SMSQ/E.....
Strange - as my Tile Map Editor runs on QPC in mode 8, as shown by the pictures from my previous post
QPC is configured with 512x256 resolution and QL colors


User avatar
RalfR
Aurora
Posts: 870
Joined: Fri Jun 15, 2018 8:58 pm

Re: The QL UDG Playground

Post by RalfR »

Andrew wrote:
RalfR wrote:
Andrew wrote:Use Mode 8 and SMSQ/E !
Makes me wonder as nothing happens when you type "MODE 8" in SMSQ/E.....
Strange - as my Tile Map Editor runs on QPC in mode 8, as shown by the pictures from my previous post
QPC is configured with 512x256 resolution and QL colors
Ahh, ok, that works!


4E75 7000
Post Reply