STGraves Posted May 28, 2015 Share Posted May 28, 2015 I read through the RT's website and found the nybble variables, thought they were very interesting and could be very helpful so I decided to try them out in my game, I thought I had understood how to use them and how do they worked but I couldn't figure out how to use them in a if... then statement that has multiple variables with different values on it, how can I implement them in such statement? Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted May 28, 2015 Share Posted May 28, 2015 If you are a beginner, it's best to avoid nybble variables. At one time batari was thinking about adding the ability to easily create nybble variables without the user needing to jump through a dozen flaming hoops. I don't know what the plan was. Maybe something like the following?_ dim _Flying_Monkey = a_lo dim _Smelly_Socks = a_hi _or_ dim _Flying_Monkey = a(lo) dim _Smelly_Socks = a(hi) _After DIMing, _Flying_Monkey and _Smelly_Socks would act like normal variables, but they would roll over from 15 to 0 and 0 to 15 in the other direction. bB would take care of the calculations and the user could use nybble variables without any worries. There are a lot of times when a full variable isn't needed, and a simple way to use nybble variables would be very helpful. If someone starts working on batari Basic again, I hope nybble variables will be near the top of the to-do list. Quote Link to comment Share on other sites More sharing options...
STGraves Posted May 28, 2015 Author Share Posted May 28, 2015 I'm not that much of a beginner any more, the reason why I want to use nybble's is because the default variables from bB aren't enough for what I want to do in my game, it uses more than 26 variables, because of the music and other stuff. If I send you a copy of my game without the nybble's and also the independet bas file with the music, could you help me to get it to work during the game? Yes the variables are for using music in the game. Thanks Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted May 28, 2015 Share Posted May 28, 2015 I'm not that much of a beginner any more, the reason why I want to use nybble's is because the default variables from bB aren't enough for what I want to do in my game, it uses more than 26 variables, because of the music and other stuff. If I send you a copy of my game without the nybble's and also the independet bas file with the music, could you help me to get it to work during the game? Yes the variables are for using music in the game. Thanks Nope. I stopped trying to use nybble variables in 2010: atariage.com/forums/blog/120/entry-6912-scrolling-game-is-rolling-along-part-4/ atariage.com/forums/blog/120/entry-6915-scrolling-game-is-rolling-along-part-5/ You can get more variables by using Superchip RAM. You get 48 extra normal variables (var0 through var47) and some special weird ones that have to be used VERY carefully. Quote Link to comment Share on other sites More sharing options...
STGraves Posted May 28, 2015 Author Share Posted May 28, 2015 No, I meant helping trying to get it to work WITHOUT THE NYBBLE VARIABLES. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted May 28, 2015 Share Posted May 28, 2015 No, I meant helping trying to get it to work WITHOUT THE NYBBLE VARIABLES. Like I said, just switch to Superchip RAM. Quote Link to comment Share on other sites More sharing options...
STGraves Posted May 28, 2015 Author Share Posted May 28, 2015 Ok, I've just read through your site in the superchip ram but I didn't understand how to use it and how it works. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted May 29, 2015 Share Posted May 29, 2015 Ok, I've just read through your site in the superchip ram but I didn't understand how to use it and how it works. It takes most people on this planet longer than 19 minutes to study something and to run little experiments. I'll see if I can add an example program to that section within the next week or two, but until then, I'm sure that you can find Superchip code examples that people have posted in this forum over the years. Quote Link to comment Share on other sites More sharing options...
STGraves Posted May 29, 2015 Author Share Posted May 29, 2015 Hahahaha, ok thanks for the help RT Quote Link to comment Share on other sites More sharing options...
bogax Posted May 30, 2015 Share Posted May 30, 2015 I read through the RT's website and found the nybble variables, thought they were very interesting and could be very helpful so I decided to try them out in my game, I thought I had understood how to use them and how do they worked but I couldn't figure out how to use them in a if... then statement that has multiple variables with different values on it, how can I implement them in such statement? How about an example? Probably the simplest thing would be to use temp variables temp1 = nybble if temp1 then .. Quote Link to comment Share on other sites More sharing options...
STGraves Posted May 30, 2015 Author Share Posted May 30, 2015 How about an example? Probably the simplest thing would be to use temp variables temp1 = nybble if temp1 then .. Thanks,I did understood it but what I don't understand is how to make sure to not to repeat any temp value throughout the game, I mean how do I know they're not repeating,on the game there are some variables that I have to increment, and other that have to be decremented Quote Link to comment Share on other sites More sharing options...
bogax Posted May 30, 2015 Share Posted May 30, 2015 I think you will have to give an example I don't understand what you are worried about repeating what sort of things do you want to do with nybbles? (some code would be nice) I think RT had bunch of this stuff but here you go rem to add something to the hi nybble of a rem shift it four places to the left by multiplying rem it by 16 rem increment the high nybble of a rem ie add 1 to the hi nybble a = a + 16 rem decrement the high nybble of a a = a - 16 rem add the lo nybble of b to the hi nybble of a a = b * 16 + a rem if you can't do the shifting first it's better rem to use a temp variable if you can or else bB rem starts messing with the stack to save intermediates rem subtract the lo nybble of b from the hi nybble of a temp1 = b * 16 a = a - temp1 rem use an XOR swap to set the lo nybble of a rem to the lo nybble of something else rem with out effecting the hi nybble of a rem the something else being temp1 here a = ((temp1 ^ a) & %11110000) ^ temp1 rem and use the parenthesis or else bB will mess with rem stack for intermediates rem do what ever in a temp variable then rem swap it back in to a rem increment the lo nybble of a temp1 = a + 1 a = (temp1 ^ a) & %11110000 ^ temp1 rem decrement the lo nybble of a temp1 = a - 1 a = (temp1 ^ a) & %11110000 ^ temp1 rem add lo nybble of b to lo nybble of a temp1 = a + b a = (temp1 ^ a) & %11110000 ^ temp1 rem to set the low nybble of a to the lo nybble of b a = (b ^ a) & %11110000 ^ b rem to set the hi nybble of a to the hi nybble rem of something else (temp1 in this case) a = (temp1 ^ a) & %00001111 ^ temp1 rem to set the hi nybble of a to the lo nybble rem of something else shift the something else 4 bits rem mask out the hi nybble of a and OR in the (shifted) rem lo nybble temp1 = b * 16 a = (a & %00001111) | temp1 you can put this stuff in macros and you don't have to use nybbles if could eg be the hi 5 bits and the lo 3 bits but the constants would change eg multiply by 8 for the 5 hi bits mask with %11111000 for the 5 hi bits or %00000111 for the lo 3 bits Quote Link to comment Share on other sites More sharing options...
Papa Posted May 30, 2015 Share Posted May 30, 2015 (edited) All this talk about nybbles and chips is making me hungry!! ...and then killer killed nybbles! Edited May 30, 2015 by Papa Quote Link to comment Share on other sites More sharing options...
STGraves Posted May 31, 2015 Author Share Posted May 31, 2015 bogax, do you want me to post my code for you to understand it? 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.