It is currently Mon Oct 20, 2014 5:44 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Jan 06, 2012 7:46 pm 
Offline
 Profile

Joined: Thu Feb 17, 2011 11:38 pm
Posts: 9
Firstly, it's probably worth saying that I've tried this on my real Beeb with and without a second processor, with and without HI-BASIC and I've also tried it in Beeb-Em in various configurations. They all fail with the same errors.

I have a procedure that looks a bit like this...

Code:

....

20 DEFPROCrenderdata
30 LOCAL zoom%, duration%, CHANGE%, EXITPROC%
35 zoom%=4:duration%=1
40 EXITPROC%=FALSE
50 REPEAT
60 CHANGE%=FALSE
65 PROCplotgraphdata(zoom%,1,FALSE)
70 REPEAT

80 IF INKEY(-38) interpolated%=1-interpolated%:CHANGE%=TRUE
90 IF INKEY(-120) EXITPROC% = TRUE

100 UNTIL CHANGE% OR EXITPROC%
110 UNTIL EXITPROC%
120 ENDPROC
130
140 DEFPROC....

...



I use intentionally blank lines to separate out procedures as illustrated at example line 130 - this is relevant to one of the errors I'm seeing.

If I press I - INKEY(-38), the program fails in the PROCplotgraphdata procedure with a divide by zero error because zoom% is 0 even though I've passed the value as a parameter to the procedure and it's not declared LOCAL anywhere else. If I remove zoom% from the LOCAL declaration, the divide by zero goes away.

If I press f9 - INKEY(-120) the program faills with the following error:

"Error 17 on line 130".

My program is 7278 bytes in length so when running on a second processor, it should have plenty of memory for variables. It's heavy on procedures and functions and most variables are declared as LOCAL throughout the code.

Right now, I'm hit a brick wall with this as the "Error 17 on line 130" is just downright odd. It's been a long while since I did much BBC BASIC programming but I'd like to think it's reasonably tidy stuff that I'm producing, I'm just puzzled as to what I'm seeing right now.

Any insight into how LOCAL is working internally would help and also why I'm seeing Error 17 on a line with no code...

If you'd like to see the full code I can put in on an SSD with test data and a walk through of how to reproduce the errors. But I figured I'd ask using an example outline of the problems first..

Any assistance is greatly welcomed.

Paul


Last edited by paulv on Fri Jan 06, 2012 11:13 pm, edited 1 time in total.

Top
 
PostPosted: Fri Jan 06, 2012 11:12 pm 
Offline
 Profile

Joined: Thu Feb 17, 2011 11:38 pm
Posts: 9
Fixed it...

It would appear I typed a line number in incorrectly so inserted a REPEAT into a section of code where there should not have been one. I guess as this procedure was run several times, the stack was getting in a mess as there was no matching UNTIL statement.

Removed the rogue REPEAT and all is well with the world :-)

Paul


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron