Jump to content



0

Program bug from program from a book


10 replies to this topic

#1 Allan OFFLINE  

Allan

    River Patroller

  • 4,249 posts
  • Location:Wallingford, CT

Posted Tue Feb 7, 2012 7:27 PM

I typed in the program below from an atari programming book (Understanding Atari Graphics) and I'm getting an error 5 in line 290 and can't figure out why. I don't think I made any mistakes. (checked it a bunch of times). Any suggestions?

Allan




10 REM Zigzag
20 REM a mode 10 demo
50 GRAPHICS 10
60 FOR R=704 TO 712:READ C:POKE R,C:NEXT R
70 DATA 0,148,182,216,30,58,74,68,100
80 DIM S$(33):I=-33
90 FOR B=1 TO 3
100 S$="ABCDEFGHABCDEFGH":T=1:I=I+32:GOSUB 160
110 S$="HGFEDCBAHGFEDCBA":T=2:I=I+32:GOSUB 160
120 NEXT B
130 X=PEEK(712)
140 FOR R=1 TO 8:Y=PEEK(704+R):POKE 70 4+R,X:X=Y:NEXT R:IF PEEK(53279)=6 THEN END
150 GOTO 140
160 FOR Y=1 TO 16
170 POSITION 0,I+Y
180 FOR X=1 TO 10
190 ON T GOSUB 280,290
200 NEXT X:NEXT Y
210 FOR Y2=16 TO 1 STEP -1
220 POSITION 0,I+16+Y2
230 FOR X=1 TO 10
240 Y=17-Y2
250 ON T GOSUB 280,290
260 NEXT X:NEXT Y2
270 RETURN
280 ? #6;S$(9-(Y-(INT((Y-1)/8)*8)),16-(Y-(INT((Y-1)/8)*8)));:RETURN
290 ? #6;S$(1-(Y-(INT((Y-1)/8)*8)),8+(Y-(INT((Y-1)/8)*8)));:RETURN

#2 jaybird3rd ONLINE  

jaybird3rd

    Quadrunner

  • 5,249 posts
  • Location:Northeast Alabama

Posted Tue Feb 7, 2012 7:41 PM

You should put that inside a pair of code tags, to get rid of the smiley faces.

#3 Bryan OFFLINE  

Bryan

    Quadrunner

  • 7,626 posts
  • Cruise Elroy = 4DB7
  • Location:Port St. Lucie, Florida

Posted Tue Feb 7, 2012 7:50 PM

View Postjaybird3rd, on Tue Feb 7, 2012 7:41 PM, said:

You should put that inside a pair of code tags, to get rid of the smiley faces.
Hmm... I think ERROR 5 is an emoticon math error.


Actually, it looks like it's going beyond the dimensioned length of S$.

#4 DanBoris OFFLINE  

DanBoris

    Dragonstomper

  • 930 posts
  • Location:New Jersey, USA

Posted Tue Feb 7, 2012 8:01 PM

View PostBryan, on Tue Feb 7, 2012 7:50 PM, said:

View Postjaybird3rd, on Tue Feb 7, 2012 7:41 PM, said:

You should put that inside a pair of code tags, to get rid of the smiley faces.
Hmm... I think ERROR 5 is an emoticon math error.


Actually, it looks like it's going beyond the dimensioned length of S$.I am going to take a wild guess and say that in line 290

I am betting that the "1-" in line 290 is wrong.

#5 miker OFFLINE  

miker

    Stargunner

  • 1,441 posts
  • Stay Atari!
  • Location:Warsaw, Poland

Posted Tue Feb 7, 2012 11:56 PM

Or something else. There's variable "X" in some loops, and no X'es present in lines 280, 290 (or maybe they ares hidden behind smileys ;) ).

@ Allan: please re-paste it into some spoiler, code-box or just turn off smileys, so we will have a closer look into this.

#6 rdea6 OFFLINE  

rdea6

    Dragonstomper

  • 910 posts
  • Location:Arizona USA

Posted Wed Feb 8, 2012 1:31 AM

View PostAllan, on Tue Feb 7, 2012 7:27 PM, said:

I typed in the program below from an atari programming book (Understanding Atari Graphics) and I'm getting an error 5 in line 290 and can't figure out why. I don't think I made any mistakes. (checked it a bunch of times). Any suggestions?

Allan




10 REM Zigzag
20 REM a mode 10 demo
50 GRAPHICS 10
60 FOR R=704 TO 712:READ C:POKE R,C:NEXT R
70 DATA 0,148,182,216,30,58,74,68,100
80 DIM S$(33):I=-33
90 FOR B=1 TO 3
100 S$="ABCDEFGHABCDEFGH":T=1:I=I+32:GOSUB 160
110 S$="HGFEDCBAHGFEDCBA":T=2:I=I+32:GOSUB 160
120 NEXT B
130 X=PEEK(712)
140 FOR R=1 TO 8:Y=PEEK(704+R):POKE 70 4+R,X:X=Y:NEXT R:IF PEEK(53279)=6 THEN END
150 GOTO 140
160 FOR Y=1 TO 16
170 POSITION 0,I+Y
180 FOR X=1 TO 10
190 ON T GOSUB 280,290
200 NEXT X:NEXT Y
210 FOR Y2=16 TO 1 STEP -1
220 POSITION 0,I+16+Y2
230 FOR X=1 TO 10
240 Y=17-Y2
250 ON T GOSUB 280,290
260 NEXT X:NEXT Y2
270 RETURN
280 ? #6;S$(9-(Y-(INT((Y-1)/ 8)* 8)),16-(Y-(INT((Y-1)/ 8)* 8)));:RETURN
290 ? #6;S$(1-(Y-(INT((Y-1)/ 8)* 8)),8+(Y-(INT((Y-1)/ 8)* 8)));:RETURN

This one works:
10 REM Zigzag
20 REM a mode 10 demo
50 GRAPHICS 10
60 FOR R=704 TO 712:READ C:POKE R,C:NEXT R
70 DATA 0,148,182,216,30,58,74,68,100
80 DIM S$(33):I=-33
90 FOR B=1 TO 2
100   S$="ABCDEFGHABCDEFGH":T=1:I=I+32:GOSUB 160
110   S$="HGFEDCBAHGFEDCBA":T=2:I=I+32:GOSUB 160
120 NEXT B
130 X=PEEK(712)
140 FOR R=1 TO 8:Y=PEEK(704+R):POKE 704+R,X:X=Y:NEXT R:IF PEEK(53279)=6 THEN END
150 GOTO 140
160 FOR Y=1 TO 16
170   POSITION 0,I+Y
180   FOR X=1 TO 10
190	 ON T GOSUB 280,290
200   NEXT X:NEXT Y
210 FOR Y2=16 TO 1 STEP -1
220   POSITION 0,(I+16)+Y2
230   FOR X=1 TO 10
240	 Y=17-Y2
250	 ON T GOSUB 280,290
260   NEXT X:NEXT Y2
270 RETURN
280 ? #6;S$(9-(Y-(INT((Y-1)/8)*8)),16-(Y-(INT((Y-1)/8)*8))):RETURN
290 ? #6;S$(9-(Y-(INT((Y-1)/8)*8)),8+(Y-(INT((Y-1)/8)*8))):RETURN
And this is the output:

ZIG.png

Edited by rdea6, Wed Feb 8, 2012 1:32 AM.


#7 Mclaneinc OFFLINE  

Mclaneinc

    Stargunner

  • 1,084 posts
  • Location:Northolt, UK

Posted Wed Feb 8, 2012 2:02 AM

its at times like this you just love the cut and paste feature in Altirra :)

I hated type ins, being a ZX81 owner with the 16K rampack I was hit with the curse of the ram pack wobble and crash many times on my type ins. I also hated going through all the data strings knowing I'd make the most typo's there :(

So why type when you can nick someone elses hard work :)

#8 Rybags OFFLINE  

Rybags

    Quadrunner

  • 10,314 posts
  • Location:Australia

Posted Wed Feb 8, 2012 3:36 AM

Wasn't there a fix for that... like jamming bits of paper in to tighten the fit or something?

#9 DEBRO OFFLINE  

DEBRO

    Stargunner

  • 1,862 posts
  • Location:Atlanta, GA

Posted Wed Feb 8, 2012 6:28 AM

Hi there,

View PostMclaneinc, on Wed Feb 8, 2012 2:02 AM, said:

I hated type ins, being a ZX81 owner with the 16K rampack I was hit with the curse of the ram pack wobble and crash many times on my type ins. I also hated going through all the data strings knowing I'd make the most typo's there :(

LOL! Those were the worst! I eventually forced myself to only create programs that ran in 2K (I had a Sinclair). If I had a 16K type-in then I was constantly saving :lol:

View PostRybags, on Wed Feb 8, 2012 3:36 AM, said:

Wasn't there a fix for that... like jamming bits of paper in to tighten the fit or something?

Yes, but it wasn't perfect. That membrane keyboard could have you pressing hard and shaking the pack loose again.

#10 Mclaneinc OFFLINE  

Mclaneinc

    Stargunner

  • 1,084 posts
  • Location:Northolt, UK

Posted Wed Feb 8, 2012 6:37 AM

The cure was to sell yours ASAP :)

I sold mine to Artic Computing (the adventure makers), was glad to see the back of it :)

#11 Allan OFFLINE  

Allan

    River Patroller

  • 4,249 posts
  • Location:Wallingford, CT

Posted Wed Feb 8, 2012 10:42 AM

Thanks for the laughs guys.

rdea6.

Thanks for the help. I think it's suppose to go across the whole screen though. When I run the original version it fills across the screen like the pic below and then it stops with an error.

10 REM Zigzag						
20 REM a mode 10 demo				
50 GRAPHICS 10						
60 FOR R=704 TO 712:READ C:POKE R,C:NEXT R								  
70 DATA 0,148,182,216,30,58,74,68,100
80 DIM S$(16):I=-33				  
90 FOR B=1 TO 3					  
100 S$="ABCDEFGHABCDEFGH":T=1:I=I+32:GOSUB 160							  
110 S$="HGFEDCBAHGFEDCBA":T=2:I=I+32:GOSUB 160							  
120 NEXT B							
130 X=PEEK(712)					  
140 FOR R=1 TO 8:Y=PEEK(704+R):POKE 704+R,X:X=Y:NEXT R:IF PEEK(53279)=6 THEN END								  
150 GOTO 140						  
160 FOR Y=1 TO 16					
170 POSITION 0,I+Y					
180 FOR X=1 TO 10					
190 ON T GOSUB 280,290				
200 NEXT X:NEXT Y					
210 FOR Y2=16 TO 1 STEP -1			
220 POSITION 0,I+16+Y2				
230 FOR X=1 TO 10					
240 Y=17-Y2						  
250 ON T GOSUB 280,290				
260 NEXT X:NEXT Y2					
270 RETURN							
280 ? #6;S$(9-(Y-(INT((Y-1)/8)*8)),16-(Y-(INT((Y-1)/8)*8)));:RETURN		
290 ? #6;S$(9-(Y-(INT((Y-1)/8)*8)),8+(Y-(INT((Y-1)/8)*8)));:RETURN		  


Dan,
Thanks. That fixed part of the problem. As you can see in the other pic there still is a problem. It defintely is a mis-print in the book. I just need to find the second problem.


Allan

Attached Thumbnails

  • atari003.jpg
  • atari002.jpg

Edited by Allan, Wed Feb 8, 2012 10:43 AM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users