Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 6, 2012 12:25:57 GMT -5
I know you can declare a variable to be INTEGER or LONG. I also see that DATA statements can be 8-bit values. Is there a way to make a variable 8-bit? I noticed many variables I use would never need to store more than 0-255 so I figure going 8-bit would save some RAM..
..just noticed I should have posted in the BEX specific section. Opps!
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 6, 2012 19:59:27 GMT -5
Is there a way to make a variable 8-bit? Nope. You could write a "interface" to pack & unpack two 8-bit values in a 16-bit variable, but this would destroy performance. Attachments:
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 7, 2012 2:39:41 GMT -5
That bit of code would be perfect for putting values into SRAM, right? Because either it'll be accessed at even or odd bytes (depending on the cart). Once again you are a font of wisdom Sadly, we lost elusives tutorial on bitwise operations when his forum was upgraded.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 7, 2012 7:27:56 GMT -5
That bit of code would be perfect for putting values into SRAM, right? No, this is the opposite of what you want / need for SRAM.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 7, 2012 7:39:53 GMT -5
That bit of code would be perfect for putting values into SRAM, right? No, this is the opposite of what you want / need for SRAM. Could you explain further? Every time I guess at your meaning it leads me further from your intention I've learned
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 7, 2012 7:42:48 GMT -5
I can rewrite the tutorial if there's anything you want as a tutorial just let me know
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 7, 2012 7:46:31 GMT -5
I can rewrite the tutorial if there's anything you want as a tutorial just let me know I was a numb nut and didn't archive your original tut. Specifically, I'm interested in gettting and putting individual bits in a variable. I totally forgot my AIM password so I'll have to make a new account if that's the easiest way to reach you.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 7, 2012 8:34:28 GMT -5
Could you explain further? I could .. but i won't. If you want to set / get individual bits, you could use something like the attached example. Attachments:
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 7, 2012 8:37:38 GMT -5
Yea, aim is the easiest way to reach me
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 7, 2012 9:34:17 GMT -5
Could you explain further? I could .. but i won't. If you want to set / get individual bits, you could use something like the attached example. You're right. I already know those routines would be useful for save memory. Nothing to discuss. I DO appreciate the Bits example. I'm not sure if it's the same technique elusive used but seems to work. Thanks! For the novice note that the first bit printed is the last bit. So: foo = setBit(foo,7,1) Would print: 00000001
|
|