You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is a part of the listing obtained from the attached HEX file.
Actually the PIC model is PIC16F18855. That's why some registers are shown here as DAT_DATA_xxxx instead of their real names: DAT_DATA_0716 instead of PIE0, DAT_DATA_070c instead of PIR0 and so on.
But it doesn't matter for the explanation of the current issue.
As can be seen from the disassembly listing, FUN_CODE_1161 in the line CODE:000b should only be called if both checking on the line CODE:0007 and CODE:0008 are met like this:
And then follows the corresponding decompilation view:
void Interrupt(void)
{
byte bVar1;
bool bVar2;
DAT_DATA_007e = DAT_DATA_007e | 1;
bVar2 = (DAT_DATA_0716 & 0x20) == 0; // There is a checking of TMR0IE bit of PIE0 register
if (!bVar2) {
bVar2 = (DAT_DATA_070c & 0x20) != 0; // There is a checking of TMR0IF bit of PIR0 register
}
if (bVar2) {
FUN_CODE_1161();
}
else {
...
In this variant calling of FUN_CODE_1161 will occur when (DAT_DATA_0716 & 0x20) == 0 regardless of the condition of the second check (DAT_DATA_070c & 0x20) != 0
My investigation of this issue led me to the next topic Skip instruction implementation #4241
Therefore it is necessary to modify all skip instructions in the corresponding processor file with inst_next2 instead of inst_next.
For example:
Describe the bug
Below is a part of the listing obtained from the attached HEX file.
Actually the PIC model is PIC16F18855. That's why some registers are shown here as DAT_DATA_xxxx instead of their real names:
DAT_DATA_0716 instead of PIE0,
DAT_DATA_070c instead of PIR0 and so on.
But it doesn't matter for the explanation of the current issue.
Expected behavior
As can be seen from the disassembly listing, FUN_CODE_1161 in the line CODE:000b should only be called if both checking on the line CODE:0007 and CODE:0008 are met like this:
or much better (so long awaited ):
Decompiler not detecting bitfields in structures #2462
Bitfields don't seem to decompile very well #1059
And then follows the corresponding decompilation view:
In this variant calling of FUN_CODE_1161 will occur when (DAT_DATA_0716 & 0x20) == 0 regardless of the condition of the second check (DAT_DATA_070c & 0x20) != 0
To Reproduce
Attachments
PIC16F18855.zip
Environment
The text was updated successfully, but these errors were encountered: