diogoandrei Posted January 19, 2011 Share Posted January 19, 2011 Hello there all, what's up? I am doing this small study on data arrays. I ran into a problem with the _lenght constant of the read-only data. My data has 12 elements and it's not returning this value. Here's the code: dim pixelPointer = a dim pixelTimer = b dim pixelX = c dim pixelY = d pixelPointer = $ff COLUPF = $40 COLUBK = $00 scorecolor = $40 MainLoop pixelTimer = pixelTimer + 1 if pixelTimer = 50 then pixelTimer = 0 : gosub pixelLocation pfpixel pixelX pixelY on rem ******************************************************************** rem TESTING VARIABLES f = pixelData_length score = 0 temp5 = f if temp5 > 0 then for temp6 = 1 to temp5 : score = score + 1000 : next temp5 = pixelY if temp5 > 0 then for temp6 = 1 to temp5 : score = score + 1 : next drawscreen goto MainLoop pixelLocation pfpixel pixelX pixelY off pixelPointer = pixelPointer + 1 : if pixelPointer = 12 then pixelPointer = 0 pixelX = pixelData[pixelPointer] pixelPointer = pixelPointer + 1 pixelY = pixelData[pixelPointer] return data pixelData 1,1,2,2,3,3,4,4,5,5,6,6 end Actually, when I test this: f = pixelData_length score = 0 temp5 = f if temp5 > 0 then for temp6 = 1 to temp5 : score = score + 1000 : next ...the playfield even changes color and the score shows 140. So I had to hand code the value to avoid the pointers going beyond the number of elements... if pixelPointer = 12 then pixelPointer = 0 Any help would be great! Thanks! Quote Link to comment Share on other sites More sharing options...
RevEng Posted January 19, 2011 Share Posted January 19, 2011 Can you attach the .asm file that was generated when you compiled the basic file? For some reason my bB version doesn't have _length attributes, but I did something equivalent in assembly and your code worked as expected. (012000, 012001, etc.) Quote Link to comment Share on other sites More sharing options...
diogoandrei Posted January 19, 2011 Author Share Posted January 19, 2011 Hello RevEng, what's up? Attached follows the .asm files (there was one for the project and one entitled bB.asm - I wasn't sure so I put both in there). Regarding the _length attribute, I did read about it at Random Terrain, this section. From there I assumed it would be in bB. Can it be possible that this is a small bug? Once again, thanks for your time and attention! PF_pixels.zip Quote Link to comment Share on other sites More sharing options...
RevEng Posted January 19, 2011 Share Posted January 19, 2011 Yeah, it's definitely a valid attribute. I just need to update my local bB, I guess. I didn't learn anything from the PF_pixels.bas.asm. I guess the *_length constants are introduced in one of the included .asm files. I do think this is probably a bB bug; my workaround produced correct results, so there aren't any bugs in your basic program. Personally, I'd just workaround it by using your own constant. You could define it right above the data statement so you won't forget to update it if you update the values. Quote Link to comment Share on other sites More sharing options...
diogoandrei Posted January 19, 2011 Author Share Posted January 19, 2011 Personally, I'd just workaround it by using your own constant. You could define it right above the data statement so you won't forget to update it if you update the values. Yeah, I'll stick to that. Thx! Quote Link to comment Share on other sites More sharing options...
RevEng Posted January 19, 2011 Share Posted January 19, 2011 You're welcome! Quote Link to comment Share on other sites More sharing options...
diogoandrei Posted January 19, 2011 Author Share Posted January 19, 2011 Should I report this "may be a bug" to someone? What's the best thing to do when running into something like this? Quote Link to comment Share on other sites More sharing options...
RevEng Posted January 19, 2011 Share Posted January 19, 2011 You can report it here: http://www.atariage.com/forums/topic/73160-bug-report-thread/ Quote Link to comment Share on other sites More sharing options...
+batari Posted January 20, 2011 Share Posted January 20, 2011 I posted about it in the bug report thread. http://www.atariage.com/forums/topic/73160-bug-report-thread/page__st__150__gopid__2188545#entry2188545 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.