Intellivision Brasil Posted January 26 Share Posted January 26 Hi friends. I would like to know if you can help me with this issue. I have several levels in the game in a huge DATA sequence (about 700 lines): GameScreens: DATE $AB6B,$AB6B,.... DATE $AB6B,$AB6B,.... When the player advances to level 2, I use a variable to position the start of the data in the SCREEN command like this: #ScreenAdjust=#ScreenAdjust+2223 SCREEN GameScreens, #ScreenAdjust, 0,14,BACKGROUND_ROWS,LastCol Is there any way to break the DATA into multiple levels and still use only 1 SCREEN command (without IF)? Something like this (it doesn't work): Screens: DATA VARPTR Screen1(0) DATA VARPTR Screen2(0) Screen1: DATE $AB6B,$AB6B,.... DATE $AB6B,$AB6B,.... Screen2: DATE $BBBB,$BBBB,.... DATE $BBBB,$BBBB,.... SCREEN Screens(0), 0, 0,14,BACKGROUND_ROWS,LastCol Instead of this: Screen1: DATE $AB6B,$AB6B,.... DATE $AB6B,$AB6B,.... Screen2: DATE $BBBB,$BBBB,.... DATE $BBBB,$BBBB,.... IF Level=1 THEN SCREEN Screen1, 0, 0,14,BACKGROUND_ROWS,LastCol ELSEIF Level=2 THEN SCREEN Screen2, 0, 0,14,BACKGROUND_ROWS,LastCol ELSEIF .... Thanks! Quote Link to comment Share on other sites More sharing options...
carlsson Posted January 26 Share Posted January 26 Not sure, but if you look at the generated assembly code, it might be possible to create a workaround by duplicating the code that is generated, but change one or two instructions to operate with VARPTR. I have made the same thing with the PLAY command, changes that haven't made their way into the language. Quote Link to comment Share on other sites More sharing options...
carlsson Posted January 26 Share Posted January 26 See here for inspiration: https://forums.atariage.com/topic/286953-intybasic-compiler-v142-reloaded-with-new-features/?do=findComment&comment=4413171 Quote Link to comment Share on other sites More sharing options...
carlsson Posted January 26 Share Posted January 26 @Intellivision Brasil As expected, you can apply the very same principle to the SCREEN command as I did with the PLAY command. One drawback is that it gets more complicated if you want to change origin offset of your screen, but all the other parameters are the same. I presume that BACKGROUND_ROWS is a constant, but LastCol is a variable? In that case, you need to look up how the compiler reads the value of a parameter and change the assembler code to the same syntax. I don't know which additional features of IntyBASIC can utilize the VARPTR syntax, but here we have two examples: play different songs based on a variable, and display different screens based on a variable. Both solve the problem in just about the same way. Perhaps it can be generalized and something to add to the compiler for the future? @nanochess many-screens.bas Quote Link to comment Share on other sites More sharing options...
+nanochess Posted January 26 Share Posted January 26 My suggestion would be to calculate yourself the offsets for the DATA table: Something like this: Screens: DATA 0 DATA 240 ' Supposing the size of the previous screen DATA 480 .... ' Etc etc Screen1: DATE $AB6B,$AB6B,.... DATE $AB6B,$AB6B,.... Screen2: DATE $BBBB,$BBBB,.... DATE $BBBB,$BBBB,.... SCREEN Screen1, Screens(room), 0,14,BACKGROUND_ROWS,LastCol 1 Quote Link to comment Share on other sites More sharing options...
Intellivision Brasil Posted January 27 Author Share Posted January 27 Thanks @carlsson and @nanochess !!!! 1 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.