Lunar lander and UDG generally

Anything QL Software or Programming Related.
User avatar
Jbizzel
Chuggy Microdrive
Posts: 67
Joined: Mon Jun 19, 2023 9:56 pm
Contact:

Lunar lander and UDG generally

Post by Jbizzel »

I ran Lunar lander using a SGC on a bbql.

The udg routine doesn't work, but not sure why?

Actually this picture isn't helpful. Essentially the udgs are coloured letters rather than a lunar lander!
IMG_20240316_104545.jpg
Here is the udg routine...
IMG_20240316_104712.jpg
Not sure what is wrong. Can anyone help?


__________________


And beyond it, the deep blue air, that shows
Nothing, and is nowhere, and is endless.

https://jbizzel.itch.io/
User avatar
t0nyt
Gold Card
Posts: 384
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Lunar lander and UDG generally

Post by t0nyt »

Not used BASIC much for a while but shouldn’t line 820 be Restore 860?


User avatar
Jbizzel
Chuggy Microdrive
Posts: 67
Joined: Mon Jun 19, 2023 9:56 pm
Contact:

Re: Lunar lander and UDG generally

Post by Jbizzel »

Thanks, it's not fixed the issue, but hasn't seemed to break anything!
IMG_20240316_113403__01.jpg


__________________


And beyond it, the deep blue air, that shows
Nothing, and is nowhere, and is endless.

https://jbizzel.itch.io/
Derek_Stewart
Font of All Knowledge
Posts: 3975
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Lunar lander and UDG generally

Post by Derek_Stewart »

Hi,

I tired the game in sQLux and Q-emulator, the UDGs are not defined if the RAM s greater than 256K.
Lunar.png
Lunar.png (5.9 KiB) Viewed 323 times

The actual programme does not run very well, i fact I would say the author does not understand the QL graphics setup, he is poke-ing into the channel table, which, is no a good idea.

It would be better to define a font and attach it to the QL Channel.

I will update this with a proper UDG Font routine.


Regards,

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

Re: Lunar lander and UDG generally

Post by tofro »

On the QL, "everything is floating". That means that POKEing to fixed addresses is potentially dangerous.

Your POKE in line 810 pokes to memory in the free memory area of the QL . This might or might not be what you assume (you seem to assume that it's a font address in a channel definition block). Apparently, on your system that's not it :) (and, as Derek rightly said: That is a clear no-no!). The address of a channel definition block depends very much on your running OS, your Minerva dual-screen settings and the history of opened and closed channels in your system.

You're also POKEing your font not into the allocated memory at a (line 830), but rather (again) into free memory at udg_base. It's a bit of a miracle your code didn't crash the machine.

The proper way to set a font in a channel is actually: Use Toolkit II's (or SMSQ/E's) CHAR_USE function to set the font.

I was thinking about providing an alternative way to do it without TK2, but you seem to be using it, so, so let's make it simple:

Code: Select all

100 udg_base = ALCHP (<fontsize>)
101 REMark POKE your font starting from udg_base here (line 820+ in your program)
110 CHAR_USE #channel,udg_base,0


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Jbizzel
Chuggy Microdrive
Posts: 67
Joined: Mon Jun 19, 2023 9:56 pm
Contact:

Re: Lunar lander and UDG generally

Post by Jbizzel »

Thanks for your help, this isn't my code, and I'm not familiar with the tk2 commands.

Having a go though.

When you say font size you mean the size of the data in the data statements?

11*9 bytes, + 2 bytes in the initial data statement, so the frontsize is 808 maybe


__________________


And beyond it, the deep blue air, that shows
Nothing, and is nowhere, and is endless.

https://jbizzel.itch.io/
User avatar
tofro
Font of All Knowledge
Posts: 2702
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Lunar lander and UDG generally

Post by tofro »

Jbizzel wrote: Sat Mar 16, 2024 1:41 pm When you say font size you mean the size of the data in the data statements?
11*9 bytes, + 2 bytes in the initial data statement, so the frontsize is 808 maybe
yep.

cw/you/your program/ :) No offense meant ;)


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Derek_Stewart
Font of All Knowledge
Posts: 3975
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Lunar lander and UDG generally

Post by Derek_Stewart »

Hi,

Have look at QL Today Vol13 issue 2,3,4 Dilwyn did an excellent article on the use of Fonts.


Regards,

Derek
User avatar
Jbizzel
Chuggy Microdrive
Posts: 67
Joined: Mon Jun 19, 2023 9:56 pm
Contact:

Re: Lunar lander and UDG generally

Post by Jbizzel »

Haha, don't worry :)

If only I *HAD* written it :D :D


Can you help me with what the new poke should look like?

Is it ...

Code: Select all

poke (udg_base +n ), but 
Assuming I am wrong, but still it shows my workings out....
IMG_20240316_141259.jpg


__________________


And beyond it, the deep blue air, that shows
Nothing, and is nowhere, and is endless.

https://jbizzel.itch.io/
User avatar
tofro
Font of All Knowledge
Posts: 2702
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Lunar lander and UDG generally

Post by tofro »

Looks alright, but the CHAR_USE should (logically, I don't think it matters) come after the font is poked.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Post Reply