Jump to content
IGNORED

Here's a tough one...at least for me.


Gorf

Recommended Posts

Is the following possible some how in batari, even perhaps with the 'asm' statement?

 

Keep in mind this is a multi-sprite kernel, using 32 rom bankswitching

 

 

 includesfile multisprite_superchip.inc
includesfile multisprite_bankswitch.inc
set kernel multisprite
set romsize 32kSC

...
... other code
...

gosub setdata

bank 2

pos0
player0:
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx 
%xxxxxxxxx
end
return

pos1
player0:
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx 
%xxxxxxxxx
end
return

pos2
player0:
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx 
%xxxxxxxxx
end
return

pos3
player0:
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx
%xxxxxxxxx 
%xxxxxxxxx
end
return

bank 3

data spriteframes
pos0,pos1,pos2,pos3
end

setdata
goto spriteframes[x] bank2

 

I know this is not right as the compiler complains but is there a way to do this?

Like a vector table but with bank-jumping ability(right term???)

 

thanks

Link to comment
Share on other sites

This is one solution. setdata is in another bank so you need to specify where it is, and you can use on...goto for determining cross-bank vectors, as follows:

 ...
 gosub setdata bank3
...

 bank 3

setdata
 on x goto p0 p1 p2 p3
p0 goto pos0 bank2
p1 goto pos1 bank2
p2 goto pos2 bank2
p3 goto pos3 bank2

BTW, is there a reason why setdata needs to be in bank 3? It would run faster if you could place it in the bank that calls it.

Edited by batari
Link to comment
Share on other sites

 includesfile multisprite_superchip.inc
includesfile multisprite_bankswitch.inc

I would use "on x goto pos0 pos1 pos2" etc., as batari suggested. Note that you don't need to use both of the "includesfile" statements shown above, just one of them-- depending on whether or not you want to use the Superchip. That is, use of the Superchip implies that you're also using bankswitching-- and I made the "multisprite_superchip.inc" file from "multisprite_bankswitch.inc," so it has everything in it that you need for bankswitching. So use "includesfile multisprite_bankswitch.inc" if you want to do bankswitching with the multisprite kernel but don't want to use the Superchip, and use "includesfile multisprite_superchip.inc" (by itself) if you want to do bankswitching with the multisprite kernel and also want to use the Superchip.

 

Michael

Link to comment
Share on other sites

This is one solution. setdata is in another bank so you need to specify where it is, and you can use on...goto for determining cross-bank vectors, as follows:

 ...
 gosub setdata bank3
...

 bank 3

setdata
 on x goto p0 p1 p2 p3
p0 goto pos0 bank2
p1 goto pos1 bank2
p2 goto pos2 bank2
p3 goto pos3 bank2

BTW, is there a reason why setdata needs to be in bank 3? It would run faster if you could place it in the bank that calls it.

 

 

 

yes...its in another bank as there will be a ton more frames like this.

if the above more effcient(space wise/speed wise) than

 

if x = 0 goto p0

if x = 1 goto p1

if x = 2 goto p2

if x = 3 goto p3

 

 

?

 

thanks as always :)

Link to comment
Share on other sites

 includesfile multisprite_superchip.inc
includesfile multisprite_bankswitch.inc

I would use "on x goto pos0 pos1 pos2" etc., as batari suggested. Note that you don't need to use both of the "includesfile" statements shown above, just one of them-- depending on whether or not you want to use the Superchip. That is, use of the Superchip implies that you're also using bankswitching-- and I made the "multisprite_superchip.inc" file from "multisprite_bankswitch.inc," so it has everything in it that you need for bankswitching. So use "includesfile multisprite_bankswitch.inc" if you want to do bankswitching with the multisprite kernel but don't want to use the Superchip, and use "includesfile multisprite_superchip.inc" (by itself) if you want to do bankswitching with the multisprite kernel and also want to use the Superchip.

 

Michael

 

 

Ah ha! Did not realize that...sweet! I'll remove the non Sc one then.

 

Thanks Mike.

:)

Link to comment
Share on other sites

if the above more effcient(space wise/speed wise) than

 

if x = 0 goto p0

if x = 1 goto p1

if x = 2 goto p2

if x = 3 goto p3

 

 

?

 

thanks as always :)

On...goto is shorter if you have 3 or more targets. On...goto takes around 20 cycles no matter how many targets you have, so speed isn't much of a concern.

Link to comment
Share on other sites

if the above more effcient(space wise/speed wise) than

 

if x = 0 goto p0

if x = 1 goto p1

if x = 2 goto p2

if x = 3 goto p3

 

 

?

 

thanks as always :)

On...goto is shorter if you have 3 or more targets. On...goto takes around 20 cycles no matter how many targets you have, so speed isn't much of a concern.

 

 

On goto it is then! Thanks Batari.

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.

Guest
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.

Loading...
  • Recently Browsing   0 members

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