QL USER type-in programs
-
- Font of All Knowledge
- Posts: 4684
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: QL USER type-in programs
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.
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
Derek
-
- Aurora
- Posts: 889
- Joined: Mon Nov 24, 2014 2:03 pm
Re: QL USER type-in programs
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.
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.
Re: QL USER type-in programs
Could some of this listing have started off as ports from other BASIC?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.
Re: QL USER type-in programs
It could very well be that the knowledge on SuperBASIC of the authors started off as ports of knowledge of other BASICsbwinkel67 wrote:Could some of this listing have started off as ports from other BASIC?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.

ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: QL USER type-in programs
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?
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?
Re: QL USER type-in programs
Well, from what you describe, it's excactly behaving as it should.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?
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
Re: QL USER type-in programs
Display Control Register - details in QL Technical Guide page 58 or Section 10.3Andrew 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?
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
--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
Re: QL USER type-in programs
Oops, sorry Tobias, your reply must have appeared while I was typing mine 

--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
Re: QL USER type-in programs
Poke 98403,2 disables the screen ... but it never gets enabled againtofro 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.

I thought it should work on QEmulator
Well, back to digging - it might be a problem in other part of the code ...
Re: QL USER type-in programs
Well, last time I looked I didn't yet have exclusive rights to answer here, so no need to apologizedilwyn wrote:Oops, sorry Tobias, your reply must have appeared while I was typing mine

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