The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Different result than expected when poking to screen
#4
Yes, the 1st problem is for Uinteger overflow.
But you can do this:

Code:
dim i as ubyte dim x as ubyte dim y as ubyte dim l as uinteger FOR i=1 TO 6 FOR y=0 TO 23 FOR x=0 TO 31 l=22528+x+(CAST(UInteger, y)<<5): REM Cast from ubyte to Uinteger to avoid overflow POKE l,i<<3 NEXT NEXT NEXT
Also, when you multiply by a power of 2 (e.g. 8, 32 like in this case) you can use << n, where n is the power.
For example, 8 = 2^3, so to multiply per 8 you do (x << 3). The same applies to integer division with >>.
Normally ZX Basic does this automatically, but for some reason it's not working in this case, so I put it explicitly.
Compile this code with -O3 (optimize for speed) and tell me if it goes fast.

Use -O3 (might have bugs!) when you have tested your program, to get a faster optimized code.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)