|
Post by Scorpion Illuminati on Nov 10, 2015 22:35:50 GMT -5
Lets say i have a byte variable called flags. As you know an integer has 8 bits.
How would I set bit X where x is 0 to 7? For example:
I want to set a bit without effecting the other ones. Any assistance in this matter would be greatly appreciated.
Sincerely,
Scorpion Illuminati
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 11, 2015 6:32:29 GMT -5
I want to set a bit without effecting the other ones. In ASM ( set bit 0 ) ... bset.b #0,(flags) In C ( set bit 0 ) ... flags = flags | 1; In BASIC ( set bit 0 ) ... flags = flags OR 1; BasiEgaXorz doesn't support BYTE variables though. So if you want to use a BYTE ( 8-bit ) instead of a WORD ( 16-bit ) you need to use the READ and WRITE commands.
|
|
|
Post by Scorpion Illuminati on Nov 12, 2015 18:11:52 GMT -5
I want to set a bit without effecting the other ones. In ASM ( set bit 0 ) ... In C ( set bit 0 ) ... In BASIC ( set bit 0 ) ... BasiEgaXorz doesn't support BYTE variables though. So if you want to use a BYTE ( 8-bit ) instead of a WORD ( 16-bit ) you need to use the READ and WRITE commands. Thanks for the info. Am having a bit of trouble figuring out how to use it effectively. Here's the proposed code:
btst #pad_button_a, d0 ; Check A button
bne @NoA ; Branch if button off
bset #FLAG_FRET_GREEN, (fret_flags) ; set the green fret bit
@NoA:
bclr #FLAG_FRET_GREEN, (fret_flags) ; clear the green fret bit
The problem is no matter what the clear bit instruction executes regardless if the button is on or off. Any assistance in this matter would be greatly appreciated. Sincerely, Scorpion Illuminati
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 13, 2015 6:31:19 GMT -5
The problem is no matter what the clear bit instruction executes regardless if the button is on or off. Any assistance in this matter would be greatly appreciated. That's because you always flow from BSET into BCLR, you need a BRA that jumps over BCLR after BSET has been executed. However, what are you trying to do exactly? Why do you have a variable for pad_button_a individually? It seems pretty unnecessary to "split" button bits from the joystick state and then rejoin them again ( if that's what you're trying to do ).
|
|
|
Post by lunchbox on Nov 16, 2015 9:42:14 GMT -5
Super quick and dirty. Titan is exactly right...
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 16, 2015 16:25:57 GMT -5
#FLAT_FRET_GREEN? Are you making Guitar Hero MD?
|
|
|
Post by Scorpion Illuminati on Dec 4, 2015 2:09:35 GMT -5
#FLAT_FRET_GREEN? Are you making Guitar Hero MD? No I'm making a rhythm game. Sincerely, Scorpion Illuminati
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 4, 2015 14:03:36 GMT -5
Lol what's the difference?
|
|