MEGA65 / mega65-user-guide

MEGA65 User Guide
75 stars 51 forks source link

Add warning about dangers using NOP and/or NEG-NEG prefixed GS opcodes @ 1 and 2MHz CPU speeds #121

Open lgblgblgb opened 4 years ago

lgblgblgb commented 4 years ago

NOP and NEG opcodes are great for prefixes as they are single cycle opcodes, and even the 65CE02 would not allow already interrupts after a single cycle opcode, thus the atomic execution of these prefixed opcodes are guaranteed (cannot be interrupted). However at 1MHz (I believe even at 2MHz "C128" mode) extra cycles are inserted to match better the 6502 timing. Which will cause to lose this behaviour, thus using GS opcodes are not safe any more (unless interrupts cannot happen).

I would even ask if it is better to make MEGA65 CPU not to be able even interpret prefixes if CPU is at 1 or 2MHz speed ... But that's scope more of mega65-core issue than the manual, I guess. And still someone can say, "fine, I take the risk, but I want this for whatever very strange reason" ... ?

Please also note about #115 that we must be careful what we call 'slow' and 'fast' mode to avoid confusion. Personally I would avoid fast/slow and would say MHz's wherever it makes sense (though it can be problematic then to fix all the references in case of the change of MEGA65 design to have other "MEGA65 fast" clock speed, than currently it has).

Some other problems about opcode descriptions: #122

FeralChild64 commented 4 years ago

Please also add explanation/warning about compound instructions safety during the 1MHz slowdown enforced by IEC bus activity.