Patch to this effect, attached
Could it be that the reset() method of class cl_huc6280 should have called the cl_mos6502::reset() method instead of the cl_uc::reset() as the one in cl_mos6502 set the stack pointer? The processor is an extended WDC 65C02, which class inherits the mos6502 class, hence also it's reset() method. I do not have a working environment so I cannot test.
I noticed that a further mcs51 peephole rule reduces the size again by 2 bytes and also increase the speed.
Defect can be closed. Does not occur in 4.6.0 anymore. Attached patch further reduces the size to 24 bytes by removing an IMO superfluous reload of A. Regards, Ruud
Improved register tracking for mcs51
CDB file format WIKI page corrupt
Just an observation: When compiling with --i-code-in-asm the i-code reveals that the order of r3 r4 is different for iTemp2 and iTemp13. This looks odd to me. Any idea why that is different? ; test.c:12: CmdBytes -= 1; // <-- bug ; [--2345--] ic:13: iTemp2 [k7 lr11:12 so:0]{ ia0 a2p0 re1 rm0 nos0 ru0 dp0}{int fixed}{ sir@ _EpdCmd_CmdBytes_10000_3}[**r3 r4** ] = iTemp13 [k21 lr9:11 so:0]{ ia0 a2p0 re0 rm0 nos0 ru0 dp0}{int fixed}[**r4 r3** ] - 0x1 {const-int literal} mov a,r4 add a,#0xff mov r3,a...
It was clear to me that it is not used, as the compiler would have complained in case it was ;-)