I read that you can get a speed boost in basic by using VPOKE instead of putsprite, so I tracked down the memory location and tried it, but it doesn't seem to be any faster... Unless I'm doing it wrong.
Here's what I tried:
10 SCREEN1:CLS 20 SPRITE$(0)=CHR$(&HD8)+CHR$(&H50)+CHR$(&HF8)+CHR$(&HA8)+CHR$(&H73)+CHR$(&H3E)+CHR$(&H7E)+CHR$(&HC7) 30 '** TEST1 PUTSPRITE 1 40 TIME=0:X=0:Y=99:A=10 50 X=X+1 60 PUTSPRITE0,(X,Y),15,0 70 IF X>254 AND A>0 THEN X=0:A=A-1 80 IF A=0 THEN GOTO 100 90 GOTO 50 100 PRINT TIME 110 '** TEST2 PUTSPRITE 2 120 TIME=0:X=0:Y=99:A=10 130 X=X+1 140 PUTSPRITE0,(X,Y) 150 IF X>254 AND A>0 THEN X=0:A=A-1 160 IF A=0 THEN GOTO 180 170 GOTO 130 180 PRINT TIME 190 '** TEST3 VPOKE 1 200 TIME=0:X=0:Y=99:A=10 210 X=X+1 220 VPOKE BASE(8),Y:VPOKE BASE(8)+1,X 230 IF X>254 AND A>0 THEN X=0:A=A-1 240 IF A=0 THEN GOTO 260 250 GOTO 210 260 PRINT TIME 270 '** TEST4 VPOKE 2 280 TIME=0:X=0:Y=99:A=10 290 X=X+1 300 VPOKE 6912,Y:VPOKE 6913,X 310 IF X>254 AND A>0 THEN X=0:A=A-1 320 IF A=0 THEN GOTO 340 330 GOTO 290 340 PRINT TIME
For test 1 "Putsprite 0,(X,Y),15,0" I got 2579
For test 2 "Putsprite 0,(X,Y)" I got 2356
For test 3 "Vpoke Base(8)" I got 3179
For test 4 "Vpoke 6912" I got 2403
It seems that Put Sprite minus the color and sprite definition is actually faster than Vpoke-ing the X and Y.
But perhaps one of you who are more experienced know how to Vpoke the sprite position better? I couldn't figure out how to combine both the X and Y coordinates into one Vpoke.
Aangemeld of registreer om reacties te plaatsen