QL USER type-in programs

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

Re: QL USER type-in programs

Post by Derek_Stewart »

Hi,

I have been looking at some of the older QL World magazine listings, it looks to me, that they do not seem to understand the Superbasic language. For example, use of NEXT instead of END FOR, the EXIT statement , they usual use GO TO to exit a REPeat loop.

Some listing use GOTOs to jump out of a Procedure to another Procedure, all bad progtramming. But Superbasic still allows the programme to run, Qliberator still compiles it.

I am not sure this a good thi k, as loading the same listing into SMSQ/E with SBASIC, often will throw problems due the bad programming.

Personally I like to have the programme in question open its own channels and does not use channel 0,1,2. For this QD with the QD/SBAS Thing is good, as if I have missed a statement channel an the default is channel #1, the Thing will open channel to suit.


Regards,

Derek
stevepoole
Super Gold Card
Posts: 712
Joined: Mon Nov 24, 2014 2:03 pm

Re: QL USER type-in programs

Post by stevepoole »

Hi All,

SuperBasic's NEXT has three uses, either to jump to a loop start, jump back to a previous loop, or to allow a 'loop 'epilogue'.

PropPascal cannot do all of these, hence the imperative use of GOTO label in that language.

Even SuperBasic needs GOTO (end of loop) to avoid unwanted loop epilogues.

GOTO is a very powerfull tool in the right hands !

But it should only be used with parcimony...

Steve.


User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Re: QL USER type-in programs

Post by bwinkel67 »

Derek_Stewart wrote:I have been looking at some of the older QL World magazine listings, it looks to me, that they do not seem to understand the Superbasic language. For example, use of NEXT instead of END FOR, the EXIT statement , they usual use GO TO to exit a REPeat loop.
Could some of this listing have started off as ports from other BASIC?


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

Re: QL USER type-in programs

Post by tofro »

bwinkel67 wrote:
Derek_Stewart wrote:I have been looking at some of the older QL World magazine listings, it looks to me, that they do not seem to understand the Superbasic language. For example, use of NEXT instead of END FOR, the EXIT statement , they usual use GO TO to exit a REPeat loop.
Could some of this listing have started off as ports from other BASIC?
It could very well be that the knowledge on SuperBASIC of the authors started off as ports of knowledge of other BASICs :D - That used to be a common symptom back then. Old habits are hard to eradicate.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Andrew
Aurora
Posts: 786
Joined: Tue Jul 17, 2018 9:10 pm

Re: QL USER type-in programs

Post by Andrew »

I am currently debugging Stellaris - was published in in QL User June 1987
I have OCR-ed it and now I am correcting the mistakes - and also trying to correct some bugs in the original code.
The first and most important problem I have encountered is the procedure:

DEFine PROCedure ka(a): POKE 98403, a: END DEFine

It is called several times and a is 2, 8 or 0.
On QEmulator POKE 98403, 2 produces only a black screen and the cursor disappers - and the QL seems to hang and needs a reset.
But not always ! sometimes, very rarely, it executes it once - but on second call it hangs.
I have tested with JS and Minerva ROMs (JS ROM always hangs - Minerva maybe executes it once)
I have used 128k, 384k, 4Mb - no change.

What is POKE 98403, x used for?


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

Re: QL USER type-in programs

Post by tofro »

Andrew wrote:I am currently debugging Stellaris - was published in in QL User June 1987
I have OCR-ed it and now I am correcting the mistakes - and also trying to correct some bugs in the original code.
The first and most important problem I have encountered is the procedure:

DEFine PROCedure ka(a): POKE 98403, a: END DEFine

It is called several times and a is 2, 8 or 0.
On QEmulator POKE 98403, 2 produces only a black screen and the cursor disappers - and the QL seems to hang and needs a reset.
But not always ! sometimes, very rarely, it executes it once - but on second call it hangs.
I have tested with JS and Minerva ROMs (JS ROM always hangs - Minerva maybe executes it once)
I have used 128k, 384k, 4Mb - no change.

What is POKE 98403, x used for?
Well, from what you describe, it's excactly behaving as it should.

98403 (or $18063) is the QL's display control register. Bit 1 (the value 2) blanks the display, bit 3 (value 8) switches between a MODE 4 and MODE 8 screen, while value 0 switches back to MODE 4 and an enabled display. It's very unlikely these POKEs would work on anything but a real QL or a true QL emulator. It's also very likely that what you describe as a crash is actually simply a disabled display.


ʎɐ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: QL USER type-in programs

Post by dilwyn »

Andrew wrote:I am currently debugging Stellaris - was published in in QL User June 1987
I have OCR-ed it and now I am correcting the mistakes - and also trying to correct some bugs in the original code.
The first and most important problem I have encountered is the procedure:

DEFine PROCedure ka(a): POKE 98403, a: END DEFine

It is called several times and a is 2, 8 or 0.
On QEmulator POKE 98403, 2 produces only a black screen and the cursor disappers - and the QL seems to hang and needs a reset.
But not always ! sometimes, very rarely, it executes it once - but on second call it hangs.
I have tested with JS and Minerva ROMs (JS ROM always hangs - Minerva maybe executes it once)
I have used 128k, 384k, 4Mb - no change.

What is POKE 98403, x used for?
Display Control Register - details in QL Technical Guide page 58 or Section 10.3
Bit 3: 0 for 512 pixel mode and 1 for 256 pixel mode.
Bit 1: blank display (commonly used by screen savers, or sometimes for drawing to a blank screen then enabling the drawn screen in one go)
Bit 7: switch screen base between both QL screens at addresses $20000 (normal QL screen) and $28000 (Minerva second screen).

So for the values you see used:
2 - blank screen
8 - 256 pixel mode 8
0 - 512 pixel mode 4 or mode 0 (whichever you normally call 512 pixel mode)

Dilwyn


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

Re: QL USER type-in programs

Post by dilwyn »

Oops, sorry Tobias, your reply must have appeared while I was typing mine :oops:


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

Re: QL USER type-in programs

Post by Andrew »

tofro wrote: Well, from what you describe, it's excactly behaving as it should.

98403 (or $18063) is the QL's display control register. Bit 1 (the value 2) blanks the display, bit 3 (value 8) switches between a MODE 4 and MODE 8 screen, while value 0 switches back to MODE 4 and an enabled display. It's very unlikely these POKEs would work on anything but a real QL or a true QL emulator. It's also very likely that what you describe as a crash is actually simply a disabled display.
Poke 98403,2 disables the screen ... but it never gets enabled again :(
I thought it should work on QEmulator
Well, back to digging - it might be a problem in other part of the code ...


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

Re: QL USER type-in programs

Post by tofro »

dilwyn wrote:Oops, sorry Tobias, your reply must have appeared while I was typing mine :oops:
Well, last time I looked I didn't yet have exclusive rights to answer here, so no need to apologize ;)

In fact, your answer mentions the Technical Guide and the second screen - which mine didn't. I think it's always better to have two answers instead of none. And, even better, if they state the same thing :)


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