I'm using a tiny13 chip& suspect there is something wrong with it...I am using 2 registers to hold 1 flag bit in each. All works fine. When I combine them into the SAME register the program quits working.
sysflag=r25, sss=r23 works
sysflag=r25, sss=r25 does not
sysflag=sss=r19 does not
since the flag bits are bit 0 & bit 2, combining them into one register should be fine
I tried other register combos, but the bottom line is when these are set to the SAME register it does not work, as though the bits are not independent. I verified that the ONLY places (throughout the code) these registers are used are as follows:
one flag is bit zero, the other flag is bit 2
I verified that the LST opecode for each looks good.
ALL lines using these locations from the code:
sbrc sysflags, 0
sbrs sss, 2
sbr sysflags, 1 ;phase 1
cbr sss, 4
cbr sysflags, 1 ;phase0
sbr sss, 4
cbr sysflags, 1 ;show phase0
The only thing affecting the bits are CBR & SBR & as shown only affect a single bit (bit 0 [value=1] or 2 [value=4]). I was using labels (like 1<<phase0), but got rid of them during the investigation
I am using interrupts, and some of these statements are located in interrupts, but are only used as already mentioned. I simply don't see why things work when sss & sysflags use different registers. Again, these registers are used ONLY where shown above. I thought perhaps it has something to do with interrupts and r-m-W cycles, but have never encountered such strangeness before. Its as though the SBR/CBR is not atomic through interrupts
Is this some flaw in the tiny13?