The black art of UDGs on the QL

Anything QL Software or Programming Related.
User avatar
TMD2003
Trump Card
Posts: 168
Joined: Sat Oct 10, 2020 12:18 pm

Re: The black art of UDGs on the QL

Post by TMD2003 »

Yesterday evening, I tried to go back to user-defined QL character sets, this time using Toolkit II, which I'd not tried before.

The idea was to turn the QL into a sort-of-Spectrum screen, albeit with slightly strange proportions. But in short, it would be:
- MODE 8
- Windows 1 and 2 redefined to 22x32 character cells with Window 0 as the 2x32 input area
- CSIZE 3,0 in all windows with Window 1 redefined to the Spectrum character set.

Spectrum characters are anything up to eight pixels wide; QL characters are five pixels plus a gap. However, the screenshots I posted last October (which were "broken" but which I've now fixed) were taken from this QL Character Definer from Sinclair User, March 1985, which I'd recently typed in. I'll repeat the former:

Image

At the time I worked out I had to take off Toolkit II and stick to a 128K QL to make it work - but even so, it's visually obvious that eight-pixel-wide characters can be displayed on a QL. The copyright symbol takes up all eight of those, and that's the official test that I'd use to see that everything is working as it should. Download the character definer, take TKII off, switch to 128K, LRUN mdv1_qlg1_bas and see for yourselves.

The package below (a regular ZIP, not a QL ZIP) contains two programs: spectk2_bas for Toolkit II, and specbb_bas for the Original Black Box Strictly 128K Non-TKII Wild West version. They only differ in that the latter has the CHAR_INC line outright deleted (and I'm not even sure I need it anyway), and CHAR_USE #1,base,0 changed to POKE_L 167722,base which I took directly from the Sinclair User program and found it works. (At least in the very specific 128K non-TKII QL situation.)

I have so far not found a way to get the eight-pixel-wide redefined Spectrum characters to display - all of them are a maximum of five pixels with the rest cut off. The printed character sets are shown with alternating STRIP colours to make it easier to see, with the Spectrum characters in Window 1 and the regular QL characters in Window 2.

However...

What I have just tried is defining a character in the Sinclair User program (which uses CSIZE 1,0) so that it displays properly, then changing to CSIZE 3,0 and finding that it doesn't, I was even more surprised to find the character I'd defined displaying so that there were single pixels in what should be a double-wide mode.
Try this on the Sinclair User program: define a character to be 85,170,85,170,85,170,85,170,0 (this should be a chessboard graphic which was graphic H on a ZX81, but was absent from the Spectrum). It will display properly in CSIZE 1,0. Now switch to CSIZE 3,0 and see what happens...

I suspect I am going to need to manipulate the character codes to get the characters to display properly - or is it a lost cause on the double-wise CSIZEs?

Anyway, here are my programs...
Attachments
spectests.zip
(3.75 KiB) Downloaded 66 times


Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
User avatar
Andrew
Aurora
Posts: 795
Joined: Tue Jul 17, 2018 9:10 pm

Re: The black art of UDGs on the QL

Post by Andrew »

TMD2003 wrote: it's visually obvious that eight-pixel-wide characters can be displayed on a QL.

only on JS or newer ROMS


User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: The black art of UDGs on the QL

Post by dilwyn »

Yes, the 8 pixel wide fonts can only be readily displayed in CSIZE 1,0 and CSIZE 1,1 (not double width CSIZE 3,0 or CSIZE 3,1).

There is a ready-made Spectrum font for QL at http://www.dilwyn.me.uk/fonts/spectrum.zip

Although characters are usually limited to 5 pixel wide in other CSIZEs, it's not generally appreciated that sometimes you can actually use 6 pixel wide fonts with no spacing in some other CSIZE combinations (afraid I can't remember whether the extra pixel is the one to the left or to the right of the regular 5, although running the above Spectrum font in various CSIZEs will soon tell you). Admittedly, not all font editors will let you define such a font though.


User avatar
TMD2003
Trump Card
Posts: 168
Joined: Sat Oct 10, 2020 12:18 pm

Re: The black art of UDGs on the QL

Post by TMD2003 »

Andrew wrote:only on JS or newer ROMS
That's what I was using (although David Nowotnik's Lunar Lander program, that I quoted earlier in the thread, was written using and for the JM ROM).

Realistically, I'd only ever change from the JS to something else if I needed it - there was a CSSCGC program I tested earlier in the year that needed Minerva, and sometimes I'll experiment with AH or PM if I'm curious to see what the really old days looked like, but for the most part it's JS all the way.
dilwyn wrote:Yes, the 8 pixel wide fonts can only be -> readily <- displayed in CSIZE 1,0 and CSIZE 1,1 (not double width CSIZE 3,0 or CSIZE 3,1).
That does still imply that it's possible...
There is a ready-made Spectrum font for QL at http://www.dilwyn.me.uk/fonts/spectrum.zip
...which I'll take a look at and see how it compares to mine, though I'd expect them to be identical, seeing as I took mine straight out of the Spectrum ROM.

I'm going to take advantage of the good weather for a while, but in the meantime, I've adapted "Bagnell"'s program to run with CSIZE 3,0 - LRUN this (TKII off, 128K only) and see what happens. Sometimes the characters appear on screen as I expect them to do once they're defined, sometimes they don't... and I can't see any correlation between when it happens correctly and when it doesn't.
Attachments
qlg3_bas.zip
(1.57 KiB) Downloaded 67 times


Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: The black art of UDGs on the QL

Post by dilwyn »

TMD2003 wrote:
dilwyn wrote:Yes, the 8 pixel wide fonts can only be -> readily <- displayed in CSIZE 1,0 and CSIZE 1,1 (not double width CSIZE 3,0 or CSIZE 3,1).
That does still imply that it's possible...
Not necessarily ... only that I don't know if it can be done! :mrgreen:

I'd hazard a guess that if it can, the likeliest way is with an enhanced screen driver like Speedscreen or Lightning, but it's a long time since I used either of those!


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

Re: The black art of UDGs on the QL

Post by Andrew »

Is it possible to use fat founts (8 pixels wide) in Mode 8, with QDOS and JS or Minerva ROM?
The online Superbasic manual says :
On pre-JS ROMs, characters which use all eight pixels available for the definition of characters will not be printed correctly on screen.
This sugests that it might be possible, but all my tests failed: only 5 pixels are shown on screen, regardless of CSIZE, CHAR_INC or OVER mode.


User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: The black art of UDGs on the QL

Post by dilwyn »

Andrew wrote:Is it possible to use fat founts (8 pixels wide) in Mode 8, with QDOS and JS or Minerva ROM?
The online Superbasic manual says :
On pre-JS ROMs, characters which use all eight pixels available for the definition of characters will not be printed correctly on screen.
This sugests that it might be possible, but all my tests failed: only 5 pixels are shown on screen, regardless of CSIZE, CHAR_INC or OVER mode.
I've only ever been able to get "fat" fonts to work in csize 1,0 and csize 1,1 in mode 4. But I haven't done thorough checks across all ROM versions, and haven't checked if Speedscreen or Lightning changes this in any way.


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

Re: The black art of UDGs on the QL

Post by Andrew »

dilwyn wrote:I've only ever been able to get "fat" fonts to work in csize 1,0 and csize 1,1 in mode 4. But I haven't done thorough checks across all ROM versions, and haven't checked if Speedscreen or Lightning changes this in any way.
I have tried in QDOS with JS ROM and Minerva ROM - all CSIZE possible combinations, all OVER modes, and several width set with CHAR_INC. It simply doesn't work in Mode 8 - only works in Mode 4
With SMSQE 8 pixels fonts are displayed correctly in mode 8 using CHAR_INC 16, height (height 9 or more) and OVER -1 or 1. With OVER 0 the strip is still 5x10 pixels and ruins the fount, both in Mode 4 and 8.
Now, I have no idea how much of a difference Speedscreen or Lightning might have when used with Minerva ROM, but I'll dig in my QL collection and see if I have them.

I was thinking about writing a noobie article named "How to use QL UDGs for simple games", but for now it seems that I'll have to change the title to "Why QL UDGs are not fit even for the simplest games" :D


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

Re: The black art of UDGs on the QL

Post by Andrew »

dilwyn wrote:I've only ever been able to get "fat" fonts to work in csize 1,0 and csize 1,1 in mode 4. But I haven't done thorough checks across all ROM versions, and haven't checked if Speedscreen or Lightning changes this in any way.
Speedscreen makes fat fonts to work in Mode 8 also! on all ROMS.
Even with the Minerva ROM the speed increase is noticeable.


Derek_Stewart
Font of All Knowledge
Posts: 3971
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: The black art of UDGs on the QL

Post by Derek_Stewart »

Hi,

The Minerva manual says that using Minerva gives a 98% of Lightning SE graphics speed increase, without the ram used by the Lighning code.

I did think Lightning was an enhanced Speedscreen, maybe that is incorrect.

The SMSQ/E screen driver maybe incompatiable with Speedscreen and Lightning. So may not work.


Regards,

Derek
Post Reply