RetroFiends #1 Posted January 3, 2014 Is there a source somewhere, or someone out there that can further elaborate bB's bitwise operations?Specifically, I'm trying to figure out if it's possible to do a bit shift rotation within bB. Quote Share this post Link to post Share on other sites
+Gemintronic #2 Posted January 3, 2014 I'm not the definitive answer. From what I've seen you need inline assembly. I mean, you could do a bunch of: foo{0} = foo{1} statements but it's slower than inline asm. Quote Share this post Link to post Share on other sites
accousticguitar #3 Posted January 3, 2014 You can drop assembly code directly into bB code anytime it's necessary. Quote Share this post Link to post Share on other sites
+RevEng #4 Posted January 4, 2014 It's possible to shift bits in pure bB, so long as you're not looking for the carry bit to do something useful. Just multiply or divide by the relevant powers of two myvar=myvar*2 : rem shifts bits in myvar one position to the left myvar=myvar/2 : rem shifts bits in myvar one position to the right myvar=myvar*4 : rem shifts bits in myvar two positions to the left myvar=myvar/4 : rem shifts bits in myvar two positions to the right myvar=myvar*8 : rem shifts bits in myvar three positions to the left myvar=myvar/8 : rem shifts bits in myvar three positions to the right ... If you want to use the carry bit (i.e. you want to shift in bits that were shifted out) then you'll need to drop in the relevant assembly code, as accousticguitar suggests. 1 Quote Share this post Link to post Share on other sites
CPUWIZ #5 Posted January 4, 2014 It sounds like the OP is after ROL. Surprised you can't do that in bB. Quote Share this post Link to post Share on other sites
+RevEng #6 Posted January 4, 2014 I guess batari figured it wasn't worth reinventing all of the opcodes in bB, since it's easy enough to drop asm into it. e.g. [some bB code here] asm rol myvariable end [more bB code here] 1 Quote Share this post Link to post Share on other sites
RetroFiends #7 Posted January 4, 2014 (edited) Thanks for the responses guys. This looks like the one instance where using asm is actually easier Edited January 4, 2014 by RetroFiends Quote Share this post Link to post Share on other sites