TAQOZ - bit masking - how to ?
The problem:
I have a memory location I can't read from. It's write only. I need to change, say, 2 bits out of 8 but I also need not change the remaining 6 bits. Since I do not know their values and have no desire to overwrite them I need to mask them out while writing the byte.
The question:
Is there a way to mask out the bits to be left intact while writing the byte ?
Comments
Use a bit mask with SET and CLR but if you just want to write to certain bits then you could CLR all selected bits first then SET. However, if you are working with the value on the stack you can just use AND or ANDN to clear bits, then OR to set them. Is this to do with the RTC?
Set and CLR.
Thanks, Peter.
It's for something else. The Control registers of the RV-3028 are always readable but if they were not, I would certainly like to be sure not to overwrite them unwillingly.
No, it is not related to the RTC
I try to imagine how TaQoz is able to read a register it will not tell me about ;-? I recall there are hidden registers in the P1. But if I ever wrote them, I could latch that information. And if they are read only, like input pins, it make no sense to not be able to read them.
But those could be fake news registers were you are able to manipulate any information you never had.
Imagine this: you have an armed bomb and the time is ticking. To disarm the bomb you know you have to cut one blue and one red wire. There are also wires of other colours but you do not know what happens when you cut any of these. It might be nothing happens but it also might be the bomb explodes right into your face.
Would you take the risk of chopping off all of the wires at one go or would you rather cut only the red and blue ones ?
That basicaly was my problem, now solved thanks to Peter.
.
As you can see, TAQOZ is so powerfull it can even disarm bombs
This thread has been moved from the P2 category to ForthSpace and will continue here.