Users browsing this thread: 1 Guest(s)
Having the option to use Vigor in some spells
05-08-2016, 03:09 PM
(05-08-2016, 12:29 PM)Madsiur Wrote: Unrelated: When does the carry flag can lead to a bug? I know you must always clear it (CLC) before an addition, but given you make a BCC or BCS and reach after in an unexpected way another BCC / BCS, the carry flag will still be based on the operation often right before the last BCC / BCS. What am I missing here?
You don't need to clear the carry for addition if your intention is to have the result be +1. Off the top of my head, one such example is in the Steal function.
The carry flag can get set by ADC/SBC, LSR/ASL, ROR/ROL, CMP/CPX/CPY, (and SEP/SEC). A wrongfully set/cleared carry flag would most commonly mess up conditional branches and cause bugs that way, but I guess with careless bit rotations it could cause some values to be wrong in a catastrophic way (messing with BEQ/BNE for example). I'm still a novice to assembly and haven't done a lot of debugging (except for my own code) so I'm not particularly familiar with common bug-causing scenarios.
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)