From: Aja H. <aja...@gm...> - 2013-05-31 14:21:33
|
> > You can remove the entire CartridgeAR class if you won't be using it (and > all other parts of the code that refer to it). So you'd either need to > edit Cart.cxx and remove references, or more easily, simply stub out the > methods in CartridgeAR. This is needed for Supercharger ROMs, but if you > won't be running them, then it's not a big deal to remove it. > Thanks for the advice. I got a few simulations / sec speed-up from removing them. Today I tried another idea and measured 1.5% speed up (0.7 simulation / sec faster): use a look-up table in M6502::PS. The code inline void M6502::PS(uInt8 ps) { N = ps & 0x80; V = ps & 0x40; B = true; // B = ps & 0x10; The 6507's B flag always true D = ps & 0x08; I = ps & 0x04; notZ = !(ps & 0x02); C = ps & 0x01; } was changed to inline void M6502::PS(uInt8 ps) { *PSPointer = PSLockupTable[ps]; } Where PSPointer is of type uint64_t* pointing to N, PSLockupTable[] precomputes the values of the flags N to C according to ps. It works by using the fact that member data in a class are contiguous in memory. To make it 8 bytes starting from N, I added a variable 'Unused' for padding. bool N; // N flag for processor status register bool V; // V flag for processor status register bool B; // B flag for processor status register bool D; // D flag for processor status register bool I; // I flag for processor status register bool notZ; // Z flag complement for processor status register bool C; // C flag for processor status register bool Unused; // *Make it 8-bytes(uInt64_t) starting from N.* Kind regards, Aja Huang |