Qbasicnews.com

Full Version: Scrolling: it goes too slow. Anything I can do?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Before your loop:

Code:
DEF SEG = &HA000

To plot a pixel:

Code:
POKE y%*320& + x%, colour%

After your loop:

Code:
DEF SEG

Faster in compiled mode, but gives an error on the IDE is this:

Code:
POKE y%*320 + x%, colour%

(odd, but in EXE form integers seem to be unsigned sometimes Tongue)
Combination of double buffering and direct vid mem access should do it. Excellent. This game just might shape up. Big Grin
Make a lookup table to avoid the mults and it will go faster:

Code:
SUB Put (bleh...)
   STATIC init%, table&()
  
   IF NOT init% THEN
      DIM table&(199)
      FOR i%=0 TO 199
         table&(i%) = 320&*i%
      NEXT
      init%=-1
   END IF

   DEF SEG=&HA000
   ' Your PUT routine here
   ' ...
   POKE table&(y%) + x%, c%
   ' ...
   DEF SEG
END SUB
[semi-offtopic]
Wow. Surprised I never thought of doing that. :o (lookup tables) Something like that might speed up Useless Sock even faster than it already is...
[/semi-offtopic]
Quote:Okay, I tried that IF thing of yours Nath. It's faster, but still not...fast. My main problem now is that you can kinda see it's being drawn. If I was using SCREEN 7,0,1,0 and PCOPYing, it would be fine. Is that what Double Bufferring does?
Btw all, about the high-speed PUT, sorry - I'm stuck with my own PutSprite routine.


Try SuperPut

It flips and clips and is faster than QB's PUT. Although you use PUT itself. :*). And yeah, transparency is supported.

If you don't want to use Supeput(I don't see why you won't) here's a mini scroller:
http://rel.betterwebber.com/junk.php?id=16

If you don't understand something just PM me. :*)

I would recommend you use SuperPut though. :*)

Here's also a preclipped-pokebased sprite routine:

http://rel.betterwebber.com/junk.php?id=4

Rel.Sprite SUB.
Superput is a library in denial Big Grin

There's actually several tricks to speed up pure qb programming... unrolling loops, etc. But libraries are so much easier and they involve soooo little work in comparison...
Rel: Ah, haven't I said it enough? I gotta use PutSprite, PJ's own little routine. However! It uses PSET, so I think that if I do two things:
1) Shrink the active screen area to be redrawn (from 30x18 to 12x10).
2) Replace PSET with the faster method.
I think it'll run just dandy.
But for now, I'm celebrating since I learned scrolling. Tongue
Quote:Superput is a library in denial Big Grin

There's actually several tricks to speed up pure qb programming... unrolling loops, etc. But libraries are so much easier and they involve soooo little work in comparison...

Heh. :*)

Zack: then Rel.Sprite might be of interest to you. It preclips and can handle offseting. It's still straight QB .:*)

Link above. :*)
Zack, i high, highly recommend looking at relgfx, and minirpg. VERY useful.

also, i prefer this tut on db myself.

http://faq.qbasicnews.com/?blast=ZipsDou...ngTutorial
Back offffff, guys, about all these libs. :wink:
I did what I said I would do, and it works perfectly. Expect enormous maps in Operation Pong. Smile
Pages: 1 2