+Gemintronic Posted August 12, 2010 Share Posted August 12, 2010 (edited) So, I'm trying to convert Game Maker 5 constants, subroutines and functions over to Batari BASIC. I'm trying to keep my library of routines in the second bank. How do functions work with multi-banked games? Do they at all? Edited August 12, 2010 by theloon Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted August 13, 2010 Share Posted August 13, 2010 So, I'm trying to convert Game Maker 5 constants, subroutines and functions over to Batari BASIC. I'm trying to keep my library of routines in the second bank. How do functions work with multi-banked games? Do they at all? Functions are like subroutines, so I think there would be a problem calling them if they're in a different bank. This is a good question, and I don't have a good answer, but it might be necessary to create a multibanked version of user functions. Otherwise, you'd probably need to find a way to work around the problem of calling them from different banks. Like I said, I don't have an answer. If I can think of something, I'll let you know. Michael Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted August 13, 2010 Share Posted August 13, 2010 I was playing with batari's platformer source code not that long ago and it used 2 banks. He put his functions in the last bank: http://www.atariage.com/forums/topic/166826-so-far-so-good/page__view__findpost__p__2065923 Quote Link to comment Share on other sites More sharing options...
+Gemintronic Posted August 13, 2010 Author Share Posted August 13, 2010 (edited) Thanks for the replies so far. I'd like to use functions multi-bank if possible. I noticed Batari's Platformer example seems to only call the functions from the same bank. So it still doesn't prove functions can work across banks. Workaround seems to be setting aside a variable or two as arguments and then calling a gosub that uses those variables. Edited August 13, 2010 by theloon Quote Link to comment Share on other sites More sharing options...
+batari Posted August 13, 2010 Share Posted August 13, 2010 (edited) Thanks for the replies so far. I'd like to use functions multi-bank if possible. I noticed Batari's Platformer example seems to only call the functions from the same bank. So it still doesn't prove functions can work across banks. Workaround seems to be setting aside a variable or two as arguments and then calling a gosub that uses those variables. You can make a cross-bank wrapper to do this. For example, if this function is in bank 2 (note this is modified a bit from the platformer source - the return is used to go back to the calling bank): function blockread temp1=temp1-16:temp1=temp1/4 temp2=temp2+1 temp2=temp2/4-3 temp1=romPFpixel(temp1,temp2) return To call it from bank 1, do something like this in bank 1: function blockread_bank1_wrapper goto blockread bank2 Untested, but I think this will work. If it does not, let me know. That said, cross-bank subroutines should be minimized as they use perhaps 30-60 more cycles than in-bank subroutines. Edited August 18, 2010 by batari Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.