![]() |
Rnd help please - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16) +---- Thread: Rnd help please (/showthread.php?tid=305) |
Rnd help please - slenkar - 02-18-2011 heres my code Code: POKE Uinteger 23675, @MyUdgBlock When I draw random dots the rnd function works fine, but when I draw factories at random positions it doesnt turn out right I am trying to draw the red ones on the right side of the screen but they end up on the left the blue ones are all over the screen Re: Rnd help please - boriel - 02-18-2011 You're overflowing your screen: SINCLAIR Basic PRINT AT uses Y, X coordinates (row, column) ![]() I've reversed them in your listing and it seems to be working ok. Since this is a compiled program, by default it won't check your screen overflows (e.g. "OUT of Screen error"), but with the flag (NOT YET IMPLEMENTED) --debug-screen it will stop when this happens. There are more checkers already done: --debug-array Will raise a "Subscript out of range" if you access an non-existing array-cell --debug-memory Will raise an "Out of memory error" in case the program run out of mem. The idea is: If you suspect your program has an error, enable the checkers and tests it. Once your program runs ok, compile again without your check flags (faster and less memory required) ![]() Re: Rnd help please - slenkar - 02-18-2011 thanks for the fix Quote: PRINT ... ; is faster than PRINT ... , im not sure what this means, like this? Print y,x; print y,x, Re: Rnd help please - boriel - 02-18-2011 slenkar Wrote:thanks for the fixNo, this way: Code: PRINT a$; : REM Faster than PRINT a$ ![]() Re: Rnd help please - slenkar - 02-19-2011 ok thanks for that Re: Rnd help please - boriel - 02-20-2011 I've just uploaded a new revision 1.2.7-r2096. Please download and test! It has some bugfixes so the --debug-array and the --debug-memory works ok again. If you run your program with --debug-array it seems to work ok, but sometimes an "OUT of Screen" is returned. So check screen boundaries. |