This is probably staring me right in the eye, but if it is, it has been for three hours. Though I was pretty good at this.... anyway.
Here is the section of code:
8100 REM arrays are complete - now scan and print empty ones
8200 FOR J = 1 TO 5
8300 FOR K = 1 TO 20
8400 FOR L = 1 TO 30
8500 IF BIN$(J,K,L)="F" THEN 9800
8600 IF BIN$(J,K,L)="Q" THEN 9800
8700 IF BIN$(J,K,L)=" " THEN 9800
8800 FOR M = 1 TO J
8900 READ AREA$
9000 NEXT M
9100 RESTORE
9200 FOR M = 1 TO K
9300 READ AREA2$
9400 NEXT M
9500 RESTORE
9600 PRINT #6,AREA$;AREA2$;" ";L
9700 PRINT AREA$;AREA2$;" ";L
9800 NEXT L
9900 NEXT K
10000 NEXT J
We can assume that everything to here is good.
Line 8600 when bin$(j,k,l)="Q" should branch to 9800, right? Well, it hits 9600 and 9700 instead. So I thought a logic error, but, change 8600 to:
8600 if bin$(j,k,l)="Q" then stop
and the program halts (when it should, as at that point bin$(j,k,l) DID ="Q")
So, how the #$^%#$& am I getting lines 9600 and 9700 when bin$(j,k,l)="Q"?
BTW... tried:
retyping the lines (weird, but I was trying anything)
renumbered
different variable name from bin$
Always the same result.
Any thoughts?
BTW - tried to register buy it seems there must be a backlog on sending confirmation emails.
Jim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Jim, thanks for getting in touch! I can't quite reproduce the problem - I'm assuming you use PC-BASIC 15.08.10; if I add a few lines and comment out 9600 to make the code fragment run, and add some debugging:
5 TRON
10 DIM BIN$(5,20,30):BIN$(1,1,1)="Q"
20 DATA 0,0,0,0,0,0,0,0,0,0,0,0
8100 REM arrays are complete - now scan and print empty ones
8200 FOR J = 1 TO 5
8300 FOR K = 1 TO 20
8400 FOR L = 1 TO 30
8450 PRINT J;K;L;BIN$(J,K,L)
8500 IF BIN$(J,K,L)="F" THEN 9800
8600 IF BIN$(J,K,L)="Q" THEN 9800
8700 IF BIN$(J,K,L)=" " THEN 9800
8800 FOR M = 1 TO J
8900 READ AREA$
9000 NEXT M
9100 RESTORE
9200 FOR M = 1 TO K
9300 READ AREA2$
9400 NEXT M
9500 RESTORE
9600 'PRINT #6,AREA$;AREA2$;" ";L
9700 PRINT AREA$;AREA2$;" ";L
9750 STOP
9800 NEXT L
9900 NEXT K
10000 NEXT J
My output is:
[10][20][8100][8200][8300][8400][8450] 1 1 1 Q
[8500][8600][9800][8450] 1 1 2
[8500][8600][8700][8800][8900][9000][9100][9200][9300][9400][9500][9600][9700]00 2
[9750]
Break in 9750
Ok
Which I think is what would be expected - after encountering the Q the program jumps to line 9800.
Perhaps the problem only shows up with the data supplied in your full program - could you send me the code that, when run, demonstrates the problem?
Thanks
Rob
Last edit: Rob Hagemans 2016-10-12
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If I had sent you the full code you probably would have seen what I FINALLY saw after houirs of staring (and, yes, programmer stupidity)
I didn't include the data statement (not prettied up) which was
ABCDEFGHIJKLMOPQRSTUVWXYZ
Apparantly I invented an alphabet withou any Ns, therefore instead of reading to Q it was reading to R. Now, why it would stop was beacuse earlier in the program it defaulted to Q for a different reason.
Appreciate you taking the time to look - sorry it was such a stupid error.
Jim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "[CLOSED] General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
This is probably staring me right in the eye, but if it is, it has been for three hours. Though I was pretty good at this.... anyway.
Here is the section of code:
8100 REM arrays are complete - now scan and print empty ones
8200 FOR J = 1 TO 5
8300 FOR K = 1 TO 20
8400 FOR L = 1 TO 30
8500 IF BIN$(J,K,L)="F" THEN 9800
8600 IF BIN$(J,K,L)="Q" THEN 9800
8700 IF BIN$(J,K,L)=" " THEN 9800
8800 FOR M = 1 TO J
8900 READ AREA$
9000 NEXT M
9100 RESTORE
9200 FOR M = 1 TO K
9300 READ AREA2$
9400 NEXT M
9500 RESTORE
9600 PRINT #6,AREA$;AREA2$;" ";L
9700 PRINT AREA$;AREA2$;" ";L
9800 NEXT L
9900 NEXT K
10000 NEXT J
We can assume that everything to here is good.
Line 8600 when bin$(j,k,l)="Q" should branch to 9800, right? Well, it hits 9600 and 9700 instead. So I thought a logic error, but, change 8600 to:
8600 if bin$(j,k,l)="Q" then stop
and the program halts (when it should, as at that point bin$(j,k,l) DID ="Q")
So, how the #$^%#$& am I getting lines 9600 and 9700 when bin$(j,k,l)="Q"?
BTW... tried:
retyping the lines (weird, but I was trying anything)
renumbered
different variable name from bin$
Always the same result.
Any thoughts?
BTW - tried to register buy it seems there must be a backlog on sending confirmation emails.
Jim
Hi Jim, thanks for getting in touch! I can't quite reproduce the problem - I'm assuming you use PC-BASIC 15.08.10; if I add a few lines and comment out 9600 to make the code fragment run, and add some debugging:
My output is:
Which I think is what would be expected - after encountering the
Q
the program jumps to line9800
.Perhaps the problem only shows up with the data supplied in your full program - could you send me the code that, when run, demonstrates the problem?
Thanks
Rob
Last edit: Rob Hagemans 2016-10-12
View and moderate all "[CLOSED] General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Rob
If I had sent you the full code you probably would have seen what I FINALLY saw after houirs of staring (and, yes, programmer stupidity)
I didn't include the data statement (not prettied up) which was
ABCDEFGHIJKLMOPQRSTUVWXYZ
Apparantly I invented an alphabet withou any Ns, therefore instead of reading to Q it was reading to R. Now, why it would stop was beacuse earlier in the program it defaulted to Q for a different reason.
Appreciate you taking the time to look - sorry it was such a stupid error.
Jim