yuppicide Posted November 8, 2008 Share Posted November 8, 2008 I'm designing a new "adult game" for the Atari 2600. I need some help/questions answered. 1 - Let's say I have some long code.. I need to break it up between two banks. Will this work? gosub catwalk bank 2 drawscreen goto gameloop bank 2 catwalk a = a + 1 bank 3 catwalk2 b = a + 1 return That's not the actual code, I just made that up, but when the code goes to catwalk in bank 2 will it continue right down into bank 3? Or do I need to do it like this with two separate gosubs? gosub catwalk bank 2 gosub catwalk2 bank 3 drawscreen goto gameloop bank 2 catwalk a = a + 1 return bank 3 catwalk2 b = a + 1 return 2 - Is there a way for me to shorten something like this code or not? This is the code I was talking about that is so large I had to split it up between multiple banks. I can get my game to compile by splitting my code between multiple banks, but when I get to a certain part it freezes up, switches color, and resets back to the title screen. oneone if pretop = 1 && prebot = 1 && holea > 0 && holea < 23 then holea = 2 if pretop = 1 && prebot = 1 && holea > 23 && holea < 46 then holea = 3 if pretop = 1 && prebot = 1 && holea > 46 && holea < 69 then holea = 4 if pretop = 1 && prebot = 1 && holea > 69 && holea < 92 then holea = 5 if pretop = 1 && prebot = 1 && holea > 92 && holea < 115 then holea = 6 if pretop = 1 && prebot = 1 && holea > 115 && holea < 138 then holea = 7 if pretop = 1 && prebot = 1 && holea > 138 && holea < 161 then holea = 8 if pretop = 1 && prebot = 1 && holea > 161 && holea < 184 then holea = 9 if pretop = 1 && prebot = 1 && holea > 184 && holea < 207 then holea = 10 if pretop = 1 && prebot = 1 && holea > 207 && holea < 230 then holea = 11 if pretop = 1 && prebot = 1 && holea > 230 && holea < 255 then holea = 12 onetwo if pretop = 1 && prebot = 2 && holea > 0 && holea < 25 then holea = 2 if pretop = 1 && prebot = 2 && holea > 25 && holea < 50 then holea = 3 if pretop = 1 && prebot = 2 && holea > 50 && holea < 75 then holea = 4 if pretop = 1 && prebot = 2 && holea > 75 && holea < 100 then holea = 5 if pretop = 1 && prebot = 2 && holea > 100 && holea < 125 then holea = 6 if pretop = 1 && prebot = 2 && holea > 125 && holea < 150 then holea = 7 if pretop = 1 && prebot = 2 && holea > 150 && holea < 175 then holea = 8 if pretop = 1 && prebot = 2 && holea > 175 && holea < 200 then holea = 9 if pretop = 1 && prebot = 2 && holea > 200 && holea < 225 then holea = 10 if pretop = 1 && prebot = 2 && holea > 225 && holea < 255 then holea = 11 onethree if pretop = 1 && prebot = 3 && holea > 0 && holea < 28 then holea = 2 if pretop = 1 && prebot = 3 && holea > 28 && holea < 56 then holea = 3 if pretop = 1 && prebot = 3 && holea > 56 && holea < 84 then holea = 4 if pretop = 1 && prebot = 3 && holea > 84 && holea < 112 then holea = 5 if pretop = 1 && prebot = 3 && holea > 112 && holea < 140 then holea = 6 if pretop = 1 && prebot = 3 && holea > 140 && holea < 168 then holea = 7 if pretop = 1 && prebot = 3 && holea > 168 && holea < 196 then holea = 8 if pretop = 1 && prebot = 3 && holea > 196 && holea < 224 then holea = 9 if pretop = 1 && prebot = 3 && holea > 224 && holea < 255 then holea = 10 onefour if pretop = 1 && prebot = 4 && holea > 0 && holea < 31 then holea = 2 if pretop = 1 && prebot = 4 && holea > 31 && holea < 62 then holea = 3 if pretop = 1 && prebot = 4 && holea > 62 && holea < 93 then holea = 4 if pretop = 1 && prebot = 4 && holea > 93 && holea < 124 then holea = 5 if pretop = 1 && prebot = 4 && holea > 124 && holea < 155 then holea = 6 if pretop = 1 && prebot = 4 && holea > 155 && holea < 186 then holea = 7 if pretop = 1 && prebot = 4 && holea > 186 && holea < 217 then holea = 8 if pretop = 1 && prebot = 4 && holea > 217 && holea < 255 then holea = 9 twoone if pretop = 2 && prebot = 1 && holea > 0 && holea < 25 then holea = 3 if pretop = 2 && prebot = 1 && holea > 25 && holea < 50 then holea = 4 if pretop = 2 && prebot = 1 && holea > 50 && holea < 75 then holea = 5 if pretop = 2 && prebot = 1 && holea > 75 && holea < 100 then holea = 6 if pretop = 2 && prebot = 1 && holea > 100 && holea < 125 then holea = 7 if pretop = 2 && prebot = 1 && holea > 125 && holea < 150 then holea = 8 if pretop = 2 && prebot = 1 && holea > 150 && holea < 175 then holea = 9 if pretop = 2 && prebot = 1 && holea > 175 && holea < 200 then holea = 10 if pretop = 2 && prebot = 1 && holea > 200 && holea < 225 then holea = 11 if pretop = 2 && prebot = 1 && holea > 225 && holea < 255 then holea = 12 twotwo if pretop = 2 && prebot = 2 && holea > 0 && holea < 28 then holea = 3 if pretop = 2 && prebot = 2 && holea > 28 && holea < 56 then holea = 4 if pretop = 2 && prebot = 2 && holea > 56 && holea < 84 then holea = 5 if pretop = 2 && prebot = 2 && holea > 84 && holea < 112 then holea = 6 if pretop = 2 && prebot = 2 && holea > 112 && holea < 140 then holea = 7 if pretop = 2 && prebot = 2 && holea > 140 && holea < 168 then holea = 8 if pretop = 2 && prebot = 2 && holea > 168 && holea < 196 then holea = 9 if pretop = 2 && prebot = 2 && holea > 196 && holea < 224 then holea = 10 if pretop = 2 && prebot = 2 && holea > 224 && holea < 255 then holea = 11 twothree if pretop = 2 && prebot = 3 && holea > 0 && holea < 31 then holea = 3 if pretop = 2 && prebot = 3 && holea > 31 && holea < 62 then holea = 4 if pretop = 2 && prebot = 3 && holea > 62 && holea < 93 then holea = 5 if pretop = 2 && prebot = 3 && holea > 93 && holea < 124 then holea = 6 if pretop = 2 && prebot = 3 && holea > 124 && holea < 155 then holea = 7 if pretop = 2 && prebot = 3 && holea > 155 && holea < 186 then holea = 8 if pretop = 2 && prebot = 3 && holea > 186 && holea < 217 then holea = 9 if pretop = 2 && prebot = 3 && holea > 217 && holea < 255 then holea = 10 twofour if pretop = 2 && prebot = 4 && holea > 0 && holea < 36 then holea = 3 if pretop = 2 && prebot = 4 && holea > 36 && holea < 72 then holea = 4 if pretop = 2 && prebot = 4 && holea > 72 && holea < 108 then holea = 5 if pretop = 2 && prebot = 4 && holea > 108 && holea < 144 then holea = 6 if pretop = 2 && prebot = 4 && holea > 144 && holea < 180 then holea = 7 if pretop = 2 && prebot = 4 && holea > 180 && holea < 216 then holea = 8 if pretop = 2 && prebot = 4 && holea > 216 && holea < 255 then holea = 9 threeone if pretop = 3 && prebot = 1 && holea > 0 && holea < 28 then holea = 4 if pretop = 3 && prebot = 1 && holea > 28 && holea < 56 then holea = 5 if pretop = 3 && prebot = 1 && holea > 56 && holea < 84 then holea = 6 if pretop = 3 && prebot = 1 && holea > 84 && holea < 112 then holea = 7 if pretop = 3 && prebot = 1 && holea > 112 && holea < 140 then holea = 8 if pretop = 3 && prebot = 1 && holea > 140 && holea < 168 then holea = 9 if pretop = 3 && prebot = 1 && holea > 168 && holea < 196 then holea = 10 if pretop = 3 && prebot = 1 && holea > 196 && holea < 224 then holea = 11 if pretop = 3 && prebot = 1 && holea > 224 && holea < 255 then holea = 12 threetwo if pretop = 3 && prebot = 2 && holea > 0 && holea < 31 then holea = 4 if pretop = 3 && prebot = 2 && holea > 31 && holea < 62 then holea = 5 if pretop = 3 && prebot = 2 && holea > 62 && holea < 93 then holea = 6 if pretop = 3 && prebot = 2 && holea > 93 && holea < 124 then holea = 7 if pretop = 3 && prebot = 2 && holea > 124 && holea < 155 then holea = 8 if pretop = 3 && prebot = 2 && holea > 155 && holea < 186 then holea = 9 if pretop = 3 && prebot = 2 && holea > 186 && holea < 217 then holea = 10 if pretop = 3 && prebot = 2 && holea > 217 && holea < 255 then holea = 11 threethree if pretop = 3 && prebot = 3 && holea > 0 && holea < 36 then holea = 4 if pretop = 3 && prebot = 3 && holea > 36 && holea < 72 then holea = 5 if pretop = 3 && prebot = 3 && holea > 72 && holea < 108 then holea = 6 if pretop = 3 && prebot = 3 && holea > 108 && holea < 144 then holea = 7 if pretop = 3 && prebot = 3 && holea > 144 && holea < 180 then holea = 8 if pretop = 3 && prebot = 3 && holea > 180 && holea < 216 then holea = 9 if pretop = 3 && prebot = 3 && holea > 216 && holea < 255 then holea = 10 threefour if pretop = 3 && prebot = 4 && holea > 0 && holea < 42 then holea = 4 if pretop = 3 && prebot = 4 && holea > 42 && holea < 84 then holea = 5 if pretop = 3 && prebot = 4 && holea > 84 && holea < 126 then holea = 6 if pretop = 3 && prebot = 4 && holea > 126 && holea < 168 then holea = 7 if pretop = 3 && prebot = 4 && holea > 168 && holea < 210 then holea = 8 if pretop = 3 && prebot = 4 && holea > 210 && holea < 255 then holea = 9 fourone if pretop = 4 && prebot = 1 && holea > 0 && holea < 31 then holea = 5 if pretop = 4 && prebot = 1 && holea > 31 && holea < 62 then holea = 6 if pretop = 4 && prebot = 1 && holea > 62 && holea < 93 then holea = 7 if pretop = 4 && prebot = 1 && holea > 93 && holea < 124 then holea = 8 if pretop = 4 && prebot = 1 && holea > 124 && holea < 155 then holea = 9 if pretop = 4 && prebot = 1 && holea > 155 && holea < 186 then holea = 10 if pretop = 4 && prebot = 1 && holea > 186 && holea < 217 then holea = 11 if pretop = 4 && prebot = 1 && holea > 217 && holea < 255 then holea = 12 fourtwo if pretop = 4 && prebot = 2 && holea > 0 && holea < 36 then holea = 5 if pretop = 4 && prebot = 2 && holea > 36 && holea < 72 then holea = 6 if pretop = 4 && prebot = 2 && holea > 72 && holea < 108 then holea = 7 if pretop = 4 && prebot = 2 && holea > 108 && holea < 144 then holea = 8 if pretop = 4 && prebot = 2 && holea > 144 && holea < 180 then holea = 9 if pretop = 4 && prebot = 2 && holea > 180 && holea < 216 then holea = 10 if pretop = 4 && prebot = 2 && holea > 216 && holea < 255 then holea = 11 fourthree if pretop = 4 && prebot = 3 && holea > 0 && holea < 42 then holea = 5 if pretop = 4 && prebot = 3 && holea > 42 && holea < 84 then holea = 6 if pretop = 4 && prebot = 3 && holea > 84 && holea < 126 then holea = 7 if pretop = 4 && prebot = 3 && holea > 126 && holea < 168 then holea = 8 if pretop = 4 && prebot = 3 && holea > 168 && holea < 210 then holea = 9 if pretop = 4 && prebot = 3 && holea > 210 && holea < 255 then holea = 10 fourfour if pretop = 4 && prebot = 4 && holea > 0 && holea < 50 then holea = 5 if pretop = 4 && prebot = 4 && holea > 50 && holea < 100 then holea = 6 if pretop = 4 && prebot = 4 && holea > 100 && holea < 150 then holea = 7 if pretop = 4 && prebot = 4 && holea > 150 && holea < 200 then holea = 8 if pretop = 4 && prebot = 4 && holea > 200 && holea < 255 then holea = 9 return 3 - Would someone take a look at my code and see why it's freezing up and resetting to title screen? My source code is fully commented and I will tell you exactly where it gets hung up. I will describe what the game does and what it's supposed to do when it freezes up. Please PM me and I'll send you the .bas and .bin. I don't want to post it until I get a working demo. Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted November 9, 2008 Share Posted November 9, 2008 (edited) In answer to #2- How about something like: if pretop=1 && prebot=1 then goto oneone if pretop=1 && prebot=2 then goto onetwo etc... then, in oneone you could have holea=(holea/24)+2. Just repeat, but not with 24 as the number to divide by, if you want, i could figure out this. (It took me five minutes to discover 24 was the number for oneone, though!) you need "include div_mul.asm" in the beginning of your code. Edited November 9, 2008 by atari2600land Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted November 9, 2008 Share Posted November 9, 2008 (edited) Check out this post for info about bankswitching: http://www.atariage.com/forums/index.php?s...p;#entry1456132 It wouldn't be "gosub catwalk bank 2" it would be "gosub catwalk bank2". You don't put a space between bank and the number when using goto or gosub. Example: goto catwalk bank2 bank 2 catwalk I try to avoid using gosub whenever possible, especially with bankswitching. You'll find out why when you read that post. And as that post says, "your program will *not* flow from one bank to the next automatically. Instead, you must jump from one bank to another by using a "goto" or "gosub" statement . . ." Edited November 9, 2008 by Random Terrain Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted November 9, 2008 Share Posted November 9, 2008 (edited) I'm designing a new "adult game" for the Atari 2600. I need some help/questions answered. 1 - Let's say I have some long code.. I need to break it up between two banks. Will this work? gosub catwalk bank 2 drawscreen goto gameloop bank 2 catwalk a = a + 1 bank 3 catwalk2 b = a + 1 return That's not the actual code, I just made that up, but when the code goes to catwalk in bank 2 will it continue right down into bank 3? Or do I need to do it like this with two separate gosubs? gosub catwalk bank 2 gosub catwalk2 bank 3 drawscreen goto gameloop bank 2 catwalk a = a + 1 return bank 3 catwalk2 b = a + 1 return You do *not* want to do it the first way, because the program will *not* transition automatically from bank 2 to bank 3. You could do it the second way, or you could do it this way: gosub catwalk bank2 drawscreen goto gameloop bank 2 catwalk a = a + 1 goto catwalk2 bank3 bank 3 catwalk2 b = a + 1 return This way is a little quicker and takes a little less ROM, because the program doesn't need to do two transbank gosubs and returns, just one, and it's quicker to do a transbank goto than a transbank gosub return. (I just made up "transbank" , but I hope you know what I mean-- a goto or gosub that goes from one bank to another bank.) 2 - Is there a way for me to shorten something like this code or not? This is the code I was talking about that is so large I had to split it up between multiple banks. I can get my game to compile by splitting my code between multiple banks, but when I get to a certain part it freezes up, switches color, and resets back to the title screen. oneone if pretop = 1 && prebot = 1 && holea > 0 && holea < 23 then holea = 2 if pretop = 1 && prebot = 1 && holea > 23 && holea < 46 then holea = 3 if pretop = 1 && prebot = 1 && holea > 46 && holea < 69 then holea = 4 if pretop = 1 && prebot = 1 && holea > 69 && holea < 92 then holea = 5 if pretop = 1 && prebot = 1 && holea > 92 && holea < 115 then holea = 6 if pretop = 1 && prebot = 1 && holea > 115 && holea < 138 then holea = 7 if pretop = 1 && prebot = 1 && holea > 138 && holea < 161 then holea = 8 if pretop = 1 && prebot = 1 && holea > 161 && holea < 184 then holea = 9 if pretop = 1 && prebot = 1 && holea > 184 && holea < 207 then holea = 10 if pretop = 1 && prebot = 1 && holea > 207 && holea < 230 then holea = 11 if pretop = 1 && prebot = 1 && holea > 230 && holea < 255 then holea = 12 onetwo if pretop = 1 && prebot = 2 && holea > 0 && holea < 25 then holea = 2 if pretop = 1 && prebot = 2 && holea > 25 && holea < 50 then holea = 3 if pretop = 1 && prebot = 2 && holea > 50 && holea < 75 then holea = 4 if pretop = 1 && prebot = 2 && holea > 75 && holea < 100 then holea = 5 if pretop = 1 && prebot = 2 && holea > 100 && holea < 125 then holea = 6 if pretop = 1 && prebot = 2 && holea > 125 && holea < 150 then holea = 7 if pretop = 1 && prebot = 2 && holea > 150 && holea < 175 then holea = 8 if pretop = 1 && prebot = 2 && holea > 175 && holea < 200 then holea = 9 if pretop = 1 && prebot = 2 && holea > 200 && holea < 225 then holea = 10 if pretop = 1 && prebot = 2 && holea > 225 && holea < 255 then holea = 11 onethree if pretop = 1 && prebot = 3 && holea > 0 && holea < 28 then holea = 2 if pretop = 1 && prebot = 3 && holea > 28 && holea < 56 then holea = 3 if pretop = 1 && prebot = 3 && holea > 56 && holea < 84 then holea = 4 if pretop = 1 && prebot = 3 && holea > 84 && holea < 112 then holea = 5 if pretop = 1 && prebot = 3 && holea > 112 && holea < 140 then holea = 6 if pretop = 1 && prebot = 3 && holea > 140 && holea < 168 then holea = 7 if pretop = 1 && prebot = 3 && holea > 168 && holea < 196 then holea = 8 if pretop = 1 && prebot = 3 && holea > 196 && holea < 224 then holea = 9 if pretop = 1 && prebot = 3 && holea > 224 && holea < 255 then holea = 10 onefour if pretop = 1 && prebot = 4 && holea > 0 && holea < 31 then holea = 2 if pretop = 1 && prebot = 4 && holea > 31 && holea < 62 then holea = 3 if pretop = 1 && prebot = 4 && holea > 62 && holea < 93 then holea = 4 if pretop = 1 && prebot = 4 && holea > 93 && holea < 124 then holea = 5 if pretop = 1 && prebot = 4 && holea > 124 && holea < 155 then holea = 6 if pretop = 1 && prebot = 4 && holea > 155 && holea < 186 then holea = 7 if pretop = 1 && prebot = 4 && holea > 186 && holea < 217 then holea = 8 if pretop = 1 && prebot = 4 && holea > 217 && holea < 255 then holea = 9 twoone if pretop = 2 && prebot = 1 && holea > 0 && holea < 25 then holea = 3 if pretop = 2 && prebot = 1 && holea > 25 && holea < 50 then holea = 4 if pretop = 2 && prebot = 1 && holea > 50 && holea < 75 then holea = 5 if pretop = 2 && prebot = 1 && holea > 75 && holea < 100 then holea = 6 if pretop = 2 && prebot = 1 && holea > 100 && holea < 125 then holea = 7 if pretop = 2 && prebot = 1 && holea > 125 && holea < 150 then holea = 8 if pretop = 2 && prebot = 1 && holea > 150 && holea < 175 then holea = 9 if pretop = 2 && prebot = 1 && holea > 175 && holea < 200 then holea = 10 if pretop = 2 && prebot = 1 && holea > 200 && holea < 225 then holea = 11 if pretop = 2 && prebot = 1 && holea > 225 && holea < 255 then holea = 12 twotwo if pretop = 2 && prebot = 2 && holea > 0 && holea < 28 then holea = 3 if pretop = 2 && prebot = 2 && holea > 28 && holea < 56 then holea = 4 if pretop = 2 && prebot = 2 && holea > 56 && holea < 84 then holea = 5 if pretop = 2 && prebot = 2 && holea > 84 && holea < 112 then holea = 6 if pretop = 2 && prebot = 2 && holea > 112 && holea < 140 then holea = 7 if pretop = 2 && prebot = 2 && holea > 140 && holea < 168 then holea = 8 if pretop = 2 && prebot = 2 && holea > 168 && holea < 196 then holea = 9 if pretop = 2 && prebot = 2 && holea > 196 && holea < 224 then holea = 10 if pretop = 2 && prebot = 2 && holea > 224 && holea < 255 then holea = 11 twothree if pretop = 2 && prebot = 3 && holea > 0 && holea < 31 then holea = 3 if pretop = 2 && prebot = 3 && holea > 31 && holea < 62 then holea = 4 if pretop = 2 && prebot = 3 && holea > 62 && holea < 93 then holea = 5 if pretop = 2 && prebot = 3 && holea > 93 && holea < 124 then holea = 6 if pretop = 2 && prebot = 3 && holea > 124 && holea < 155 then holea = 7 if pretop = 2 && prebot = 3 && holea > 155 && holea < 186 then holea = 8 if pretop = 2 && prebot = 3 && holea > 186 && holea < 217 then holea = 9 if pretop = 2 && prebot = 3 && holea > 217 && holea < 255 then holea = 10 twofour if pretop = 2 && prebot = 4 && holea > 0 && holea < 36 then holea = 3 if pretop = 2 && prebot = 4 && holea > 36 && holea < 72 then holea = 4 if pretop = 2 && prebot = 4 && holea > 72 && holea < 108 then holea = 5 if pretop = 2 && prebot = 4 && holea > 108 && holea < 144 then holea = 6 if pretop = 2 && prebot = 4 && holea > 144 && holea < 180 then holea = 7 if pretop = 2 && prebot = 4 && holea > 180 && holea < 216 then holea = 8 if pretop = 2 && prebot = 4 && holea > 216 && holea < 255 then holea = 9 threeone if pretop = 3 && prebot = 1 && holea > 0 && holea < 28 then holea = 4 if pretop = 3 && prebot = 1 && holea > 28 && holea < 56 then holea = 5 if pretop = 3 && prebot = 1 && holea > 56 && holea < 84 then holea = 6 if pretop = 3 && prebot = 1 && holea > 84 && holea < 112 then holea = 7 if pretop = 3 && prebot = 1 && holea > 112 && holea < 140 then holea = 8 if pretop = 3 && prebot = 1 && holea > 140 && holea < 168 then holea = 9 if pretop = 3 && prebot = 1 && holea > 168 && holea < 196 then holea = 10 if pretop = 3 && prebot = 1 && holea > 196 && holea < 224 then holea = 11 if pretop = 3 && prebot = 1 && holea > 224 && holea < 255 then holea = 12 threetwo if pretop = 3 && prebot = 2 && holea > 0 && holea < 31 then holea = 4 if pretop = 3 && prebot = 2 && holea > 31 && holea < 62 then holea = 5 if pretop = 3 && prebot = 2 && holea > 62 && holea < 93 then holea = 6 if pretop = 3 && prebot = 2 && holea > 93 && holea < 124 then holea = 7 if pretop = 3 && prebot = 2 && holea > 124 && holea < 155 then holea = 8 if pretop = 3 && prebot = 2 && holea > 155 && holea < 186 then holea = 9 if pretop = 3 && prebot = 2 && holea > 186 && holea < 217 then holea = 10 if pretop = 3 && prebot = 2 && holea > 217 && holea < 255 then holea = 11 threethree if pretop = 3 && prebot = 3 && holea > 0 && holea < 36 then holea = 4 if pretop = 3 && prebot = 3 && holea > 36 && holea < 72 then holea = 5 if pretop = 3 && prebot = 3 && holea > 72 && holea < 108 then holea = 6 if pretop = 3 && prebot = 3 && holea > 108 && holea < 144 then holea = 7 if pretop = 3 && prebot = 3 && holea > 144 && holea < 180 then holea = 8 if pretop = 3 && prebot = 3 && holea > 180 && holea < 216 then holea = 9 if pretop = 3 && prebot = 3 && holea > 216 && holea < 255 then holea = 10 threefour if pretop = 3 && prebot = 4 && holea > 0 && holea < 42 then holea = 4 if pretop = 3 && prebot = 4 && holea > 42 && holea < 84 then holea = 5 if pretop = 3 && prebot = 4 && holea > 84 && holea < 126 then holea = 6 if pretop = 3 && prebot = 4 && holea > 126 && holea < 168 then holea = 7 if pretop = 3 && prebot = 4 && holea > 168 && holea < 210 then holea = 8 if pretop = 3 && prebot = 4 && holea > 210 && holea < 255 then holea = 9 fourone if pretop = 4 && prebot = 1 && holea > 0 && holea < 31 then holea = 5 if pretop = 4 && prebot = 1 && holea > 31 && holea < 62 then holea = 6 if pretop = 4 && prebot = 1 && holea > 62 && holea < 93 then holea = 7 if pretop = 4 && prebot = 1 && holea > 93 && holea < 124 then holea = 8 if pretop = 4 && prebot = 1 && holea > 124 && holea < 155 then holea = 9 if pretop = 4 && prebot = 1 && holea > 155 && holea < 186 then holea = 10 if pretop = 4 && prebot = 1 && holea > 186 && holea < 217 then holea = 11 if pretop = 4 && prebot = 1 && holea > 217 && holea < 255 then holea = 12 fourtwo if pretop = 4 && prebot = 2 && holea > 0 && holea < 36 then holea = 5 if pretop = 4 && prebot = 2 && holea > 36 && holea < 72 then holea = 6 if pretop = 4 && prebot = 2 && holea > 72 && holea < 108 then holea = 7 if pretop = 4 && prebot = 2 && holea > 108 && holea < 144 then holea = 8 if pretop = 4 && prebot = 2 && holea > 144 && holea < 180 then holea = 9 if pretop = 4 && prebot = 2 && holea > 180 && holea < 216 then holea = 10 if pretop = 4 && prebot = 2 && holea > 216 && holea < 255 then holea = 11 fourthree if pretop = 4 && prebot = 3 && holea > 0 && holea < 42 then holea = 5 if pretop = 4 && prebot = 3 && holea > 42 && holea < 84 then holea = 6 if pretop = 4 && prebot = 3 && holea > 84 && holea < 126 then holea = 7 if pretop = 4 && prebot = 3 && holea > 126 && holea < 168 then holea = 8 if pretop = 4 && prebot = 3 && holea > 168 && holea < 210 then holea = 9 if pretop = 4 && prebot = 3 && holea > 210 && holea < 255 then holea = 10 fourfour if pretop = 4 && prebot = 4 && holea > 0 && holea < 50 then holea = 5 if pretop = 4 && prebot = 4 && holea > 50 && holea < 100 then holea = 6 if pretop = 4 && prebot = 4 && holea > 100 && holea < 150 then holea = 7 if pretop = 4 && prebot = 4 && holea > 150 && holea < 200 then holea = 8 if pretop = 4 && prebot = 4 && holea > 200 && holea < 255 then holea = 9 return I might be wrong, but I don't think you can put so many &&s in a single if. And even if it's okay, it takes more ROM to do the same checks over and over again (i.e., the parts of the ifs that are the same in several lines). You might be able to shorten the code by doing something like this instead: on pretop goto pretop0 pretop1 pretop2 pretop3 pretop4 pretop0 rem * do whatever you need to do when pretop is 0 rem * if pretop is greater than 4, the on goto will rem * also fall through to this routine, so if it's rem * possible for pretop to exceed 4 then you rem * might want to do something for that as well return pretop1 rem * do whatever you need to do when pretop is 1 return pretop2 rem * do whatever you need to do when pretop is 2 return pretop3 rem * do whatever you need to do when pretop is 3 return pretop4 rem * do whatever you need to do when pretop is 4 return And you can simplify all the ifs by using division instead, such as oneone if pretop = 1 && prebot = 1 then holea = holea / 23 + 1 onetwo if pretop = 1 && prebot = 2 then holea = holea / 25 + 1 onethree if pretop = 1 && prebot = 3 then holea = holea / 28 + 1 onefour if pretop = 1 && prebot = 4 then holea = holea / 31 + 1 twoone if pretop = 2 && prebot = 1 then holea = holea / 25 + 2 twotwo if pretop = 2 && prebot = 2 then holea = holea / 28 + 2 twothree if pretop = 2 && prebot = 3 then holea = holea / 31 + 2 twofour if pretop = 2 && prebot = 4 then holea = holea / 36 + 2 threeone if pretop = 3 && prebot = 1 then holea = holea / 28 + 3 threetwo if pretop = 3 && prebot = 2 then holea = holea / 31 + 3 threethree if pretop = 3 && prebot = 3 then holea = holea / 36 + 3 threefour if pretop = 3 && prebot = 4 then holea = holea / 42 + 3 fourone if pretop = 4 && prebot = 1 then holea = holea / 31 + 4 fourtwo if pretop = 4 && prebot = 2 then holea = holea / 36 + 4 fourthree if pretop = 4 && prebot = 3 then holea = holea / 42 + 4 fourfour if pretop = 4 && prebot = 4 then holea = holea / 50 + 4 return I'm not saying these will give the same exact results as your original code, but it should be close. And having made that simplification, it looks like you could simplify it even further as follows: temp3 = pretop + prebot temp3 = predata[temp3] holea = holea / temp3 + pretop return data predata 21,23,25,28,31,36,42,50 end As long as pretop and prebot are always 1, 2, 3, or 4, their sum will always be 2, 3, 4, 5, 6, 7, or 8, so the first byte of the data table would never be used. 3 - Would someone take a look at my code and see why it's freezing up and resetting to title screen? My source code is fully commented and I will tell you exactly where it gets hung up. I will describe what the game does and what it's supposed to do when it freezes up. Please PM me and I'll send you the .bas and .bin. I don't want to post it until I get a working demo. Most likely it's freezing up and resetting to the title screen because the code is running past the end of one bank and then hitting some code that's making it reset the game. In a multibanked game, bB has some bankswitching code that it uses to do transbank gosubs and returns, and there's no telling what might happen if your program is falling into that code when it shouldn't be. Michael Edited November 9, 2008 by SeaGtGruff Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted November 9, 2008 Share Posted November 9, 2008 I might be wrong, but I don't think you can put so many &&s in a single if. I just checked the docs, and I was wrong-- you can use multiple &&s in a single if-- presumably as many as you can squeeze onto one line of bB code. But if you're using a lot of &&s like that, there's almost always a way to optimize your code so it doesn't use that many. You can use only one || in an if. And you can't combine a && and a || in an if. *That* is what was in the back of my mind when I was talking about more than one &&. Michael Quote Link to comment Share on other sites More sharing options...
yuppicide Posted November 10, 2008 Author Share Posted November 10, 2008 On your page it says: Examples: bank 2 bank 8 You should change it to say that to specify the start of bank 2 you write it as bank 2, but to use a goto or gosub it's without the space. Check out this post for info about bankswitching: http://www.atariage.com/forums/index.php?s...p;#entry1456132 It wouldn't be "gosub catwalk bank 2" it would be "gosub catwalk bank2". You don't put a space between bank and the number when using goto or gosub. Example: Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted November 10, 2008 Share Posted November 10, 2008 Check out this post for info about bankswitching: http://www.atariage.com/forums/index.php?s...p;#entry1456132 It wouldn't be "gosub catwalk bank 2" it would be "gosub catwalk bank2". You don't put a space between bank and the number when using goto or gosub. Example: On your page it says: Examples: bank 2 bank 8 You should change it to say that to specify the start of bank 2 you write it as bank 2, but to use a goto or gosub it's without the space. There are examples under goto and gosub, but that section should probably also show it too. Didn't know if it was necessary since I have a link to SeaGtGruff's detailed post about bankswitching. Quote Link to comment Share on other sites More sharing options...
yuppicide Posted November 10, 2008 Author Share Posted November 10, 2008 Part of this was my fault. I am so used to using the bB "offline" guide, which is old, that comes in VBB. I have Verizon FIOS being installed at my new apartment today, so I'll be up to date in no time. 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.