Curve smoothing
-
- Font of All Knowledge
- Posts: 4667
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: Curve smoothing
Hi,
This looks great, I wish everyond would produce ptogrammes in this style.
This looks great, I wish everyond would produce ptogrammes in this style.
Regards,
Derek
Derek
-
- Font of All Knowledge
- Posts: 4667
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: Curve smoothing
Hi,Tinyfpga wrote: Sun Nov 03, 2024 8:59 pmFrom my perspective it is quite quirky, but that is because I use SMSQE at high resolutions and thus need programs that are moveable within its extended environment.Just UNZIP & LRUN. Please report any other quirks you may detect.... Regards, Steve.
The program LRUNs on my SMSQE setup, but does not execute as an SBASIC job. It will not compile using QLiberator with or without line numbers.
I like the program and felt it was worth modifying it to be moveable and compilable without line numbers. The most difficult bit (for me) was eliminating the program's GOTOs. The result was a compiled moveable program that might be used to create animated wire frame images, if only I could understand how it works. As you say "the program is quite lengthy".
The really quirky thing ,now, is that with GOTO's eliminate the code cannot be interpreted but works perfectly when compiled. If interpreted it fails with the error:- "At line 2160:1 Return not in procedure or function"
I post a container file with copies of the modified code for the Contour program with and without dots. I tried to modify the original as little as possible.
contour 6.jpg
contour 7.jpg
Win3.zip
Tried your updated demo programs, which look great as I said earlier.
But both compiled and Basic program halt with an error, due to the "wait 50" statement, I do not have wait as a command on my SMSQ/E setup.
Regards,
Derek
Derek
-
- Aurora
- Posts: 888
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Curve smoothing
Hi Guys,
I assume you are referring to the program ContourDemo3_bas ?
Line 2160 is a Procedure END DEFINE, so no implicit RETurn is required.
Just tested again ok on a fresh QPC interface..... Regards, Steve.
I assume you are referring to the program ContourDemo3_bas ?
Line 2160 is a Procedure END DEFINE, so no implicit RETurn is required.
Just tested again ok on a fresh QPC interface..... Regards, Steve.
Re: Curve smoothing
[quote I assume you are referring to the program ContourDemo3_bas ?][/quote]
No. We are referring to my cheekily modified programs ContourDemo 6 and 7. The error returned by these programs when interpreted
is misleading. The problem (or difference if you like) lies within the interpreter as outlined bellow:-
The WAIT code was written by Tony Tebby years ago. It is included in the new Win3 file. One can substitute PAUSE #1,50 for Wait 50. WAIT was created because PAUSE has to be associated with a channel which defaults to #0 if not specified. As far as I can remember PAUSE caused problems with some compiled programs.
Replace WAIT 50 with PAUSE 50 to see what I mean. I have noticed that the optional #n for
PAUSE is not mentioned in the QPC Keywords manual. WAIT n is merely a delay in n x 20ms steps and sadly 1 is a minimum.
I have taken the time to find out why my Contour modifications cannot be interpreted.
I created two test programs that demonstrate the problem:- x_bas which can be interpreted
and x2_bas which cannot. The programs are identical! The various bits of code can be found in Win3.zip
It seems that the interpreter fails if one uses the same variable (if it is a variable) or name with multiple REP and END REPs, whilst the compiler does not ie:-
REP p ..... END REP p followed by REP p ..... END REP p causes the interpreter to fail.
REP p ..... END REP p followed by REP pp..... END REP pp is OK.
I have modified the contour programs so that they can be interpreted. I only ever use the interpreter to run my BOOT program so I have never come across the problem mentioned above.
New file:-
No. We are referring to my cheekily modified programs ContourDemo 6 and 7. The error returned by these programs when interpreted
is misleading. The problem (or difference if you like) lies within the interpreter as outlined bellow:-
The WAIT code was written by Tony Tebby years ago. It is included in the new Win3 file. One can substitute PAUSE #1,50 for Wait 50. WAIT was created because PAUSE has to be associated with a channel which defaults to #0 if not specified. As far as I can remember PAUSE caused problems with some compiled programs.
Replace WAIT 50 with PAUSE 50 to see what I mean. I have noticed that the optional #n for
PAUSE is not mentioned in the QPC Keywords manual. WAIT n is merely a delay in n x 20ms steps and sadly 1 is a minimum.
I have taken the time to find out why my Contour modifications cannot be interpreted.
I created two test programs that demonstrate the problem:- x_bas which can be interpreted
and x2_bas which cannot. The programs are identical! The various bits of code can be found in Win3.zip
It seems that the interpreter fails if one uses the same variable (if it is a variable) or name with multiple REP and END REPs, whilst the compiler does not ie:-
REP p ..... END REP p followed by REP p ..... END REP p causes the interpreter to fail.
REP p ..... END REP p followed by REP pp..... END REP pp is OK.
I have modified the contour programs so that they can be interpreted. I only ever use the interpreter to run my BOOT program so I have never come across the problem mentioned above.
New file:-
-
- Aurora
- Posts: 888
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Curve smoothing
Hi Tinyfpga,
Try modifying Line 2160 to read
=4: dud=1: REMark not implemented yet.
The 'empty' select item may have been affecting the compiler ?
Steve.
Try modifying Line 2160 to read
=4: dud=1: REMark not implemented yet.
The 'empty' select item may have been affecting the compiler ?
Steve.
Re: Curve smoothing
A couple of things Tinyfpga:
rep p:
in x2_bas do
1132 LOcal p
and the program works as youd expect..
PAUSE:
SuperBASIC PAUSE does not take a channel number. It will error if you do something like PAUSE#0. Only Minerva and SBASIC accept a channel number. In SBASIC if no channel#0 is available the interpreter opens a small window especially for it. For the sake of compatibility across S*BASICS it is often better to use INKEY$(#channel; n) instead of PAUSE n.
Your program opens a channel#1, so you could have written PAUSE#1. That would also have been ok.
ContourDemo7_bas:
It would have been more useful to have replaced wait 50 in line 3470 with
3470 IF CODE(INKEY$(#1; 50)) = 27: QUIT: REMark or STOP
That way one could have got out of the program without the aid of RJOB! And it saves loading an unnecessary toolkit command.
I didnt have a problem running either ContourDemo6_bas nor ContourDemo7_bas with EX or directly from QD, nor the corresponding compiled versions..
rep p:
in x2_bas do
1132 LOcal p
and the program works as youd expect..
PAUSE:
SuperBASIC PAUSE does not take a channel number. It will error if you do something like PAUSE#0. Only Minerva and SBASIC accept a channel number. In SBASIC if no channel#0 is available the interpreter opens a small window especially for it. For the sake of compatibility across S*BASICS it is often better to use INKEY$(#channel; n) instead of PAUSE n.
Your program opens a channel#1, so you could have written PAUSE#1. That would also have been ok.
ContourDemo7_bas:
It would have been more useful to have replaced wait 50 in line 3470 with
3470 IF CODE(INKEY$(#1; 50)) = 27: QUIT: REMark or STOP
That way one could have got out of the program without the aid of RJOB! And it saves loading an unnecessary toolkit command.
I didnt have a problem running either ContourDemo6_bas nor ContourDemo7_bas with EX or directly from QD, nor the corresponding compiled versions..
Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
-
- Aurora
- Posts: 888
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Curve smoothing
Hi Ralfr,
Here is a DIY WAIT routine. Wait accepts ANY delay, (or much smaller than PAUSE).
UNZIP, LRUN and Experiment... Steve.
Here is a DIY WAIT routine. Wait accepts ANY delay, (or much smaller than PAUSE).
UNZIP, LRUN and Experiment... Steve.
-
- Font of All Knowledge
- Posts: 4667
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: Curve smoothing
Hi,
The WAIT command seems to be referred back to the commands in SMS2, which had a Command Line Interpreter instead of S*BASIC:
The WAIT command seems to be referred back to the commands in SMS2, which had a Command Line Interpreter instead of S*BASIC:
SMS2 Manual wrote: Wait - Wait for a period of time
This procedure requires one parameter - the time required to wait in units of 1/50 second.
The maximum specified period is 32,767 which is equivalent to approximately 665 seconds or 10.9 minutes. If
you specify a negative value then the CLI will wait forever. Only a negative value of -1 should be used in this
case and although we cannot think of any useful reason to suspend the CLI forever, you should be aware of this
possibility.
Wait period
Wait 300
Wait 1500
Wait -1
wait for a period of time
wait for 6 seconds
wait for 30 sec
Regards,
Derek
Derek