Flags Definition Editor - Bit Number

Discuss anything TunerPro related.

Moderators: Mangus, robertisaar, dex

Post Reply
User avatar
dfddfd2
Posts: 112
Joined: Wed Feb 27, 2008 4:37 pm
Location: Burgaw, NC

Flags Definition Editor - Bit Number

Post by dfddfd2 » Mon Jan 02, 2012 7:26 am

I have a byte that contains flags where one, and only one, bit should be set. I tried using the "Use Mask" setting in the "Bit Number" drop-down, but the setting is not saved and reverts back to the specific Bit.

Also, "Use Mask" isn't documented, but I'm hoping "Use Mask" means that the byte to be edited is or'd with the specified bit, and then anded with it to turn the other bits off.

Thanks,
Dave

User avatar
Mangus
TunerPro Author
Posts: 1827
Joined: Wed Mar 19, 2003 1:49 pm

Post by Mangus » Tue Jan 03, 2012 9:59 pm

"Use Bitmask" causes the mask you provide to be ANDed on read, and ORed on write. If you select "Use Bitmask," and you specify a mask that's a single bit, it will revert to bit mode with the bit corresponding your mask. (e.g. if you select "use mask" and set a mask of 0x01, then it will be saved as bit mode with bit 0 as the bit.)
***************************************
TunerPro Author
1989 Trans Am

User avatar
dfddfd2
Posts: 112
Joined: Wed Feb 27, 2008 4:37 pm
Location: Burgaw, NC

Post by dfddfd2 » Wed Jan 04, 2012 4:05 am

Mangus wrote:"Use Bitmask" causes the mask you provide to be ANDed on read, and ORed on write. If you select "Use Bitmask," and you specify a mask that's a single bit, it will revert to bit mode with the bit corresponding your mask. (e.g. if you select "use mask" and set a mask of 0x01, then it will be saved as bit mode with bit 0 as the bit.)
A single bit is a legitimate mask. Why would you force the use of multiple bits in order to enable the mask feature?

Thanks,
Dave

User avatar
Mangus
TunerPro Author
Posts: 1827
Joined: Wed Mar 19, 2003 1:49 pm

Post by Mangus » Wed Jan 04, 2012 6:32 am

dfddfd2 wrote: A single bit is a legitimate mask. Why would you force the use of multiple bits in order to enable the mask feature?

Thanks,
Dave
I don't. Perhaps you misunderstand.
***************************************
TunerPro Author
1989 Trans Am

User avatar
dfddfd2
Posts: 112
Joined: Wed Feb 27, 2008 4:37 pm
Location: Burgaw, NC

Post by dfddfd2 » Wed Jan 04, 2012 6:55 am

I mentioned that "Use Mask" isn't documented, so misunderstanding is possible. Of course, in my case, documentation does not guarantee understanding.

Please explain how "Use Mask" works, it's affect on bin contents, and how it differs from bit mode, and why it is only applied when more than 1 bit is specified.

What I would like to accomplish is having multiple flag definitions for a single byte (same address for each flag definition), where only one of the specified bits defined is allowed to be ON (all other bits in that byte OFF).

Thanks,
Dave

User avatar
Mangus
TunerPro Author
Posts: 1827
Joined: Wed Mar 19, 2003 1:49 pm

Post by Mangus » Wed Jan 04, 2012 7:24 am

dfddfd2 wrote: What I would like to accomplish is having multiple flag definitions for a single byte (same address for each flag definition), where only one of the specified bits defined is allowed to be ON (all other bits in that byte OFF).

Thanks,
Dave
Because the mask you specify is ORed with the source data on save, you won't be able to accomplish this. One do, should I implement table-based constants, you may be able to.
***************************************
TunerPro Author
1989 Trans Am

User avatar
XantheFIN
Posts: 19
Joined: Mon Jul 29, 2013 5:46 am

Post by XantheFIN » Fri May 16, 2014 7:09 am

Sorry to hijack thread but same kind of problem.

How i would be able now make flag this way:
Normally byte is C7 which means Off. 10 Means On.

If i try to make "Mask" Mask is too big to be added and i end up to incorrect values when "Set" has been Enabled and wrong On value when Disabled (Or not "Set")..

Need to make it Scalar which feels stupid.


Advice me for this please. :oops:

Post Reply