Jump to content

How can I speed up an XB program?


Recommended Posts

Wilsy you are correct, we need to give Barry Traver credit for Tiger Cub being entirely written in CALL [program] format.


In the GPL code it uses all temporary variables and forces a garbage collection (XML COMPCT) and XML SPEED

(makes XML faster by cutting down on support routines use in ROM)


Very well played Wilsy. Maybe I should look at RXB and borrow some of the tricks to speed up other things in XB.

Link to comment
Share on other sites

GOSUB and RETURN are faster but use normal memory to access Variables and as such do not use XML COMPCT or XML SPEED that often.


But GOSUB and RETURN are in the NUD table so you are correct that they are faster as they use Assembly ROM for access.


So you are right and I was mistaken.

Link to comment
Share on other sites

I would have expected CALL "SUB" to be slower than GOSUB, and the timing table indicated just that.


There's the option to use local and/or global variables, but I'd still expect GOSUB to be faster. For this topic (speed) it's GOSUB over CALL SUB. Though the timing table list CALL SUB as one of the faster statements.


For speed one might also consider the power of ON GOSUB.

Link to comment
Share on other sites

Yep. For speed in XB its GOTO and GOSUB. That is definately true.


I can say though (having written programs using spaghetti GOTOs GOSUBs and SUBs that writing with SUBs is so much nicer. Passing locals into the SUBs is a nice high-level system.


But yeah, for speed I can see that you'd want to use GOTO & GOSUB (or, not use XB at all and use something else, like assembler ;)

Link to comment
Share on other sites

or, not use XB at all and use something else, like assembler


Besides compiling an XB program (which I haven't tried), then I don't think it's been directly suggested here, or maybe considered outside topic, but you can of course "speed up an XB program" using an Assembly routine(s). And there's already quite a few routines out there, for example Matthew's music player or some of my own one shot and hook up effect routines. Like this one (sorry, animation is not as smooth as on the real iron) ...




Also not forgetting your own The Gamewriter's Toolkit.


One could write a hook up that monitors the hardware collision detection, and when sprung, freezes action (sets number of sprites for auto movement to zero) and stores information in a byte for XB to read at any time. XB might be a bit late to pickup and react upon the collision, but the collision isn't missed.


Lots of possibilities.

Link to comment
Share on other sites

XB has a added bonus of being able to create outlines for more complicated languages like Assembly.


Most programs you see had the first concept in XB for a good reason.

Also XB is much more easy to transfer over into another language then say C into XB or C into Logo or Forth.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...